cucumber / cucumber-android

Android support for Cucumber-JVM
MIT License
135 stars 62 forks source link

Cannot run plain espresso tests with custom CucumberAndroidJUnitRunner in Java #101

Closed IgnacioGarcia198 closed 1 year ago

IgnacioGarcia198 commented 2 years ago

πŸ‘“ What did you see?

I made a test project with both Cucumber and plain Espresso tests, using a custom runner extending CucumberAndroidJUnitRunner. I tested it with files in Kotlin and worked. I tested it again with files in Java and, when I try to run my plain Espresso test, my Cucumber test is launched instead, every single time.

βœ… What did you expect to see?

I expected that both Cucumber and plain Espresso tests would work in Java, same as in Kotlin.

πŸ“¦ Which tool/library version are you using?

androidTestImplementation 'io.cucumber:cucumber-android:4.8.3'
androidTestImplementation 'io.cucumber:cucumber-picocontainer:4.8.1'

πŸ”¬ How could we reproduce it?

Reproduce it using this test project. Last commit in main branch is in Java and failing, if you just checkout previous commit it is in Kotlin and both tests work.

Steps to reproduce the behavior:

  1. Open project
  2. Run test MainActivitySteps and verify it's passing
  3. Run test ExampleInstrumentedTest and verify MainActivitySteps is running instead
  4. Checkout commit "both tests working in Kotlin" 48735819
  5. Run test MainActivitySteps and verify it's passing
  6. Run test ExampleInstrumentedTest and verify it actually runs and passes
  7. EDIT: It is not working now on Kotlin either

πŸ“š Any additional context?


This text was originally generated from a template, then edited by hand. You can modify the template here.

lsuski commented 1 year ago

To run plain tests you have to execute tests with instrumentation argument cucumberUseAndroidJUnitRunner=true