cucumber / cucumber-android

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

Cucumber Android not running on Flavors #95

Closed menova closed 1 year ago

menova commented 2 years ago

I have a folder -> androidTestMyFlavor and inside ->

class CucumberTestRunner : CucumberAndroidJUnitRunner()

and ->

@CucumberOptions(
    features = ["features"],
    glue = ["com.blah.blah.cucumber.steps"],
    tags = ["@e2e", "@smoke"]
)
class CucumberTestCase

inside gradle file ->

testInstrumentationRunner 'com.blah.blah.cucumber.runner.CucumberTestRunner'

_

debug {
            applicationIdSuffix ".beta"
            versionNameSuffix '.debug'
            ....
}

productFlavors {
    MyFlavor {
              applicationId 'com.foo.blah'
              testApplicationId 'com.foo.blah.test'
              ....
    }
    MyFlavor2 {
              applicationId 'com.bar.blah'
              testApplicationId 'com.bar.blah.test'
              ....
    }
}

I use :

   androidTestImplementation "io.cucumber:cucumber-android:4.9.0"

and my real package name is different from applicationId

package="com.blah.foobar" <-and-> applicationId com.lorem.ipsum

I run :

./geadlew connectedMyFlavorAndroidTest -Pcucumber -Ptags="@e2e"

But I get this message :

> Task :app:connectedAyandeDebugAndroidTest Starting 0 tests on Mi A3 - 11

I need help to run cucumber test on Android Flavors please help me :)

lhoracek commented 2 years ago

I started running into this issue twice. Once it was when I had two feature files with same feature name inside. Second time now when I just added firebase-inappmessaging-display-ktx dependency with firebase BOM in version 29.2.0. Suddenly 0 tests and I'm stuck. Do you have this dependency?

lsuski commented 2 years ago

In which package class CucumberTestCase resides?

lhoracek commented 2 years ago

Well figured it out in my case it was exception in runtime that eventually caused 0 tests to be reported. Eventually tracked it down to protobuf-lite and excluded from espresso-contrib