Unable to execute Instrumentation using Android test orchestrator

57 views
Skip to first unread message

Anantha Nallur

unread,
Dec 2, 2020, 3:15:15 PM12/2/20
to androidx-test-discuss

We have a requirement to develop a test framework, that would take a json file as test steps and then execute instrumentation tests on an app.

Since the json is parsed and would leave a List, we had used a for loop inside a method annotated with @test.

In order to run these tests as, separated tests in android, we used Paramaterized tests concept and now we were able to run multiple dynamic tests from a single json.

We would now want to reset the host app between test cases. We identified, android test orchestrator, but we are unable to run it inside android test orchestrator from the command line.

We are using the below command.

adb shell 'CLASSPATH=$(pm path androidx.test.services) app_process / androidx.test.services.shellexecutor.ShellMain am instrument -w -r -e clearPackageData true --no-window-animation -e class com.xxx.android.test.EspressoAutomationTest com.xxx.android.test/androidx.test.runner.AndroidJUnitRunner androdx.test.orchestrator/.AndroidTestOrchestrator'

build.gradle is configured as below

android { defaultConfig { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments clearPackageData: 'true' } packagingOptions { exclude 'META-INF/DEPENDENCIES' } dexOptions { preDexLibraries = false additionalParameters=['--core-library'] javaMaxHeapSize "4g" } testOptions { execution 'ANDROIDX_TEST_ORCHESTRATOR' } } dependencies { … implementation 'androidx.test:runner:1.1.0' androidTestUtil 'androidx.test:orchestrator:1.1.0' }

I verified the processId of the process being run in the test. All test runs in the same process.

If i run the gradle command connectedCheck, it runs in separate processes. But, i am unable to launch the instrumentation on the application in this case.

Reply all
Reply to author
Forward
0 new messages