maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1051569 - in /maven/surefire/trunk: surefire-api/src/main/java/org/apache/maven/surefire/suite/ surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ surefire-integration-tests/src/test/resources/surefire-674-buildFailing...
Date Tue, 21 Dec 2010 17:22:11 GMT
Author: krosenvold
Date: Tue Dec 21 17:22:11 2010
New Revision: 1051569

URL: http://svn.apache.org/viewvc?rev=1051569&view=rev
Log:
[SUREFIRE-674] Errors should fail build. Surefire+failsafe affected

Added:
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire674BuildFailingWhenErrorsIT.java
  (with props)
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml
  (with props)
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/src/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/src/test/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/src/test/java/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/src/test/java/resultcounting/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/src/test/java/resultcounting/Test2.java
  (with props)
Modified:
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java?rev=1051569&r1=1051568&r2=1051569&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java
(original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java
Tue Dec 21 17:22:11 2010
@@ -68,7 +68,7 @@ public class RunResult
 
     public int getBooterCode()
     {
-        return getFailures() == 0 ? SUCCESS : FAILURE;
+        return getFailures() == 0 && getErrors() == 0 ? SUCCESS : FAILURE;
     }
 
 }

Added: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire674BuildFailingWhenErrorsIT.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire674BuildFailingWhenErrorsIT.java?rev=1051569&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire674BuildFailingWhenErrorsIT.java
(added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire674BuildFailingWhenErrorsIT.java
Tue Dec 21 17:22:11 2010
@@ -0,0 +1,44 @@
+package org.apache.maven.surefire.its;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+
+/**
+ * SUREFIRE-674 Asserts that the build fails when tests have errors
+ *
+ * @author Kristian Rosenvold
+ */
+public class Surefire674BuildFailingWhenErrorsIT
+    extends AbstractSurefireIntegrationTestClass
+{
+    public void testBuildFailingWhenErrors()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/surefire-674-buildFailingWhenErrors"
);
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        this.executeGoal( verifier, "test" );
+        verifier.resetStreams();
+        verifier.verifyTextInLog(  "BUILD FAILURE");
+    }
+}
\ No newline at end of file

Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire674BuildFailingWhenErrorsIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml?rev=1051569&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml
(added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml
Tue Dec 21 17:22:11 2010
@@ -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/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.surefire</groupId>
+  <artifactId>buildFailingWhenErrors</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>buildFailingWhenErrors</name>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>${junit.version}</version>
+    </dependency>
+  </dependencies>
+  <build>
+     <plugins>
+        <plugin>
+           <groupId>org.apache.maven.plugins</groupId>
+           <artifactId>maven-compiler-plugin</artifactId>
+           <configuration>
+              <source>1.5</source>
+              <target>1.5</target>
+           </configuration>
+        </plugin>
+        <plugin>
+           <groupId>org.apache.maven.plugins</groupId>
+           <artifactId>maven-surefire-plugin</artifactId>
+           <version>${surefire.version}</version>
+           <configuration>
+             <forkMode>${forkMode}</forkMode>
+             <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>
+  </properties>
+</project>

Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/src/test/java/resultcounting/Test2.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/src/test/java/resultcounting/Test2.java?rev=1051569&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/src/test/java/resultcounting/Test2.java
(added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/src/test/java/resultcounting/Test2.java
Tue Dec 21 17:22:11 2010
@@ -0,0 +1,15 @@
+package resultcounting;
+
+import org.junit.Test;
+
+/**
+ * A test that causes an error
+ * @author Kristian Rosenvold
+ */
+public class Test2 
+{
+    @Test
+    public void testWithException1() {
+        throw new RuntimeException("We expect this");
+    }
+}
\ No newline at end of file

Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-674-buildFailingWhenErrors/src/test/java/resultcounting/Test2.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message