Exemplo n.º 1
0
def main():
    bboxcoverage = BBoxCoverage()
    #bboxcoverage.instrumentApkForCoverage(pathToOrigApk="/home/yury/TMP/BBoxTester/Notepad.apk", resultsDir="/home/yury/TMP/BBoxTester/results/", tmpDir="/home/yury/TMP/BBoxTester/tmp", overwriteExisting=True, removeApkTmpDirAfterInstr=False, copyApkToRes=True)
    #bboxcoverage.installApkOnDevice()
    #bboxcoverage.startTesting()
    #time.sleep(30)
    #localReport = bboxcoverage.stopTesting()
    #bboxcoverage.generateReport([localReport], EMMA_REPORT.XML)
    
    #bboxcoverage.instrumentApkForCoverage(pathToOrigApk="/home/yury/PROJECTS/BBOXTESTING2/app/com.markuspage.android.atimetracker.apk", resultsDir="/home/yury/PROJECTS/BBOXTESTING2/app/results", tmpDir="/home/yury/TMP/BBoxTester/tmp", removeApkTmpDirAfterInstr=False, copyApkToRes=True)
    #bboxcoverage.installApkOnDevice()
    #bboxcoverage.startTesting()
    #time.sleep(30)
    #localReport = bboxcoverage.stopTesting()
    #bboxcoverage.generateReport([localReport], EMMA_REPORT.XML)
    
#     bboxcoverage.instrumentApkForCoverage(pathToOrigApk="/home/yury/PROJECTS/BBOXTESTING2/app/com.markuspage.android.atimetracker_17.apk", resultsDir="/home/yury/PROJECTS/BBOXTESTING2/app/results_packed", tmpDir="/home/yury/TMP/BBoxTester/tmp", removeApkTmpDirAfterInstr=False, copyApkToRes=True)
#     bboxcoverage.installApkOnDevice()
#     bboxcoverage.startTesting()
#     time.sleep(30)
#     localReport = bboxcoverage.stopTesting()
    
    bboxcoverage._signApk(bboxcoverage.bboxInstrumenter, "/home/yury/PROJECTS/BBOXTESTING2/app/com.markuspage.android.atimetracker_17_aligned.apk", "/home/yury/PROJECTS/BBOXTESTING2/app/com.markuspage.android.atimetracker_17_aligned_signed.apk")
    bboxcoverage.initAlreadyInstrApkEnv(pathToInstrApk="/home/yury/PROJECTS/BBOXTESTING2/app/com.markuspage.android.atimetracker_17_aligned_signed.apk", resultsDir="/home/yury/PROJECTS/BBOXTESTING2/app/results_packed/com.markuspage.android.atimetracker_17/")
    bboxcoverage.installApkOnDevice()
    bboxcoverage.startTesting()
    time.sleep(30)
    localReport = bboxcoverage.stopTesting()
Exemplo n.º 2
0
if apk_file:
    print "Starting monkeyrunner strategy experiment for apk: %s" % apk_file
    res_dir = os.path.split(os.path.abspath(apk_file))[0]
#     if not os.path.exists(res_dir):
#         auxiliary_utils.mkdir(res_dir, mode=0777, overwrite=True)
    print "Putting results in directory: %s" % res_dir
    try:
        bboxcoverage.initAlreadyInstrApkEnv(pathToInstrApk=apk_file, resultsDir=res_dir)
        bboxcoverage.installApkOnDevice()
        
        bboxcoverage.startTesting()
        package_name =  bboxcoverage.getPackageName()
        runMonkeyStrategy(adb=adb, package_name=package_name, 
                          eventsCount=EVENTS_COUNT, seed=SEED, 
                          throttle=THROTTLE)
        
        params={}
        params["strategy"] = "monkey"
        params["package_name"] = package_name
        params["events_count"] = EVENTS_COUNT
        params["seed"] = SEED
        params["throttle"] = THROTTLE
        time.sleep(3)
        bboxcoverage.stopTesting("monkey_events_%d_seed_%d_throttle_%d" % (EVENTS_COUNT, SEED, THROTTLE), paramsToWrite=params)
        time.sleep(3)
        bboxcoverage.uninstallPackage()
        time.sleep(5)
    except Exception as e:
        print "EXCEPTION while execution: " + str(e)
    except:
        print "UNKNOWN EXCEPTION"
Exemplo n.º 3
0
            params["strategy"] = "main_intents"
            params["package_name"] = package_name
            params["main_activity"] = bboxcoverage.androidManifest.getMainActivity()

            try:
                bboxcoverage.startTesting()
            except:
                print "Exception while startTesting!"
                bboxcoverage.uninstallPackage()
                continue

            try:
                runMainIntentsStrategy(adb=adb, androidManifest=bboxcoverage.androidManifestFile, delay=10)
            except:
                print "Exception while running strategy!"
                bboxcoverage.uninstallPackage()
                continue

            try:
                bboxcoverage.stopTesting("main_intents", paramsToWrite=params)
            except:
                print "Exception while running strategy!"
                bboxcoverage.uninstallPackage()
                continue

            time.sleep(3)
            bboxcoverage.uninstallPackage()
            time.sleep(5)

    sendMessage("[BBoxTester]", "Experiments done for directory [%s]!" % apk_dir_source)
Exemplo n.º 4
0
            try:
                bboxcoverage.startTesting()
            except:
                print "Exception while startTesting!"
                bboxcoverage.uninstallPackage()
                continue

            try:
                runMainIntentsStrategy(
                    adb=adb,
                    androidManifest=bboxcoverage.androidManifestFile,
                    delay=10)
            except:
                print "Exception while running strategy!"
                bboxcoverage.uninstallPackage()
                continue

            try:
                bboxcoverage.stopTesting("main_intents", paramsToWrite=params)
            except:
                print "Exception while running strategy!"
                bboxcoverage.uninstallPackage()
                continue

            time.sleep(3)
            bboxcoverage.uninstallPackage()
            time.sleep(5)

    sendMessage("[BBoxTester]",
                "Experiments done for directory [%s]!" % apk_dir_source)
            params["strategy"] = "main_activity"
            params["package_name"] = package_name
            params["main_activity"] = bboxcoverage.androidManifest.getMainActivity()
            
            try: 
                bboxcoverage.startTesting()
            except:
                print "Exception while startTesting!"
                bboxcoverage.uninstallPackage()
                continue
            
            try:
                runMainActivityStrategy(adb=adb, androidManifest=bboxcoverage.androidManifestFile)
            except:
                print "Exception while running strategy!"
                bboxcoverage.uninstallPackage()
                continue
            
            try:    
                bboxcoverage.stopTesting("main_activity", paramsToWrite=params)
            except:
                print "Exception while running strategy!"
                bboxcoverage.uninstallPackage()
                continue
            
            time.sleep(3)
            bboxcoverage.uninstallPackage()
            time.sleep(5)
            
    sendMessage("[BBoxTester]", "Experiments done for directory [%s]!" % apk_dir_source)