cucumber / cucumber-android

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

Running tests from feature files directly in android studio fails #110

Closed renetik closed 1 year ago

renetik commented 1 year ago

When I download this repository and open in android studio, I build project and everything looks fine, then I go to feature file and click on arrow to run individual test. It fails !

Is this not supported at all ? Is there some feature request or bug report for this already ?

Screenshot 2023-02-08 at 16 39 25 Screenshot 2023-02-08 at 16 39 55

It fails here: java.lang.IllegalStateException: No instrumentation registered! Must run under a registering instrumentation. at androidx.test.platform.app.InstrumentationRegistry.getInstrumentation(InstrumentationRegistry.java:45) at androidx.test.core.app.ApplicationProvider.getApplicationContext(ApplicationProvider.java:41) at dagger.hilt.android.internal.testing.MarkThatRulesRanRule.(MarkThatRulesRanRule.java:43) at dagger.hilt.android.testing.HiltAndroidRule.(HiltAndroidRule.java:36)

But you can just test it out easily on your own repo so I believe you already know this and it is not implemented nor planned ? Why ?

PS: I see and know that I can run tests but other means. This question is about this specific way of running tests and why it is not supported nor reported as not working somewhere. Thanks.

lsuski commented 1 year ago

See this https://github.com/cucumber/cucumber-android/issues/78

What you are trying is not supported by cucumber for java intellij plugin and it's not responsibility of this repository but Intellij/Android Studio plugin. I have written such plugin but it closed sourced and used in my company. We plan to publish it

lsuski commented 1 year ago

You can try this plugin now https://plugins.jetbrains.com/plugin/22107-cucumber-for-kotlin-and-android