|
|
|
Artima SuiteRunner |
Why |
Getting Started |
Tutorial |
Get Help |
Discuss |
Print |
Email |
First Page |
Previous |
Next
|
Suite Execution by Overriding execute
|
Advertisement
|
ScriptDrivenAccountSuite for a Spin
To make it easy to try ScriptDrivenAccountSuite, I added a new recipe file, scriptdriven.srj, and
a sample test script file, script.txt, to the
Artima SuiteRunner distribution ZIP file in version 1.0beta6.
If you have a release prior to 1.0beta6, please download the
latest version of Artima SuiteRunner. Once you unzip the distribution ZIP file, you'll find scriptdriven.srj
in the suiterunner-[release] directory. Here are the contents of scriptdriven.srj:
org.suiterunner.Suites=-s com.artima.examples.scriptdriven.ex1.ScriptDrivenAccountSuite org.suiterunner.Runpath=-p "example" org.suiterunner.Reporters=-g
In scriptdriven.srj:
org.suiterunner.Runpath (-p "example") specifies a runpath with a single
directory, example.
org.suiterunner.Suites (-s com.artima.examples.scriptdriven.ex1.ScriptDrivenAccountSuite)
indicates Artima SuiteRunner should load the specified class, a subclass of org.suiterunner.Suite,
and invoke its execute method.
org.suiterunner.Reporters (-g)
indicates that Artima SuiteRunner will display its graphical user interface (GUI) and show the
results of the run there.
When invoked via the previous command that specifies scriptdriven.srj as a command line parameter,
Artima SuiteRunner will:
URLClassLoader that can load classes from the example directory, the directory specified via
the recipe file's org.suiterunner.Runpath property.
URLClassLoader, load class com.artima.examples.scriptdriven.ex1.ScriptDrivenAccountSuite, the
class specified in via the recipe file's org.suiterunner.Suites property.
com.artima.examples.scriptdriven.ex1.ScriptDrivenAccountSuite class is a subclass of org.suiterunner.Suite.
com.artima.examples.scriptdriven.ex1.ScriptDrivenAccountSuite.
execute on the com.artima.examples.scriptdriven.ex1.ScriptDrivenAccountSuite instance.
org.suiterunner.Reporters property.
To see the ScriptDrivenAccountSuite in action, run the following command from the suiterunner-[release] subdirectory of
the directory in which you unzipped the Artima SuiteRunner
distribution ZIP file:
java -jar suiterunner-[release].jar scriptdriven.srj
When you execute the previous command, you should see results similar to those shown in Figure 2. Because the previous command doesn't set
the ScriptFile system property, ScriptDrivenAccountSuite will use its default script file name, script.txt.
This script file, which sits alongside scriptdriven.srj, contains 23 tests, six of which fail. The six failures are caused
by a bug introduced intentionally into class Account to demonstrate how Artima SuiteRunner reports failed tests. If you
fix this bug and rerun the previous command, you should get 23 successful tests and a satisfying green bar.

Figure 2. ScriptDrivenAccountSuite results for script script.txt
|
Sponsored Links
|