http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/classpath-order/src/main/resources/surefire-classpath-order.properties ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/classpath-order/src/main/resources/surefire-classpath-order.properties b/surefire-its/src/test/resources/classpath-order/src/main/resources/surefire-classpath-order.properties new file mode 100644 index 0000000..10493b4 --- /dev/null +++ b/surefire-its/src/test/resources/classpath-order/src/main/resources/surefire-classpath-order.properties @@ -0,0 +1,2 @@ +# This file collides with the equally named file from the project's test resources +Surefire: classes
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/classpath-order/src/main/resources/surefire-report.properties ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/classpath-order/src/main/resources/surefire-report.properties b/surefire-its/src/test/resources/classpath-order/src/main/resources/surefire-report.properties new file mode 100644 index 0000000..585dd8b --- /dev/null +++ b/surefire-its/src/test/resources/classpath-order/src/main/resources/surefire-report.properties @@ -0,0 +1,2 @@ +# This file collides with the equally named i18n bundle in the Surefire Report Plugin +Surefire: classes http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/classpath-order/src/test/java/it/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/classpath-order/src/test/java/it/BasicTest.java b/surefire-its/src/test/resources/classpath-order/src/test/java/it/BasicTest.java new file mode 100644 index 0000000..739e134 --- /dev/null +++ b/surefire-its/src/test/resources/classpath-order/src/test/java/it/BasicTest.java @@ -0,0 +1,61 @@ +package it; + +/* + * 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.InputStream; +import java.io.IOException; +import java.util.Properties; + +import junit.framework.TestCase; + +public class BasicTest + extends TestCase +{ + + public void testTestClassesBeforeMainClasses() + { + Properties props = getProperties( "/surefire-classpath-order.properties" ); + assertEquals( "test-classes", props.getProperty( "Surefire" ) ); + } + + public void testMainClassesBeforeDependencies() + { + Properties props = getProperties( "/surefire-report.properties" ); + assertEquals( "classes", props.getProperty( "Surefire" ) ); + } + + private Properties getProperties(String resource) + { + InputStream in = getClass().getResourceAsStream( resource ); + assertNotNull( in ); + try + { + Properties props = new Properties(); + props.load( in ); + return props; + } + catch (IOException e) + { + fail(e.toString()); + return null; + } + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/classpath-order/src/test/resources/surefire-classpath-order.properties ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/classpath-order/src/test/resources/surefire-classpath-order.properties b/surefire-its/src/test/resources/classpath-order/src/test/resources/surefire-classpath-order.properties new file mode 100644 index 0000000..246cf2c --- /dev/null +++ b/surefire-its/src/test/resources/classpath-order/src/test/resources/surefire-classpath-order.properties @@ -0,0 +1,2 @@ +# This file collides with the equally named file from the project's main resources +Surefire: test-classes http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/classpath-scope-filtering/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/classpath-scope-filtering/pom.xml b/surefire-its/src/test/resources/classpath-scope-filtering/pom.xml new file mode 100644 index 0000000..7dcdfa2 --- /dev/null +++ b/surefire-its/src/test/resources/classpath-scope-filtering/pom.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>classpath-scope-filter</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for classpath scope filter</name> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <classpathDependencyScopeExclude>compile</classpathDependencyScopeExclude> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-email</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/classpath-scope-filtering/src/test/java/classpathFiltering/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/classpath-scope-filtering/src/test/java/classpathFiltering/BasicTest.java b/surefire-its/src/test/resources/classpath-scope-filtering/src/test/java/classpathFiltering/BasicTest.java new file mode 100644 index 0000000..5f8b23a --- /dev/null +++ b/surefire-its/src/test/resources/classpath-scope-filtering/src/test/java/classpathFiltering/BasicTest.java @@ -0,0 +1,44 @@ +package classpathFiltering; + +/* + * 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 BasicTest + extends TestCase +{ + + public void testDependencyFilter() { + + Class testClass = null; + String testClassName = "org.apache.commons.mail.Email"; + try + { + testClass = Class.forName( testClassName ); + System.out.println( "Able to load class " + testClass ); + } + catch ( ClassNotFoundException e ) + { + System.out.println( "Couldn't load " + testClassName ); + } + assertNull( testClass ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/consoleOutput/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/consoleOutput/pom.xml b/surefire-its/src/test/resources/consoleOutput/pom.xml new file mode 100644 index 0000000..407f909 --- /dev/null +++ b/surefire-its/src/test/resources/consoleOutput/pom.xml @@ -0,0 +1,46 @@ +<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/xsd/maven-4.0.0.xsd"> + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>consoleOutputTest</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>consoleOutputTest</name> + <url>http://maven.apache.org</url> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.7</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <redirectTestOutputToFile>true</redirectTestOutputToFile> + <testFailureIgnore>true</testFailureIgnore> + <forkMode>${forkMode}</forkMode> + <includes> + <include>**/Test*.java</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/consoleOutput/src/test/java/consoleOutput/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/consoleOutput/src/test/java/consoleOutput/Test1.java b/surefire-its/src/test/resources/consoleOutput/src/test/java/consoleOutput/Test1.java new file mode 100644 index 0000000..8994251 --- /dev/null +++ b/surefire-its/src/test/resources/consoleOutput/src/test/java/consoleOutput/Test1.java @@ -0,0 +1,81 @@ +package consoleOutput; + +/* + * 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; + +import static org.junit.Assert.fail; + +public class Test1 +{ + static + { + System.out.println("Printline in static block"); + Runtime.getRuntime().addShutdownHook( new Thread( ){ + @Override + public void run() + { + System.out.println( "Printline in shutdown hook" ); + } + }); + } + + @Override + protected void finalize() + throws Throwable + { + System.out.println( "Printline in finalizer" ); + } + + public Test1(){ + System.out.println("In constructor"); + } + + @Test + public void testStdOut() + { + char c = 'C'; + System.out.print( "Sout" ); + System.out.print( "Again" ); + System.out.print( "\n" ); + System.out.print( c ); + System.out.println( "SoutLine" ); + System.out.println( "äöüÃ" ); + System.out.println( "" ); + System.out.println( "==END==" ); + + fail( "failing with ü" ); + } + + @Test + public void testStdErr() + { + char e = 'E'; + System.err.print( "Serr" ); + System.err.print( "\n" ); + System.err.print( e ); + System.err.println( "SerrLine" ); + System.err.println( "äöüÃ" ); + System.err.println( "" ); + System.err.println( "==END==" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/consoleOutputEncoding/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/consoleOutputEncoding/pom.xml b/surefire-its/src/test/resources/consoleOutputEncoding/pom.xml new file mode 100644 index 0000000..5dec5d8 --- /dev/null +++ b/surefire-its/src/test/resources/consoleOutputEncoding/pom.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<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/xsd/maven-4.0.0.xsd"> + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>consoleOutputEncodingsTest</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>consoleOutputTest</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-surefire-plugin</artifactId> + <configuration> + <forkMode>${forkMode}</forkMode> + <printSummary>${printSummary}</printSummary> + <reportFormat>${reportFormat}</reportFormat> + <includes> + <include>**/Test*.java</include> + </includes> + </configuration> + </plugin> + </plugins> + + </build> + + <properties> + <junit.version>4.8.1</junit.version> + <forkMode>once</forkMode> + <printSummary>true</printSummary> + <reportFormat>brief</reportFormat> + </properties> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/consoleOutputEncoding/src/test/java/consoleOutput/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/consoleOutputEncoding/src/test/java/consoleOutput/Test1.java b/surefire-its/src/test/resources/consoleOutputEncoding/src/test/java/consoleOutput/Test1.java new file mode 100644 index 0000000..dfcfb97 --- /dev/null +++ b/surefire-its/src/test/resources/consoleOutputEncoding/src/test/java/consoleOutput/Test1.java @@ -0,0 +1,47 @@ +package consoleOutput; + +/* + * 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; + +import java.io.IOException; +import java.io.PrintStream; +import java.nio.charset.Charset; + +public class Test1 +{ + @Test + public void testSystemOut() + throws IOException + { + PrintStream out = System.out; + out.print( getS( "print" )); + out.write( getS( "utf-8" ).getBytes( Charset.forName( "UTF-8" ) ) ); + out.write( getS( "8859-1" ).getBytes( Charset.forName( "ISO-8859-1" ) ) ); + out.write( getS( "utf-16" ).getBytes( Charset.forName( "UTF-16" ) ) ); + } + + private String getS( String s ) + { + return " Hell\u00d8 " + s + "\n"; + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/consoleoutput-noisy/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/consoleoutput-noisy/pom.xml b/surefire-its/src/test/resources/consoleoutput-noisy/pom.xml new file mode 100644 index 0000000..e80b978 --- /dev/null +++ b/surefire-its/src/test/resources/consoleoutput-noisy/pom.xml @@ -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/xsd/maven-4.0.0.xsd"> + + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>fork-consoleOutput-noisy</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>consoleOutput-noisy</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-surefire-plugin</artifactId> + <configuration> + <forkMode>${forkMode}</forkMode> + <printSummary>${printSummary}</printSummary> + <useFile>${useFile}</useFile> + <parallel>${parallel}</parallel> + <threadCount>${threadCount}</threadCount> + <reportFormat>${reportFormat}</reportFormat> + <redirectTestOutputToFile>${redirect.to.file}</redirectTestOutputToFile> + <trimStackTrace>${trimStackTrace}</trimStackTrace> + <!-- argLine>-agentpath:/opt/yjp-9.5.4/bin/linux-x86-64/libyjpagent.so=tracing,monitors,onexit=snapshot</argLine --> + <includes> + <include>**/Test*.java</include> + </includes> + </configuration> + </plugin> + </plugins> + + </build> + + <properties> + <useFile>true</useFile> + <junit.version>4.8.1</junit.version> + <redirect.to.file>true</redirect.to.file> + <forkMode>once</forkMode> + <printSummary>true</printSummary> + <parallel></parallel> + <reportFormat>brief</reportFormat> + <trimStackTrace>true</trimStackTrace> + <threadCount>4</threadCount> + </properties> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/consoleoutput-noisy/src/test/java/consoleoutput_noisy/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/consoleoutput-noisy/src/test/java/consoleoutput_noisy/Test1.java b/surefire-its/src/test/resources/consoleoutput-noisy/src/test/java/consoleoutput_noisy/Test1.java new file mode 100644 index 0000000..888cd22 --- /dev/null +++ b/surefire-its/src/test/resources/consoleoutput-noisy/src/test/java/consoleoutput_noisy/Test1.java @@ -0,0 +1,85 @@ +package consoleoutput_noisy; + +/* + * 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 org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; + +public class Test1 +{ + + public static final int thousand = Integer.parseInt( System.getProperty( "thousand", "1000" ) ); + + @Test + public void test1MillionBytes() + { + for ( int i = 0; i < ( 10 * thousand ); i++ ) + { + System.out.println( "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" ); + } + } + + @Test + public void testHundredThousand() + { + printAlot(); + } + + private static void printAlot() + { + for ( int i = 0; i < thousand; i++ ) + { + System.out.println( "AAAAAAAAAABBBBBBBBBBCCCCCCCCCCDDDDDDDDDDEEEEEEEEEEFFFFFFFFFFGGGGGGGGGGHHHHHHHHHHIIIIIIIIIIJJJJJJJJJJ" ); + } + } + + @Test + public void testAnotherHundredThousand() + { + printAlot(); + } + + @Before + public void before() + { + printAlot(); + } + + @BeforeClass + public static void beforeClass() + { + printAlot(); + } + + @After + public void after() + { + printAlot(); + } + + @AfterClass + public static void afterClass() + { + printAlot(); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/consoleoutput-noisy/src/test/java/consoleoutput_noisy/Test2.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/consoleoutput-noisy/src/test/java/consoleoutput_noisy/Test2.java b/surefire-its/src/test/resources/consoleoutput-noisy/src/test/java/consoleoutput_noisy/Test2.java new file mode 100644 index 0000000..10f607f --- /dev/null +++ b/surefire-its/src/test/resources/consoleoutput-noisy/src/test/java/consoleoutput_noisy/Test2.java @@ -0,0 +1,53 @@ +package consoleoutput_noisy; + +/* + * 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 test2MillionBytes() + { + for ( int i = 0; i < 20 * Test1.thousand; i++ ) + { + System.out.println( + "0-2-3-6-8-012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" ); + } + } + + public static void testHundredThousand() + { + for ( int i = 0; i < Test1.thousand; i++ ) + { + System.out.println( + "A-A-3-A-A-BBBBBBBBBBCCCCCCCCCCDDDDDDDDDDEEEEEEEEEEFFFFFFFFFFGGGGGGGGGGHHHHHHHHHHIIIIIIIIIIJJJJJJJJJJ" ); + } + } + + public static void testAnotherHundredThousand() + { + for ( int i = 0; i < Test1.thousand; i++ ) + { + System.out.println( + "A-A-A-3-3-ABBBBBBBBBCCCCCCCCCCDDDDDDDDDDEEEEEEEEEEFFFFFFFFFFGGGGGGGGGGHHHHHHHHHHIIIIIIIIIIJJJJJJJJJJ" ); + } + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/crash-detection/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/crash-detection/pom.xml b/surefire-its/src/test/resources/crash-detection/pom.xml new file mode 100644 index 0000000..81e9c6a --- /dev/null +++ b/surefire-its/src/test/resources/crash-detection/pom.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<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/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>crash-detection</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Tests vm crash</name> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.4</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <forkMode>once</forkMode> + </configuration> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/crash-detection/src/test/java/junit44/environment/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/crash-detection/src/test/java/junit44/environment/BasicTest.java b/surefire-its/src/test/resources/crash-detection/src/test/java/junit44/environment/BasicTest.java new file mode 100644 index 0000000..2c97a7f --- /dev/null +++ b/surefire-its/src/test/resources/crash-detection/src/test/java/junit44/environment/BasicTest.java @@ -0,0 +1,46 @@ +package junit44.environment; + +/* + * 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.Test; + + +public class BasicTest +{ + + + @Test + public void testNothing() + { + } + + @AfterClass + public static void killTheVm(){ + if ( Boolean.getBoolean( "killHard" )) + { + Runtime.getRuntime().halt( 0 ); + } + else { + System.exit( 0 ); + } + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/crash-during-test/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/crash-during-test/pom.xml b/surefire-its/src/test/resources/crash-during-test/pom.xml new file mode 100644 index 0000000..0d9e3e7 --- /dev/null +++ b/surefire-its/src/test/resources/crash-during-test/pom.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<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/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>crash-during-test</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Tests vm crash while a test is in progress</name> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.4</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>uk.me.mjt</groupId> + <artifactId>crashjvm</artifactId> + <version>1.0</version> + <scope>test</scope> + <type>jar</type> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <forkMode>once</forkMode> + </configuration> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/BasicTest.java b/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/BasicTest.java new file mode 100644 index 0000000..57d57bb --- /dev/null +++ b/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/BasicTest.java @@ -0,0 +1,52 @@ +package junit44.environment; + +/* + * 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.junit.Assert.*; +import org.junit.Test; +import uk.me.mjt.CrashJvm; + +public class BasicTest +{ + @Test + public void testCrashJvm() + { + assertTrue(CrashJvm.loadedOk()); + + String crashType = System.getProperty("crashType"); + assertNotNull(crashType); + if ( crashType.equals( "exit" ) ) + { + CrashJvm.exit(); + } + else if ( crashType.equals( "abort" ) ) + { + CrashJvm.abort(); + } + else if (crashType.equals( "segfault" )) + { + CrashJvm.segfault(); + } + else + { + fail("Don't recognise crashType " + crashType); + } + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/SomeOtherTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/SomeOtherTest.java b/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/SomeOtherTest.java new file mode 100644 index 0000000..e10f6aa --- /dev/null +++ b/surefire-its/src/test/resources/crash-during-test/src/test/java/junit44/environment/SomeOtherTest.java @@ -0,0 +1,28 @@ + +package junit44.environment; + +/* + * 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; + +public class SomeOtherTest { + @Test + public void nonCrashingTest() {} +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/default-configuration-abstract/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/default-configuration-abstract/pom.xml b/surefire-its/src/test/resources/default-configuration-abstract/pom.xml new file mode 100644 index 0000000..1bd1f91 --- /dev/null +++ b/surefire-its/src/test/resources/default-configuration-abstract/pom.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>default-configuration-abstract</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for default configuration with abstract classes</name> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/AbstractConcreteBasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/AbstractConcreteBasicTest.java b/surefire-its/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/AbstractConcreteBasicTest.java new file mode 100644 index 0000000..d7a7fa5 --- /dev/null +++ b/surefire-its/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/AbstractConcreteBasicTest.java @@ -0,0 +1,87 @@ +package abstractClasses; + +/* + * 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.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +public class AbstractConcreteBasicTest // not really abstract! + extends TestCase +{ + + private boolean setUpCalled = false; + + private static boolean tearDownCalled = false; + + public AbstractConcreteBasicTest( String name, String extraName ) + { + super( name ); + } + + public static Test suite() + { + System.out.println( "suite" ); + TestSuite suite = new TestSuite(); + Test test = new AbstractConcreteBasicTest( "testSetUp", "dummy" ); + suite.addTest( test ); + + return new TestSetup( suite ) + { + + protected void setUp() + { + //oneTimeSetUp(); + } + + protected void tearDown() + { + oneTimeTearDown(); + } + + }; + } + + protected void setUp() + { + setUpCalled = true; + tearDownCalled = false; + System.out.println( "Called setUp" ); + } + + protected void tearDown() + { + setUpCalled = false; + tearDownCalled = true; + System.out.println( "Called tearDown" ); + } + + public void testSetUp() + { + assertTrue( "setUp was not called", setUpCalled ); + } + + public static void oneTimeTearDown() + { + assertTrue( "tearDown was not called", tearDownCalled ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/NonInstantiableTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/NonInstantiableTest.java b/surefire-its/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/NonInstantiableTest.java new file mode 100644 index 0000000..f08f888 --- /dev/null +++ b/surefire-its/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/NonInstantiableTest.java @@ -0,0 +1,28 @@ +package abstractClasses; + +/* + * 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 abstract class NonInstantiableTest + extends TestCase +{ + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/default-configuration-classWithNoTests/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/default-configuration-classWithNoTests/pom.xml b/surefire-its/src/test/resources/default-configuration-classWithNoTests/pom.xml new file mode 100644 index 0000000..dafe6e5 --- /dev/null +++ b/surefire-its/src/test/resources/default-configuration-classWithNoTests/pom.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>default-configuration-classWithNoTests</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for class with no tests</name> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/default-configuration-classWithNoTests/src/test/java/classWithNoTests/NoMethodsTestCase.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/default-configuration-classWithNoTests/src/test/java/classWithNoTests/NoMethodsTestCase.java b/surefire-its/src/test/resources/default-configuration-classWithNoTests/src/test/java/classWithNoTests/NoMethodsTestCase.java new file mode 100644 index 0000000..217a04f --- /dev/null +++ b/surefire-its/src/test/resources/default-configuration-classWithNoTests/src/test/java/classWithNoTests/NoMethodsTestCase.java @@ -0,0 +1,22 @@ +package classWithNoTests; + +/* + * 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. + */ + +public class NoMethodsTestCase {} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/default-configuration-noTests/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/default-configuration-noTests/pom.xml b/surefire-its/src/test/resources/default-configuration-noTests/pom.xml new file mode 100644 index 0000000..fc77535 --- /dev/null +++ b/surefire-its/src/test/resources/default-configuration-noTests/pom.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>default-configuration-noTests</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for no test directory</name> + + <properties> + <junit.version>3.8.1</junit.version> + </properties> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <profiles> + <profile> + <id>junit47</id> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/default-configuration/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/default-configuration/pom.xml b/surefire-its/src/test/resources/default-configuration/pom.xml new file mode 100644 index 0000000..1d9587a --- /dev/null +++ b/surefire-its/src/test/resources/default-configuration/pom.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>default-configuration</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for default configuration</name> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/default-configuration/src/test/java/defaultConfiguration/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/default-configuration/src/test/java/defaultConfiguration/BasicTest.java b/surefire-its/src/test/resources/default-configuration/src/test/java/defaultConfiguration/BasicTest.java new file mode 100644 index 0000000..00d4ea2 --- /dev/null +++ b/surefire-its/src/test/resources/default-configuration/src/test/java/defaultConfiguration/BasicTest.java @@ -0,0 +1,87 @@ +package defaultConfiguration; + +/* + * 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.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +public class BasicTest + extends TestCase +{ + + private boolean setUpCalled = false; + + private static boolean tearDownCalled = false; + + public BasicTest( String name, String extraName ) + { + super( name ); + } + + public static Test suite() + { + System.out.println( "suite" ); + TestSuite suite = new TestSuite(); + Test test = new BasicTest( "testSetUp", "dummy" ); + suite.addTest( test ); + + return new TestSetup( suite ) + { + + protected void setUp() + { + //oneTimeSetUp(); + } + + protected void tearDown() + { + oneTimeTearDown(); + } + + }; + } + + protected void setUp() + { + setUpCalled = true; + tearDownCalled = false; + System.out.println( "Called setUp" ); + } + + protected void tearDown() + { + setUpCalled = false; + tearDownCalled = true; + System.out.println( "Called tearDown" ); + } + + public void testSetUp() + { + assertTrue( "setUp was not called", setUpCalled ); + } + + public static void oneTimeTearDown() + { + assertTrue( "tearDown was not called", tearDownCalled ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/environment-variables/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/environment-variables/pom.xml b/surefire-its/src/test/resources/environment-variables/pom.xml new file mode 100644 index 0000000..902e97e --- /dev/null +++ b/surefire-its/src/test/resources/environment-variables/pom.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>environment-variables</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for checking environment variables into forks</name> + + <properties> + <forkMode>always</forkMode> + <useSystemClassLoader>false</useSystemClassLoader> + <maven.compiler.source>1.7</maven.compiler.source> + <maven.compiler.target>1.7</maven.compiler.target> + </properties> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.4</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <forkMode>${forkMode}</forkMode> + <useSystemClassLoader>${useSystemClassLoader}</useSystemClassLoader> + <environmentVariables> + <DUMMY_ENV_VAR>foo</DUMMY_ENV_VAR> + <EMPTY_VAR></EMPTY_VAR> + <UNSET_VAR /> + </environmentVariables> + </configuration> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/environment-variables/src/test/java/environment/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/environment-variables/src/test/java/environment/BasicTest.java b/surefire-its/src/test/resources/environment-variables/src/test/java/environment/BasicTest.java new file mode 100644 index 0000000..e1a0f79 --- /dev/null +++ b/surefire-its/src/test/resources/environment-variables/src/test/java/environment/BasicTest.java @@ -0,0 +1,46 @@ +package environment; + +/* + * 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.hamcrest.core.IsNull; +import org.junit.Assert; +import org.junit.Test; + +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsNull.notNullValue; +import static org.hamcrest.core.IsNull.nullValue; + + +public class BasicTest +{ + + + @Test + public void testEnvVar() + { + Assert.assertThat( System.getenv( "PATH" ), notNullValue() ); + Assert.assertThat( System.getenv( "DUMMY_ENV_VAR" ), is( "foo" ) ); + Assert.assertThat( System.getenv( "EMPTY_VAR" ), is( "" ) ); + Assert.assertThat( System.getenv( "UNSET_VAR" ), is( "" ) ); + Assert.assertThat( System.getenv( "UNDEFINED_VAR" ), nullValue() ); + } + + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fail-fast-junit/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fail-fast-junit/pom.xml b/surefire-its/src/test/resources/fail-fast-junit/pom.xml new file mode 100644 index 0000000..b82448e --- /dev/null +++ b/surefire-its/src/test/resources/fail-fast-junit/pom.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + </parent> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>jiras-surefire-580-junit</artifactId> + <version>1.0</version> + + <properties> + <junit>4.0</junit> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <runOrder>alphabetical</runOrder> + <forkMode>once</forkMode><!--override to default value in order to enable forkCount--> + </configuration> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>junit4</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit4</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>junit47</id> + <properties> + <junit>4.7</junit> + </properties> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java new file mode 100644 index 0000000..4d09bab --- /dev/null +++ b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/ATest.java @@ -0,0 +1,20 @@ +package pkg; + +import org.junit.Test; + +import java.util.concurrent.TimeUnit; + +public class ATest +{ + + @Test + public void someMethod() + throws Exception + { + // checking processros # due to very slow Windows Jenkins machines + TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 3600 : 1500 ); + throw new RuntimeException( "assert \"foo\" == \"bar\"\n" + + " |\n" + + " false" ); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java new file mode 100644 index 0000000..1dc76b7 --- /dev/null +++ b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/BTest.java @@ -0,0 +1,18 @@ +package pkg; + +import org.junit.Test; + +import java.util.concurrent.TimeUnit; + +public class BTest +{ + @Test + public void test() + throws InterruptedException + { + // checking processros # due to very slow Windows Jenkins machines + TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 ); + throw new RuntimeException(); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java new file mode 100644 index 0000000..2660779 --- /dev/null +++ b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/CTest.java @@ -0,0 +1,17 @@ +package pkg; + +import org.junit.Test; + +import java.util.concurrent.TimeUnit; + +public class CTest +{ + @Test + public void test() + throws InterruptedException + { + // checking processros # due to very slow Windows Jenkins machines + TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java new file mode 100644 index 0000000..12a9bc7 --- /dev/null +++ b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/DTest.java @@ -0,0 +1,17 @@ +package pkg; + +import org.junit.Test; + +import java.util.concurrent.TimeUnit; + +public class DTest +{ + @Test + public void test() + throws InterruptedException + { + // checking processros # due to very slow Windows Jenkins machines + TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/ETest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/ETest.java b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/ETest.java new file mode 100644 index 0000000..61c7516 --- /dev/null +++ b/surefire-its/src/test/resources/fail-fast-junit/src/test/java/pkg/ETest.java @@ -0,0 +1,12 @@ +package pkg; + +import org.junit.Test; + +public class ETest +{ + @Test + public void test() + { + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fail-fast-testng/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fail-fast-testng/pom.xml b/surefire-its/src/test/resources/fail-fast-testng/pom.xml new file mode 100644 index 0000000..d52ad12 --- /dev/null +++ b/surefire-its/src/test/resources/fail-fast-testng/pom.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + </parent> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>jiras-surefire-580-testng</artifactId> + <version>1.0</version> + + <dependencies> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>5.10</version> + <classifier>jdk15</classifier> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <runOrder>alphabetical</runOrder> + <forkMode>once</forkMode><!--override to default value in order to enable forkCount--> + </configuration> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java new file mode 100644 index 0000000..46b9d09 --- /dev/null +++ b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java @@ -0,0 +1,19 @@ +package pkg; + +import org.testng.annotations.Test; + +import java.util.concurrent.TimeUnit; + +public class ATest +{ + @Test + public void someMethod() + throws InterruptedException + { + // checking processros # due to very slow Windows Jenkins machines + TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 3600 : 1500 ); + throw new RuntimeException( "assert \"foo\" == \"bar\"\n" + + " |\n" + + " false" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java new file mode 100644 index 0000000..90e2fdb --- /dev/null +++ b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java @@ -0,0 +1,18 @@ +package pkg; + +import org.testng.annotations.Test; + +import java.util.concurrent.TimeUnit; + +public class BTest +{ + @Test + public void test() + throws InterruptedException + { + // checking processros # due to very slow Windows Jenkins machines + TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 ); + throw new RuntimeException(); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java new file mode 100644 index 0000000..d407aa3 --- /dev/null +++ b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java @@ -0,0 +1,17 @@ +package pkg; + +import org.testng.annotations.Test; + +import java.util.concurrent.TimeUnit; + +public class CTest +{ + @Test + public void test() + throws InterruptedException + { + // checking processros # due to very slow Windows Jenkins machines + TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java new file mode 100644 index 0000000..a00260f --- /dev/null +++ b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java @@ -0,0 +1,17 @@ +package pkg; + +import org.testng.annotations.Test; + +import java.util.concurrent.TimeUnit; + +public class DTest +{ + @Test + public void test() + throws InterruptedException + { + // checking processros # due to very slow Windows Jenkins machines + TimeUnit.MILLISECONDS.sleep( Runtime.getRuntime().availableProcessors() == 1 ? 9000 : 3750 ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/ETest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/ETest.java b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/ETest.java new file mode 100644 index 0000000..ff71562 --- /dev/null +++ b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/ETest.java @@ -0,0 +1,12 @@ +package pkg; + +import org.testng.annotations.Test; + +public class ETest +{ + @Test + public void test() + { + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failingBuilds/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failingBuilds/pom.xml b/surefire-its/src/test/resources/failingBuilds/pom.xml new file mode 100644 index 0000000..8e988ad --- /dev/null +++ b/surefire-its/src/test/resources/failingBuilds/pom.xml @@ -0,0 +1,40 @@ +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>failingBuilds-test</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>failingBuilds</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-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <includes> + <include>**/*Test.java</include> + <include>**/MySuiteTest1.java</include> + <include>**/MySuiteTest2.java</include> + <include>**/MySuiteTest3.java</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + <properties> + <junit.version>4.8.1</junit.version> + <forkMode>once</forkMode> + <maven.compiler.source>1.7</maven.compiler.source> + <maven.compiler.target>1.7</maven.compiler.target> + </properties> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failingBuilds/src/test/java/failingbuilds/ExceptionsTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failingBuilds/src/test/java/failingbuilds/ExceptionsTest.java b/surefire-its/src/test/resources/failingBuilds/src/test/java/failingbuilds/ExceptionsTest.java new file mode 100644 index 0000000..fe47279 --- /dev/null +++ b/surefire-its/src/test/resources/failingBuilds/src/test/java/failingbuilds/ExceptionsTest.java @@ -0,0 +1,38 @@ +package failingbuilds; + +/* + * 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.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assume.*; + +import junit.framework.TestCase; + +public class ExceptionsTest + extends TestCase +{ + public void testWithMultiLineExceptionBeingThrown() + { + throw new RuntimeException( "A very very long exception message indeed, which is to demonstrate truncation. It will be truncated somewhere\nA cat\nAnd a dog\nTried to make a\nParrot swim" ); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failsafe-buildfail/invoker.properties ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-buildfail/invoker.properties b/surefire-its/src/test/resources/failsafe-buildfail/invoker.properties new file mode 100644 index 0000000..ab6608f --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-buildfail/invoker.properties @@ -0,0 +1,19 @@ +# +# 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. +# +invoker.buildResult=failure http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failsafe-buildfail/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-buildfail/pom.xml b/surefire-its/src/test/resources/failsafe-buildfail/pom.xml new file mode 100644 index 0000000..c28972f --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-buildfail/pom.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>localhost</groupId> + <artifactId>working-directory-test</artifactId> + <version>1.0</version> + <name>Run tests multiple times</name> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <version>${surefire.version}</version> + <executions> + <execution> + <id>integration-test</id> + <goals> + <goal>integration-test</goal> + </goals> + <configuration> + <summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary-1.xml</summaryFile> + </configuration> + </execution> + <execution> + <id>acceptance-test</id> + <goals> + <goal>integration-test</goal> + </goals> + <configuration> + <includes> + <include>**/AT*.java</include> + <include>**/*AT.java</include> + <include>**/*ATCase.java</include> + </includes> + <summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary-2.xml</summaryFile> + </configuration> + </execution> + <execution> + <id>verify</id> + <goals> + <goal>verify</goal> + </goals> + <configuration> + <summaryFiles> + <summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary-1.xml</summaryFile> + <summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary-2.xml</summaryFile> + </summaryFiles> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failsafe-buildfail/src/test/java/MyAT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-buildfail/src/test/java/MyAT.java b/surefire-its/src/test/resources/failsafe-buildfail/src/test/java/MyAT.java new file mode 100644 index 0000000..40a8a34 --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-buildfail/src/test/java/MyAT.java @@ -0,0 +1,25 @@ +/* + * 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 MyAT extends TestCase { + public void testSomething() { + assertTrue(false); + } +}