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

Add support for spring-boot @IntegrationTest in spring module #783

Closed
yukatan opened this issue Sep 30, 2014 · 7 comments
Closed

Add support for spring-boot @IntegrationTest in spring module #783

yukatan opened this issue Sep 30, 2014 · 7 comments

Comments

@yukatan
Copy link

yukatan commented Sep 30, 2014

Sometimes you need to run test agains the server running and not to use mockMcv or something similar. At the moment there is not support for this annotation and run the spring boot application is really a headache. Where are at the moment running the spring boot application with a hook, but it would be easier to support this annotation to test spring boot applications with cucumber.

@marceloverdijk
Copy link

As well as supporting Boot's org.springframework.boot.test.SpringApplicationConfiguration as alternative to ContextConfiguration.

I was working on PR but I'm unable to make a successfull build. The cucumber-jruby module fails when building.

Anyway I was hoping changing SpringFactory's dependsOnSpringContext should help:

    private boolean dependsOnSpringContext(Class<?> type) {
        Class springApplicationConfigurationClass = null;
        try {
            // support for Spring Boot SpringApplicationConfiguration
            springApplicationConfigurationClass = Class.forName("org.springframework.boot.test.SpringApplicationConfiguration");
        } catch (ClassNotFoundException e) {
            // ignore
        }
        return type.isAnnotationPresent(ContextConfiguration.class)
            || type.isAnnotationPresent(ContextHierarchy.class)
            || (springApplicationConfigurationClass != null && type.isAnnotationPresent(springApplicationConfigurationClass));
    }

But as I can't build I cannot verify currently.

As Spring Boot is gaining a lot of traction I think it's important providing Boot support in the cucumber-spring module.

@jamessawle
Copy link

I was wondering what progress had been made with supporting @IntegerationTest. I am currently working on a project that would greatly benefit from using Cucumber; however, this is a stumbling block for the team.

@ThibautGery
Copy link

Until it is added, you can use this solution on stackoverflow

@c10gdn
Copy link

c10gdn commented Apr 10, 2015

Hi, I tried using this solution referred to on stackoverflow but I couldn't get it to work, is there any update on the progress? Thanks.

@aantono
Copy link

aantono commented Sep 26, 2016

Actually all that is needed is to add support for @BootstrapWith annotation in the SpringFactory, that will automatically support the newly added Spring Boot @SpringBootTest annotation and all the sliced tests like @WebMvcTest, etc.

See #1061

@mpkorstanje
Copy link
Contributor

Superceded by #1061.

@lock
Copy link

lock bot commented Oct 24, 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 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants