Author: krosenvold Date: Sun Jan 2 12:19:17 2011 New Revision: 1054391 URL: http://svn.apache.org/viewvc?rev=1054391&view=rev Log: [SUREFIRE-679] testSetStarting called twice
Added: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ReportersIT.java (with props) maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/ maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/pom.xml (with props) maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/ maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/ maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/ maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/reporters/ maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/reporters/Test1.java (with props) maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/reporters/Test2.java (with props) Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java Added: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ReportersIT.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ReportersIT.java?rev=1054391&view=auto ============================================================================== --- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ReportersIT.java (added) +++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ReportersIT.java Sun Jan 2 12:19:17 2011 @@ -0,0 +1,49 @@ +package org.apache.maven.surefire.its; +/* + * 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. + */ + + +/** + * Asserts proper behaviour of console output when forking + * SUREFIRE-679 + * + * @author Kristian Rosenvold + */ +public class ReportersIT + extends SurefireVerifierTestClass +{ + + public ReportersIT() + { + super( "/reporters" ); + } + + public void testRedirectOutputTestNg() + throws Exception + { + redirectToFile( true ); + printSummary( true ); + + execute( "test" ); + assertPresent( getSurefireReportsFile( "TestSuite-output.txt" ) ); + assertPresent( getSurefireReportsFile( "TEST-TestSuite.xml" ) ); + assertPresent( getSurefireReportsFile( "TestSuite.txt" ) ); + } +} + Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ReportersIT.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/pom.xml URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/pom.xml?rev=1054391&view=auto ============================================================================== --- maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/pom.xml (added) +++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/pom.xml Sun Jan 2 12:19:17 2011 @@ -0,0 +1,55 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>reporters</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>reporters</name> + <url>http://maven.apache.org</url> + + <dependencies> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>5.8</version> + <scope>test</scope> + <classifier>jdk15</classifier> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <disableXmlReport>false</disableXmlReport> + <forkMode>${forkMode}</forkMode> + <printSummary>${printSummary}</printSummary> + <useFile>true</useFile> + <redirectTestOutputToFile>${redirect.to.file}</redirectTestOutputToFile> + <includes> + <include>**/Test*.java</include> + </includes> + </configuration> + </plugin> + </plugins> + + </build> + + <properties> + <junit.version>4.8.1</junit.version> + <redirect.to.file>true</redirect.to.file> + <forkMode>once</forkMode> + <printSummary>true</printSummary> + </properties> +</project> Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/reporters/Test1.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/reporters/Test1.java?rev=1054391&view=auto ============================================================================== --- maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/reporters/Test1.java (added) +++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/reporters/Test1.java Sun Jan 2 12:19:17 2011 @@ -0,0 +1,30 @@ +package reporters; + +/* + * 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 junit.framework.TestCase; + +public class Test1 extends TestCase +{ + public void test6281() { + System.out.println( "Test1 on" + Thread.currentThread().getName()); + } + +} Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/reporters/Test1.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/reporters/Test2.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/reporters/Test2.java?rev=1054391&view=auto ============================================================================== --- maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/reporters/Test2.java (added) +++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/reporters/Test2.java Sun Jan 2 12:19:17 2011 @@ -0,0 +1,30 @@ +package reporters; + +/* + * 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 junit.framework.TestCase; + +public class Test2 extends TestCase +{ + public void test6281() { + System.out.println( "Test2 on" + Thread.currentThread().getName()); + } +} Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/resources/reporters/src/test/java/reporters/Test2.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java?rev=1054391&r1=1054390&r2=1054391&view=diff ============================================================================== --- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java (original) +++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java Sun Jan 2 12:19:17 2011 @@ -99,8 +99,6 @@ public class TestNGDirectoryTestSuite public void execute( TestsToRun testsToRun, ReporterFactory reporterManagerFactory ) throws ReporterException, TestSetFailedException { - ReporterManager reporterManager = (ReporterManager) reporterManagerFactory.createReporter(); - startTestSuite( reporterManager, this ); if ( testsToRun.size() == 0 ) { @@ -112,6 +110,10 @@ public class TestNGDirectoryTestSuite executeMulti( testsToRun, reporterManagerFactory ); return; } + + ReporterManager reporterManager = (ReporterManager) reporterManagerFactory.createReporter(); + startTestSuite( reporterManager, this ); + TestNGExecutor.run( new Class[]{ (Class) testsToRun.iterator().next() }, this.testSourceDirectory, this.options, this.version, this.classifier, reporterManager, this, reportsDirectory );