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

support running tests from non default test folders #4924

Merged
merged 1 commit into from
Apr 17, 2023

Conversation

Honza-cz
Copy link

@Honza-cz Honza-cz commented Nov 5, 2022

Netbeans are not able to run the test in extra test source folder added by build-helper-maven-plugin maven plugin ...

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.9.1</version>
    <executions>
        <execution>
            <id>add-test-source</id>
            <phase>generate-test-sources</phase>
            <goals>
                <goal>add-test-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>src/it/java</source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

If I run the test by Ctrl+F6, netbeans is not able to replace packageClassName by a test name

cd /.../repository; JAVA_HOME=/.../jdk-19.0.1 /.../netbeans/java/maven/bin/mvn -Dtest=${packageClassName} surefire:test

After fix:

cd /...repository; JAVA_HOME=/.../jdk-19.0.1 /.../netbeans/java/maven/bin/mvn -Dtest=some.pkg.Test surefire:test

The updated code is covered by UT.

This pull request is linked to my previous one which I decided to close due to wrong fix.

@Honza-cz
Copy link
Author

@neilcsmith-net : You pointed a week ago how to fix that issue and in fact it simplifies the fix. Can you maybe have a look again?

@neilcsmith-net neilcsmith-net added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Maven [ci] enable "build tools" tests labels Nov 11, 2022
@neilcsmith-net
Copy link
Member

@Honza-cz thanks for the contribution. Kicked off tests and requested reviews. Some of us tied up with finalising NB16 release at the moment, so might take a little while.

packClassname.append(test
.stream()
.map(String::trim)
.collect(Collectors.joining(","))
Copy link
Member

Choose a reason for hiding this comment

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

Please check whether syntax with comma-separated package names (not paths) works in ancient Surefire version - according to docs, there were some significant changes in Surefire 2.19. We recommend Surefire 2.22 for Junit5, and surefire 2.8 (which may fail with this syntax) for single test run. See org.netbeans.modules.maven.ActionProviderImp::checkSurefire for details.

Copy link
Author

Choose a reason for hiding this comment

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

I made a test with junit:4.12 and maven-surefire-plugin:2.8. In Netbeans I selected 2 packages and execute them. It generated -Dtest=some.it.pkg.other.**,some.it.pkg.** and it run the tests in those packages as expected:

Running some.it.pkg.ItTest ... Running some.it.pkg.other.It3Test ...

Is a such manual test enough?

@Honza-cz
Copy link
Author

let me know in case of any doubts. thx in advance. @sdedic , @neilcsmith-net

@mbien mbien changed the title The improvement to let netbeans/maven to execute tests in non default… support running tests from non default test folders Dec 22, 2022
@Honza-cz
Copy link
Author

@sdedic , @neilcsmith-net : any update?

This fix will help me in my day-to-day job to be able to run the tests by IDE directly and not by maven which is ok, but a bit unnecessary.

@Honza-cz
Copy link
Author

Honza-cz commented Apr 3, 2023

@neilcsmith-net, @sdedic : Kind reminder
... I started to accept the reality that this update won't make it to official release

@sdedic
Copy link
Member

sdedic commented Apr 3, 2023

Apologies - pings lost in the mail traffic. Looks good; thanks for the patience / persistence.

@sdedic sdedic added this to the NB18 milestone Apr 3, 2023
Copy link
Member

@mbien mbien left a comment

Choose a reason for hiding this comment

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

looks good to me too.

PR is reviewed and it looks like all questions were sufficiently answered. Tests are included which cover this change and everything is green.

@Honza-cz congrats to your first contribution -> merging

@mbien
Copy link
Member

mbien commented Apr 17, 2023

squashing locally + rebase force push. will merge when green on all tests - don't want to risk anything one day before freeze.

…olders

which were added by maven plugin: build-helper-maven-plugin/add-test-source
@mbien mbien added the ci:all-tests [ci] enable all tests label Apr 17, 2023
@mbien mbien force-pushed the generated-test-execution branch from 90126ff to 9ecdd96 Compare April 17, 2023 17:08
@mbien mbien merged commit 5a97ccf into apache:master Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:all-tests [ci] enable all tests Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Maven [ci] enable "build tools" tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants