Author: lektran
Date: Sat Nov 21 21:20:50 2009
New Revision: 882995
URL:
http://svn.apache.org/viewvc?rev=882995&view=revLog:
Throw a ContainerException if any tests are unsuccessful during a test run and have the run-tests target fail if that is the case
Modified:
ofbiz/trunk/build.xml
ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java
Modified: ofbiz/trunk/build.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/build.xml?rev=882995&r1=882994&r2=882995&view=diff==============================================================================
--- ofbiz/trunk/build.xml (original)
+++ ofbiz/trunk/build.xml Sat Nov 21 21:20:50 2009
@@ -433,7 +433,7 @@
</target>
<target name="run-tests" depends="build"
description="Run OFBiz default tests">
- <java jar="ofbiz.jar" fork="true">
+ <java jar="ofbiz.jar" fork="true" failonerror="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${memory.maxpermsize.param}"/>
Modified: ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java?rev=882995&r1=882994&r2=882995&view=diff==============================================================================
--- ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java (original)
+++ ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java Sat Nov 21 21:20:50 2009
@@ -120,6 +120,7 @@
throw new ContainerException("No tests found (" + component + " / " + suiteName + " / " + testCase + ")");
}
+ boolean failedRun = false;
for (ModelTestSuite modelSuite: jsWrapper.getModelTestSuites()) {
Delegator testDelegator = modelSuite.getDelegator();
TestSuite suite = modelSuite.makeTestSuite();
@@ -148,6 +149,10 @@
testDelegator.rollback();
xml.endTestSuite(test);
+ if (!results.wasSuccessful()) {
+ failedRun = true;
+ }
+
// display the results
Debug.log("[JUNIT] Results for test suite: " + suite.getName());
Debug.log("[JUNIT] Pass: " + results.wasSuccessful() + " | # Tests: " + results.runCount() + " | # Failed: " +
@@ -184,6 +189,9 @@
}
}
+ if (failedRun) {
+ throw new ContainerException("Test run was unsuccessful");
+ }
return true;
}