[jboss-svn-commits] JBL Code SVN: r29433 - in labs/jbosstm/trunk/qa: tests/src/org/jboss/jbossts/qa/junit and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Sep 22 09:55:54 EDT 2009


Author: jhalliday
Date: 2009-09-22 09:55:53 -0400 (Tue, 22 Sep 2009)
New Revision: 29433

Modified:
   labs/jbosstm/trunk/qa/run-tests.xml
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/junit/TestGroupBase.java
Log:
Add ability to filter tests by name. JBTM-390


Modified: labs/jbosstm/trunk/qa/run-tests.xml
===================================================================
--- labs/jbosstm/trunk/qa/run-tests.xml	2009-09-22 10:23:56 UTC (rev 29432)
+++ labs/jbosstm/trunk/qa/run-tests.xml	2009-09-22 13:55:53 UTC (rev 29433)
@@ -42,7 +42,10 @@
     <!-- handy utility space where you can copy one or more test groups if you want to run something ad-hoc -->
     <target name="scratch">
 
-        <antcall target="junit-tests"><param name="tests" value="jtatests01"/></antcall>
+        <antcall target="junit-tests">
+            <param name="tests" value="jtatests01"/>
+            <param name="names" value="Test00[2|3]"/>
+        </antcall>
         
     </target>
 
@@ -294,6 +297,9 @@
     <!-- This is where all the hard work happens - use junit to coordinate multi-process tests: -->
     <target  name="junit-tests">
 
+        <!-- pass in a param to override this. by default run everything. -->
+        <property name="names" value=".*"/>
+
         <!-- TODO support JTA mode testing of JTS .jar files? -
             would need classpath munging for props file in TaskImpl.properties -->
 
@@ -334,6 +340,8 @@
 
             <test name="org.jboss.jbossts.qa.junit.testgroup.TestGroup_${tests}"/>
 
+            <sysproperty key="names" value="${names}"/>
+
             <!--<jvmarg value="-Xdebug"/>-->
             <!--<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"/>-->
 

Modified: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/junit/TestGroupBase.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/junit/TestGroupBase.java	2009-09-22 10:23:56 UTC (rev 29432)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/junit/TestGroupBase.java	2009-09-22 13:55:53 UTC (rev 29433)
@@ -23,6 +23,7 @@
 import org.junit.Before;
 import org.junit.After;
 import org.junit.Assert;
+import org.junit.Assume;
 
 import java.io.*;
 
@@ -59,8 +60,21 @@
     // inform us of it explicitly.
     protected void setTestName(String testName) {
         this.testName = testName;
+        checkIncludes();
     }
 
+    protected void checkIncludes() {
+        String includePattern = System.getProperty("names");
+        if(includePattern != null && testName != null) {
+            if(!testName.matches(includePattern)) {
+                System.out.println("TestGroupBase.checkIncludes: skipping test "+testName+" as it does not match 'names' pattern "+includePattern);
+                 // 'assume' causes the default junit4 runner to behave as with @Ignore
+                // except that @setUp has already run and @tearDown will still run.
+                Assume.assumeTrue(false);
+            }
+        }
+    }
+
     public Task createTask(String taskName, Class clazz, Task.TaskType taskType, int timeout) {
         OutputStream out;
         String filename = "./testoutput/"+getTestGroupName()+"/"+(testName == null ? "" : testName+"/")+taskName+"_output.txt";



More information about the jboss-svn-commits mailing list