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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cucumber annotation to suite #268

Closed
wants to merge 2 commits into from
Closed

Cucumber annotation to suite #268

wants to merge 2 commits into from

Conversation

timtebeek
Copy link
Contributor

Not sure why I can't replace a single annotation with two annotations from a single template like this. 馃

Comment on lines +128 to +129
runtimeOnly("io.cucumber:cucumber-junit-platform-engine:7.+")
runtimeOnly("org.junit.platform:junit-platform-suite-api:latest.release")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general dependencies necessary for recipe testing should belong to the testRuntimeOnly group.

@pway99
Copy link
Contributor

pway99 commented Oct 13, 2022

closed as completed by 50ba449

@pway99 pway99 closed this Oct 13, 2022
@pway99
Copy link
Contributor

pway99 commented Oct 13, 2022

@timtebeek, when you have a chance it would be a good idea to add a maven project to the test, I ran out of steam today and did not fully track down the inital maven project configuration

@Test
void should_replace_cucumber_annotation_with_suite_with_selected_classpath_resource() {
rewriteRun(
        mavenProject("project",
                srcTestJava(
                        java("""
                            package com.example.app;
            
                            import io.cucumber.junit.platform.engine.Cucumber;
            
                            @Cucumber
                            public class CucumberJava8Definitions {
                            }
                            """,
                            """
                            package com.example.app;
            
                            import org.junit.platform.suite.api.SelectClasspathResource;
                            import org.junit.platform.suite.api.Suite;
            
                            @Suite
                            @SelectClasspathResource("com/example/app")
                            public class CucumberJava8Definitions {
                            }
                            """)
                ),
                pomXml(
                        """
                        <project>
                            <groupId>com.mycompany.app</groupId>
                            <artifactId>my-app</artifactId>
                            <version>1</version>
                        </project>
                        <dependencies>
                            ...
                        </dependencies>
                        """,
                        """
                        <project>
                            <groupId>com.mycompany.app</groupId>
                            <artifactId>my-app</artifactId>
                            <version>1</version>
                        </project>
                        <dependencies>
                            <dependency>
                                <groupId>org.junit.platform</groupId>
                                <artifactId>junit-platform-suite</artifactId>
                                <version>1.9.1</version>
                            <dependency>
                        </dependencies>
                        """)
        )
);
}

@timtebeek timtebeek deleted the CucumberAnnotationToSuite branch October 14, 2022 07:11
@pway99
Copy link
Contributor

pway99 commented Oct 14, 2022

Hello @timtebeek and @mpkorstanje,
I had made an error in suggesting that the cucumber dependencies should be moved to the testRuntimeOnly class path and the JavaParser class-path references replaced with stubs. If you're interested here are the changes 5cd92db changes. Thanks again for your help on this one :)

@pway99
Copy link
Contributor

pway99 commented Oct 14, 2022

On second thought, I decided to remove the maven changes from the test to avoid future test failures after the next junit-platform-suite release. 59c9c57

@timtebeek
Copy link
Contributor Author

Awesome; thanks a lot for the help, especially throughout the various iterations around testing.
I could see the maven project tests indeed require frequent upgrades if we had left those in.
Perhaps in the future we can look at some form of version matching to not have to update those.

That makes #264 ready for a write up; I'll try to squeeze in both a blog and some release notes for Cucumber-JVM.

@pway99
Copy link
Contributor

pway99 commented Oct 17, 2022

Yeah, that would be a nice feature. The maven test is very useful during the development cycle; I had an error in the dependency glob expression which might have gone unnoticed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants