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
        return dev_list[choice-1]

def runMonkeyStrategy(adb, package_name, eventsCount, seed, throttle):
    automaticTriggeringStrategy = MonkeyStrategy(adbDevice=adb, packageName=package_name, eventsCount=eventsCount,  seed=seed, verbosityLevel=2, throttle=throttle)
    automaticTriggeringStrategy.run()



#main part
adb = AdbInterface()
device = getExecutionDevice()
if not device:
    exit(1)
    
adb.setTargetSerial(device)
bboxcoverage = BBoxCoverage()

apk_file = INSTRUMENTED_APK_PATH
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, 
Exemplo n.º 3
0
    return None


def runMainIntentsStrategy(adb, androidManifest, delay=10):
    automaticTriggeringStrategy = IntentInvocationStrategy(adbDevice=adb, pathToAndroidManifest=androidManifest)
    automaticTriggeringStrategy.run(delay=delay)


# main part
adb = AdbInterface()
device = getExecutionDevice()
if not device:
    exit(1)

adb.setTargetSerial(device)
bboxcoverage = BBoxCoverage()

for apk_dir_source in APK_DIR_SOURCES:
    print "\n\nStarting experiment for directory: [%s]" % apk_dir_source
    result_directories = getSubdirs(apk_dir_source)
    for directory in result_directories:
        apk_file = getInstrApkInFolder(directory)
        if apk_file:
            print "Starting experiment for apk: [%s]" % apk_file
            try:
                bboxcoverage.initAlreadyInstrApkEnv(pathToInstrApk=apk_file, resultsDir=directory)
            except:
                print "Exception while initialization!"
                continue
            try:
                bboxcoverage.installApkOnDevice()
Exemplo n.º 4
0

def runMainIntentsStrategy(adb, androidManifest, delay=10):
    automaticTriggeringStrategy = IntentInvocationStrategy(
        adbDevice=adb, pathToAndroidManifest=androidManifest)
    automaticTriggeringStrategy.run(delay=delay)


#main part
adb = AdbInterface()
device = getExecutionDevice()
if not device:
    exit(1)

adb.setTargetSerial(device)
bboxcoverage = BBoxCoverage()

for apk_dir_source in APK_DIR_SOURCES:
    print "\n\nStarting experiment for directory: [%s]" % apk_dir_source
    result_directories = getSubdirs(apk_dir_source)
    for directory in result_directories:
        apk_file = getInstrApkInFolder(directory)
        if apk_file:
            print "Starting experiment for apk: [%s]" % apk_file
            try:
                bboxcoverage.initAlreadyInstrApkEnv(pathToInstrApk=apk_file,
                                                    resultsDir=directory)
            except:
                print "Exception while initialization!"
                continue
            try: