incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ewor...@apache.org
Subject svn commit: r612704 - in /incubator/nmaven/trunk: core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/ core-integration-tests/src/test/resources/MavenITmng-0019-BuildFailureOnNUnitFailure/ core-integration-tests/src/test/resou...
Date Thu, 17 Jan 2008 04:38:05 GMT
Author: eworley
Date: Wed Jan 16 20:38:03 2008
New Revision: 612704

URL: http://svn.apache.org/viewvc?rev=612704&view=rev
Log:
* Adding IT0019 which should someday verify that a build fails when an nunit test fails, but
I am unsure how to do this with current IT framework
* Made DotnetTestMojo fail when nunit-console fails, added command line execution result to
debug output

Added:
    incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0019BuildFailureOnNUnitFailure.java
    incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0019-BuildFailureOnNUnitFailure/
    incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0019-BuildFailureOnNUnitFailure/pom.xml
    incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0019-BuildFailureOnNUnitFailure/test/
    incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0019-BuildFailureOnNUnitFailure/test/It0007.cs
Modified:
    incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/IntegrationTestSuite.java
    incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java

Modified: incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/IntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/IntegrationTestSuite.java?rev=612704&r1=612703&r2=612704&view=diff
==============================================================================
--- incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/IntegrationTestSuite.java
(original)
+++ incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/IntegrationTestSuite.java
Wed Jan 16 20:38:03 2008
@@ -48,6 +48,7 @@
         suite.addTestSuite( MavenITmng0016CSharpAssemblyInfoGeneration.class );
         suite.addTestSuite( MavenITmng0017CSharpStrongNamedAssembly.class );
         suite.addTestSuite( MavenITmng0018CSharpSynchronizeTargetWithSource.class );
+        suite.addTestSuite( MavenITmng0019BuildFailureOnNUnitFailure.class );
         return suite;
     }
 }

Added: incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0019BuildFailureOnNUnitFailure.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0019BuildFailureOnNUnitFailure.java?rev=612704&view=auto
==============================================================================
--- incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0019BuildFailureOnNUnitFailure.java
(added)
+++ incubator/nmaven/trunk/core-integration-tests/src/test/java/org/apache/maven/dotnet/integrationtests/MavenITmng0019BuildFailureOnNUnitFailure.java
Wed Jan 16 20:38:03 2008
@@ -0,0 +1,24 @@
+package org.apache.maven.dotnet.integrationtests;
+
+import java.io.File;
+
+import org.apache.maven.integrationtests.AbstractMavenIntegrationTestCase;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+public class MavenITmng0019BuildFailureOnNUnitFailure
+    extends AbstractMavenIntegrationTestCase
+{
+    public void testit0019()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/MavenITmng-0019-BuildFailureOnNUnitFailure"
);
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.executeGoal( "test" );
+        
+        
+        // TODO: Need to verify that the build failed!
+        
+        verifier.resetStreams();
+    }
+}

Added: incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0019-BuildFailureOnNUnitFailure/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0019-BuildFailureOnNUnitFailure/pom.xml?rev=612704&view=auto
==============================================================================
--- incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0019-BuildFailureOnNUnitFailure/pom.xml
(added)
+++ incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0019-BuildFailureOnNUnitFailure/pom.xml
Wed Jan 16 20:38:03 2008
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>NMaven.Its</groupId>
+  <artifactId>NMaven.It.It0019</artifactId>
+  <packaging>dotnet:library</packaging>
+  <version>1.0.0</version>
+  <name>NMaven.It.It00019</name>
+
+  <build>
+    <sourceDirectory>src</sourceDirectory>
+    <testSourceDirectory>test</testSourceDirectory>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.dotnet.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <extensions>true</extensions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.dotnet.plugins</groupId>
+        <artifactId>dotnet-test-plugin</artifactId>
+        <configuration>
+            <arguments>
+                <param>/nologo</param>
+                <param>/labels</param>
+            </arguments>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.dotnet</groupId>
+      <artifactId>NUnit.Framework</artifactId>
+      <version>2.4.6-incubating-SNAPSHOT</version>
+      <type>dotnet:library</type>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <repositories>
+    <repository>
+      <id>m2-snapshot</id>
+      <name>Maven2 Snapshot Repository</name>
+      <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+</project>

Added: incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0019-BuildFailureOnNUnitFailure/test/It0007.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0019-BuildFailureOnNUnitFailure/test/It0007.cs?rev=612704&view=auto
==============================================================================
--- incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0019-BuildFailureOnNUnitFailure/test/It0007.cs
(added)
+++ incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0019-BuildFailureOnNUnitFailure/test/It0007.cs
Wed Jan 16 20:38:03 2008
@@ -0,0 +1,19 @@
+using System;
+using NUnit.Framework;
+
+namespace NMaven.IT {
+
+    [TestFixture]
+	public class It0019 {
+		[Test] 
+		public void testSimple1() {
+		    Assertion.AssertEquals(1, 1);
+		}
+		
+		[Test] 
+		public void testSimple2() {
+			// Forced failure
+		    Assertion.AssertEquals(2, 3);
+		}
+	}
+}

Modified: incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java?rev=612704&r1=612703&r2=612704&view=diff
==============================================================================
--- incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java
(original)
+++ incubator/nmaven/trunk/plugins/dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java
Wed Jan 16 20:38:03 2008
@@ -95,23 +95,31 @@
         NUnitStreamConsumer systemOut = new NUnitStreamConsumer( getLog() );
         NUnitStreamConsumer systemErr = new NUnitStreamConsumer( getLog() );
 
+        int commandLineResult = -999;
+        
         try
         {
             // Execute the commandline
-            CommandLineUtils.executeCommandLine( commandline, systemOut, systemErr );
+            commandLineResult = 
+                CommandLineUtils.executeCommandLine( commandline, systemOut, systemErr );
+            
+            getLog().debug( "Executed command: " + commandline + ", Result = " + commandLineResult);
 
             // Check if nunit-console is not in the path
             if ( systemErr.isCommandNotFound() )
             {
                 throw new MojoExecutionException( "Please add nunit-console to your path"
);
             }
+            else if ( commandLineResult != 0 )
+            {
+                throw new MojoFailureException( "There were NUnit test failure(s)" );
+            }
         }
         catch ( CommandLineException e )
         {
             throw new MojoExecutionException( "Failure executing commandline, " + e.getMessage()
);
         }
 
-        getLog().debug( "Executed command: " + commandline );
 
         getLog().info( "Done executing tests.." );
     }



Mime
View raw message