http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failsafe-buildfail/src/test/java/MyIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-buildfail/src/test/java/MyIT.java b/surefire-its/src/test/resources/failsafe-buildfail/src/test/java/MyIT.java new file mode 100644 index 0000000..c74feb1 --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-buildfail/src/test/java/MyIT.java @@ -0,0 +1,26 @@ +/* + * 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 MyIT extends TestCase { + public void testSomething() { + assertTrue(true); + } +}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failsafe-nofail/invoker.properties ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-nofail/invoker.properties b/surefire-its/src/test/resources/failsafe-nofail/invoker.properties new file mode 100644 index 0000000..ab6608f --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-nofail/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-nofail/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-nofail/pom.xml b/surefire-its/src/test/resources/failsafe-nofail/pom.xml new file mode 100644 index 0000000..c28972f --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-nofail/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-nofail/src/test/java/MyAT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-nofail/src/test/java/MyAT.java b/surefire-its/src/test/resources/failsafe-nofail/src/test/java/MyAT.java new file mode 100644 index 0000000..b447e94 --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-nofail/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(true); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failsafe-nofail/src/test/java/MyIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-nofail/src/test/java/MyIT.java b/surefire-its/src/test/resources/failsafe-nofail/src/test/java/MyIT.java new file mode 100644 index 0000000..c74feb1 --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-nofail/src/test/java/MyIT.java @@ -0,0 +1,26 @@ +/* + * 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 MyIT extends TestCase { + public void testSomething() { + assertTrue(true); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failsafe-notests/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-notests/pom.xml b/surefire-its/src/test/resources/failsafe-notests/pom.xml new file mode 100644 index 0000000..24d1dec --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-notests/pom.xml @@ -0,0 +1,61 @@ +<?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>failsafe-notests</artifactId> + <version>1.0</version> + <name>failsafe-notests</name> + + <properties> + <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>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> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failsafe-notests/src/test/java/AClass.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-notests/src/test/java/AClass.java b/surefire-its/src/test/resources/failsafe-notests/src/test/java/AClass.java new file mode 100644 index 0000000..268eec5 --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-notests/src/test/java/AClass.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 AClass extends TestCase { + public void testSomething() { + assertTrue(false); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failsafe-regular/invoker.properties ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-regular/invoker.properties b/surefire-its/src/test/resources/failsafe-regular/invoker.properties new file mode 100644 index 0000000..ab6608f --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-regular/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-regular/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-regular/pom.xml b/surefire-its/src/test/resources/failsafe-regular/pom.xml new file mode 100644 index 0000000..4755cb4 --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-regular/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/Xfailsafe-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/Xfailsafe-summary-2.xml</summaryFile> + </configuration> + </execution> + <execution> + <id>verify</id> + <goals> + <goal>verify</goal> + </goals> + <configuration> + <summaryFiles> + <summaryFile>${project.build.directory}/failsafe-reports/Xfailsafe-summary-1.xml</summaryFile> + <summaryFile>${project.build.directory}/failsafe-reports/Xfailsafe-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-regular/src/test/java/MyAT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-regular/src/test/java/MyAT.java b/surefire-its/src/test/resources/failsafe-regular/src/test/java/MyAT.java new file mode 100644 index 0000000..615ee76 --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-regular/src/test/java/MyAT.java @@ -0,0 +1,26 @@ +/* + * 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(true); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failsafe-regular/src/test/java/MyIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failsafe-regular/src/test/java/MyIT.java b/surefire-its/src/test/resources/failsafe-regular/src/test/java/MyIT.java new file mode 100644 index 0000000..c74feb1 --- /dev/null +++ b/surefire-its/src/test/resources/failsafe-regular/src/test/java/MyIT.java @@ -0,0 +1,26 @@ +/* + * 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 MyIT extends TestCase { + public void testSomething() { + assertTrue(true); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failure-result-counting/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failure-result-counting/pom.xml b/surefire-its/src/test/resources/failure-result-counting/pom.xml new file mode 100644 index 0000000..7d79f29 --- /dev/null +++ b/surefire-its/src/test/resources/failure-result-counting/pom.xml @@ -0,0 +1,38 @@ +<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>maven-surefire</groupId> + <artifactId>small-result-counting</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>failure-result-counting</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> + <forkMode>${forkMode}</forkMode> + <includes> + <include>**/*.java</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + <properties> + <junit.version>4.10</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/failure-result-counting/src/test/java/failureresultcounting/BeforeClassError.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeClassError.java b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeClassError.java new file mode 100644 index 0000000..0e80332 --- /dev/null +++ b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeClassError.java @@ -0,0 +1,43 @@ +package failureresultcounting; +/* + * 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.BeforeClass; +import org.junit.Test; + +/** + * @author Kristian Rosenvold + */ +public class BeforeClassError +{ + + @BeforeClass + public static void beforeClassError() + { + throw new RuntimeException( "Exception in beforeclass" ); + } + + @Test + public void ok() + { + System.out.println( "beforeClassError run !!" ); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeClassFailure.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeClassFailure.java b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeClassFailure.java new file mode 100644 index 0000000..62d51ac --- /dev/null +++ b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeClassFailure.java @@ -0,0 +1,43 @@ +package failureresultcounting; +/* + * 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.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * @author Kristian Rosenvold + */ +public class BeforeClassFailure +{ + + @BeforeClass + public static void failInBeforeClass() + { + Assert.fail( "Failing in @BeforeClass" ); + } + + @Test + public void ok() + { + System.out.println( "failInBeforeClass run !!"); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeError.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeError.java b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeError.java new file mode 100644 index 0000000..0798c80 --- /dev/null +++ b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeError.java @@ -0,0 +1,48 @@ +package failureresultcounting; +/* + * 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.Before; +import org.junit.Test; + +/** + * @author Kristian Rosenvold + */ +public class BeforeError +{ + + @Before + public void exceptionInBefore() + { + throw new RuntimeException( "Exception in @before" ); + } + + @Test + public void ok() + { + System.out.println( "exceptionInBefore run!!"); + } + + /*@Test + public void ok2() + { + System.out.println( "exceptionInBefore2 run!!"); + } */ + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeFailure.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeFailure.java b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeFailure.java new file mode 100644 index 0000000..174a448 --- /dev/null +++ b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/BeforeFailure.java @@ -0,0 +1,43 @@ +package failureresultcounting; +/* + * 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.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * @author Kristian Rosenvold + */ +public class BeforeFailure +{ + + @Before + public void failInBEfore() + { + Assert.fail( "Failing in @before" ); + } + + @Test + public void ok() + { + System.out.println( "failInBEfore run !!"); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/NoErrors.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/NoErrors.java b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/NoErrors.java new file mode 100644 index 0000000..245c9a6 --- /dev/null +++ b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/NoErrors.java @@ -0,0 +1,43 @@ +package failureresultcounting; +/* + * 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.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * @author Kristian Rosenvold + */ +public class NoErrors +{ + + @Test + @Ignore + public void allOk1() + { + } + + @Test + @Ignore + public void allOk2() + { + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/OrdinaryError.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/OrdinaryError.java b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/OrdinaryError.java new file mode 100644 index 0000000..7e6387a --- /dev/null +++ b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/OrdinaryError.java @@ -0,0 +1,42 @@ +package failureresultcounting; +/* + * 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.Assert; +import org.junit.Test; + +/** + * @author Kristian Rosenvold + */ +public class OrdinaryError +{ + + @Test + public void ordinaryEror() + { + throw new RuntimeException( "Exception in @before" ); + } + + @Test + public void ordinaryFailure() + { + Assert.fail(); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/RunTests.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/RunTests.java b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/RunTests.java new file mode 100644 index 0000000..6dc2f4c --- /dev/null +++ b/surefire-its/src/test/resources/failure-result-counting/src/test/java/failureresultcounting/RunTests.java @@ -0,0 +1,33 @@ +package failureresultcounting; + +/* + * 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 RunTests +{ + public static void main(String args[]) { + org.junit.runner.JUnitCore.main(BeforeClassError.class.getName(), + BeforeClassFailure.class.getName(), + BeforeError.class.getName(), + BeforeFailure.class.getName(), + OrdinaryError.class.getName(), + NoErrors.class.getName() + ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failureOutput/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failureOutput/pom.xml b/surefire-its/src/test/resources/failureOutput/pom.xml new file mode 100644 index 0000000..85c10ee --- /dev/null +++ b/surefire-its/src/test/resources/failureOutput/pom.xml @@ -0,0 +1,50 @@ +<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>failureOutput</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>failureOutput</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> + <forkMode>${forkMode}</forkMode> + <printSummary>${printSummary}</printSummary> + <useFile>${userFile}</useFile> + <reportFormat>${reportFormat}</reportFormat> + <redirectTestOutputToFile>${redirect.to.file}</redirectTestOutputToFile> + <includes> + <include>**/Test*.java</include> + </includes> + </configuration> + </plugin> + </plugins> + + </build> + + <properties> + <junit.version>4.8.1</junit.version> + <redirect.to.file>true</redirect.to.file> + <forkMode>once</forkMode> + <printSummary>true</printSummary> + <useFile>true</useFile> + <reportFormat>brief</reportFormat> + <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/failureOutput/src/test/java/forkConsoleOutput/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failureOutput/src/test/java/forkConsoleOutput/Test1.java b/surefire-its/src/test/resources/failureOutput/src/test/java/forkConsoleOutput/Test1.java new file mode 100644 index 0000000..af92952 --- /dev/null +++ b/surefire-its/src/test/resources/failureOutput/src/test/java/forkConsoleOutput/Test1.java @@ -0,0 +1,85 @@ +package forkConsoleOutput; + +/* + * 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.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.File; + +public class Test1 +{ + @Test + public void test6281() { + System.out.println( "Test1 on" + Thread.currentThread().getName()); + } + + @Test + public void nullPointerInLibrary() { + new File((String)null); + } + + @Test + public void failInMethod() { + innerFailure(); + } + + @Test + public void failInLibInMethod() { + new File((String)null); + } + + + @Test + public void failInNestedLibInMethod() { + nestedLibFailure(); + } + + @Test + public void assertion1() { + Assert.assertEquals("Bending maths", "123", "312"); + } + + @Test + public void assertion2() { + Assert.assertFalse("True is false", true); + } + + private void innerFailure(){ + throw new NullPointerException("Fail here"); + } + + private void nestedLibFailure(){ + new File((String) null); + } + + @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()); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failureOutput/src/test/java/forkConsoleOutput/Test2.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failureOutput/src/test/java/forkConsoleOutput/Test2.java b/surefire-its/src/test/resources/failureOutput/src/test/java/forkConsoleOutput/Test2.java new file mode 100644 index 0000000..f5c825e --- /dev/null +++ b/surefire-its/src/test/resources/failureOutput/src/test/java/forkConsoleOutput/Test2.java @@ -0,0 +1,35 @@ +package forkConsoleOutput; + +/* + * 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 Test2 +{ + @Test + public void test6281() + { + System.out.println( "sout: I am talking to you" ); + System.out.println( "sout: Will Fail soon" ); + System.err.println( "serr: And you too" ); + System.err.println( "serr: Will Fail now" ); + throw new RuntimeException( "FailHere" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/failureOutput/test ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/failureOutput/test b/surefire-its/src/test/resources/failureOutput/test new file mode 100644 index 0000000..873a7bf --- /dev/null +++ b/surefire-its/src/test/resources/failureOutput/test @@ -0,0 +1,15 @@ +[INFO] Scanning for projects... +[WARNING] +[WARNING] Some problems were encountered while building the effective model for org.apache.maven.plugins.surefire:failureOutput:jar:1.0-SNAPSHOT +[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 20, column 17 +[WARNING] +[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. +[WARNING] +[WARNING] For this reason, future Maven versions might no longer support building such malformed projects. +[WARNING] +[INFO] +[INFO] ------------------------------------------------------------------------ +[INFO] Building failureOutput 1.0-SNAPSHOT +[INFO] ------------------------------------------------------------------------ +[INFO] +[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ failureOutput --- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fixture/testsuitexmlparser/TEST-org.apache.maven.surefire.test.SucceedingTest.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fixture/testsuitexmlparser/TEST-org.apache.maven.surefire.test.SucceedingTest.xml b/surefire-its/src/test/resources/fixture/testsuitexmlparser/TEST-org.apache.maven.surefire.test.SucceedingTest.xml new file mode 100644 index 0000000..2801bf6 --- /dev/null +++ b/surefire-its/src/test/resources/fixture/testsuitexmlparser/TEST-org.apache.maven.surefire.test.SucceedingTest.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite failures="0" time="0.008" errors="0" skipped="0" tests="2" name="org.apache.maven.surefire.test.SucceedingTest"> + <properties> + <property name="surefire.version" value="2.13-SNAPSHOT"/> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + <property name="sun.boot.library.path" value="c:\java\jdk1.7.0_09\jre\bin"/> + <property name="java.vm.version" value="23.5-b02"/> + <property name="user.country.format" value="NO"/> + <property name="java.vm.vendor" value="Oracle Corporation"/> + <property name="java.vendor.url" value="http://java.oracle.com/"/> + <property name="path.separator" value=";"/> + <property name="guice.disable.misplaced.annotation.check" value="true"/> + <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/> + <property name="file.encoding.pkg" value="sun.io"/> + <property name="user.script" value=""/> + <property name="user.country" value="US"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="sun.os.patch.level" value="Service Pack 1"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="user.dir" value="c:\workspace\maven-surefire\surefire-integration-tests\src\test\resources\surefire-803-multiFailsafeExec-failureInFirst"/> + <property name="java.runtime.version" value="1.7.0_09-b05"/> + <property name="java.awt.graphicsenv" value="sun.awt.Win32GraphicsEnvironment"/> + <property name="java.endorsed.dirs" value="c:\java\jdk1.7.0_09\jre\lib\endorsed"/> + <property name="os.arch" value="amd64"/> + <property name="java.io.tmpdir" value="C:\Users\krose\AppData\Local\Temp\"/> + <property name="line.separator" value=" +"/> + <property name="java.vm.specification.vendor" value="Oracle Corporation"/> + <property name="user.variant" value=""/> + <property name="os.name" value="Windows 7"/> + <property name="classworlds.conf" value="c:/java/apache-maven-3.0.4/bin/m2.conf"/> + <property name="sun.jnu.encoding" value="Cp1252"/> + <property name="java.library.path" value="c:\java\jdk1.7.0_09\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;x:\bin;.;C:\java\Git\local\bin;C:\java\Git\mingw\bin;C:\java\Git\bin;c:\java\jdk1.7.0_09\bin;c:\java\Subversion;c:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;c:\Program Files (x86)\Common Files\Microsoft Shared\Microsoft Online Services;c:\Windows\system32;c:\Windows;c:\Windows\System32\Wbem;c:\Windows\System32\WindowsPowerShell\v1.0\;c:\java\jdk1.7.0_09\bin;c:\java\Subversion;c:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;c:\Program Files (x86)\Common Files\Microsoft Shared\Microsoft Online Services;c:\Windows\system32;c:\Windows;c:\Windows\System32\Wbem;c:\Windows\System32\WindowsPowerShell\v1.0\;c:\java\bin;."/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="java.class.version" value="51.0"/> + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> + <property name="os.version" value="6.1"/> + <property name="user.home" value="C:\Users\krose"/> + <property name="user.timezone" value="Europe/Paris"/> + <property name="java.awt.printerjob" value="sun.awt.windows.WPrinterJob"/> + <property name="java.specification.version" value="1.7"/> + <property name="file.encoding" value="Cp1252"/> + <property name="user.name" value="krose"/> + <property name="java.class.path" value="c:/java/apache-maven-3.0.4/boot/plexus-classworlds-2.4.jar"/> + <property name="java.vm.specification.version" value="1.7"/> + <property name="sun.arch.data.model" value="64"/> + <property name="java.home" value="c:\java\jdk1.7.0_09\jre"/> + <property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher -Dsurefire.version=2.13-SNAPSHOT clean verify"/> + <property name="java.specification.vendor" value="Oracle Corporation"/> + <property name="user.language" value="en"/> + <property name="user.language.format" value="no"/> + <property name="awt.toolkit" value="sun.awt.windows.WToolkit"/> + <property name="java.vm.info" value="mixed mode"/> + <property name="java.version" value="1.7.0_09"/> + <property name="java.ext.dirs" value="c:\java\jdk1.7.0_09\jre\lib\ext;C:\Windows\Sun\Java\lib\ext"/> + <property name="sun.boot.class.path" value="c:\java\jdk1.7.0_09\jre\lib\resources.jar;c:\java\jdk1.7.0_09\jre\lib\rt.jar;c:\java\jdk1.7.0_09\jre\lib\sunrsasign.jar;c:\java\jdk1.7.0_09\jre\lib\jsse.jar;c:\java\jdk1.7.0_09\jre\lib\jce.jar;c:\java\jdk1.7.0_09\jre\lib\charsets.jar;c:\java\jdk1.7.0_09\jre\lib\jfr.jar;c:\java\jdk1.7.0_09\jre\classes"/> + <property name="java.vendor" value="Oracle Corporation"/> + <property name="maven.home" value="c:\java\apache-maven-3.0.4"/> + <property name="file.separator" value="\"/> + <property name="java.vendor.url.bug" value="http://bugreport.sun.com/bugreport/"/> + <property name="sun.cpu.endian" value="little"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="sun.desktop" value="windows"/> + <property name="sun.cpu.isalist" value="amd64"/> + </properties> + <testcase time="0.007" classname="org.apache.maven.surefire.test.SucceedingTest" name="defaultTestValueIs_Value"/> + <testcase time="0.001" classname="org.apache.maven.surefire.test.SucceedingTest" name="setTestAndRetrieveValue"/> +</testsuite> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fixture/testsuitexmlparser/org.apache.maven.surefire.test.FailingTest.txt ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fixture/testsuitexmlparser/org.apache.maven.surefire.test.FailingTest.txt b/surefire-its/src/test/resources/fixture/testsuitexmlparser/org.apache.maven.surefire.test.FailingTest.txt new file mode 100644 index 0000000..38abc1f --- /dev/null +++ b/surefire-its/src/test/resources/fixture/testsuitexmlparser/org.apache.maven.surefire.test.FailingTest.txt @@ -0,0 +1,84 @@ +------------------------------------------------------------------------------- +Test set: org.apache.maven.surefire.test.FailingTest +------------------------------------------------------------------------------- +Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.046 sec <<< FAILURE! +defaultTestValueIs_Value(org.apache.maven.surefire.test.FailingTest) Time elapsed: 0.013 sec <<< FAILURE! +java.lang.AssertionError: +Expected: "wrong" + got: "value" + + at org.junit.Assert.assertThat(Assert.java:778) + at org.junit.Assert.assertThat(Assert.java:736) + at org.apache.maven.surefire.test.FailingTest.defaultTestValueIs_Value(FailingTest.java:23) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:601) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) + at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) + at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48) + at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) + at org.junit.runners.ParentRunner.run(ParentRunner.java:236) + at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:262) + at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:151) + at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:122) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:601) + at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) + at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) + at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) + at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:128) + at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:88) + +setTestAndRetrieveValue(org.apache.maven.surefire.test.FailingTest) Time elapsed: 0.001 sec <<< FAILURE! +java.lang.AssertionError: +Expected: "bar" + got: "foo" + + at org.junit.Assert.assertThat(Assert.java:778) + at org.junit.Assert.assertThat(Assert.java:736) + at org.apache.maven.surefire.test.FailingTest.setTestAndRetrieveValue(FailingTest.java:34) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:601) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) + at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) + at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48) + at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) + at org.junit.runners.ParentRunner.run(ParentRunner.java:236) + at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:262) + at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:151) + at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:122) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:601) + at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) + at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) + at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) + at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:128) + at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:88) + http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fixture/testsuitexmlparser/org.apache.maven.surefire.test.SucceedingTest.txt ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fixture/testsuitexmlparser/org.apache.maven.surefire.test.SucceedingTest.txt b/surefire-its/src/test/resources/fixture/testsuitexmlparser/org.apache.maven.surefire.test.SucceedingTest.txt new file mode 100644 index 0000000..9433827 --- /dev/null +++ b/surefire-its/src/test/resources/fixture/testsuitexmlparser/org.apache.maven.surefire.test.SucceedingTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: org.apache.maven.surefire.test.SucceedingTest +------------------------------------------------------------------------------- +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.044 sec http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fork-consoleOutput/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-consoleOutput/pom.xml b/surefire-its/src/test/resources/fork-consoleOutput/pom.xml new file mode 100644 index 0000000..407d86b --- /dev/null +++ b/surefire-its/src/test/resources/fork-consoleOutput/pom.xml @@ -0,0 +1,47 @@ +<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>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-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <forkMode>${forkMode}</forkMode> + <printSummary>${printSummary}</printSummary> + <useFile>true</useFile> + <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> + <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/fork-consoleOutput/src/test/java/forkConsoleOutput/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-consoleOutput/src/test/java/forkConsoleOutput/Test1.java b/surefire-its/src/test/resources/fork-consoleOutput/src/test/java/forkConsoleOutput/Test1.java new file mode 100644 index 0000000..ad18954 --- /dev/null +++ b/surefire-its/src/test/resources/fork-consoleOutput/src/test/java/forkConsoleOutput/Test1.java @@ -0,0 +1,43 @@ +package forkConsoleOutput; + +/* + * 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()); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fork-consoleOutputWithErrors/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-consoleOutputWithErrors/pom.xml b/surefire-its/src/test/resources/fork-consoleOutputWithErrors/pom.xml new file mode 100644 index 0000000..9aa5e1b --- /dev/null +++ b/surefire-its/src/test/resources/fork-consoleOutputWithErrors/pom.xml @@ -0,0 +1,50 @@ +<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>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-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <forkMode>${forkMode}</forkMode> + <printSummary>${printSummary}</printSummary> + <useFile>${userFile}</useFile> + <reportFormat>${reportFormat}</reportFormat> + <redirectTestOutputToFile>${redirect.to.file}</redirectTestOutputToFile> + <includes> + <include>**/Test*.java</include> + </includes> + </configuration> + </plugin> + </plugins> + + </build> + + <properties> + <junit.version>4.8.1</junit.version> + <redirect.to.file>true</redirect.to.file> + <forkMode>once</forkMode> + <printSummary>true</printSummary> + <useFile>true</useFile> + <reportFormat>brief</reportFormat> + <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/fork-consoleOutputWithErrors/src/test/java/forkConsoleOutput/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-consoleOutputWithErrors/src/test/java/forkConsoleOutput/Test1.java b/surefire-its/src/test/resources/fork-consoleOutputWithErrors/src/test/java/forkConsoleOutput/Test1.java new file mode 100644 index 0000000..ad18954 --- /dev/null +++ b/surefire-its/src/test/resources/fork-consoleOutputWithErrors/src/test/java/forkConsoleOutput/Test1.java @@ -0,0 +1,43 @@ +package forkConsoleOutput; + +/* + * 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()); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fork-consoleOutputWithErrors/src/test/java/forkConsoleOutput/Test2.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-consoleOutputWithErrors/src/test/java/forkConsoleOutput/Test2.java b/surefire-its/src/test/resources/fork-consoleOutputWithErrors/src/test/java/forkConsoleOutput/Test2.java new file mode 100644 index 0000000..f5c825e --- /dev/null +++ b/surefire-its/src/test/resources/fork-consoleOutputWithErrors/src/test/java/forkConsoleOutput/Test2.java @@ -0,0 +1,35 @@ +package forkConsoleOutput; + +/* + * 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 Test2 +{ + @Test + public void test6281() + { + System.out.println( "sout: I am talking to you" ); + System.out.println( "sout: Will Fail soon" ); + System.err.println( "serr: And you too" ); + System.err.println( "serr: Will Fail now" ); + throw new RuntimeException( "FailHere" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fork-fail/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-fail/pom.xml b/surefire-its/src/test/resources/fork-fail/pom.xml new file mode 100644 index 0000000..9db6d72 --- /dev/null +++ b/surefire-its/src/test/resources/fork-fail/pom.xml @@ -0,0 +1,60 @@ +<?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>fork-fail</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for failing fork</name> + + <properties> + <argLine>-Xmxxxx712743m</argLine> + <maven.compiler.source>1.7</maven.compiler.source> + <maven.compiler.target>1.7</maven.compiler.target> + </properties> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <forkMode>once</forkMode> + <argLine>${argLine}</argLine> + <redirectTestOutputToFile>true</redirectTestOutputToFile> + </configuration> + </plugin> + </plugins> + </build> + + <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/fork-fail/src/test/java/forkMode/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test1.java new file mode 100644 index 0000000..8c09af6 --- /dev/null +++ b/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test1.java @@ -0,0 +1,58 @@ +package forkMode; + +/* + * 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.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.management.ManagementFactory; + +import junit.framework.TestCase; + +public class Test1 + extends TestCase +{ + + public void test1() + throws IOException + { + dumpPidFile( this ); + } + + public static void dumpPidFile( TestCase test ) + throws IOException + { + String fileName = test.getName() + "-pid"; + File target = new File( "target" ); + if ( !( target.exists() && target.isDirectory() ) ) + { + target = new File( "." ); + } + File pidFile = new File( target, fileName ); + FileWriter fw = new FileWriter( pidFile ); + // DGF little known trick... this is guaranteed to be unique to the PID + // In fact, it usually contains the pid and the local host name! + String pid = ManagementFactory.getRuntimeMXBean().getName(); + fw.write( pid ); + fw.flush(); + fw.close(); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test2.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test2.java b/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test2.java new file mode 100644 index 0000000..33d3cf1 --- /dev/null +++ b/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test2.java @@ -0,0 +1,34 @@ +package forkMode; + +/* + * 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 junit.framework.TestCase; + +public class Test2 + extends TestCase +{ + + public void test2() throws IOException { + Test1.dumpPidFile(this); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test3.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test3.java b/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test3.java new file mode 100644 index 0000000..c8eef74 --- /dev/null +++ b/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test3.java @@ -0,0 +1,34 @@ +package forkMode; + +/* + * 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 junit.framework.TestCase; + +public class Test3 + extends TestCase +{ + + public void test3() throws IOException { + Test1.dumpPidFile(this); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/pom.xml b/surefire-its/src/test/resources/fork-mode-multimodule/module-a/pom.xml new file mode 100644 index 0000000..9de3941 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-multimodule/module-a/pom.xml @@ -0,0 +1,36 @@ +<?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.plugins.surefire</groupId> + <artifactId>fork-mode-multimodule</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>fork-mode-multimodule.module-a</artifactId> + <name>Test for forkMode Module A</name> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java new file mode 100644 index 0000000..7497816 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java @@ -0,0 +1,67 @@ +package forkMode; + +/* + * 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.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.management.ManagementFactory; +import java.util.Random; + +import junit.framework.TestCase; + +public class Test1 + extends TestCase +{ + + private static final Random RANDOM = new Random(); + + public void test1() + throws IOException, InterruptedException + { + int sleepLength = Integer.valueOf( System.getProperty( "sleepLength", "1500" )); + Thread.sleep(sleepLength); + dumpPidFile( this ); + } + + public static void dumpPidFile( TestCase test ) + throws IOException + { + String fileName = test.getName() + "-pid"; + File target = new File( "target" ).getCanonicalFile(); // getCanonicalFile required for embedded mode + if ( !( target.exists() && target.isDirectory() ) ) + { + target = new File( "." ); + } + File pidFile = new File( target, fileName ); + FileWriter fw = new FileWriter( pidFile ); + // DGF little known trick... this is guaranteed to be unique to the PID + // In fact, it usually contains the pid and the local host name! + String pid = ManagementFactory.getRuntimeMXBean().getName(); + fw.write( pid ); + fw.write( " " ); + fw.write( System.getProperty( "testProperty", String.valueOf( RANDOM.nextLong() ) ) ); + fw.flush(); + fw.close(); + System.out.println( "Done Writing pid file" + pidFile.getAbsolutePath() ); + } + + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test2.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test2.java b/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test2.java new file mode 100644 index 0000000..e9d0652 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test2.java @@ -0,0 +1,36 @@ +package forkMode; + +/* + * 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 junit.framework.TestCase; + +public class Test2 + extends TestCase +{ + + public void test2() throws IOException, InterruptedException { + int sleepLength = Integer.valueOf( System.getProperty( "sleepLength", "1500" )); + Thread.sleep(sleepLength); + Test1.dumpPidFile(this); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test3.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test3.java b/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test3.java new file mode 100644 index 0000000..c8eef74 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test3.java @@ -0,0 +1,34 @@ +package forkMode; + +/* + * 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 junit.framework.TestCase; + +public class Test3 + extends TestCase +{ + + public void test3() throws IOException { + Test1.dumpPidFile(this); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/pom.xml b/surefire-its/src/test/resources/fork-mode-multimodule/module-b/pom.xml new file mode 100644 index 0000000..61fd8a0 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-multimodule/module-b/pom.xml @@ -0,0 +1,36 @@ +<?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.plugins.surefire</groupId> + <artifactId>fork-mode-multimodule</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>fork-mode-multimodule.module-b</artifactId> + <name>Test for forkMode Module B</name> + +</project>