When using Before / After annotated methods in two or more stepdef classes getting
Error: Either the specified parameters do not match any of the following constructors: [private classNameStepdefs]; OR the constructors were no
t accessible for 'classNameStepdefs'
I experienced it with cucumber-parallel-jvm-plugin as well and opened an issue with cucumber-jvm, altough also posting it here as I really need a solution and might be it is coming from parallelization that both plugins are doing.
Expected Behavior
I have several sptepdef classes for each of the features. Each feature has a tag:
@featureOne@featureTwo
In each stepdef class I have setup methods to run before Scenario execution as Before / After and they have tag names ingested:
@Before("@featureOne") / @Before("@featureTwo")
I expect each setup method to be executed for the scenarios with provided tag however it seems that picocontainer is confused about to which annotated method to use and throws an exception.
Current Behavior
Getting following exception:
org.picocontainer.PicoCompositionException: Either the specified parameters do not match any of the following constructors: [private com.accenture.ava.rt_testrobot.stepdefs.HiveStepde
fs()]; OR the constructors were not accessible for 'HiveStepdefs'
at org.picocontainer.injectors.ConstructorInjector.getGreediestSatisfiableConstructor(ConstructorInjector.java:200)
at org.picocontainer.injectors.ConstructorInjector.getGreediestSatisfiableConstructor(ConstructorInjector.java:110)
at org.picocontainer.injectors.ConstructorInjector.access$100(ConstructorInjector.java:51)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:331)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
at cucumber.runtime.java.picocontainer.PicoFactory.getInstance(PicoFactory.java:40)
at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:38)
at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37)
at cucumber.runtime.Runtime.runStep(Runtime.java:300)
at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44)
at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:102)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:95)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:38)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.api.junit.Cucumber.run(Cucumber.java:100)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:157)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:386)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:323)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:143)
Context & Motivation
I have different features and each has different setup to be executed before actual scenario execution and teardown after scenario execution.
Summary
When using Before / After annotated methods in two or more stepdef classes getting
I experienced it with cucumber-parallel-jvm-plugin as well and opened an issue with cucumber-jvm, altough also posting it here as I really need a solution and might be it is coming from parallelization that both plugins are doing.
Expected Behavior
I have several sptepdef classes for each of the features. Each feature has a tag:
@featureOne
@featureTwo
In each stepdef class I have setup methods to run before Scenario execution as Before / After and they have tag names ingested:
@Before("@featureOne")
/@Before("@featureTwo")
I expect each setup method to be executed for the scenarios with provided tag however it seems that picocontainer is confused about to which annotated method to use and throws an exception.
Current Behavior
Getting following exception:
Context & Motivation
I have different features and each has different setup to be executed before actual scenario execution and teardown after scenario execution.
Your Environment