Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DC9F9200C27 for ; Sun, 26 Feb 2017 16:39:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id DB0FC160B6E; Sun, 26 Feb 2017 15:39:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B3EC7160B59 for ; Sun, 26 Feb 2017 16:39:04 +0100 (CET) Received: (qmail 52172 invoked by uid 500); 26 Feb 2017 15:39:03 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 52163 invoked by uid 99); 26 Feb 2017 15:39:03 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Feb 2017 15:39:03 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B2F0EDFDB1; Sun, 26 Feb 2017 15:39:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tibordigana@apache.org To: commits@maven.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: maven-surefire git commit: SUREFIRE_SYSPROP_DUPLICATES [Forced Update!] Date: Sun, 26 Feb 2017 15:39:03 +0000 (UTC) archived-at: Sun, 26 Feb 2017 15:39:07 -0000 Repository: maven-surefire Updated Branches: refs/heads/SUREFIRE_SYSPROP_DUPLICATES ef5b0f460 -> ef8e9e395 (forced update) SUREFIRE_SYSPROP_DUPLICATES Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/ef8e9e39 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/ef8e9e39 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/ef8e9e39 Branch: refs/heads/SUREFIRE_SYSPROP_DUPLICATES Commit: ef8e9e395db652436ed9dcf22818c8e04768ad58 Parents: 179abbf Author: Tibor17 Authored: Thu Feb 16 18:40:45 2017 +0100 Committer: Tibor17 Committed: Sun Feb 26 16:38:40 2017 +0100 ---------------------------------------------------------------------- surefire-integration-tests/pom.xml | 2 - .../its/CheckTestNgBeforeMethodFailureIT.java | 8 ++- .../surefire/its/CheckTestNgBeforeMethodIT.java | 6 ++- .../surefire/its/CheckTestNgExecuteErrorIT.java | 2 + .../its/CheckTestNgGroupThreadParallelIT.java | 6 ++- .../its/CheckTestNgListenerReporterIT.java | 41 +++++++++------ .../its/CheckTestNgPathWithSpacesIT.java | 6 ++- .../surefire/its/CheckTestNgReportTestIT.java | 11 ++-- .../surefire/its/CheckTestNgSuiteXmlIT.java | 4 +- .../its/CheckTestNgSuiteXmlSingleIT.java | 7 ++- .../surefire/its/CheckTestNgVersionsIT.java | 55 ++++++++++++++------ .../maven/surefire/its/TestMethodPatternIT.java | 37 +++++++++---- .../surefire/its/TestNgSuccessPercentageIT.java | 6 ++- .../maven/surefire/its/TestSingleMethodIT.java | 35 +++++++++---- .../maven/surefire/its/TwoTestCasesIT.java | 22 ++++++-- .../surefire/its/fixture/MavenLauncher.java | 47 ++++++++++++++--- .../surefire/its/fixture/MavenLauncherTest.java | 47 +++++++++++++++++ .../surefire/its/fixture/SurefireLauncher.java | 52 +++--------------- ...fire1135ImproveIgnoreMessageForTestNGIT.java | 2 +- .../Surefire376TestNgAfterSuiteFailureIT.java | 9 +++- .../Surefire377TestNgAndJUnitTogetherIT.java | 12 ++++- .../pom.xml | 2 +- .../resources/testng-afterSuiteFailure/pom.xml | 5 -- .../test/resources/testng-beforeMethod/pom.xml | 5 -- .../testng-beforeMethodFailure/pom.xml | 5 -- .../test/resources/testng-execute-error/pom.xml | 5 -- .../testng-group-thread-parallel/pom.xml | 5 -- .../resources/testng-junit-together/pom.xml | 5 -- .../resources/testng-listener-reporter/pom.xml | 5 -- .../testng-method-pattern-after/pom.xml | 6 --- .../testng-method-pattern-before/pom.xml | 6 --- .../resources/testng-method-pattern/pom.xml | 6 --- .../resources/testng-path with spaces/pom.xml | 5 -- .../src/test/resources/testng-simple/pom.xml | 1 - .../test/resources/testng-single-method/pom.xml | 6 --- .../resources/testng-succes-percentage/pom.xml | 5 -- .../src/test/resources/testng-suite-xml/pom.xml | 5 -- .../resources/testng-twoTestCaseSuite/pom.xml | 5 -- 38 files changed, 294 insertions(+), 205 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/pom.xml b/surefire-integration-tests/pom.xml index beab2be..d55d14b 100644 --- a/surefire-integration-tests/pom.xml +++ b/surefire-integration-tests/pom.xml @@ -35,7 +35,6 @@ UTF-8 false - 5.7 5 false @@ -105,7 +104,6 @@ ${project.version} - ${testng.version} ${maven.home} ${project.basedir}/../surefire-setup-integration-tests/target/private/it-settings.xml http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgBeforeMethodFailureIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgBeforeMethodFailureIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgBeforeMethodFailureIT.java index 9e9d688..440955c 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgBeforeMethodFailureIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgBeforeMethodFailureIT.java @@ -36,6 +36,12 @@ public class CheckTestNgBeforeMethodFailureIT public void TestNgBeforeMethodFailure() throws Exception { - unpack( "/testng-beforeMethodFailure" ).maven().withFailure().executeTest().assertTestSuiteResults( 2, 0, 1, 1 ); + unpack( "/testng-beforeMethodFailure" ) + .maven() + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .withFailure() + .executeTest() + .assertTestSuiteResults( 2, 0, 1, 1 ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgBeforeMethodIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgBeforeMethodIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgBeforeMethodIT.java index ab25279..d96fefc 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgBeforeMethodIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgBeforeMethodIT.java @@ -35,6 +35,10 @@ public class CheckTestNgBeforeMethodIT public void TestNgBeforeMethod() throws Exception { - unpack( "/testng-beforeMethod" ).executeTest().verifyErrorFree( 1 ); + unpack( "/testng-beforeMethod" ) + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .executeTest() + .verifyErrorFree( 1 ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgExecuteErrorIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgExecuteErrorIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgExecuteErrorIT.java index 2d03900..24ee3e6 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgExecuteErrorIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgExecuteErrorIT.java @@ -44,6 +44,8 @@ public class CheckTestNgExecuteErrorIT { OutputValidator outputValidator = unpack( "/testng-execute-error" ) .maven() + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) .showErrorStackTraces() .withFailure() .executeTest(); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgGroupThreadParallelIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgGroupThreadParallelIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgGroupThreadParallelIT.java index 36ef57e..f56e2e4 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgGroupThreadParallelIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgGroupThreadParallelIT.java @@ -34,6 +34,10 @@ public class CheckTestNgGroupThreadParallelIT @Test public void TestNgGroupThreadParallel() { - unpack( "testng-group-thread-parallel" ).executeTest().verifyErrorFree( 3 ); + unpack( "testng-group-thread-parallel" ) + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .executeTest() + .verifyErrorFree( 3 ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgListenerReporterIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgListenerReporterIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgListenerReporterIT.java index e028215..9c223ea 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgListenerReporterIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgListenerReporterIT.java @@ -21,6 +21,7 @@ package org.apache.maven.surefire.its; import org.apache.commons.lang3.JavaVersion; import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.apache.maven.surefire.its.fixture.SurefireLauncher; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -48,32 +49,32 @@ public class CheckTestNgListenerReporterIT public static Collection data() { return Arrays.asList(new Object[][] { - { "5.6", JAVA_1_5 }, // First TestNG version with reporter support - { "5.7", JAVA_1_5 }, // default version from pom of the test case - { "5.10", JAVA_1_5 }, - { "5.13", JAVA_1_5 }, // "reporterslist" param becomes String instead of List + { "5.6", "jdk15", JAVA_1_5 }, // First TestNG version with reporter support + { "5.7", "jdk15", JAVA_1_5 }, // default version from pom of the test case + { "5.10", "jdk15", JAVA_1_5 }, + { "5.13", null, JAVA_1_5 }, // "reporterslist" param becomes String instead of List // "listener" param becomes String instead of List // configure(Map) in 5.14.1 and 5.14.2 is transforming List into a String with a space as separator. // Then configure(CommandLineArgs) splits this String into a List with , or ; as separator => fail. // If we used configure(CommandLineArgs), we would not have the problem with white spaces. - //{ "5.14.1", "1.5" }, // "listener" param becomes List instead of String + //{ "5.14.1", null, "1.5" }, // "listener" param becomes List instead of String // Fails: Issue with 5.14.1 and 5.14.2 => join with , split with "," // TODO will work with "configure(CommandLineArgs)" - //{ "5.14.2", "1.5" }, // ReporterConfig is not available + //{ "5.14.2", null, "1.5" }, // ReporterConfig is not available - //{ "5.14.3", "1.5" }, // TestNG uses "reporter" instead of "reporterslist" + //{ "5.14.3", null, "1.5" }, // TestNG uses "reporter" instead of "reporterslist" // Both String or List are possible for "listener" // Fails: not able to test due to system dependency org.testng:guice missed the path and use to break CI // ClassNotFoundException: com.beust.jcommander.ParameterException - //{ "5.14.4", "1.5" }, { "5.14.5", "1.5" }, // Fails: not able to test due to system dependency org.testng:guice missed the path and use to break CI + //{ "5.14.4", null, "1.5" }, { "5.14.5", null, "1.5" }, // Fails: not able to test due to system dependency org.testng:guice missed the path and use to break CI // ClassNotFoundException: com.beust.jcommander.ParameterException - { "5.14.6", JAVA_1_5 }, // Usage of org.testng:guice removed - { "5.14.9", JAVA_1_5 }, // Latest 5.14.x TestNG version - { "6.0", JAVA_1_5 }, - { "6.9.9", JAVA_1_7 } // Currently latest TestNG version + { "5.14.6", null, JAVA_1_5 }, // Usage of org.testng:guice removed + { "5.14.9", null, JAVA_1_5 }, // Latest 5.14.x TestNG version + { "6.0", null, JAVA_1_5 }, + { "6.9.9", null, JAVA_1_7 } // Currently latest TestNG version }); } @@ -81,16 +82,24 @@ public class CheckTestNgListenerReporterIT public String version; @Parameter(1) + public String classifier; + + @Parameter(2) public JavaVersion javaVersion; @Test public void testNgListenerReporter() { - assumeJavaVersion( javaVersion ); - unpack( "testng-listener-reporter", "_" + version ) - .resetInitialGoals( version ) - .executeTest() + final SurefireLauncher launcher = unpack( "testng-listener-reporter", "_" + version ) + .sysProp( "testNgVersion", version ); + + if ( classifier != null ) + { + launcher.sysProp( "testNgClassifier", "jdk15" ); + } + + launcher.executeTest() .verifyErrorFree( 1 ) .getTargetFile( "resultlistener-output.txt" ).assertFileExists() .getTargetFile( "suitelistener-output.txt" ).assertFileExists() http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgPathWithSpacesIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgPathWithSpacesIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgPathWithSpacesIT.java index bf713d3..aa77d1b 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgPathWithSpacesIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgPathWithSpacesIT.java @@ -33,6 +33,10 @@ public class CheckTestNgPathWithSpacesIT @Test public void TestWithSpaces() { - unpack( "testng-path with spaces" ).executeTest().verifyErrorFree( 1 ); + unpack( "testng-path with spaces" ) + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .executeTest() + .verifyErrorFree( 1 ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java index 1bad84b..fb534b1 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java @@ -38,9 +38,14 @@ public class CheckTestNgReportTestIT public void testNgReport() throws Exception { - final OutputValidator outputValidator = - unpack( "/testng-simple" ).addSurefireReportGoal().executeCurrentGoals().verifyErrorFree( 3 ); - outputValidator.getSiteFile( "surefire-report.html" ).assertFileExists(); + unpack( "/testng-simple" ) + .sysProp( "testNgVersion", "5.10" ) + .sysProp( "testNgClassifier", "jdk15" ) + .addSurefireReportGoal() + .executeCurrentGoals() + .verifyErrorFree( 3 ) + .getSiteFile( "surefire-report.html" ) + .assertFileExists(); } @Test http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java index e8cef5f..2e56dc9 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java @@ -53,6 +53,8 @@ public class CheckTestNgSuiteXmlIT private SurefireLauncher unpack() { - return unpack( "testng-suite-xml" ); + return unpack( "testng-suite-xml" ) + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java index 903c14a..e2b63b6 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java @@ -33,7 +33,12 @@ public class CheckTestNgSuiteXmlSingleIT @Test public void TestNgSuite() { - unpack( "/testng-twoTestCaseSuite" ).setTestToRun( "TestNGTestTwo" ).executeTest().verifyErrorFree( 1 ); + unpack( "/testng-twoTestCaseSuite" ) + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .setTestToRun( "TestNGTestTwo" ) + .executeTest() + .verifyErrorFree( 1 ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgVersionsIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgVersionsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgVersionsIT.java index 49c0be7..6d2bbfa 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgVersionsIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgVersionsIT.java @@ -25,6 +25,7 @@ import org.apache.maven.plugins.surefire.report.ReportTestSuite; import org.apache.maven.surefire.its.fixture.HelperAssertions; import org.apache.maven.surefire.its.fixture.OutputValidator; import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.apache.maven.surefire.its.fixture.SurefireLauncher; import org.junit.Ignore; import org.junit.Test; @@ -46,73 +47,73 @@ public class CheckTestNgVersionsIT @Test public void test47() throws Exception { - runTestNgTest( "4.7" ); + runTestNgTest( "4.7", "jdk15" ); } @Test @Ignore( "5.0 and 5.0.1 jars on central are malformed SUREFIRE-375 + MAVENUPLOAD-1024" ) public void XXXtest50() throws Exception { - runTestNgTest( "5.0" ); + runTestNgTest( "5.0", "jdk15" ); } @Test @Ignore( "5.0 and 5.0.1 jars on central are malformed SUREFIRE-375 + MAVENUPLOAD-1024" ) public void XXXtest501() throws Exception { - runTestNgTest( "5.0.1" ); + runTestNgTest( "5.0.1", "jdk15" ); } @Test public void test502() throws Exception { - runTestNgTest( "5.0.2" ); + runTestNgTest( "5.0.2", "jdk15" ); } @Test public void test51() throws Exception { - runTestNgTest( "5.1" ); + runTestNgTest( "5.1", "jdk15" ); } @Test public void test55() throws Exception { - runTestNgTest( "5.5" ); + runTestNgTest( "5.5", "jdk15" ); } @Test public void test56() throws Exception { - runTestNgTest( "5.6" ); + runTestNgTest( "5.6", "jdk15" ); } @Test public void test57() throws Exception { - runTestNgTest( "5.7" ); + runTestNgTest( "5.7", "jdk15" ); } @Test public void test58() throws Exception { - runTestNgTest( "5.8" ); + runTestNgTest( "5.8", "jdk15" ); } @Test public void test59() throws Exception { - runTestNgTest( "5.9" ); + runTestNgTest( "5.9", "jdk15" ); } @Test public void test510() throws Exception { - runTestNgTest( "5.10" ); + runTestNgTest( "5.10", "jdk15" ); } @Test public void test511() throws Exception { - runTestNgTest( "5.11" ); + runTestNgTest( "5.11", "jdk15" ); } @Test public void test512() @@ -154,7 +155,7 @@ public class CheckTestNgVersionsIT @Test public void test60() throws Exception { - runTestNgTest( "6.0", false ); + runTestNgTest( "6.0" ); } @Test public void test685() @@ -166,20 +167,40 @@ public class CheckTestNgVersionsIT private void runTestNgTestWithRunOrder( String version ) throws Exception { - runTestNgTest( version, true ); + runTestNgTest( version, null, true ); } private void runTestNgTest( String version ) - throws Exception + throws Exception { - runTestNgTest( version, false ); + runTestNgTest( version, null, false ); } private void runTestNgTest( String version, boolean validateRunOrder ) + throws Exception + { + runTestNgTest( version, null, validateRunOrder ); + } + + private void runTestNgTest( String version, String classifier ) + throws Exception + { + runTestNgTest( version, classifier, false ); + } + + private void runTestNgTest( String version, String classifier, boolean validateRunOrder ) throws Exception { + final SurefireLauncher launcher = unpack( "testng-simple" ) + .sysProp( "testNgVersion", version ); + + if ( classifier != null ) + { + launcher.sysProp( "testNgClassifier", classifier ); + } + + final OutputValidator outputValidator = launcher.executeTest(); - final OutputValidator outputValidator = unpack( "testng-simple" ).resetInitialGoals( version ).executeTest(); outputValidator.verifyErrorFreeLog().assertTestSuiteResults( 3, 0, 0, 0 ); if ( validateRunOrder ) http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestMethodPatternIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestMethodPatternIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestMethodPatternIT.java index b057a34..447d8f1 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestMethodPatternIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestMethodPatternIT.java @@ -24,6 +24,11 @@ import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; import org.apache.maven.surefire.its.fixture.SurefireLauncher; import org.junit.Test; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + /** * Test project using -Dtest=mtClass#myMethod * @@ -34,9 +39,13 @@ public class TestMethodPatternIT { private static final String RUNNING_WITH_PROVIDER47 = "parallel='none', perCoreThreadCount=true, threadCount=0"; - public OutputValidator runMethodPattern( String projectName, String... goals ) + public OutputValidator runMethodPattern( String projectName, Map props, String... goals ) { SurefireLauncher launcher = unpack( projectName ); + for ( Entry entry : props.entrySet() ) + { + launcher.sysProp( entry.getKey(), entry.getValue() ); + } for ( String goal : goals ) { launcher.addGoal( goal ); @@ -49,19 +58,19 @@ public class TestMethodPatternIT @Test public void testJUnit44() { - runMethodPattern( "junit44-method-pattern" ); + runMethodPattern( "junit44-method-pattern", Collections.emptyMap() ); } @Test public void testJUnit48Provider4() { - runMethodPattern( "junit48-method-pattern", "-P surefire-junit4" ); + runMethodPattern( "junit48-method-pattern", Collections.emptyMap(), "-P surefire-junit4" ); } @Test public void testJUnit48Provider47() { - runMethodPattern( "junit48-method-pattern", "-P surefire-junit47" ) + runMethodPattern( "junit48-method-pattern", Collections.emptyMap(), "-P surefire-junit47" ) .verifyTextInLog( RUNNING_WITH_PROVIDER47 ); } @@ -71,28 +80,36 @@ public class TestMethodPatternIT unpack( "junit48-method-pattern" ) .addGoal( "-Dgroups=junit4.SampleCategory" ) .executeTest() - .assertTestSuiteResults( 1, 0, 0, 0 );; + .assertTestSuiteResults( 1, 0, 0, 0 ); } @Test public void testTestNgMethodBefore() { - runMethodPattern( "testng-method-pattern-before" ); + Map props = new HashMap(); + props.put( "testNgVersion", "5.7" ); + props.put( "testNgClassifier", "jdk15" ); + runMethodPattern( "testng-method-pattern-before", props ); } @Test public void testTestNGMethodPattern() { - runMethodPattern( "/testng-method-pattern" ); + Map props = new HashMap(); + props.put( "testNgVersion", "5.7" ); + props.put( "testNgClassifier", "jdk15" ); + runMethodPattern( "/testng-method-pattern", props ); } @Test public void testMethodPatternAfter() { unpack( "testng-method-pattern-after" ) - .executeTest() - .verifyErrorFree( 2 ) - .verifyTextInLog( "Called tearDown" ); + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .executeTest() + .verifyErrorFree( 2 ) + .verifyTextInLog( "Called tearDown" ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgSuccessPercentageIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgSuccessPercentageIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgSuccessPercentageIT.java index a9f26e7..3b12e03 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgSuccessPercentageIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestNgSuccessPercentageIT.java @@ -34,7 +34,11 @@ public class TestNgSuccessPercentageIT extends SurefireJUnit4IntegrationTestCase @Test public void testPassesWhenFailuresLessThanSuccessPercentage() { - OutputValidator validator = unpack("/testng-succes-percentage").mavenTestFailureIgnore( true ).executeTest(); + OutputValidator validator = unpack("/testng-succes-percentage") + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .mavenTestFailureIgnore( true ) + .executeTest(); validator.assertTestSuiteResults(8, 0, 1, 0); } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestSingleMethodIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestSingleMethodIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestSingleMethodIT.java index 9cc14fb..53eddce 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestSingleMethodIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestSingleMethodIT.java @@ -24,6 +24,10 @@ import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; import org.apache.maven.surefire.its.fixture.SurefireLauncher; import org.junit.Test; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + /** * Test project using -Dtest=mtClass#myMethod * @@ -34,10 +38,15 @@ public class TestSingleMethodIT { private static final String RUNNING_WITH_PROVIDER47 = "parallel='none', perCoreThreadCount=true, threadCount=0"; - public OutputValidator singleMethod( String projectName, String testToRun, String... goals ) + public OutputValidator singleMethod( String projectName, Map props, String testToRun, + String... goals ) throws Exception { SurefireLauncher launcher = unpack( projectName ); + for ( Map.Entry entry : props.entrySet() ) + { + launcher.sysProp( entry.getKey(), entry.getValue() ); + } for ( String goal : goals ) { launcher.addGoal( goal ); @@ -56,21 +65,21 @@ public class TestSingleMethodIT public void testJunit44() throws Exception { - singleMethod( "junit44-single-method", null ); + singleMethod( "junit44-single-method", Collections.emptyMap(), null ); } @Test public void testJunit48Provider4() throws Exception { - singleMethod( "junit48-single-method", null, "-P surefire-junit4" ); + singleMethod( "junit48-single-method", Collections.emptyMap(), null, "-P surefire-junit4" ); } @Test public void testJunit48Provider47() throws Exception { - singleMethod( "junit48-single-method", null, "-P surefire-junit47" ) + singleMethod( "junit48-single-method", Collections.emptyMap(), null, "-P surefire-junit47" ) .verifyTextInLog( RUNNING_WITH_PROVIDER47 ); } @@ -90,35 +99,43 @@ public class TestSingleMethodIT public void testTestNg() throws Exception { - singleMethod( "testng-single-method", null ); + Map props = new HashMap(); + props.put( "testNgVersion", "5.7" ); + props.put( "testNgClassifier", "jdk15" ); + singleMethod( "testng-single-method", props, null ); } @Test public void testTestNg5149() throws Exception { - singleMethod( "/testng-single-method-5-14-9", null ); + singleMethod( "/testng-single-method-5-14-9", Collections.emptyMap(), null ); } @Test public void fullyQualifiedJunit48Provider4() throws Exception { - singleMethod( "junit48-single-method", "junit4.BasicTest#testSuccessOne", "-P surefire-junit4" ); + singleMethod( "junit48-single-method", Collections.emptyMap(), + "junit4.BasicTest#testSuccessOne", "-P surefire-junit4" ); } @Test public void fullyQualifiedJunit48Provider47() throws Exception { - singleMethod("junit48-single-method", "junit4.BasicTest#testSuccessOne", "-P surefire-junit47"); + singleMethod("junit48-single-method", Collections.emptyMap(), + "junit4.BasicTest#testSuccessOne", "-P surefire-junit47"); } @Test public void fullyQualifiedTestNg() throws Exception { - singleMethod( "testng-single-method", "testng.BasicTest#testSuccessOne" ); + Map props = new HashMap(); + props.put( "testNgVersion", "5.7" ); + props.put( "testNgClassifier", "jdk15" ); + singleMethod( "testng-single-method", props, "testng.BasicTest#testSuccessOne" ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TwoTestCasesIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TwoTestCasesIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TwoTestCasesIT.java index eca2fb0..c218769 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TwoTestCasesIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TwoTestCasesIT.java @@ -41,7 +41,12 @@ public class TwoTestCasesIT public void testTwoTestCases() throws Exception { - unpack( "junit-twoTestCases" ).executeTest().verifyErrorFreeLog().assertTestSuiteResults( 2, 0, 0, 0 ); + unpack( "junit-twoTestCases" ) + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .executeTest() + .verifyErrorFreeLog() + .assertTestSuiteResults( 2, 0, 0, 0 ); } /** @@ -51,7 +56,10 @@ public class TwoTestCasesIT public void testTwoTestCaseSuite() throws Exception { - final OutputValidator outputValidator = unpack( "junit-twoTestCaseSuite" ).executeTest(); + final OutputValidator outputValidator = unpack( "junit-twoTestCaseSuite" ) + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .executeTest(); outputValidator.verifyErrorFreeLog().assertTestSuiteResults( 2, 0, 0, 0 ); List reports = HelperAssertions.extractReports( outputValidator.getBaseDir() ); Set classNames = extractClassNames( reports ); @@ -85,7 +93,10 @@ public class TwoTestCasesIT public void testJunit4Suite() throws Exception { - final OutputValidator outputValidator = unpack( "junit4-twoTestCaseSuite" ).executeTest(); + final OutputValidator outputValidator = unpack( "junit4-twoTestCaseSuite" ) + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .executeTest(); outputValidator.verifyErrorFreeLog().assertTestSuiteResults( 2, 0, 0, 0 ); List reports = @@ -102,7 +113,10 @@ public class TwoTestCasesIT public void testTestNGSuite() throws Exception { - final OutputValidator outputValidator = unpack( "testng-twoTestCaseSuite" ).executeTest(); + final OutputValidator outputValidator = unpack( "testng-twoTestCaseSuite" ) + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .executeTest(); outputValidator.verifyErrorFreeLog().assertTestSuiteResults( 2, 0, 0, 0 ); List reports = HelperAssertions.extractReports( outputValidator.getBaseDir() ); Set classNames = extractClassNames( reports ); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java index 1198fcb..e7aff2e 100755 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java @@ -19,18 +19,22 @@ package org.apache.maven.surefire.its.fixture; * under the License. */ +import org.apache.commons.lang.text.StrSubstitutor; +import org.apache.maven.it.VerificationException; +import org.apache.maven.it.Verifier; +import org.apache.maven.it.util.ResourceExtractor; +import org.apache.maven.shared.utils.io.FileUtils; + import java.io.File; import java.io.IOException; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.ListIterator; import java.util.Map; -import org.apache.commons.lang.text.StrSubstitutor; -import org.apache.maven.it.VerificationException; -import org.apache.maven.it.Verifier; -import org.apache.maven.it.util.ResourceExtractor; -import org.apache.maven.shared.utils.io.FileUtils; + +import static java.util.Collections.unmodifiableList; /** * Encapsulate all needed features to start a maven run @@ -203,13 +207,13 @@ public class MavenLauncher public MavenLauncher skipClean() { - goals.add( "-Dclean.skip=true" ); + writeGoal( "-Dclean.skip=true" ); return this; } public MavenLauncher addGoal( String goal ) { - goals.add( goal ); + writeGoal( goal ); return this; } @@ -223,6 +227,35 @@ public class MavenLauncher return conditionalExec( "test" ); } + List getGoals() + { + return unmodifiableList( goals ); + } + + private void writeGoal( String newGoal ) + { + if ( newGoal != null && newGoal.startsWith( "-D" ) ) + { + final String sysPropKey = + newGoal.contains( "=" ) ? newGoal.substring( 0, newGoal.indexOf( '=' ) ) : newGoal; + + final String sysPropStarter = sysPropKey + "="; + + for ( ListIterator it = goals.listIterator(); it.hasNext(); ) + { + String goal = it.next(); + if ( goal.equals( sysPropKey ) || goal.startsWith( sysPropStarter ) ) + { + System.out.printf( "[WARNING] System property already exists '%s'. Overriding to '%s'.\n", + goal, newGoal ); + it.set( newGoal ); + return; + } + } + } + goals.add( newGoal ); + } + private OutputValidator conditionalExec(String goal) { OutputValidator verify; http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncherTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncherTest.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncherTest.java new file mode 100644 index 0000000..4a638b6 --- /dev/null +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncherTest.java @@ -0,0 +1,47 @@ +package org.apache.maven.surefire.its.fixture; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.junit.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.hamcrest.CoreMatchers.hasItems; + +/** + * @author Tibor Digana (tibor17) + * @since 2.19.2 + */ +public class MavenLauncherTest +{ + @Test + public void shouldNotDuplicateSystemProperties() + { + MavenLauncher launcher = new MavenLauncher( getClass(), "", "" ) + .addGoal( "-DskipTests" ) + .addGoal( "-Dx=a" ) + .addGoal( "-DskipTests" ) + .addGoal( "-Dx=b" ); + + assertThat( launcher.getGoals(), hasItems( "-Dx=b", "-DskipTests" ) ); + + assertThat( launcher.getGoals().size(), is( 2 ) ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java index 23a09b0..4cb162d 100755 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java @@ -19,15 +19,13 @@ package org.apache.maven.surefire.its.fixture; * under the License. */ +import org.apache.maven.it.VerificationException; + import java.io.File; import java.io.IOException; -import java.util.ArrayList; import java.util.List; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.it.VerificationException; + +import static java.util.Collections.singletonList; /** * Encapsulate all needed features to start a surefire run @@ -37,13 +35,10 @@ import org.apache.maven.it.VerificationException; * * @author Kristian Rosenvold - */ -public class SurefireLauncher +public final class SurefireLauncher { - private final MavenLauncher mavenLauncher; - private final String testNgVersion = System.getProperty( "testng.version" ); - private final String surefireVersion = System.getProperty( "surefire.version" ); public SurefireLauncher( MavenLauncher mavenLauncher ) @@ -65,7 +60,7 @@ public class SurefireLauncher public void reset() { mavenLauncher.reset(); - for ( String s : getInitialGoals( testNgVersion ) ) + for ( String s : getInitialGoals() ) { mavenLauncher.addGoal( s ); } @@ -122,40 +117,9 @@ public class SurefireLauncher return this; } - private List getInitialGoals( String testNgVersion ) + private List getInitialGoals() { - List goals1 = new ArrayList(); - goals1.add( "-Dsurefire.version=" + surefireVersion ); - - if ( this.testNgVersion != null ) - { - goals1.add( "-DtestNgVersion=" + testNgVersion ); - - ArtifactVersion v = new DefaultArtifactVersion( testNgVersion ); - try - { - if ( VersionRange.createFromVersionSpec( "(,5.12.1)" ).containsVersion( v ) ) - { - goals1.add( "-DtestNgClassifier=jdk15" ); - } - } - catch ( InvalidVersionSpecificationException e ) - { - throw new RuntimeException( e.getMessage(), e ); - } - } - - return goals1; - } - - public SurefireLauncher resetInitialGoals( String testNgVersion ) - { - mavenLauncher.resetGoals(); - for ( String s : getInitialGoals( testNgVersion ) ) - { - mavenLauncher.addGoal( s ); - } - return this; + return singletonList( "-Dsurefire.version=" + surefireVersion ); } public SurefireLauncher showErrorStackTraces() http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1135ImproveIgnoreMessageForTestNGIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1135ImproveIgnoreMessageForTestNGIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1135ImproveIgnoreMessageForTestNGIT.java index 131244f..7bd12c8 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1135ImproveIgnoreMessageForTestNGIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1135ImproveIgnoreMessageForTestNGIT.java @@ -1 +1 @@ -package org.apache.maven.surefire.its.jiras; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import static org.apache.maven.shared.utils.xml.Xpp3DomBuilder.build; import static org.hamcrest.Matchers.*; import static org.junit.Assert. assertThat; import java.io.FileNotFoundException; import org.apache.maven.shared.utils.xml.Xpp3Dom; import org.apache.maven.surefire.its.fixture.OutputValidator; import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; import org.junit.Test; /** * Test surefire-report on TestNG test * * @author Michal Bocek */ public class Surefire1135ImproveIgnoreMessageForTestNGIT extends SurefireJUnit4IntegrationTestCase { private enum ResultType { SKIPPED( "skipped" ), FAILURE( "failure" ); private final String type; ResultType(String type) { this.type = type; } public String getType() { return type; } } @Test public void testNgReport688() throws Exception { testNgReport( "6.8.8", ResultType.SKIPPED, "Skip test", /*"org.testng.SkipException"* / null, /*"SkipExceptionReportTest.java:30"*/ null ); } @Test public void testNgReport57() throws Exception { testNgReport( "5.7", ResultType.SKIPPED, "Skip test", /*"org.testng.SkipException"*/ null, /*"SkipExceptionReportTest.java:30"*/ null ); } private void testNgReport( String version, ResultType resultType, String message, String type, String stackTrace ) throws Exception { OutputValidator outputValidator = runTest( version, resultType, "/surefire-1135-improve-ignore-message-for-testng" ); Xpp3Dom[] children = readTests( outputValidator, "testng.SkipExceptionReportTest" ); assertThat( "Report should contains only one test case", children.length, is( 1 ) ); Xpp3Dom test = children[0]; assertThat( "Not expected classname", test.getAttribute( "cla ssname" ), is( "testng.SkipExceptionReportTest" ) ); assertThat( "Not expected test name", test.getAttribute( "name" ), is( "testSkipException" ) ); children = test.getChildren( resultType.getType() ); assertThat( "Test should contains only one " + resultType.getType() + " element", children, is( arrayWithSize( 1 ) ) ); Xpp3Dom result = children[0]; if ( message == null ) { assertThat( "Subelement message attribute must be null", result.getAttribute( "message" ), is( nullValue() ) ); } else { assertThat( "Subelement should contains message attribute", result.getAttribute( "message" ), is( message ) ); } if ( type == null ) { assertThat( "Subelement type attribute must be null", result.getAttribute( "type" ), is( nullValue() ) ); } else { assertThat( "Subelement should contains type attribute", result.getAttribute( "type" ), is( type ) ); } if ( stackTrace == null ) { assertThat( "Element body must be null", result.getValue() , isEmptyOrNullString() ); } else { assertThat( "Element body must contains", result.getValue(), containsString( stackTrace ) ); } } private OutputValidator runTest( String version, ResultType resultType, String resource ) { int skipped = ResultType.SKIPPED.equals( resultType ) ? 1 : 0; int failure = ResultType.FAILURE.equals( resultType ) ? 1 : 0; return unpack( resource ) .resetInitialGoals( version ) .addSurefireReportGoal() .executeCurrentGoals() .assertTestSuiteResults( 1, 0, failure, skipped ); } private static Xpp3Dom[] readTests( OutputV alidator validator, String className ) throws FileNotFoundException { Xpp3Dom testResult = build( validator.getSurefireReportsXmlFile( "TEST-" + className + ".xml" ).getFileInputStream(), "UTF-8" ); return testResult.getChildren( "testcase" ); } } \ No newline at end of file +package org.apache.maven.surefire.its.jiras; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import static org.apache.maven.shared.utils.xml.Xpp3DomBuilder.build; import static org.hamcrest.Matchers.*; import static org.junit.Assert. assertThat; import java.io.FileNotFoundException; import org.apache.maven.shared.utils.xml.Xpp3Dom; import org.apache.maven.surefire.its.fixture.OutputValidator; import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; import org.apache.maven.surefire.its.fixture.SurefireLauncher; import org.junit.Test; /** * Test surefire-report on TestNG test * * @author Michal Bocek */ public class Surefire1135ImproveIgnoreMessageForTestNGIT extends SurefireJUnit4IntegrationTestCase { private enum ResultType { SKIPPED( "skipped" ), FAILURE( "failure" ); private final String type; ResultType(String type) { this.type = type; } public String getType() { return type; } } @Test public void testNgReport688() throws Exception { testNgReport( "6.8.8", null, ResultType.SKIPPED, "Skip te st", /*"org.testng.SkipException"*/ null, /*"SkipExceptionReportTest.java:30"*/ null ); } @Test public void testNgReport57() throws Exception { testNgReport( "5.7", "jdk15", ResultType.SKIPPED, "Skip test", /*"org.testng.SkipException"*/ null, /*"SkipExceptionReportTest.java:30"*/ null ); } private void testNgReport( String version, String classifier, ResultType resultType, String message, String type, String stackTrace ) throws Exception { OutputValidator outputValidator = runTest( version, classifier, resultType, "/surefire-1135-improve-ignore-message-for-testng" ); Xpp3Dom[] children = readTests( outputValidator, "testng.SkipExceptionReportTest" ); assertThat( "Report should contains only one test c ase", children.length, is( 1 ) ); Xpp3Dom test = children[0]; assertThat( "Not expected classname", test.getAttribute( "classname" ), is( "testng.SkipExceptionReportTest" ) ); assertThat( "Not expected test name", test.getAttribute( "name" ), is( "testSkipException" ) ); children = test.getChildren( resultType.getType() ); assertThat( "Test should contains only one " + resultType.getType() + " element", children, is( arrayWithSize( 1 ) ) ); Xpp3Dom result = children[0]; if ( message == null ) { assertThat( "Subelement message attribute must be null", result.getAttribute( "message" ), is( nullValue() ) ); } else { assertThat( "Subelement should contains message attribute", result.getAttribute( "message" ), is( message ) ); } if ( type == null ) { assertThat( "Subelement type attribute must be null", result.getAttribute( "type" ), is( nullValue() ) ); } else { assertThat( "Subelement should contains type attribute", result.getAttribute( "type" ), is( type ) ); } if ( stackTrace == null ) { assertThat( "Element body must be null", result.getValue() , isEmptyOrNullString() ); } else { assertThat( "Element body must contains", result.getValue(), containsString( stackTrace ) ); } } private OutputValidator runTest( String version, String classifier, ResultType resultType, String resource ) { int skipped = ResultType.SKIPPED.equals( resultType ) ? 1 : 0; int failure = ResultType.FAILURE.equals( resultType ) ? 1 : 0; SurefireLauncher launcher = unpack( resource ).sysProp( "testNgVersion", version ); if ( classifier != null ) { l auncher.sysProp( "testNgClassifier", classifier ); } return launcher.addSurefireReportGoal() .executeCurrentGoals() .assertTestSuiteResults( 1, 0, failure, skipped ); } private static Xpp3Dom[] readTests( OutputValidator validator, String className ) throws FileNotFoundException { Xpp3Dom testResult = build( validator.getSurefireReportsXmlFile( "TEST-" + className + ".xml" ).getFileInputStream(), "UTF-8" ); return testResult.getChildren( "testcase" ); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire376TestNgAfterSuiteFailureIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire376TestNgAfterSuiteFailureIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire376TestNgAfterSuiteFailureIT.java index ee85b2b..ebc0e1e 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire376TestNgAfterSuiteFailureIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire376TestNgAfterSuiteFailureIT.java @@ -33,7 +33,12 @@ public class Surefire376TestNgAfterSuiteFailureIT @Test public void testAfterSuiteFailure() { - unpack( "/testng-afterSuiteFailure" ).maven().withFailure().executeTest(). - assertTestSuiteResults( 2, 0, 1, 0 ); + unpack( "/testng-afterSuiteFailure" ) + .maven() + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .withFailure() + .executeTest() + .assertTestSuiteResults( 2, 0, 1, 0 ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire377TestNgAndJUnitTogetherIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire377TestNgAndJUnitTogetherIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire377TestNgAndJUnitTogetherIT.java index 2fe4ff0..a29d030 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire377TestNgAndJUnitTogetherIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire377TestNgAndJUnitTogetherIT.java @@ -33,12 +33,20 @@ public class Surefire377TestNgAndJUnitTogetherIT @Test public void testTestNgAndJUnitTogether() { - executeErrorFreeTest( "/testng-junit-together", 2 ); + unpack( "/testng-junit-together" ) + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .executeTest() + .verifyErrorFree( 2 ); } @Test public void testTestNgAndJUnit4Together() { - executeErrorFreeTest( "/testng-junit4-together", 3 ); + unpack( "/testng-junit4-together" ) + .sysProp( "testNgVersion", "5.7" ) + .sysProp( "testNgClassifier", "jdk15" ) + .executeTest() + .verifyErrorFree( 3 ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/surefire-1135-improve-ignore-message-for-testng/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-1135-improve-ignore-message-for-testng/pom.xml b/surefire-integration-tests/src/test/resources/surefire-1135-improve-ignore-message-for-testng/pom.xml index 4a88e6d..3f71089 100644 --- a/surefire-integration-tests/src/test/resources/surefire-1135-improve-ignore-message-for-testng/pom.xml +++ b/surefire-integration-tests/src/test/resources/surefire-1135-improve-ignore-message-for-testng/pom.xml @@ -1 +1 @@ - 4.0.0 org.apache.maven.plugins.surefire surefire-1135-improve-ignore-message-for-testng 1.0-SNAPSHOT Surefire 1135 testng-old testNgClassifier org.testng testng ${testNgVersion} ${testNgClassifier} testng-new !testNgClassifier org.testng testng ${testNgVersion} 5.7 jdk15 org.apache.maven.plugins maven-surefire-plugin ${surefire.version} SkipExceptionReportTest org.apache.maven.plugins maven-compiler-plugin 1.5 1.5 \ No newline at end of file + 4.0.0 org.apache.maven.plugins.surefire surefire-1135-improve-ignore-message-for-testng 1.0-SNAPSHOT Surefire 1135 testng-old testNgClassifier org.testng testng ${testNgVersion} ${testNgClassifier} testng-new !testNgClassifier org.testng testng ${testNgVersion} org.apache.maven.plugins maven-surefire-plugin ${surefire.version} SkipExceptionReportTest org.apache.maven.plugins maven-compiler-plugin 1.5 1.5 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-afterSuiteFailure/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-afterSuiteFailure/pom.xml b/surefire-integration-tests/src/test/resources/testng-afterSuiteFailure/pom.xml index 21f1bf0..f738827 100644 --- a/surefire-integration-tests/src/test/resources/testng-afterSuiteFailure/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-afterSuiteFailure/pom.xml @@ -58,11 +58,6 @@ - - 5.7 - jdk15 - - http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-beforeMethod/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-beforeMethod/pom.xml b/surefire-integration-tests/src/test/resources/testng-beforeMethod/pom.xml index 4d2621c..af46b6b 100644 --- a/surefire-integration-tests/src/test/resources/testng-beforeMethod/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-beforeMethod/pom.xml @@ -58,11 +58,6 @@ - - 5.7 - jdk15 - - http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-beforeMethodFailure/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-beforeMethodFailure/pom.xml b/surefire-integration-tests/src/test/resources/testng-beforeMethodFailure/pom.xml index 374b182..bda724c 100644 --- a/surefire-integration-tests/src/test/resources/testng-beforeMethodFailure/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-beforeMethodFailure/pom.xml @@ -58,11 +58,6 @@ - - 5.7 - jdk15 - - http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-execute-error/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-execute-error/pom.xml b/surefire-integration-tests/src/test/resources/testng-execute-error/pom.xml index da39df3..ae1a1d1 100644 --- a/surefire-integration-tests/src/test/resources/testng-execute-error/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-execute-error/pom.xml @@ -58,11 +58,6 @@ - - 5.7 - jdk15 - - http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-group-thread-parallel/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-group-thread-parallel/pom.xml b/surefire-integration-tests/src/test/resources/testng-group-thread-parallel/pom.xml index 8ae10d3..f0ad40c 100644 --- a/surefire-integration-tests/src/test/resources/testng-group-thread-parallel/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-group-thread-parallel/pom.xml @@ -65,11 +65,6 @@ - - 5.7 - jdk15 - - http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-junit-together/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-junit-together/pom.xml b/surefire-integration-tests/src/test/resources/testng-junit-together/pom.xml index 68dcfbf..dac6b9b 100644 --- a/surefire-integration-tests/src/test/resources/testng-junit-together/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-junit-together/pom.xml @@ -58,11 +58,6 @@ - - 5.7 - jdk15 - - junit http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-listener-reporter/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-listener-reporter/pom.xml b/surefire-integration-tests/src/test/resources/testng-listener-reporter/pom.xml index b39c11b..975eff5 100644 --- a/surefire-integration-tests/src/test/resources/testng-listener-reporter/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-listener-reporter/pom.xml @@ -65,11 +65,6 @@ - - 5.7 - jdk15 - - http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-method-pattern-after/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-method-pattern-after/pom.xml b/surefire-integration-tests/src/test/resources/testng-method-pattern-after/pom.xml index dcc76b8..4cb27c6 100644 --- a/surefire-integration-tests/src/test/resources/testng-method-pattern-after/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-method-pattern-after/pom.xml @@ -28,12 +28,6 @@ 1.0-SNAPSHOT Test for Testng - - - 5.7 - jdk15 - - testng-old http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-method-pattern-before/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-method-pattern-before/pom.xml b/surefire-integration-tests/src/test/resources/testng-method-pattern-before/pom.xml index dcc76b8..4cb27c6 100644 --- a/surefire-integration-tests/src/test/resources/testng-method-pattern-before/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-method-pattern-before/pom.xml @@ -28,12 +28,6 @@ 1.0-SNAPSHOT Test for Testng - - - 5.7 - jdk15 - - testng-old http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-method-pattern/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-method-pattern/pom.xml b/surefire-integration-tests/src/test/resources/testng-method-pattern/pom.xml index dcc76b8..4cb27c6 100644 --- a/surefire-integration-tests/src/test/resources/testng-method-pattern/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-method-pattern/pom.xml @@ -28,12 +28,6 @@ 1.0-SNAPSHOT Test for Testng - - - 5.7 - jdk15 - - testng-old http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-path with spaces/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-path with spaces/pom.xml b/surefire-integration-tests/src/test/resources/testng-path with spaces/pom.xml index 31877df..88eb6da 100644 --- a/surefire-integration-tests/src/test/resources/testng-path with spaces/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-path with spaces/pom.xml @@ -58,11 +58,6 @@ - - 5.7 - jdk15 - - http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-simple/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-simple/pom.xml b/surefire-integration-tests/src/test/resources/testng-simple/pom.xml index fffad18..bad1178 100644 --- a/surefire-integration-tests/src/test/resources/testng-simple/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-simple/pom.xml @@ -73,7 +73,6 @@ - 5.7 0 http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-single-method/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-single-method/pom.xml b/surefire-integration-tests/src/test/resources/testng-single-method/pom.xml index 5f99c56..965fc55 100644 --- a/surefire-integration-tests/src/test/resources/testng-single-method/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-single-method/pom.xml @@ -28,12 +28,6 @@ 1.0-SNAPSHOT Test for Testng - - - 5.7 - jdk15 - - testng-old http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-succes-percentage/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-succes-percentage/pom.xml b/surefire-integration-tests/src/test/resources/testng-succes-percentage/pom.xml index 13bc831..1d2cfbd 100644 --- a/surefire-integration-tests/src/test/resources/testng-succes-percentage/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-succes-percentage/pom.xml @@ -33,11 +33,6 @@ 1.0-SNAPSHOT Test for Testng - - 5.7 - jdk15 - - testng-old http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-suite-xml/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-suite-xml/pom.xml b/surefire-integration-tests/src/test/resources/testng-suite-xml/pom.xml index c43c10b..f51bb49 100644 --- a/surefire-integration-tests/src/test/resources/testng-suite-xml/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-suite-xml/pom.xml @@ -58,11 +58,6 @@ - - 5.7 - jdk15 - - http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ef8e9e39/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/pom.xml b/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/pom.xml index ec9b524..37d77bf 100644 --- a/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/pom.xml +++ b/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/pom.xml @@ -58,11 +58,6 @@ - - 5.7 - jdk15 - -