Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to initialize Citrus instance - instance has already been initialized #357

Closed
sburkard opened this Issue Mar 27, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@sburkard
Copy link

sburkard commented Mar 27, 2018

Situation:

  • I have a test project with multiple Cucumber feature files in different packages
  • For each feature file there is a test class with the runner setup (@RunWith(Cucumber.class)...)
  • All feature files share the same glue code classes
  • The glue code implements the test steps with Spring/Citrus (autowire etc)
  • I have set cucumber.api.java.ObjectFactory=cucumber.runtime.java.spring.CitrusSpringObjectFactory
  • I can run each test class individually in IntelliJ. All tests are green.

But when I run all tests through Maven (mvn verify) the tests of the first test class are running fine while all other test classes are failing with the following error:

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.034 s <<< FAILURE! - in [package/testclass] [ERROR] Feature: [feature file] Time elapsed: 0.009 s <<< ERROR! java.lang.IllegalStateException: Unable to initialize Citrus instance - instance has already been initialized

Seems like the Cucumber runner wants to re-build the Spring/Citrus context for each test class and after the first it fails because the context is already there.

By the way, I have moved the Cucumber dependencies before the Citrus dependencies as recommended in issue 209.

Is it not supported to have multiple Cucumber test runner classes in one project?

PS: I have another project with two test classes. Same picture, but a small difference: in this project I have one test class with two feature files and another test class with a single feature file. Here too, the second test runner class fails while the two feature files of the first test class are running fine. So multiple feature files for the same test class are not a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.