Author: krosenvold
Date: Sun May 8 20:04:37 2011
New Revision: 1100803
URL: http://svn.apache.org/viewvc?rev=1100803&view=rev
Log:
[SUREFIRE-703] junit47 does not work with redirectToTestOutputToFile
Integration test submitted by Will May. The issue itself was fixed in
SUREFIRE-732 refactoring
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RedirectOutputIT.java
(with props)
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/pom.xml
(with props)
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test1.java
(with props)
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test2.java
(with props)
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RedirectOutputIT.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RedirectOutputIT.java?rev=1100803&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RedirectOutputIT.java
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RedirectOutputIT.java
Sun May 8 20:04:37 2011
@@ -0,0 +1,68 @@
+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.
+ */
+
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+
+public class JUnit47RedirectOutputIT
+ extends SurefireVerifierTestClass
+{
+ public JUnit47RedirectOutputIT()
+ {
+ super("/junit47-redirect-output");
+ }
+
+ public void testPrintSummaryTrueWithRedirect()
+ throws Exception
+ {
+ redirectToFile( true );
+
+ addGoal( "clean" );
+ executeTest();
+ checkReports();
+ }
+
+
+ public void testClassesParallel()
+ throws Exception
+ {
+ redirectToFile( true );
+
+ addGoal( "clean" );
+ addGoal( "-Dparallel=classes" );
+ executeTest( );
+ checkReports();
+ }
+
+ private void checkReports()
+ throws IOException
+ {
+ String report = StringUtils.trimToNull(
+ FileUtils.readFileToString( getSurefireReportsFile(
"junit47ConsoleOutput.Test1-output.txt" ) ) );
+ assertNotNull( report );
+ String report2 = StringUtils.trimToNull( FileUtils.readFileToString(
+ getSurefireReportsFile( "junit47ConsoleOutput.Test2-output.txt" )
) );
+ assertNotNull(report2);
+ }
+
+}
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RedirectOutputIT.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/pom.xml
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/pom.xml?rev=1100803&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/pom.xml
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/pom.xml
Sun May 8 20:04:37 2011
@@ -0,0 +1,63 @@
+<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>fork-consoleOutput</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>fork-consoleOutput</name>
+ <url>http://maven.apache.org</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ </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>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-junit47</artifactId>
+ <version>2.7.2</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <forkMode>${forkMode}</forkMode>
+ <printSummary>${printSummary}</printSummary>
+ <useFile>true</useFile>
+
<redirectTestOutputToFile>${redirect.to.file}</redirectTestOutputToFile>
+ <threadCount>2</threadCount>
+ <parallel>${parallel}</parallel>
+ <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>
+ <parallel>none</parallel>
+ </properties>
+
+</project>
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test1.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test1.java?rev=1100803&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test1.java
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test1.java
Sun May 8 20:04:37 2011
@@ -0,0 +1,43 @@
+package junit47ConsoleOutput;
+
+/*
+ * 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.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class Test1
+{
+ @Test
+ public void test6281() {
+ System.out.println( "Test1 on" + Thread.currentThread().getName());
+ }
+
+ @BeforeClass
+ public static void testWithFailingAssumption2() {
+ System.out.println( "BeforeTest1 on" +
Thread.currentThread().getName());
+ }
+
+ @AfterClass
+ public static void testWithFailingAssumption3() {
+ System.out.println( "AfterTest1 on" +
Thread.currentThread().getName());
+ }
+
+}
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test1.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test2.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test2.java?rev=1100803&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test2.java
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test2.java
Sun May 8 20:04:37 2011
@@ -0,0 +1,43 @@
+package junit47ConsoleOutput;
+
+/*
+ * 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.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class Test2
+{
+ @Test
+ public void test6281() {
+ System.out.println( "Test2 on" + Thread.currentThread().getName());
+ }
+
+ @BeforeClass
+ public static void testWithFailingAssumption2() {
+ System.out.println( "BeforeTest2 on" +
Thread.currentThread().getName());
+ }
+
+ @AfterClass
+ public static void testWithFailingAssumption3() {
+ System.out.println( "AfterTest2 on" +
Thread.currentThread().getName());
+ }
+
+}
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test2.java
------------------------------------------------------------------------------
svn:eol-style = native