-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable JUnit 5 test suite engine in tycho-surefire #2462
Currently, Tycho is not capable of running JUnit 5 test suites, since the required SuiteTestEngine is not provided while running tests. This change adds the SuiteTestEngine to tycho-surefire executions using JUnit Platform 1.8 (the first with suite support) or newer. To this end, the SuiteTestEngine is always enabled when running JUnit 5 tests. It also adds a regression test for executing a test suite based on JUnit Jupiter 5.9. Fixes #2462
- Loading branch information
1 parent
178782d
commit 731e5d7
Showing
19 changed files
with
197 additions
and
5 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
tycho-its/projects/surefire.junit59suite/bundle.test/META-INF/MANIFEST.MF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: JUnit5 Suite Test Plug-in | ||
Bundle-SymbolicName: bundle.test.junit59suite | ||
Bundle-Version: 1.0.0 | ||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||
Import-Package: org.junit.jupiter.api;version="5.9.0", | ||
org.junit.platform.suite.api;version="1.9.0" |
4 changes: 4 additions & 0 deletions
4
tycho-its/projects/surefire.junit59suite/bundle.test/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source.. = src/ | ||
output.. = bin/ | ||
bin.includes = META-INF/,\ | ||
. |
37 changes: 37 additions & 0 deletions
37
tycho-its/projects/surefire.junit59suite/bundle.test/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.eclipse.tycho.tycho-its.surefire-junit5</groupId> | ||
<artifactId>bundle.test.junit59suite</artifactId> | ||
<packaging>eclipse-test-plugin</packaging> | ||
<version>1.0.0</version> | ||
|
||
<repositories> | ||
<repository> | ||
<id>eclipse</id> | ||
<layout>p2</layout> | ||
<url>${target-platform}</url> | ||
</repository> | ||
</repositories> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-maven-plugin</artifactId> | ||
<version>${tycho-version}</version> | ||
<extensions>true</extensions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-surefire-plugin</artifactId> | ||
<version>${tycho-version}</version> | ||
<configuration> | ||
<includes> | ||
<include>**/SuiteWithAllTests.java</include> | ||
</includes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
28 changes: 28 additions & 0 deletions
28
tycho-its/projects/surefire.junit59suite/bundle.test/src/bundle/test/JUnit59Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Vector Informatik GmbH and others. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Vector Informatik GmbH - initial API and implementation | ||
*******************************************************************************/ | ||
package bundle.test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class JUnit59Test { | ||
|
||
@Test | ||
@DisplayName("started from test suite") | ||
void startedFromSuite() { | ||
assertEquals(2, 1 + 1); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
tycho-its/projects/surefire.junit59suite/bundle.test/src/bundle/test/SuiteWithAllTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Vector Informatik GmbH and others. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Vector Informatik GmbH - initial API and implementation | ||
*******************************************************************************/ | ||
package bundle.test; | ||
|
||
import org.junit.platform.suite.api.Suite; | ||
import org.junit.platform.suite.api.SelectClasses; | ||
|
||
@Suite | ||
@SelectClasses({ JUnit59Test.class }) | ||
public class SuiteWithAllTests { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...urefire.junit58/src/main/resources/META-INF/services/org.junit.platform.engine.TestEngine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
org.junit.jupiter.engine.JupiterTestEngine | ||
org.junit.platform.suite.engine.SuiteTestEngine |
1 change: 1 addition & 0 deletions
1
tycho-surefire/org.eclipse.tycho.surefire.junit58withvintage/bnd.bnd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...it58withvintage/src/main/resources/META-INF/services/org.junit.platform.engine.TestEngine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Manual merge of META-INF/services/org.junit.platform.engine.TestEngine of both junit-vintage-engine and junit-jupiter-engine | ||
# otherwise only one of the two files would win when extracting dependencies | ||
org.junit.jupiter.engine.JupiterTestEngine | ||
org.junit.vintage.engine.VintageTestEngine | ||
org.junit.vintage.engine.VintageTestEngine | ||
org.junit.platform.suite.engine.SuiteTestEngine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...urefire.junit59/src/main/resources/META-INF/services/org.junit.platform.engine.TestEngine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
org.junit.jupiter.engine.JupiterTestEngine | ||
org.junit.platform.suite.engine.SuiteTestEngine |
1 change: 1 addition & 0 deletions
1
tycho-surefire/org.eclipse.tycho.surefire.junit59withvintage/bnd.bnd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...it59withvintage/src/main/resources/META-INF/services/org.junit.platform.engine.TestEngine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Manual merge of META-INF/services/org.junit.platform.engine.TestEngine of both junit-vintage-engine and junit-jupiter-engine | ||
# otherwise only one of the two files would win when extracting dependencies | ||
org.junit.jupiter.engine.JupiterTestEngine | ||
org.junit.vintage.engine.VintageTestEngine | ||
org.junit.vintage.engine.VintageTestEngine | ||
org.junit.platform.suite.engine.SuiteTestEngine |