makeDir(monkeyDir) makeDir(jimpleDir) apk_folder = Constant.apk_path + apk_name apk_robt_folder = Constant.apk_robt_path + apk_robt_name removeDir(apk_robt_folder) apk_path = apk_folder + "\\" + apk_name apk_robt_path = apk_robt_folder+ "\\" + apk_robt_name apko = ApkOpearate(apk_name,apk_folder) package = apko.getPackage() # buile robotium apk apko2 = ApkOpearate(apk_name,apk_robt_folder) apko2.createRobotProject(package) apko2.buildApk() print 'install apk under test' os.popen("adb uninstall "+package) os.system("adb install "+ apk_path+"_signed.apk") print '\ninstall apk for exploration' os.popen("adb uninstall "+package+".test") os.system("adb install "+ apk_robt_path+"_signed.apk")
#part1.2 write file about package and classname apko = ApkOpearate(apk_name, apk_folder) apko.get_methods() acts = apko.getAct() package = apko.getPackage() #package name of app under testing main = apko.getMain() #main activity name of app under testing #generate test sequence through calling jar file #print "java -jar "+Constant.testGenerator+" "+ package+" "+main +" " +apk_name #os.system("java -jar "+Constant.testGenerator+" "+ package+" "+main+" " +apk_name ) #generate robotium DFS test apk file apko3 = ApkOpearate(apk_name, apk_test_folder) apko3.createTestProject(package) apko3.buildApk() #uninstall and install test apk print "uninstall and install" os.system("adb uninstall " + package + ".test") os.system("adb install " + apk_test_path + "_signed.apk") fr4 = open(Constant.java_path + myTest + ".txt", 'r') names = fr4.readlines() os.system("echo num " + str(len(names))) idx = 0 windowPackageName = getCurrentPackageName() for name in names: common.glvariable.isRunning = True t1 = threading.Thread(target=judgeIsOutCurrentApp, args=(apko, apk_name, package,