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

exiting the process if 0 tests are run in retry run #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pepop99
Copy link
Collaborator

@pepop99 pepop99 commented May 22, 2023

If no unit tests were found in the first run, SuperTest would exit with a status code 0, giving a false success.
This has been resolved now by checking the number of unit tests that are to be run in the retry run.

@pepop99 pepop99 requested a review from tpetrov-lp May 22, 2023 19:48
@sonarcloud
Copy link

sonarcloud bot commented May 22, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Copy link
Collaborator

@tpetrov-lp tpetrov-lp left a comment

Choose a reason for hiding this comment

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

This code does not seem quite correct, I think it need some changes.

testsToBeRetried += runResult.getFailedTestCases().size();
}

if (testsToBeRetried == 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does not seem correct to me.

If there are no unit tests found, then allTestClasses will be empty. If it is not, then we have at least one unit test. And if we come to this point here, it says that there is no failing test, but in some cases, we don't get a xml file at all. E.g. if the test was running for too long and we had to interrupt the execution. In this case testsToBeRetried will be 0, but we should actually retry.

The problem may be

new TestListResolver(
                        includes, excludes, getTest(), testClassesDir).scanDirectories()

Check if TestListResolver works fine with non-trivial -Dtest=.... If it works, just check allTestClasses in case mvn exited with non-zero code (i.e. potentially it had zero tests). Though to be even more precise, you may want to check readProcessStdOut for the right error message that there are no tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants