The
MessageDriver node declared in apps/basics can be used to
drive any other application node, essentially providing a messaging test
harness, which forms the basis for a regression test suite. Here's how
to set this up.
Create a test Configuration
Using the TestScriptEditor (link provided on your app
deployment page), create a new
Configuration to use for your test. The config should include the
initial data and setup information normally available for your app, but
instead of a listing all the nodes in your deployment, it would have only a
MessageDriverNodeInstance and an instance of the node being
tested. The test node points to the MessageDriver for all of
its inbound and outbound messaging.
Create a TestScript
Again using the TestScriptEditor, create a
TestScript and set the configuration file to your test config. Then
add enough initial data to satisfy any startup queries needed by the test
node, and record the messaging test steps.
Create a testsuite build target
In your deployment build.xml file create a target like:
<target name="testsuite">
<get src="http://localhost:8080/XYZ_XYZMain/XYZ?testfile=../test/MyTest1.xml"
dest="../test/MyTest1.out" verbose="true"/>
<exec executable="cat"><arg line="../test/MyTest1.out"/></exec>
</target>
Then ant testsuite to run your test. Multiple tests can be
run in succession, so as you define more tests, add them to your
testsuite target.
After receiving the first test directive, the UI will be left in test mode ready to run another test. To return to normal application mode, insert the following line after your last test:
<get src="http://localhost:8080/XYZ_XYZMain/XYZ?testfile=done"
dest="../test/done.out"/>
The "done" parameter value signals the UI to switch back to normal.
However it is recommended that you restart your local server (ant
stop, ant start) to ensure that all singleton variables
and memory structures are reinitialized before doing any manual testing.
You can run the testsuite target anytime as part of a local build to verify your application nodes still behave as expected.