maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bogdan Calmac <bcal...@gmail.com>
Subject Running tests twice and the build success status
Date Tue, 09 Nov 2010 21:17:37 GMT

Our project is configured to run the unit tests twice, with oracle and mssql
databases. This is achieved by configuring two executions of the surefire
plugin and passing in a different system property. Here is the relevant
snippet from the POM:

            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <executions>
                <execution>
                  <id>default-test</id>
                  <configuration>
                   
<systemPropertyVariables><testDBTypes>mssql</testDBTypes></systemPropertyVariables>
                   
<reportsDirectory>${project.build.directory}/surefire-reports-mssql</reportsDirectory>
                  </configuration>
                </execution>
                <execution>
                  <id>oracle</id>
                  <phase>test</phase>
                  <goals><goal>test</goal></goals>
                  <configuration>
                   
<systemPropertyVariables><testDBTypes>oracle</testDBTypes></systemPropertyVariables>
                   
<reportsDirectory>${project.build.directory}/surefire-reports-oracle</reportsDirectory>
                  </configuration>
                </execution>
              </executions>
            </plugin>


This setup works fine but we've recently discovered that the build appears
as successful when the mssql tests pass and the oracle tests fail. The build
continues and the artifacts are deployed as if nothing happened. It looks
like the mssql execution sets some flag that tests passed and it doesn't
matter what happens with the oracle execution.

Any idea how to get the build to fail when either of the test executions
fail (which is the common-sense expectation)?

Could this be just a bug or are we abusing surefire with this kind of
configuration?

We are using maven 2.2.1, surefire 2.6 and testng 5.14.1

Also, here is the relevant console output for the build:

[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory:
c:\hudson\jobs\commons\workspace\target\surefire-reports-mssql

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
...
Tests run: 374, Failures: 0, Errors: 0, Skipped: 0

[HUDSON] Recording test results
[INFO] [surefire:test {execution: oracle}]
[INFO] Surefire report directory:
c:\hudson\jobs\commons\workspace\target\surefire-reports-oracle

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
Tests run: 374, Failures: 2, Errors: 0, Skipped: 0

[ERROR] There are test failures.

Please refer to
c:\hudson\jobs\commons\workspace\target\surefire-reports-oracle for the
individual test results.
[HUDSON] Recording test results
[INFO] [jar:jar {execution: default-jar}]
[INFO] [install:install {execution: default-install}]
[INFO] [deploy:deploy {execution: default-deploy}]
Uploading:
http://hudson/nexus/content/repositories/snapshots/com/knoa/knoa-commons/5.6.3-SNAPSHOT/knoa-commons-5.6.3-SNAPSHOT-sources.jar
221K uploaded  (knoa-commons-5.6.3-SNAPSHOT-sources.jar)
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 10 minutes 16 seconds
[INFO] Finished at: Tue Nov 09 15:05:44 EST 2010
[INFO] Final Memory: 19M/47M
[INFO]
------------------------------------------------------------------------

-- 
View this message in context: http://maven.40175.n5.nabble.com/Running-tests-twice-and-the-build-success-status-tp3257693p3257693.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message