want to keep the app in the foreground while executing feature files using CucumberAndroidJUnitRunner

46 views Asked by At

I want to keep the app in the foreground while executing feature files using CucumberAndroidJUnitRunner , Right now after executing below command from application, app is going background , but i want app to be in foreground and show result of each test scenario .

Process process = Runtime.getRuntime().exec(command);

command is below ..

/system/bin/am instrument -w -e debug false -e class com.sample.auto.androidBDD.MyAppCucumberAndroidJUnitRunner -e features /features/Release/ExecuteCommand_method.feature com.sample.auto.androidBDD.test/com.sample.auto.androidBDD.MyAppCucumberAndroidJUnitRunner

I can see feature file execution happening properly from logs and i can see results generated in html format once after execution. I want to see results in the android app screen while executing the feature file .

sample below ..

  1. Asset folder we have .feature file

  2. Step Implementation class is a feature file implementation

  3. TestRunner class update in gradle file testInstrumentationRunner "com.sample.auto.androidBDD.TestRunner (MyAppCucumberAndroidJUnitRunner)"

  4. @CucumberOptions( //features = {"features/bodyaccess/login.feature"}, glue = "com.sample.auto.androidBDD", plugin = { "pretty" "json:/data/user/10/com.sample.auto.androidBDD/cache/cucumber-reports/report.json"}, monochrome = true ) public class MyAppCucumberAndroidJUnitRunner extends CucumberAndroidJUnitRunner { @Override public void onCreate(Bundle arguments) { super.onCreate(arguments); }
    }

  5. From Terminal :: adb shell am instrument -w -e debug false -e class com.sample.auto.androidBDD.MyAppCucumberAndroidJUnitRunner -e features /features/Release/ExecuteCommand_method.feature com.sample.auto.androidBDD.test/com.sample.auto.androidBDD.MyAppCucumberAndroidJUnitRunner

  6. From code :: Process process = Runtime.getRuntime().exec(command);

command is below ..

/system/bin/am instrument -w -e debug false -e class com.sample.auto.androidBDD.MyAppCucumberAndroidJUnitRunner -e features /features/Release/ExecuteCommand_method.feature com.sample.auto.androidBDD.test/com.sample.auto.androidBDD.MyAppCucumberAndroidJUnitRunner

  1. Dependencies :: androidTestImplementation 'io.cucumber:cucumber-android:7.14.0' androidTestImplementation 'io.cucumber:cucumber-junit:7.14.1'
0

There are 0 answers