Skip to content

[Spring] Remove cucumber.xml and implied context configuration #1959

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

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented Apr 23, 2020

The preferred way to use cucumber-spring is to annotate a class
with both @CucumberContextConfiguration and a Spring context
configuration annotation such as @ContextConfiguration,
@SpringBootTest, ect.

Previously Cucumber would support the discovery of context
configuration on any step definition class. This requires a
significant amount of code and intimate knowledge of the
Spring Framework.
By restricting this too only classes annotated with
@CucumberContextConfiguration we remove this complexity and
simply pass the annotated class to Spring TestContextManager
framework.

If no context configuration is available Cucumber currently also
supports reading the application context from a magical
cucumber.xml file or should none exist an empty application
context.
Both these fallback strategies tend to hide user errors. And
removing them will provide more clarity and also removes
a nugget of complexity.

Closes: #1904

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

The preferred way to use `cucumber-spring` is to annotate a class
with both `@CucumberContextConfiguration` and a Spring context
configuration annotation such as `@ContextConfiguration`,
`@SpringBootTest`, ect.

Previously Cucumber would support the discovery of context
configuration on any step definition class. This requires a
significant amount of code and intimate knowledge of the
Spring Framework.
By restricting this too only classes annotated with
`@CucumberContextConfiguration` we remove this complexity and
simply pass the annotated class to Spring `TestContextManager`
framework.

If no context configuration is available Cucumber currently also
supports reading the application context from a magical
`cucumber.xml` file or should none exist an empty application
context.
Both these fallback strategies tend to hide user errors. And
removing them will provide more clarity and also removes
a nugget of complexity.
@mpkorstanje mpkorstanje added this to the 6.0.0 milestone Apr 23, 2020
@coveralls
Copy link

Coverage Status

Coverage increased (+0.0008%) to 86.655% when pulling 8f09905 on spring-remove-cucumber-xml-and-implicit-context-configuration into 5b73489 on v6.x.x.

@mpkorstanje mpkorstanje merged commit 9011b5e into v6.x.x Apr 23, 2020
@mpkorstanje mpkorstanje deleted the spring-remove-cucumber-xml-and-implicit-context-configuration branch April 23, 2020 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants