<td>A comma separated list of <a href="https://junit.org/junit5/docs/current/user-guide/#writing-tests-annotations">JUnit 5 tags</a>, describing the tests to include.
<p><em>Since Ant 1.10.7</em></p>
</td>
<td>No</td>
</tr>
<tr>
<td>excludeTags</td>
<td>A comma separated list of <a href="https://junit.org/junit5/docs/current/user-guide/#writing-tests-annotations">JUnit 5 tags</a>, describing the tests to exclude.
<p><em>Since Ant 1.10.7</em></p>
</td>
<td>No</td>
</tr>
<tr>
<td>haltOnFailure</td>
<td>A value of <q>true</q> implies that build has to stop if any failure occurs in any of
@@ -228,7 +230,7 @@ public class JUnitLauncherTaskTest {
final String targetName = "test-junit-ant-runtime-lib-excluded";
try {
buildRule.executeTarget(targetName);
Assert.fail(targetName + " was expected to fail since JUnit platform libraries " +
Assert.fail(targetName + " was expected to fail since Ant runtime libraries " +
"weren't included in the classpath of the forked JVM");
} catch (BuildException be) {
// expect a Error due to missing main class (which is part of Ant runtime libraries
@@ -313,6 +315,107 @@ public class JUnitLauncherTaskTest {
JUnit4SampleTest.class.getName(), "testBar"));
}
/**
* Tests execution of a test which is configured to execute only methods with a special tag
*/
@Test
public void testMethodWithIncludeTag() throws Exception {
final String target = "test-method-with-include-tag";
final Path tracker2 = setupTrackerProperty(target);
buildRule.executeTarget(target);
// verify only that specific method was run
Assert.assertTrue("testMethodIncludeTagisExecuted was expected to be run", wasTestRun(tracker2, JupiterSampleTest.class.getName(),
"testMethodIncludeTagisExecuted"));
Assert.assertFalse("testMethodIncludeTagisNotExecuted was expected NOT to be run", wasTestRun(tracker2, JupiterSampleTest.class.getName(),
"testMethodIncludeTagisNotExecuted"));
}
/**
* Tests execution of a test which is configured to execute only methods without special tags
*/
@Test
public void testMethodWithExcludeTag() throws Exception {
final String target = "test-method-with-exclude-tag";
final Path tracker2 = setupTrackerProperty(target);
buildRule.executeTarget(target);
// verify only that specific method was run
Assert.assertTrue("testMethodIncludeTagisExecuted was expected to be run", wasTestRun(tracker2, JupiterSampleTest.class.getName(),
"testMethodIncludeTagisExecuted"));
Assert.assertFalse("testMethodIncludeTagisNotExecuted was expected NOT to be run", wasTestRun(tracker2, JupiterSampleTest.class.getName(),
"testMethodIncludeTagisNotExecuted"));
}
/**
* Tests execution of a test which is configured to execute only methods with special tags, two classes specified
*/
@Test
public void testMethodWithTag2Classes() throws Exception {
final String target = "test-method-with-tag-2-classes";
final Path tracker1 = setupTrackerProperty(target + "1");
final Path tracker2 = setupTrackerProperty(target + "2");
buildRule.executeTarget(target);
// verify only that specific method was run
Assert.assertTrue("testMethodIncludeTagisExecuted was expected to be run", wasTestRun(tracker1, JupiterSampleTest.class.getName(),
"testMethodIncludeTagisExecuted"));
Assert.assertFalse("testMethodIncludeTagisNotExecuted was expected NOT to be run", wasTestRun(tracker1, JupiterSampleTest.class.getName(),
"testMethodIncludeTagisNotExecuted"));
Assert.assertTrue("testMethodIncludeTagisExecutedTagSampleTest was expected to be run", wasTestRun(tracker2, JupiterTagSampleTest.class.getName(),
"testMethodIncludeTagisExecutedTagSampleTest"));
Assert.assertFalse("testMethodIncludeTagisNotExecutedTagSampleTest was expected NOT to be run", wasTestRun(tracker2, JupiterTagSampleTest.class.getName(),
Assert.assertFalse("testMethodIncludeTagisNotExecutedTagSampleTest2 was expected NOT to be run", wasTestRun(tracker2, JupiterTagSampleTest.class.getName(),
* Tests execution of a test which is configured to execute only methods with special tags, two classes specified
*/
@Test
public void testMethodWithTagFileSet() throws Exception {
final String target = "test-method-with-tag-fileset";
final Path tracker = setupTrackerProperty(target);
buildRule.executeTarget(target);
// verify only that specific method was run
Assert.assertTrue("testMethodIncludeTagisExecuted was expected to be run", wasTestRun(tracker, JupiterSampleTest.class.getName(),
"testMethodIncludeTagisExecuted"));
Assert.assertFalse("testMethodIncludeTagisNotExecuted was expected NOT to be run", wasTestRun(tracker, JupiterSampleTest.class.getName(),
"testMethodIncludeTagisNotExecuted"));
Assert.assertTrue("testMethodIncludeTagisExecutedTagSampleTest was expected to be run", wasTestRun(tracker, JupiterTagSampleTest.class.getName(),
"testMethodIncludeTagisExecutedTagSampleTest"));
Assert.assertFalse("testMethodIncludeTagisNotExecutedTagSampleTest was expected NOT to be run", wasTestRun(tracker, JupiterTagSampleTest.class.getName(),
Assert.assertFalse("testMethodIncludeTagisNotExecutedTagSampleTest2 was expected NOT to be run", wasTestRun(tracker, JupiterTagSampleTest.class.getName(),
* Tests execution of a test which is configured to execute only methods with special tags, two classes specified
*/
@Test
public void testMethodWithTagFileSetFork() throws Exception {
final String target = "test-method-with-tag-fileset-fork";
final Path tracker = setupTrackerProperty(target);
buildRule.executeTarget(target);
Assert.assertTrue("testMethodIncludeTagisExecuted was expected to be run", wasTestRun(tracker, JupiterSampleTest.class.getName(),
"testMethodIncludeTagisExecuted"));
Assert.assertFalse("testMethodIncludeTagisNotExecuted was expected NOT to be run", wasTestRun(tracker, JupiterSampleTest.class.getName(),
"testMethodIncludeTagisNotExecuted"));
Assert.assertTrue("testMethodIncludeTagisExecutedTagSampleTest was expected to be run", wasTestRun(tracker, JupiterTagSampleTest.class.getName(),
"testMethodIncludeTagisExecutedTagSampleTest"));
Assert.assertFalse("testMethodIncludeTagisNotExecutedTagSampleTest was expected NOT to be run", wasTestRun(tracker, JupiterTagSampleTest.class.getName(),
Assert.assertFalse("testMethodIncludeTagisNotExecutedTagSampleTest2 was expected NOT to be run", wasTestRun(tracker, JupiterTagSampleTest.class.getName(),
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.