cucumber / cucumber-android

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

What version of picocontainer should be used along with v7.14.0? #122

Closed badrinrs closed 1 year ago

badrinrs commented 1 year ago

As the question implies. I am trying to upgrade from v4.10.0 to v7.14.0. We were using picocontainer version 4.8.1 along with v4.10.0 version of cucumber-android.

I see on maven repo, v7.14.0 of picocontainer is available. Both with v4.8.1 and v7.14.0, I am seeing an error:

Error in initializationError(io.cucumber.android.CucumberJUnitRunnerBuilder):
io.cucumber.core.exception.CucumberException: No CucumberOptions annotated class present in package
lsuski commented 1 year ago

I'm using picocontainer 7.14.0 and it works however with custom ObjectFactory but it shouldn't have any impact. This error looks like not related with ObjectFactory. Could you provide:

  1. Class annotated with CucumberOptions (with imports) - maybe wrong annotation is used
  2. testApplicationId
  3. Full stacktrace
badrinrs commented 1 year ago

My cucumber runnner looks like

package package.test.cucumber.runner

import android.app.Application
import android.content.Context
import package.MyApplication
import io.cucumber.android.runner.CucumberAndroidJUnitRunner
import io.cucumber.junit.CucumberOptions

@CucumberOptions(
    features = [ "features" ],
    tags = "@smoke",
    glue = ["stepDefs"],
    plugin = [
        "junit:/sdcard/Android/data/package/files/reports/cucumber.xml", 
        "json:/sdcard/Android/data/package/files/reports/cucumber.json", 
        "html:/sdcard/Android/data/package/files/reports/cucumber", 
        "com.epam.reportportal.cucumber.ScenarioReporter"]
)
class CucumberTestRunner : CucumberAndroidJUnitRunner() {

    override fun newApplication(cl: ClassLoader, className: String, context: Context): Application {
        return super.newApplication(cl, MyApplication::class.java.name, context)
    }
}

Full Stacktrace:

initializationError(io.cucumber.android.CucumberJUnitRunnerBuilder)
io.cucumber.core.exception.CucumberException: No CucumberOptions annotated class present in package package.test
        at io.cucumber.android.CucumberJunitRunner.getCucumberOptionsClass(CucumberJunitRunner.kt:133)
        at io.cucumber.android.CucumberJunitRunner.<init>(CucumberJunitRunner.kt:46)
        at io.cucumber.android.CucumberJUnitRunnerBuilder.runnerForClass(CucumberJUnitRunnerBuilder.java:10)
        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:1)
        at androidx.test.internal.runner.AndroidRunnerBuilder.runnerForClass(AndroidRunnerBuilder.java:143)
        at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:1)
        at androidx.test.internal.runner.DirectTestLoader.doCreateRunner(DirectTestLoader.java:45)
        at androidx.test.internal.runner.TestLoader.getRunnersFor(TestLoader.java:64)
        at androidx.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:835)
        at androidx.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:650)
        at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:418)
        at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2275)
lsuski commented 1 year ago

Exception says that app test package is package.test and in this package you have to place class annotated with CucumberOptions. Also keep in mind that plugins will probably not work because they use nonexistent java api