Skip to content

No support for Spring Boot Test version 1.5.x #1242

New issue

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

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

Already on GitHub? # to your account

Closed
vipinjose8683 opened this issue Oct 9, 2017 · 4 comments · Fixed by #1245
Closed

No support for Spring Boot Test version 1.5.x #1242

vipinjose8683 opened this issue Oct 9, 2017 · 4 comments · Fixed by #1245
Labels
⚡ enhancement Request for new functionality

Comments

@vipinjose8683
Copy link

vipinjose8683 commented Oct 9, 2017

Summary

In spring boot test version 1.5.x, the only way to launch a spring boot instance with cucumber is to use @SpringBootTest annotation in one of the stepdef classes. But the cucumber does not support @SpringBootTest. As a result, the spring boot instance does not launch.

Expected Behavior

If the following code is included in the glue code then cucumber should launch a spring boot embedded container

@SpringBootTest(webEnvironment=WebEnvironment.DEFINED_PORT)
public class SpringBootTestSetup {

	@Given("^there is a local spring boot instance of subject to test against$")
	public void there_is_a_local_instance_of_subject_to_test_against() throws Throwable {
            //This test method is to launch the embedded container that will be tested against
	}

}

Current Behavior

Spring Boot instance does not launch.

Possible Solution

#1061 ?
The above mentioned issue does not clearly state the importance and urgency of the requirement.

Context & Motivation

The workaround was to use the following set of annotations:

@ContextConfiguration(classes = ApplicationInitializer.class, loader = SpringBootContextLoader.class)
@WebIntegrationTest
public class SpringBootTestSetup {

	@Given("^there is a local spring boot instance of subject to test against$")
	public void there_is_a_local_instance_of_subject_to_test_against() throws Throwable {
        //This test method is to launch the embedded container that will be tested against
	}

}

But @WebIntegrationTest (which was deprecated in v1.4) is removed from v1.5 as a single annotation @SpringBootTest achieves the same.
I use spring boot v1.5.x and cannot find any other way to do integration test with cucumber.

@brasmusson
Copy link
Contributor

does not clearly state the importance and urgency of the requirement.

Cucumber-JVM is community supported, see https://github.com/cucumber/cucumber-jvm#how-soon-will-my-ticket-be-fixed

If you want to support the development of Cucumber-JVM by other means than providing pull requests, see https://cucumber.io/blog/2017/10/03/invest-in-cucumber

BTW @RunWith(SpringJUnit4ClassRunner.class) has no meaning on glue classes, I recommend that you remove them from the pull-request description to avoid confusion.

@mpkorstanje mpkorstanje added ⚡ enhancement Request for new functionality Spring labels Oct 11, 2017
mpkorstanje added a commit that referenced this issue Oct 11, 2017
Fixes #1242, #1061

Spring annotations are hierarchical and can be customized. This
requires that the entire graph is scanned to determine if one of
the supported annotations is present.
mpkorstanje added a commit that referenced this issue Oct 11, 2017
Fixes #1242
Fixes #1061

Spring annotations are hierarchical and can be customized. This
requires that the entire graph is scanned to determine if one of
the supported annotations is present.
@mpkorstanje
Copy link
Contributor

@vipinjose8683 you're lucky I'll need this myself soon.

Would you mind building this branch locally and test driving it for a bit?

https://github.com/cucumber/cucumber-jvm/tree/spring-support-bootstrap-with-annotation

@vipinjose8683
Copy link
Author

vipinjose8683 commented Oct 16, 2017

@mpkorstanje Thank you.

I built the branch locally and tested it in my use case. The spring boot instance starts up as expected when I add the following class in my glue code.

@SpringBootTest(webEnvironment=WebEnvironment.DEFINED_PORT)
public class SpringBootInstanceLauncher {
	@Given("^there is a local spring boot instance of subject to test against$")
	public void there_is_a_local_instance_of_subject_to_test_against() throws Throwable {
        //This test method is to launch the embedded container that will be tested against
	}
}

(On a side note, i had to skip tests during maven install because test cases in "Examples: Pax Exam: Calculator Test" module was failing.)

mpkorstanje added a commit that referenced this issue Oct 25, 2017
Fixes #1242
Fixes #1061

Spring annotations are hierarchical and can be customized. This
requires that the entire graph is scanned to determine if one of
the supported annotations is present.
mlvandijk pushed a commit that referenced this issue Oct 26, 2017
Fixes #1242
Fixes #1061

Spring annotations are hierarchical and can be customized. This
requires that the entire graph is scanned to determine if one of
the supported annotations is present.
@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
⚡ enhancement Request for new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants