|
Re: customizing the suiterunner
|
Posted: Mar 28, 2003 8:11 PM
|
|
> Hi All, > I have come across a new problem now. I want to > to customize the suiterunner. I have written certain Test > Suites. For a Test Suite, the Artima SuiteRunner executes > all the test methods inside it. I want to execute the > test methods inside it selectively (based on some > criteria). For instance, say based on the value of some > flag, I want to execute only a subset of test methods for > a given value of the flag. How to make this possible? The > value of the flag ofcourse has to be passed on the > command line. But I don't know how to pass a flag value > to the suiterunner as a commandline parameter. > Thanx and regards
What you need to do is override executeTestMethods in your Suite subclass. That is the method that executes test methods. You can change it to look at a Java property, which you can define on the command line, and use that to decide which test methods to invoke.
In the near future, I plan to enhance SuiteRunner so that you can specify user defined properties in the recipe file. I always planned to do this. Just haven't had time to do it yet. That will be the best way to pass user-defined properties to your executeTestMethods once the enhancement is in place. For the time being, you'll need to use plain old Java properties.
For an example of overriding the execute method, which is similar to overriding executeTestMethods , see:
http://www.artima.com/suiterunner/scriptdriven.html
Here's an example of starting SuiteRunner and specifying a Java property (with the -D):
java -DScriptFile=generatedscript.txt -jar suiterunner-1.0beta6.jar accountscript.srj
The previous example is from page 11 of the above article:
http://www.artima.com/suiterunner/scriptdriven11.html
|
|