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

@MavenProjectSources - if no parameters set, then use "maven_project" subdirectory? #378

Open
hugoheden opened this issue Oct 15, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@hugoheden
Copy link

hugoheden commented Oct 15, 2023

The @MavenProjectSources (new since 0.12) is very useful. If the user does not set any parameters to it (neither resourcesUsage nor sources), I have a vague suggestion what it should default to.

The has similar semantics to @MavenProject, which - when used without paramenters - defaults to a directory called maven_project. So I am just wondering if @MavenProjectSources should behave similarly - i.e default to using the maven_project subdirectory?

Argumentation:

In the current documentation for @MavenProject, we see this example:

@MavenJupiterExtension
class SetIT
{
    private static final String VERSIONS_PLUGIN_SET =
      "${project.groupId}:${project.artifactId}:${project.version}:set";

    @Nested
    @MavenProject
    @TestMethodOrder( OrderAnnotation.class )
    @MavenOption(MavenCLIOptions.NON_RECURSIVE)
    @MavenGoal(VERSIONS_PLUGIN_SET)
    class set_001
    {

        @SystemProperty(value = "newVersion", content="2.0")
        @MavenTest
        @Order(10)
        void first( MavenExecutionResult result )
        {
            assertThat( result ).isSuccessful();
        }

        @SystemProperty(value = "newVersion", content="2.0")
        @SystemProperty(value = "groupId", content="*")
        @SystemProperty(value = "artifactId", content="*")
        @SystemProperty(value = "oldVersion", content="*")
        @MavenTest
        @Order(20)
        void second( MavenExecutionResult result)
        {
            assertThat( result ).isSuccessful();
        }
    }
}

And then we learn that we should place the project in a directory named maven_project:

The @MavenProject defines that project name which is by default maven_project. This means, 
you have to define the project you would like to test on like this: ....

Ok, so I am just thinking that it would be elegantly consistent that the @MavenProjectSources would behave similarly - it could default to using the maven_project subdirectory.

There could be a section in the documentation right before (or after) the above section, that would contain a similar code example as above, but using @MavenProjectSources (without parameters) instead of @MavenProject (and without any ordering of the tests):

@MavenJupiterExtension
class SetIT
{
    private static final String VERSIONS_PLUGIN_SET =
      "${project.groupId}:${project.artifactId}:${project.version}:set";

    @Nested
    @MavenProjectSources
    @MavenOption(MavenCLIOptions.NON_RECURSIVE)
    @MavenGoal(VERSIONS_PLUGIN_SET)
    class set_001
    {

        @SystemProperty(value = "newVersion", content="2.0")
        @MavenTest
        void some_test( MavenExecutionResult result )
        {
            assertThat( result ).isSuccessful();
        }

        @SystemProperty(value = "newVersion", content="3.0")
        @MavenTest
        void some_other_test( MavenExecutionResult result)
        {
            assertThat( result ).isSuccessful();
        }
    }
}

I think this usage of @MavenProjectSources could be documented in the same section as the @MavenProject, because it would highlight the similarities and differences between the two annotations nicely.

@hugoheden hugoheden added the enhancement New feature or request label Oct 15, 2023
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
None yet
Development

No branches or pull requests

1 participant