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

Donate current sources from junit-platform-surefire-provider #184

Merged
merged 1 commit into from
Jun 7, 2018
Merged

Donate current sources from junit-platform-surefire-provider #184

merged 1 commit into from
Jun 7, 2018

Conversation

sormuras
Copy link
Contributor

@sormuras sormuras commented May 3, 2018

This PR includes enhancements and bug fixes that were applied since the initial code donation.

History of changes: https://github.com/junit-team/junit5/commits/master/junit-platform-surefire-provider

Addresses https://issues.apache.org/jira/browse/SUREFIRE-1330

@olamy
Copy link
Member

olamy commented May 3, 2018

awesome!!

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

great ! thank you

@Tibor17
Copy link
Contributor

Tibor17 commented May 3, 2018

@sormuras
I should perhaps squash all 4 commits in the branch https://gitbox.apache.org/repos/asf?p=maven-surefire.git;a=shortlog;h=refs/heads/1330 and add the last commit 4d9173e .
Do you have permissions in ASF git?

@sormuras
Copy link
Contributor Author

sormuras commented May 3, 2018

Sure. Go ahead.

I am still waiting for the ASF git permissions.

@Tibor17
Copy link
Contributor

Tibor17 commented May 3, 2018

@sormuras
The branch contains all your changes now.

@sormuras
Copy link
Contributor Author

sormuras commented May 4, 2018

Nice. But animal-sniffer-maven-plugin still fails either by not finding a bunch of methods, like:

surefire-providers\surefire-junit-platform\src\main\java\org\apache\maven\surefire\junitplatform\JUnitPlatformProvider.java:213: Undefined reference: boolean org.junit.platform.commons.util.StringUtils.isNotBlank(String)
surefire-providers\surefire-junit-platform\src\main\java\org\apache\maven\surefire\junitplatform\JUnitPlatformProvider.java:228: Undefined reference: void org.junit.platform.commons.util.Preconditions.condition(boolean, String)

or if I comment the exclude for org.junit.platform:junit-platform-commons out, it seems to choke due to an out-dated ASM version:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.15:check (signature-check) on project surefire-junit-platform: Execution signature-check of goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.15:check failed.
[...]
Caused by: java.lang.IllegalArgumentException
	at org.objectweb.asm.ClassReader.<init>(Unknown Source)
	at org.objectweb.asm.ClassReader.<init>(Unknown Source)
	at org.objectweb.asm.ClassReader.<init>(Unknown Source)
	at org.codehaus.mojo.animal_sniffer.ClassListBuilder.process(ClassListBuilder.java:71)

How do I fix those build errors?

@sormuras
Copy link
Contributor Author

sormuras commented May 4, 2018

Working-around it for now by

[...]
<ignores>
    <param>org.junit.platform.commons.*</param>
</ignores>

@sormuras
Copy link
Contributor Author

sormuras commented May 4, 2018

@Tibor17 Can you please integrate the last two commits as well? The build was successful on my machine and before I write more integration tests, I'd like to know whether I'm on the right track.

@sormuras
Copy link
Contributor Author

sormuras commented May 5, 2018

Make it three commits. 🔱

/**
* JUnitPlatformProvider.
*
* @since 1.0
Copy link
Contributor

@Tibor17 Tibor17 May 5, 2018

Choose a reason for hiding this comment

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

Pls put here another version. We can make release of the provider in e.g. 2.22.0.

Copy link
Contributor Author

@sormuras sormuras May 5, 2018

Choose a reason for hiding this comment

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

Fixing all JUnit-related versions to 2.22.0.

@@ -1022,9 +1029,9 @@ private void createDependencyResolver()
Artifact junitDepArtifact = getJunitDepArtifact();
return new ProviderList( new DynamicProviderInfo( null ),
new TestNgProviderInfo( getTestNgArtifact() ),
new JUnitPlatformProviderInfo( getJunitPlatformArtifact() ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Here the order of provider-info was changed. Does it mean something important for functionality?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are the built-in providers documented somewhere? I couldn't find any external information.

The first auto-detected provider wins, right?

If I understand the isApplicable() logic correctly, the platform info needs to checked before the legacy JUnit (3 + 4) infos. This is due to fact, that a legacy "junit-4.12.jar" is present in both cases: the users is on 4 and wants to run JUnit 4 test cases. Or the user is on "5" and wants to Vintage Engine to execute JUnit 4 or 3 test cases.

So, when we find org.junit.platform:junit-platform-engine as a dependency the uses wants to launch the JUnit Platform -- perhaps with the Vintage Engine which brings along JUnit 4.x jar.

Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK the found providers are run separately in a loop, see AbstractSurefireMojo.java in method execute.

@sormuras
Copy link
Contributor Author

sormuras commented May 5, 2018

I think, we may get rid of integration test class JUnit5IT as it refers to the soon deprecated org.junit.platform:junit-platform-surefire-provider. Or should we keep it for the sake of completeness?

@Tibor17
Copy link
Contributor

Tibor17 commented May 5, 2018

@sormuras
Did you override the branch 1330? Because I squashed last cca 5 commits to one.
You have to squash all commits b83121..0633293 in one commit with this command
git rebase -i HEAD~11 amend the resulting commit message to
[SUREFIRE-1330] JUnit 5 surefire-provider code donation
and then force push itself branch
git push origin +1330:1330

@Tibor17
Copy link
Contributor

Tibor17 commented May 5, 2018

I will have a look to the sniffer plugin in the evening and I will try to run the build.

@sormuras
Copy link
Contributor Author

sormuras commented May 5, 2018

... You have to squash all commits ...

Losing history and reasoning is okay?

Done.

https://gitbox.apache.org/repos/asf?p=maven-surefire.git;a=commit;h=fb1188b6b45e7a2d71e9d9807c67775a9595031d

@sormuras
Copy link
Contributor Author

sormuras commented May 5, 2018

Why are they banned?

[linux-jdk10-maven3.5.x] Found Banned Dependency: org.apache.commons:commons-lang3:jar:3.7
[linux-jdk10-maven3.5.x] Found Banned Dependency: commons-io:commons-io:jar:2.6

Reverting to old versions...

@sormuras
Copy link
Contributor Author

sormuras commented May 5, 2018

JDK 10 seems okay now. JDK 7 still chokes on "--target 1.8" options...

https://builds.apache.org/job/maven-box/job/maven-surefire/job/1330/8/

@Tibor17
Copy link
Contributor

Tibor17 commented May 5, 2018

@sormuras
Did you also have a problem with JaCoCO:0.7.9 on JDK10?
Do we need to have scope=compile on the dependency <artifactId>junit-platform-launcher</artifactId> in our provider POM? What will happen if it would be scope provided?

@Tibor17
Copy link
Contributor

Tibor17 commented May 5, 2018

@sormuras
How did you skip tests on surefire-junit-platform with JDK 1.7?

@Tibor17
Copy link
Contributor

Tibor17 commented May 5, 2018

Now I see, you used the build process JDK
<jvm>${java.home}/bin/java</jvm>
Very well!

@Tibor17
Copy link
Contributor

Tibor17 commented May 5, 2018

That's exactly why we have two JDKs.

@sormuras
Copy link
Contributor Author

sormuras commented May 6, 2018

Did you also have a problem with JaCoCO:0.7.9 on JDK10?

According to https://github.com/jacoco/jacoco/releases 0.8.1 introduced JDK 10 support. Thus, 0.7.9 had to fail.

Do we need to have scope=compile on the dependency junit-platform-launcher in our provider POM? What will happen if it would be scope provided?

99% yes, the provider needs it at compile time. That's what JUnit Platform is all about. It's the API for tools (build tools, IDEs, ...) to get "JUnit 5" (technically, there's no JUnit 5) running. See this import statements in org.apache.maven.surefire.junitplatform.JUnitPlatformProvider:

import org.junit.platform.launcher.Launcher;
import org.junit.platform.launcher.LauncherDiscoveryRequest;
import org.junit.platform.launcher.TagFilter;
import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder;
import org.junit.platform.launcher.core.LauncherFactory;

And recall the "JUnit 5" architecture layout:

Just move the junit-platform-surefire-provider from the bottom-left out off the red PLATFORM box into the IDEs/Build Tool bubble at the bottom. Here be dragons, Gradle, Surefire, IDEA, Eclipse, etc...

1% no, perhaps there's some Maven-trick to achieve the same with provided scope?

How did you skip tests on surefire-junit-platform with JDK 1.7?

Mh, if it is because of <jvm>${java.home}/bin/java</jvm> then @britter did it.
At test runtime, the assumption declared in JUnitPlatformIT ensures that a JDK 1.8+ is at work:

@Before
public void setUp()
{
    assumeThat( "java.specification.version: ",
                    getProperty( "java.specification.version" ),
                    is( greaterThanOrEqualTo( "1.8" ) ) );
}

@Tibor17
Copy link
Contributor

Tibor17 commented May 6, 2018 via email

@sormuras
Copy link
Contributor Author

sormuras commented May 6, 2018

I think it will work even without is( greaterThanOrEqualTo( "1.8" ) ).

Okay. Removed the setUp method. Let's see what Jenkins reports.

@Tibor17
Copy link
Contributor

Tibor17 commented May 6, 2018

It may happen that version of junit-platform-launcher would be too low after years?
Therefore I asked about different scope.
The junit-platform-launcher is dependent on junit-platform-engine which means for us that JUnit5 should guarantee backwards compatibility of platform engine for long time.

@Tibor17
Copy link
Contributor

Tibor17 commented May 6, 2018

@sormuras
Try to use your PC. The build takes few minutes with only your ITs.
It is just only about adding system property on commandline -Djdk.home=/path/to/jdk1.7.

@sormuras
Copy link
Contributor Author

sormuras commented May 6, 2018

[...] JUnit5 should guarantee backwards compatibility of platform engine for long time.

That's exactly the plan of @junit-team! The platform is the stable part that build tools depend on. What a test is and how to execute it, is defined by an engine implementation. Like "Jupiter" now and "Saturn" (JUnit 6) in a few years... or any other flavor. See the list of well-known engine implementations at https://github.com/junit-team/junit5/wiki/Third-party-Extensions#junit-platform-test-engines

...so, if a build tool supports the JUnit Platform it doesn't have to care about new testing frameworks, as long as they implement TestEngine. The junit-platform-engine-jqwik IT in 1330 shows how and that it works.

@Tibor17
Copy link
Contributor

Tibor17 commented May 8, 2018

@sormuras
Regarding the plexus-java:0.9.8 I pushed the commit to the branch 1518 and additionally second commit in Jenkinsfile where I excluded machine windows-2012-3. See the Jenkins job status:
https://builds.apache.org/job/maven-box/job/maven-surefire/job/1518
We have 4 Windows machines altogether and excluded one which is not that bad but the build may take 3 hours to complete on master. The machine windows-2012-3 must have some problems with long Windows path because of the Compilation failures - the compiler does not reach the files. I repored this issue already to our INFRA team.

@Tibor17
Copy link
Contributor

Tibor17 commented May 8, 2018

@sormuras
I added JDK 11 b8 (early access build) to test on the branch 1518. So we should way especially for the outcome from JDK 11.

@Tibor17
Copy link
Contributor

Tibor17 commented May 8, 2018

I have reported a bug for PowerMock due to JDK 11
powermock/powermock#904
Another problem is on Windows:
16:38:38 [windows-jdk11-maven3.5.x] The system cannot find the path specified.
https://builds.apache.org/job/maven-box/job/maven-surefire/job/1518/8/consoleFull
So we have a real problem to test with JDK 11.

@sormuras
Copy link
Contributor Author

sormuras commented May 8, 2018

I may look into the JDK 11 issues later... but as it is still early-access state, we and other tools have some months time to adopt.

@Tibor17
Copy link
Contributor

Tibor17 commented May 8, 2018

It seems we have to avoid one more machine, windows-2016-1, see
https://issues.apache.org/jira/browse/INFRA-16491
It is actually the most fast Windows machine ;-(

@Tibor17
Copy link
Contributor

Tibor17 commented May 8, 2018

@sormuras
Copy link
Contributor Author

Rebased onto https://github.com/apache/maven-surefire/commits/master and merged gitbox-1330 changes.

@Tibor17
Copy link
Contributor

Tibor17 commented May 11, 2018

@sormuras
The CI https://builds.apache.org/job/maven-box/job/maven-surefire/job/1330/ does not see the branch after you have rebased 1330 on master. Did you push it to a new branch?

@sormuras
Copy link
Contributor Author

sormuras commented May 12, 2018

No, didn't do it yet. Just wanted get the changes I made on gitbox-1330 to show up here as "Polishing". Will reset 1330 to this branch (github-184) and squash all commits into a single one there.

@sormuras
Copy link
Contributor Author

What happend on the linux-jdk7-maven3.5.x build?

[linux-jdk7-maven3.5.x] Tests run: 58, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.858 sec
[linux-jdk7-maven3.5.x] 
[linux-jdk7-maven3.5.x] Results :
[linux-jdk7-maven3.5.x] 
[linux-jdk7-maven3.5.x] Tests run: 58, Failures: 0, Errors: 0, Skipped: 0
[linux-jdk7-maven3.5.x] 
[linux-jdk7-maven3.5.x] [INFO] 
[linux-jdk7-maven3.5.x] [INFO] --- maven-jar-plugin:3.0.0:jar (default-jar) @ surefire-booter ---
[linux-jdk7-maven3.5.x] [INFO] Building jar: /home/jenkins/jenkins-slave/workspace/ven-box_maven-surefire_1330-TSMLOBV5ENRMCK6YV52ANAULUWOG4OYEMBRTFOGSINEWTK45IYLQ/surefire-booter/target/surefire-booter-3.0.0-SNAPSHOT.jar
[linux-jdk7-maven3.5.x] [INFO] 
[linux-jdk7-maven3.5.x] [INFO] --- maven-site-plugin:3.4:attach-descriptor (attach-descriptor) @ surefire-booter ---
[linux-jdk7-maven3.5.x] [INFO] 
[linux-jdk7-maven3.5.x] [INFO] --- maven-shade-plugin:3.1.0:shade (default) @ surefire-booter ---
[linux-jdk7-maven3.5.x] [INFO] Excluding org.apache.maven.surefire:surefire-api:jar:3.0.0-SNAPSHOT from the shaded jar.
[linux-jdk7-maven3.5.x] [INFO] Excluding org.apache.maven.surefire:surefire-logger-api:jar:3.0.0-SNAPSHOT from the shaded jar.
[linux-jdk7-maven3.5.x] [INFO] Including org.apache.commons:commons-lang3:jar:3.5 in the shaded jar.
[linux-jdk7-maven3.5.x] [INFO] Including commons-io:commons-io:jar:2.5 in the shaded jar.
[linux-jdk7-maven3.5.x] [INFO] Minimizing jar org.apache.maven.surefire:surefire-booter:jar:3.0.0-SNAPSHOT
[linux-jdk7-maven3.5.x] [INFO] ------------------------------------------------------------------------
[linux-jdk7-maven3.5.x] [INFO] Reactor Summary:
[linux-jdk7-maven3.5.x] [INFO] 
[linux-jdk7-maven3.5.x] [INFO] Apache Maven Surefire .............................. SUCCESS [ 13.605 s]
[linux-jdk7-maven3.5.x] [INFO] SureFire Logger API ................................ SUCCESS [  3.933 s]
[linux-jdk7-maven3.5.x] [INFO] SureFire API ....................................... SUCCESS [ 12.695 s]
[linux-jdk7-maven3.5.x] [INFO] ShadeFire JUnit3 Provider .......................... SUCCESS [  1.921 s]
[linux-jdk7-maven3.5.x] [INFO] SureFire Booter .................................... FAILURE [ 10.408 s]
[linux-jdk7-maven3.5.x] [INFO] Maven Surefire Test-Grouping Support ............... SKIPPED
[...]

windows-jdk7-maven3.5.x build was doing fine.

@sormuras
Copy link
Contributor Author

Restarting the build didn't help...

@Tibor17
Copy link
Contributor

Tibor17 commented May 12, 2018 via email

@Tibor17
Copy link
Contributor

Tibor17 commented May 12, 2018 via email

*---------------------------------------------+------------+----------+------------+-----------+----------+--------------------+
| runOrder support | Y | Y | Y | ? | Y | N |
*---------------------------------------------+------------+----------+------------+-----------+----------+--------------------+
| run >1 individual test method in a class | N | Y | Y | Y | N | ? |
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we have question mark for run >1 individual test method in a class. I think this should be Y. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but there are some corner cases that are not supported, yet (see junit-team/junit5#1343 and junit-team/junit5#1406).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Keeping the ? and adding the links as footnotes to the matrix.

*---------------------------------------------+------------+----------+------------+-----------+----------+--------------------+
| run >1 individual test method in a class | N | Y | Y | Y | N | ? |
*---------------------------------------------+------------+----------+------------+-----------+----------+--------------------+
| parallel support | N | N | Y | Y | N | N |
Copy link
Contributor

Choose a reason for hiding this comment

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

In parallel support we have N. Can we utilize ParallelComputer from JUnit4?
The PC covers parallelism. I would like to utilize it because it has a complex possibilities with configuration and I do not want to develop it again.

Copy link
Contributor

Choose a reason for hiding this comment

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

No, ParallelComputer cannot be reused. Jupiter currently does not have support for parallel execution, that will be added in junit-team/junit5#60.

Copy link
Contributor

Choose a reason for hiding this comment

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

@marcphilipp
It's better if we implement PC in surefire. We know what configuration we need. Is there something like Scheduler as it was in previous JUnit4? Is there a difference between runner and suite?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should stick with 'N' for now.

Let's see which way is best to implement parallel execution support for the Platform.

@@ -141,6 +141,8 @@ mvn verify

* {{{./examples/testng.html}Using TestNG}}

* {{{./examples/junit-platform.html}Using JUnit Platform}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if users would realize this is JUnit5 provider.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just mention Using JUnit5 Platform - added 5.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

@@ -40,6 +40,7 @@
<menu name="Examples">
<item name="Using TestNG" href="examples/testng.html"/>
<item name="Using JUnit" href="examples/junit.html"/>
<item name="Using JUnit Platform" href="examples/junit-platform.html"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

<configuration>
<properties>
<configurationParameters>
junit.jupiter.conditions.deactivate = *
Copy link
Contributor

Choose a reason for hiding this comment

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

The separator is \n? Is it reliable?
What about CSV?
We should check if we put the value between "..." on CLI.

Copy link
Contributor

Choose a reason for hiding this comment

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

It uses Properties.load() so it will do the right thing whichever line separator is used.

Copy link
Contributor

Choose a reason for hiding this comment

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

Java code Properties.load() is okay but the way it is transferred via CLI might not be okay.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mean transferring them from the Maven process to the forked VM? Or when specifying the property using -DconfigurationParameters? Or something else?

Copy link
Contributor

Choose a reason for hiding this comment

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

@marcphilipp
Yes I "mean transferring them from the Maven process to the forked VM".
We should check how this data is escaped and transfered.
Next thing, the text in POM should be in CDATA.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should check how this data is escaped and transfered.

Agreed, but it works. 😉

Next thing, the text in POM should be in CDATA.

As long as the string does not contain any XML-specific characters, I don't see a reason to wrap it in a CDATA block. Am I missing something?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the newlines would be platform specific. We should check it in the code but I do not have time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where can I find the escape and transfer code in CLI @Tibor17 ?

As long as newline separators are transfered (doesn't matter which one is received on the forked VM) the loading via Properties.load will be fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @sormuras. I will participate again tomorrow.

<version>{surefire-version}</version>
<configuration>
<properties>
<includeTags>acceptance | !feature-a</includeTags>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we did not utilize Surefire's parameters groups and excludedGroups?
The same is in TestNG.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should indeed do that, cf. junit-team/junit5#1425 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll take a look.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean with

Surefire's parameters groups and excludedGroups

the TestNG specific contants in org.apache.maven.surefire.booter.ProviderParameterNames?

    public static final String TESTNG_EXCLUDEDGROUPS_PROP = "excludegroups";
    public static final String TESTNG_GROUPS_PROP = "groups";

If yes, then I'd like to keep the JUnit 5 Platform configuration separate from those. The meaning of entries listed in groups and excludedGroups may be different.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes we have to use groups and excludegroups. I think this can be solved fast. The includeTags looks like system property. The provider observes these properties in constructor.

The only missing information is the mechanism how you can set includeTags via JUnit5 API.
This I do not know. We can write IT because it's the change and Surefire feature then.

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 tags (include and exclude) are passed as filters to the org.apache.maven.surefire.junitplatform.TestPlanScannerFilter in line:

https://github.com/apache/maven-surefire/pull/184/files#diff-b3a2904e92be87f11f2622fbfd122e31R137

The filters are generated here:

https://github.com/apache/maven-surefire/pull/184/files#diff-b3a2904e92be87f11f2622fbfd122e31R172

Does that help?

Copy link
Contributor

Choose a reason for hiding this comment

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

@sormuras
Let's go to the IRC chat.

+---+
if the JUnit Platform Engine is present in the project
use junit-platform
if the JUnit version in the project >= 4.7 and the parallel attribute has ANY value
Copy link
Contributor

@Tibor17 Tibor17 May 16, 2018

Choose a reason for hiding this comment

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

Pls emphase with <<<parallel>>> but the attribute should be rewritten to configuration parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

private boolean isTestSetStarted( TestIdentifier testIdentifier )
{
return testSetNodes.contains( testIdentifier )
|| testPlan.getParent( testIdentifier ).map( this::isTestSetStarted ).orElse( false );
Copy link
Contributor Author

@sormuras sormuras Jun 5, 2018

Choose a reason for hiding this comment

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

The recursive call via map( this::isTestSetStarted ) may lead to a stack overflow error when an engine implementation provides a parent-child graph with cycles.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

junit-team/junit5#1451 will fix this for the unreleased JUnit Platform version 1.3.0 -- creating an issue to track.

Copy link
Contributor

@Tibor17 Tibor17 Jun 7, 2018

Choose a reason for hiding this comment

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

@sormuras
How did we come to this discussion with RunListenerAdapter.java? You wanted to make a fix in surefire for junit-team/junit5#1451?

Copy link
Contributor

Choose a reason for hiding this comment

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

No real engine will do that so I don't think it's crucial to introduce a (temporary) workaround in Surefire.

@sormuras sormuras merged commit a132614 into apache:master Jun 7, 2018
@marcphilipp
Copy link
Contributor

Thanks @sormuras and @Tibor17 for getting this merged! I can't wait to use the released version! 🎉

@olamy
Copy link
Member

olamy commented Jun 7, 2018

Awesome guys!! Good job!!

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.

5 participants