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

[SUREFIRE-2015] Implement testRunId and RunMode in the SimpleReportEntry #482

Merged
merged 2 commits into from Mar 6, 2022

Conversation

Tibor17
Copy link
Contributor

@Tibor17 Tibor17 commented Mar 1, 2022

This PR is the most important because it implements RunMode and testRunId in the ReportEntry, TestSetReportEntry, SimpleReportEntry, CategorizedReportEntry and WrappedReportEntry in appropriate implementation form.

Additionally, I had to distinguish between two events (OutputReportEntry, TestOutputReportEntry) and therefore the interface TestReportListener handles them via generics dependeing on the situation.
The first situation happens when provider's listeners handles the event OutputReportEntry from System.out and System.err via the ConsoleOutputCapture. The ConsoleOutputCapture does not have any notion about runMode and testRunId, and therefore the only provider's listener would add runMode and testRunId to a recreated entry which would be finally propagated to the ForkingRunListener and TestSetRunListener. The runMode and testRunId are determined opon the events testStarted and any test end and Thread local.
The second situation happens when ForkingRunListener and TestSetRunListener handles TestOutputReportEntry which contains runMode and testRunId.

Some classes are deprecated in the module surefire-junit47 and can be freely removed after the XML Reporter would be fully capable of parallel tests (must support events chaos in one thread). That's the reason why parallel tests are badly handled in JUnit5 reports. The provider surefire-junit47 also supports parallel tests and we do not see the problem with undeterministic XML report, but the reason is that the provider has a cache, eats the memory including the std/out logs and all the messages and test events are replayed in a sequence as if the tests were executed in one thread.

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SUREFIRE-XXX] - Fixes bug in ApproximateQuantiles,
    where you replace SUREFIRE-XXX with the appropriate JIRA issue. Best practice
    is to use the JIRA issue title in the pull request title and in the first line of the
    commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its clean install).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@Tibor17
Copy link
Contributor Author

Tibor17 commented Mar 1, 2022

@slachiewicz
Now only SUREFIRE-2014 remains to complete the entire SUREFIRE-1860.

@Tibor17
Copy link
Contributor Author

Tibor17 commented Mar 1, 2022

@slachiewicz
If a Javadoc is missing somewhere, I can add one of course.

@slachiewicz
Copy link
Member

@slawekjaranowski ?

@Tibor17
Copy link
Contributor Author

Tibor17 commented Mar 1, 2022

@slachiewicz
Sorry for typo. My bad!
May I ask you for having a look since you are already here? Thx

Copy link
Member

@slawekjaranowski slawekjaranowski left a comment

Choose a reason for hiding this comment

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

please add javadocs for new interface/ classes 😄

public RunMode markAs( RunMode currentRunMode )
{
RunMode runMode = this.runMode;
this.runMode = requireNonNull( currentRunMode );
Copy link
Member

Choose a reason for hiding this comment

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

private field runMode can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thx, done :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The RunMode will be finally removed in AbstractStandardStreamEvent and EventChannelEncoder in the SUREFIRE-2014.

@Tibor17
Copy link
Contributor Author

Tibor17 commented Mar 1, 2022

@slawekjaranowski Javadoc was added.

@Tibor17 Tibor17 merged commit 79db903 into master Mar 6, 2022
@asfgit asfgit deleted the SUREFIRE-2015 branch March 27, 2022 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants