anadroid.testing_framework package

Subpackages

Submodules

anadroid.testing_framework.AbstractTestingFramework module

class anadroid.testing_framework.AbstractTestingFramework.AbstractTestingFramework(id, profiler, analyzer, default_test_res='anadroid_results/custom_test_results')[source]

Bases: ABC

Defines a basic interface to be implemented by classes that provide integration of Android testing frameworks. .. attribute:: profiler

profiler.

type:

Profiler

id

testing framework uuid.

Type:

str

analyzer

Analyzer to be used.

Type:

AbstractAnalyzer

config

set of testing frameowrk configurations.

Type:

dict

abstract execute_test(w_unit, timeout=None, *args, **kwargs)[source]

execute a test described by a work unit w_unit. :param w_unit: work unit containing information of the test to be executed. :type w_unit: object :param timeout: test timeout.

get_config(key, default=None)[source]

get value of test configuration. :param key: config name/key. :param default: default value to be returned in the case of missing configuration.

get_default_test_dir()[source]
abstract init()[source]

initialize framework.

abstract init_default_workload(pkg, args_file=None, tests_dir=None)[source]

initialize workload to be done by tests of the testing framework. :param pkg: package of app under test. :param args_file: file containing test arguments, where each line contains arguments for 1 test. :param tests_dir: directory where test files or resources are stored.

abstract install()[source]

install framework.

is_recordable()[source]

checks if framework can record tests to be replayed.

record_test(app_id=None, test_id=None, output_dir=None)[source]

record test to be replayed later.

abstract test_app(device, app)[source]

test a given app on a given device.

abstract uninstall()[source]

uninstall framework.

anadroid.testing_framework.AppCrawlerFramework module

class anadroid.testing_framework.AppCrawlerFramework.AppCrawlerFramework(profiler, analyzer, default_workload=False, resdir='/Users/ruirua/repos/pyAnaDroid/anadroid/resources/testingFrameworks/app-crawler')[source]

Bases: AbstractTestingFramework

Implements AbstractTestingFramework interface to allow executing tests using App Crawler. .. attribute:: executable_prefix

prefix for test command. It is basically a call to java execute the framework’s jar.

type:

str

workload

workload object containing the work units to be executed.

Type:

WorkLoad

res_dir

directory containing app crawler resources.

Type:

str

exec_one_test(test_id, device, app, wk_unit, n_retries=1)[source]

executes one test identified by test_id of an given app on a given device. :param test_id: test uuid. :param device: device. :type device: Device :param app: app. :type app: App :param wk_unit: work unit to be executed. :type wk_unit: WorkUnit :param n_retries: number of times to try run the test in case it fails. :type n_retries: int

execute_test(package, wunit=None, timeout=None, *args, **kwargs)[source]

execute a test described by a work unit w_unit. :param package: app package. :type package: str :param wunit: work unit containing information of the test to be executed. :type wunit: object :param timeout: test timeout.

init()[source]

initialize framework.

init_default_workload(pkg, args_file=None, tests_dir=None)[source]

Initializes the workload with AppCrawlerWorkUnits. Initializes workload attribute with many AppCrawlerWorkUnits, configured with configurations coming from config file. :param pkg: app package (ignored). :param args_file: ignored. :param tests_dir: ignored.

install()[source]

install framework.

test_app(device, app)[source]

test a given app on a given device. Executes each work unit of workload on app running on device. :param device: device. :type device: Device :param app: app. :type app: App

uninstall()[source]

uninstall framework.

anadroid.testing_framework.DroidBotFramework module

class anadroid.testing_framework.DroidBotFramework.DroidBotFramework(profiler, analyzer, default_workload=False, resdir='/Users/ruirua/repos/pyAnaDroid/anadroid/resources/testingFrameworks/droidbot')[source]

Bases: AbstractTestingFramework

Implements AbstractTestingFramework interface to allow executing tests using DroidBot. .. attribute:: executable_prefix

prefix for test command. It is basically a call to the executable.

type:

str

workload

workload object containing the work units to be executed.

Type:

WorkLoad

res_dir

directory containing app crawler resources.

Type:

str

exec_one_test(test_id, device, app, wk_unit, n_retries=1)[source]

executes one test identified by test_id of an given app on a given device. :param test_id: test uuid. :param device: device. :type device: Device :param app: app. :type app: App :param wk_unit: work unit to be executed. :type wk_unit: WorkUnit :param n_retries: number of times to try run the test in case it fails. :type n_retries: int

execute_test(apk_path, wunit=None, timeout=None, *args, **kwargs)[source]

execute a test described by a work unit w_unit. :param package: app package. :type package: str :param wunit: work unit containing information of the test to be executed. :type wunit: object :param timeout: test timeout.

init()[source]

initialize framework.

init_default_workload(pkg, args_file=None, tests_dir=None)[source]

Initializes the workload with AppCrawlerWorkUnits. Initializes workload attribute with many AppCrawlerWorkUnits, configured with configurations coming from config file. :param pkg: app package (ignored). :param args_file: ignored. :param tests_dir: ignored.

install()[source]

install framework.

test_app(device, app)[source]

test a given app on a given device. Executes each work unit of workload on app running on device. :param device: device. :type device: Device :param app: app. :type app: App

uninstall()[source]

uninstall framework.

anadroid.testing_framework.DroidBotFramework.get_exec_prefix()[source]
anadroid.testing_framework.DroidBotFramework.get_machine_arch()[source]

anadroid.testing_framework.JUnitBasedFramework module

class anadroid.testing_framework.JUnitBasedFramework.JUnitBasedFramework(profiler, analyzer, resdir='/Users/ruirua/repos/pyAnaDroid/anadroid/resources/testingFramework/junit')[source]

Bases: AbstractTestingFramework

Implements AbstractTestingFramework interface to allow executing tests using JUnit based testing frameworks. The tests executed are barely configurable. This class lists instrumentations on device and runs one by one. .. attribute:: executable_prefix

prefix for test command. It is basically a call to the executable.

type:

str

workload

workload object containing the work units to be executed.

Type:

WorkLoad

res_dir

directory containing app crawler resources.

Type:

str

exec_one_test(test_id, device, app, wk_unit, n_retries=1)[source]

executes one test identified by test_id of an given app on a given device. :param test_id: test uuid. :param device: device. :type device: Device :param app: app. :type app: App :param wk_unit: work unit to be executed. :type wk_unit: WorkUnit :param n_retries: number of times to try run the test in case it fails. :type n_retries: int

execute_test(package, wunit=None, timeout=None, *args, **kwargs)[source]

execute a test described by a work unit w_unit. :param w_unit: work unit containing information of the test to be executed. :type w_unit: object :param timeout: test timeout.

init()[source]

initialize framework.

init_default_workload(pkg, seeds_file=None, tests_dir=None)[source]

initialize workload to be done by tests of the testing framework. :param pkg: package of app under test. :param args_file: file containing test arguments, where each line contains arguments for 1 test. :param tests_dir: directory where test files or resources are stored.

install()[source]

install framework.

test_app(device, app)[source]

test a given app on a given device. Executes each work unit of workload on app running on device. :param device: device. :type device: Device :param app: app. :type app: App

uninstall()[source]

uninstall framework.

anadroid.testing_framework.MonkeyFramework module

class anadroid.testing_framework.MonkeyFramework.MonkeyFramework(profiler, analyzer, default_workload=False, resdir='/Users/ruirua/repos/pyAnaDroid/anadroid/resources/testingFrameworks/monkey')[source]

Bases: AbstractTestingFramework

Implements AbstractTestingFramework interface to allow executing tests using Monkey testing framework. .. attribute:: executable_prefix

prefix for test command. It is basically a call to the executable.

type:

str

workload

workload object containing the work units to be executed.

Type:

WorkLoad

res_dir

directory containing app crawler resources.

Type:

str

exec_one_test(test_id, device, app, wk_unit, n_retries=1)[source]

executes one test identified by test_id of an given app on a given device. :param test_id: test uuid. :param device: device. :type device: Device :param app: app. :type app: App :param wk_unit: work unit to be executed. :type wk_unit: WorkUnit :param n_retries: number of times to try run the test in case it fails. :type n_retries: int

execute_test(package, wunit=None, timeout=None, *args, **kwargs)[source]

execute a test described by a work unit w_unit. :param w_unit: work unit containing information of the test to be executed. :type w_unit: object :param timeout: test timeout.

init()[source]

initialize framework.

init_default_workload(pkg, seeds_file='monkey_seeds.txt', tests_dir=None)[source]

initialize workload to be done by tests of the testing framework. :param pkg: package of app under test. :param args_file: file containing test arguments, where each line contains arguments for 1 test. :param tests_dir: directory where test files or resources are stored.

install()[source]

install framework.

test_app(device, app)[source]

test a given app on a given device. Executes each work unit of workload on app running on device. :param device: device. :type device: Device :param app: app. :type app: App

uninstall()[source]

uninstall framework.

anadroid.testing_framework.MonkeyRunnerFramework module

class anadroid.testing_framework.MonkeyRunnerFramework.MonkeyRunnerFramework(profiler, analyzer, default_workload=False, resources_dir='/Users/ruirua/repos/pyAnaDroid/anadroid/resources/testingFrameworks/monkey-runner')[source]

Bases: AbstractTestingFramework

Implements AbstractTestingFramework interface to allow executing tests using monkeyrunner framework. .. attribute:: workload

workload object containing the work units to be executed.

type:

WorkLoad

resources_dir

directory containing app crawler resources.

Type:

str

exec_one_test(test_id, device, app, wk_unit, n_retries=1)[source]

executes one test identified by test_id of an given app on a given device. :param test_id: test uuid. :param device: device. :type device: Device :param app: app. :type app: App :param wk_unit: work unit to be executed. :type wk_unit: WorkUnit :param n_retries: number of times to try run the test in case it fails. :type n_retries: int

execute_test(package, wunit=None, timeout=None, *args, **kwargs)[source]

execute a test described by a work unit w_unit. :param w_unit: work unit containing information of the test to be executed. :type w_unit: object :param timeout: test timeout.

init()[source]

initialize framework.

init_default_workload(pkg, seeds_file=None, tests_dir='/Users/ruirua/repos/pyAnaDroid/anadroid/resources/testingFrameworks/monkey-runner/tests')[source]

initialize workload to be done by tests of the testing framework. :param pkg: package of app under test. :param args_file: file containing test arguments, where each line contains arguments for 1 test. :param tests_dir: directory where test files or resources are stored.

install()[source]

install framework.

load_tests_of_app(monkeyrunner_tests_dir='/Users/ruirua/repos/pyAnaDroid/anadroid/resources/testingFrameworks/monkey-runner/tests')[source]
test_app(device, app)[source]

test a given app on a given device. Executes each work unit of workload on app running on device. :param device: device. :type device: Device :param app: app. :type app: App

uninstall()[source]

uninstall framework.

anadroid.testing_framework.RERANFramework module

class anadroid.testing_framework.RERANFramework.RERANFramework(device, profiler, analyzer, resources_dir='/Users/ruirua/repos/pyAnaDroid/anadroid/resources/testingFrameworks/RERAN')[source]

Bases: AbstractTestingFramework

Implements AbstractTestingFramework interface to allow recording and executing tests using RERAN framework. .. attribute:: workload

workload object containing the work units to be executed.

type:

WorkLoad

resources_dir

directory containing app crawler resources.

Type:

str

exec_one_test(test_id, device, app, wk_unit, n_retries=1)[source]

executes one test identified by test_id of an given app on a given device. :param test_id: test uuid. :param device: device. :type device: Device :param app: app. :type app: App :param wk_unit: work unit to be executed. :type wk_unit: WorkUnit :param n_retries: number of times to try run the test in case it fails. :type n_retries: int

execute_test(package, wunit=None, timeout=None, *args, **kwargs)[source]

execute a test described by a work unit w_unit. :param w_unit: work unit containing information of the test to be executed. :type w_unit: object :param timeout: test timeout.

init()[source]

initialize framework.

init_default_workload(pkg, seeds_file=None, tests_dir=None)[source]

initialize workload to be done by tests of the testing framework. :param pkg: package of app under test. :param args_file: file containing test arguments, where each line contains arguments for 1 test. :param tests_dir: directory where test files or resources are stored.

install()[source]

install framework.

is_recordable()[source]

checks if framework can record tests.

load_tests_of_app(package_name, reran_tests_dir=None)[source]
push_test(test_path)[source]

push test to device.

record_test(app_id=None, test_id=None, output_dir=None)[source]

record test of a given app, identified by test_id.

test_app(device, app)[source]

test a given app on a given device. Executes each work unit of workload on app running on device. :param device: device. :type device: Device :param app: app. :type app: App

uninstall()[source]

uninstall framework.

Module contents