8. Reference Guide
A TestScenario XML document provides all the orchestration instructions to operate a functional test, load and performance test, and business service monitor in TestMaker. This page is the reference guide to TestScenario documents.
Reference Guide
A TestScenario XML document provides all the orchestration instructions to operate a functional test, load and performance test, and business service monitor in TestMaker. This page is the reference guide to TestScenario documents.
A TestScenario XML document provides all the orchestration instructions to operate a functional test, load and performance test, and business service monitor in TestMaker. This page is the reference guide to TestScenario documents.
Overview of this Section
This section contains the following sections:
Logging To A Relational Database Management Server (RDBMS)
<testusecase> For a Single Dimension Functional Test
<testusecase> for Load Tests to Determine a Scalability Index
<testusecase> for a Multi-Dimensional Test
<sequence> for Multiple Testusecases
<while> - Variable Test Use Case Periods
TestScenario Reference
A TestScenario is a complete definition of a functional test, load test and service monitor. TestScenario documents follow an XML Schema Definition (XSD) found at http://downloads.pushtotest.com/tm5/testscenario.xsd
Examples of TestScenario documents used in functional, load, scalability and performance tests plus service monitors are found in the Tutorials.
<basics>

Defines the TestScenario name and default directory.
<defaultdirectory>./geospatialtest</defaultdirectory/>
<description>Test description if desired</description>
The <name> element defines the test scenario name. TestMaker uses the name in the Controller Panel, in the status Output Panel and in the results files. The <defaultdirectory> element defines the default path to find scripts, JAR files and other resources. The <desciption> element stands for a brief description of the test.
About Paths And The Default Directory
PushToTest TestMaker works well in a distributed environment where developers and QA engineers run tests within any
directory structure (i.e. wherever they've checked out the project files). TestMaker TestScenario test orchestration documents determine the default directory path for test resources. The following options overriding the default directory and other elements in the TestScenario. For example, consider the following directory structure:
ScenarioDirectory
- Scenarios
- - MyScenario.xml
- Resources
- - resource.csv
TestMaker provides a {scenario} operator that resolves to the path of the TestScenario document. This operator may be used in the <defaultdirectory> element, in <resource> elements, and in individual resource paths. For example. use the above resource.csv with
path="{scenario}/../Resources/resource.csv"
The following is also valid:
Defaultdirectory ="{scenario}/../" and path="Resources/resource.csv"
<testnodes>

Defines a TestNode name and URL for running the test.
<node name="node1" location="http://localhost:8080/TestNetwork/TestNode"/>
TestMaker provides an special form of the <node> tag to identify a TestNode and a PTTMonitor.
<testnodes>
<node
name="node1"
location="http://localhost:8080/TestNetwork/ws/TestNode"
monitor="http:///localhost:51111"/>
</testnodes>
<arguments>

Defines a set of name / value pairs passed to running tests; allows for parameterized test scenarios
<argument name="targethost" value="10.0.0.1/gis"/>
<argument name="id" value="admin"/>
<argument name="password" value="admin"/>
A running test has access to the name / value pairs through a dictionary (Jython) or HashMap (JAVA).
<resources>

Identifies files to be dynamically loaded when the test is run on a TestNode
<testgen4web path="./PTT_Examples_UnitTest.testgen4web"/>
<soapui path="example_agents/soapui_examples/PTT_Examples-soapui-project.xml"/>
<module name="myJythonModule" path="./example_agents/scriptTutorial/example1.py"/>
<module name="myRubyModule" path="./example_agents/rubyExample/calc.rb"/>
<selenese path="CalendarTest.selenium"/>
<data path="./example_agents/dplCSVExample/csv.txt"/>
TestScenarios recoganizes several types of resource files described in the following:
- • <jar> - JAVA Archive Resource containing compiled JAVA classes and data.
- • <testgen4web> - TestGen4Web recorded unit tests of a Web application.
- • <soapui> - soapUI recorded test suite of a soap-based Web service.
- • <module> - a unit test script.
- • <data> - any data file, including a comma separated value file, an image file, a file the unit test will use for validation. They are accessed using DPL resources.
- • <selenese> - Selenium recorded test suite of a Web application.
<DataSources> and Data Production Library (DPL)

Identifies Data Production Library (DPL) providing dynamic operational test data when the test is run.
library="./example_agents/dplExample/dplSimple.jar" lang="java"
classname="com.dpl.SimpleDPL"/>
<dpl name="lingo" type="LingoDPL"/>
<dpl name="simple" type="SimpleDPL">
<argument name="argrun2" value="Data"/>
<dpl name="simple" type="SimpleDPL">
<argument name="argrun2" dpl="lingo" value="getNextData"/>
See the Data Production Library page for examples of the DataSources function, including HashDPL, dplCSVExample, dplExample, and counterDPLExample. DPL can use standard arguments and DPL arguments from previous defined DPLs.
<logs>

Defines one or more log handlers handling logged entries during a running test
<log type="file" path="logs/mylog.txt" level="2"/>
The <logs> option includes optional attributes to contract the summary reports for a load test
<logs summaryreport="true" showsummary="true"/>
In the above example summaryreport tells TestMaker to save all charts and create the summary report in HTML form for easier sharing of test results. The showsummary attribute opens the summary report in a browser at the end of a load TestScenario.
<logs logerror="true"/>
The logerror option tells the TestNodes to capture console exception messages to a log file. This is useful while debugging a test.
Step Logging

Step logging enables root cause analysis of slowly performing steps within a transaction. For instance, the following TestScenario defines a transaction with three steps: geo_insert, geo_query, geo_update, geo_delete
<run name="geo_insert" testclass="com.pushtotest.example.test"
method="insert" langtype="java"/>
<run name="geo_query" testclass="com.pushtotest.example.test"
method="query" langtype="java"/>
<run name="geo_update" testclass="com.pushtotest.example.test"
method="update" langtype="java"/>
<run name="geo_delete" testclass="com.pushtotest.example.test"
method="delete" langtype="java"/>
With step logging enabled, each <run> is a step within the test transaction. PushToTest logs the step values to a transaction log. For instance, the following is part of a transaction log for the above testusecase
<testmakerlog version="200" usecase="Selenese usecase" target="AppHost"
node="localhost" dataindex="1" description="Selenese usecase" users="1" duration="60">
<results>
<tx id="0" seq="0" dur="4594" res="true" ts="1224604845575">
<steps times="1469,16,15,1766"/>
</tx>
<tx id="0" seq="0" dur="1719" res="true" ts="1224604851169">
<steps times="891,15,16,453"/>
</tx>
…
</results>
<definitions>
<sequence name="Selenese sequence" id="0">
<step id="0" name="geo_insert"/>
<step id="1" name="geo_query"/>
<step id="2" name="geo_update"/>
<step id="3" name="geo_delete"/>
</sequence>
</definitions>
<duration seconds="67"/>
</testmakerlog>
The <step> entries show the time it took to perform each step.To enable step logging add the following to the <logging> element in a TestScenario.
<logs summaryreport="true" showsummary="false" step="true"/>
The <step> entries show the time it took to perform each step.To enable step logging add the following to the <logging> element in a TestScenario
<logs summaryreport="true" showsummary="false" step="true"/>
User Defined Log Step Entries in Test Scripts

Tests implemented in Java, Jython, and other script languages support user defined log entries. TestMaker implements a special log listener at com.pushtotest.tool.PTTStepListener. Use the following method call to log step information within a test script:
import com.pushtotest.tool.PTTStepListener;
public class tester {
public void runTest()
{
PTTStepListener.startStep( "my custom step log entry" );
/* Perform my test step here /*
PTTStepListener.endStep();
}
TestMaker uses the string value given in startStep as the name of the step. This value appears in the transaction log files as a sequence step name. The PTTStepListener lets you create an arbitrary number of steps. However, each operation of the test use case must contain the same number of steps.
Logging To A Relational Database Management Server (RDBMS)

Using a database logger, PushToTest TestMaker stores data in a Relational Database Management Server (RDBMS) database including results, performance snapshots and all other statistics. This is a description of that database schema:

To enable RDBMS logging, create the database and tables. See testmaker_home/docs/resources/Standard_DB_for_logging.sql for commands to create the database and tables in MySQL. Then, add the following lines to a TestScenario document:
<log type="console" level="info"/>
<log type="file" path="mylog.txt" level="info"/>
connector="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/testmaker"
Use multiple RDBMS log handlers to log data to multiple databases. The database default name is testmaker , but it can be easily changed.
<functionaltest>

Operate a testusecase in a single concurrent virtual user (CVU). The repeat attribute specifies the number of times to run the testusecase
TestMaker displays a Functional Test in the following styled controller panel.

<loadtest>

Operate a testusecase in multiple concurrent virtual users (CVUs)
The testusecase requires <dimensions> and <crlevels> elements.
TestMaker displays a Load Test in the following styled controller panel.

<monitor>

Periodically operate a testusecase in a single concurrent virtual user (CVU). The timeBetweenTest element identifies the number of milliseconds (1000 milliseconds = 1 second) to wait between operations. This <monitor> element requires the <until> element to define the exceptions that stop the monitor
<monitor timeBetweenTest="10000">
<exception type="java.lang.Exception"></exception>
Service monitors show an up-or-down icon to indicate the last known condition of the service under test.

<shocktest>

<shocktest> makes concurrent requests to an application host. A ShockTest stages a test by communicating a test usecase - defined in a TestScenario - to the defined TestNode(s). Each TestNode instantiates the needed number of threads. The threads execute the test usecase immediately when all the Threads on all of the TestNodes exist. The threads run the test use case once and then the test ends. The results directory for the ShockTest updates with the time it took to operate all of the threads on all the TestNodes.
<ShockTest>
<testusecase>
<dimensions>
<usecases>
<usecase name="Untitled_usecase">
<sequence name="Untitled_sequence" proportion="100">
<test>
<run
name="Appcelerator"
instance="I1"
testclass="org.appcelerator.client.ServiceBrokerClient" method="run"
langtype="java">
<argument name="theUrl" value="http://localhost:8080/AjaxService/"/>
<argument name="message" value="Hello World"/>
</run>
</test>
</sequence>
</usecase>
</usecases>
</dimensions>
</testusecase>
</ShockTest>
<options>

Defines default and optional values for the test. The following child tags may be put within the <options> command.
Sleeptime sets the duration TestMaker waits between running the test use case. The value is milliseconds (1000 = 1 second.) Set the value to 0 for no delay.
<delayBetweenStartingUseCases time="10"/>
delayBetweenStartingUseCases sets the delay time between starting concurrently running user. TestMaker creates one Thread for each simulated user. This option facilitates pacing the amount of time it takes to stage a load and performance test. The value is milliseconds (1000 = 1 second.) Set the value to 0 for no delay.
<delayBetweenTestCases time="60"/>
delayBetweenTestCases sets the duration TestMaker waits between running a concurrently running simulated user level (CRLEVEL) in a load and performance test. The value is milliseconds (1000 = 1 second.) Set the value to 0 for no delay.
testTime sets the amount of time TestMaker operates a concurrently running simulated user level (CRLEVEL) in a load and performance test. The value is milliseconds (1000 = 1 second.) Set the value to 0 for no delay. The <testTime> value does not include the time setup the test - when the TestNodes instantiate the Threads - or the time it takes to teardown the threads.
<target name="PushToTest_WebServer"/>
Target sets the name of the target application host under test. TestMaker uses the target name of AppHost if none is defined in the TestScenario.
<htmlunit
DebuggingWebConnection="true"
HtmlUnitContextFactory="true"
XmlTestResultImpl="true"
Csswarning="true"
Jswarning="true"/>
TestMaker uses the HTMLUnit Web browser to operate Selenium (not Selenium RC) and TestGen4Web tests. The <htmlunit> tag controls many features that come with HTMLUnit. The options contains the following tag options:
• DebuggingWebConnection a wrapper around a "real" WebConnection that will use the wrapped web connection to do the real job and save all received responses in the your local operating environment's temp directory with an overview page. This may be useful at test development/debug time to understand what is "browsed". For more information check HTMLUnit documentation.
• HtmlUnitContextFactory enables or disables the HTMLUnit debugger that logs stack entries and exceptions. Enabling the debugger may be useful if HtmlUnit is having trouble with JavaScript, especially if you are using some of the more advanced libraries like Dojo, Prototype or jQuery. Currently only implemented for TestGen4Web.
• XmlTestResultImpl logs results using xml output. Currently only implemented for TestGen4Web.
• Jswarning supresses JavaScript warnings to avoid excessive logging that may artificially increase transaction duration. Useful in load testing.
• Csswarning supresses CSS warnings to avoid excessive logging that may artificially increase transaction duration. Useful in load testing.
TestMaker uses the <Selenium>option to the system start the internal Selenium remote control (Selenium RC) server and control logging and behavior. Control logging and exception handling for Selenium tests (langtype="selenium"):
<selenium
loglevel="off"
throwExceptionOnFailingStatusCode="true"
throwExceptionOnScriptError="true"/>
• loglevel = "off", "info", "debug" controls the Selenium HTMLUnit logging
• throwExceptionOnFailingStatusCode, when set to true HTMLUnit will ignore errors when the source of an external script cannot be loaded
• throwExceptionOnScriptError, when set to true HTMLUnit will ignore JavaScript execution errors
<notifications>

Sets the notification parameters for the email notification triggered when a test changes state
<email on="start" email=" This e-mail address is being protected from spambots. You need JavaScript enabled to view it "/>
<email on="end" email=" This e-mail address is being protected from spambots. You need JavaScript enabled to view it "/>
<email on="interrupted" email=" This e-mail address is being protected from spambots. You need JavaScript enabled to view it "/>
<email on="testcasestart" email=" This e-mail address is being protected from spambots. You need JavaScript enabled to view it "/>
<email on="hourly" email=" This e-mail address is being protected from spambots. You need JavaScript enabled to view it "/>
<username value="yourUsename"/>
<password value="yourPassword"/>
<hostname value="YourMailHost"/>
<email on="start" email="EmailDirection" subject="test scenario started"
message="The test started. - From Pushtotes"/>
<email on="testcasestart" email="EmailDirection"
<email on="end" email="EmailDirection"
message="The test scenario had ended. - From push to test"/>
<testusecase>

Defines the functional test made-up of one or more unit test operations. <testusecase> operates a single unit test, a sequence of unit tests, or a mix of sequences for the duration of the test.
A <testusecase> for a functional test and a service monitor operates one or more unit tests in sequence. The functional test operates the <testusecase> once in one simulated user. The service monitor operates the <testusecase> in one simulated user repeatidly with a delay timer between operations. TestMaker offers several options for <testusecase> when run in a load and performance test.
The following sections show how to configure a <testusecase> in a TestScenario XML file.
<testusecase> For a Single Dimension Test
<testusecase name="simpletest">
<run name="geo_insert" testclass="com.pushtotest.example.test"
method="runTest" langtype="java"/>
In this example TestMaker instantiates the class com.pushtotest.example.test and runs the runTest method.
This form is used when setup and teardown instructions are required by the service under test or the test itself:
<testusecase name="simpletest">
<setup name="geo_insert" testclass="com.pushtotest.example.test"
method="setUp" langtype="java"/>
<run name="geo_insert" testclass="com.pushtotest.example.test"
method="runTest" langtype="java"/>
<teardown name="geo_insert" testclass="com.pushtotest.example.test"
method="tearDown" langtype="java"/>
In this example TestMaker makes three successive calls to the com.pushtotest.example.text class. The test calls the setUp, runTest, and tearDown methods in sequence.
This form is used when testing a service by calling several functions in series:
<testusecase name="simpletest">
<setup name="geo_insert" testclass="com.pushtotest.example.test"
method="setUp" langtype="java"/>
<run name="geo_insert" testclass="com.pushtotest.example.test"
method="insert" langtype="java"/>
<run name="geo_insert" testclass="com.pushtotest.example.test"
method="query" langtype="java"/>
<run name="geo_insert" testclass="com.pushtotest.example.test"
method="update" langtype="java"/>
<run name="geo_insert" testclass="com.pushtotest.example.test"
method="delete" langtype="java"/>
<teardown name="geo_insert" testclass="com.pushtotest.example.test"
</testusecase>
In this example TestMaker instantiates the Java class com.pushtotest.example.test and runs the setup method of the test object once. If this were a load test, TestMaker calls the insert method of the test object, sleeps for the default 1 second, calls the query method, sleeps, runs the update method, sleeps, runs the delete method, sleeps and repeats the call to insert until time expires. TestMaker then calls the teardown method once.
<testusecase> for Load Tests to Determine a Scalability Index
This section shows how to turn a functional test into a load test to understand the scalability and performance of a target service.
A Scalability Index shows how a target service performs under various load levels. For instance, TestMaker runs a testusecase in the specified number of concurrent running virtual users (CRs for short), and tracks the number of completed testusecases measured as Transactions Per Second (TPS). Contrasting TPS to CRs values yields the Scalability Index. This chart shows the TPS results for three CRs levels:

A perfectly scalable system should be able to respond in equally faster proportion to more user requests. For instance, if we double the number of users then we should get twice the number of transactions processed. The chart above shows that the service does not scale in proportion to the number of CRs. At 2 CRs the application performs 8 TPS, at 4 CRs it performs 11 TPS, but at 8 CRs the application only performs 17 TPS. A perfectly scalable system has this Scalability Index :

The <testusecase> definition for load-tests builds on the prior examples with this form defining load tests at 2, 4 and 8 CRs:
<testusecase name="simpletest">
<run name="geo_insert" testclass="com.pushtotest.example.test"
method="runTest" langtype="java"/>
In this example TestMaker stages a load test to run for the default <testtime> of 1 minute. TestMaker instantiates two concurrently running threads at the start of the test period. In each thread TestMaker instantiates the Java class test in the com.pushtotest.example package. In each thread during the test, TestMaker calls the runTest method of the test object, sleeps (for the default 1 second), then repeatedly calls runTest until time expires. At the end of the test period, TestMaker ends the threads, starts the next test by repeating the test with 4 threads, then does the same operation again with 8 threads.
To make defining CRs easier, TestMaker supports a short-hand syntax. This is the CRs levels definition from the example:
The equivalent definition using short-hand is:
<crlevel start="2" multiple="2" steps="3"/>
This defines the same 3 CRs levels (steps), starting with 2 (start), and increasing by a multiple of 2 (multiple) for subsequent steps, yielding the same 2, 4 and 8 CRs level values.
<testusecase> for a Multi-Dimensional Test
TestMaker uses the <crlevels> element to define a single dimension of a test, but TestMaker also supports multiple dimensions. For instance, TestMaker can vary the message size of a call to a soap-based Web Service using the <messagesizes> element:
From this definition, TestMaker operates a test with the message size of 1, then repeats the test with message sizes of 2 and 3. The testusecase object defines the meaning of the message size value. Each dimension used geometrically increases the number of tests. For instance, this test definition causes TestMaker to run 9 test cases (3 CRs levels multiplied by 3 message size levels):
This chart illustrates the resulting Scalability Index showing increasing CRs with increasing message sizes:

Consider the TPS results between the 2 and 8 CRs levels. At the 2 CRs level increasing message size slightly reduces TPS levels, but at the 8 CRs level increasing message size dramatically reduces TPS levels.
By the way, <messagesize> and <dataindex> may be used interchangeably. <messagesize> started in TestMaker 5.0 as a way to identify the second dimension of a multiple dimension test. The more generic <dataindex> appeared in TestMaker 5.2 and is used going forward because it is much more inclusive.
<sequence> for Multiple Testusecases
An earlier example showed testing a service by calling several functions in series; this series of functions is called a <sequence> . Real world use cases often need more than one sequence operating at a time and TestMaker supports operating multiple sequences for each <testusecase> . For instance, testing a database doing insert and update operations concurrently may uncover contention problems.
This is an example showing the definition of two sequences:
<testusecase name="sequencetest">
<setup name="geo_insert" testclass="com.pushtotest.example.test"
method="setUp" langtype="java">
<argument name="geoval" value="1738"/>
<sequence name="inserts" proportion="80">
<setup name="geo_insert" testclass="com.pushtotest.example.test"
<argument name="geoval" value="1738"/>
<run name="geo_insert" testclass="" method="" langtype="java">
<argument name="geoval" value="1738"/>
<teardown name="geo_insert" testclass="com.pushtotest.example.test"
method="geoteardown" langtype="java"/>
<sequence name="queries" proportion="20">
<setup name="geo_insert" testclass="com.pushtotest.example.test"
<argument name="geoval" value="1738"/>
<run name="geo_insert" testclass="" method="" langtype="java">
<argument name="geoval" value="1738"/>
<teardown name="geo_insert" testclass="com.pushtotest.example.test"
method="geoteardown" langtype="java"/>
<teardown name="geo_insert" testclass="com.pushtotest.example.test"
method="geoteardown" langtype="java"/>
In the example, TestMaker operates the test at 2, 4 and 10 CRs levels. At each CRs level, TestMaker instantiates the corresponding number of concurrently running threads and the threads instantiate one of the two <sequence> elements. TestMaker sets 80% of the threads to operate the inserts sequence and the remaining 20% to operate the queries sequence.
Number of Threads per sequence:
| Sequence\Users | 2 | 4 | 10 |
| inserts | 0 | 1 | 2 |
| queries | 2 | 3 | 8 |
In the example, TestMaker operates the test at 2, 4 and 8 CRs levels. At each CRs level, TestMaker instantiates the corresponding number of concurrently running threads and the threads instantiate one of the two <sequence> s. TestMaker sets 80% of the threads to operate the inserts sequence and the remaining 20% to operate the queries sequence.
Mustrun Option
Mustrun Option

A <sequence> has a proportions attribute, which defines the number of threads that will execute the actual sequence. This number of threads is calculated from the concurrent running virtual user <crlevel> . In the case the number of threads ends in decimals (3.7 threads in a sequence for instance) this number is rounded to the nearest integer number (4 threads). It can happen that the number of threads in some sequence falls below 0.5 and then TestMaker does not run the sequence at all. To allow the user to have the capability of choosing which sequences to must run at least in one thread, TestMaker introduced a new attribute: <sequence mustrun='true'>. When mustrun is true, the sequence will be run in AT LEAST one thread, even if the number of threads for this sequence is zero.
Number of Threads per sequence using the mustrun option:
| Sequence\Users | 2 | 4 | 10 |
| inserts | 0 | 1 | 2 |
| queries | 2 | 3 | 8 |
Instance Variables

PushToTest TestScenarios feature the <setup>, <run>, <teardown> elements instantiate and run unit tests implemented in JAVA and many other supported dynamic scripting languages. Each call instantiates a new class. Instance variables enable PushToTest to instantiate a class once and reuse it. The following example illustrates instance variables and reuse:
<jar path="./example_agents/instancestest/SampleClass.jar"/>
<sequence name="InstancesTest" proportion="100">
<run instance="I1" testclass="SampleClass" method="open" langtype="java">
<argument name="id" value="1"/>
<run instance="I1" testclass="SampleClass" method="close" langtype="java"/>
<run instance="I2" testclass="SampleClass" method="open" langtype="java">
<argument name="id" value="1"/>
<run instance="I2" testclass="SampleClass" method="close" langtype="java"/>
The above example uses the class defined below.
System.out.println(v1+"-"+s1);
<while> - Variable Test Use Case Periods

PushToTest TestScenarios operate a set of <testusecases> for a period of time defined by <testTime> in the <options> section. Certain load TestScenario situations operate a test until it reaches a certain condition and then moves to the next crlevel or data level. PushToTest provides the <while> operator for these circumstances.
For instance, a data driven test finishes operating a <testusecase> when the test exhausts the data from a set of data files or a database. Consider the following example:
<sequence name="while test" proportion="100">
<setup testclass="whiletest.While" method="setup" langtype="java">
<argument name="quantity" value="100"/>
<while testclass="whiletest.While" method="mustContinue" langtype="java"/>
<run testclass="whiletest.While" method="run" langtype="java"/>
<delayBetweenStartingUseCases time="1000"/>
<delayBetweenTestCases time="100"/>
In the above example, PushToTest operates 10 Threads for 20 seconds ( time="20000" .) Each time through the <test> if the <while> value returns false, then the ScriptRunner ends the usecase - it takes down the Threads and moves onto the 20 CR level.
<monitoring>

PushToTest TestMaker provides PTTMonitor, an agent-based monitoring service, to observe machine and server performance as TestMaker operates a test. PTTMonitor by default observes CPU, network, and memory use. TestMaker polls the PTTMonitor periodically and correlates performance hotspots to test activity.
PTTMonitor installs on TestNodes and on one or more target systems that run the target application. TestMaker TestScenarios use <monitoring> to identify the target host and turn monitoring on or off when presenting results:
<monitoring enablednodes="true" enabledtarget="false" targethost="http://localhost" />
TestMaker allows monitoring of multiple target hosts. Consider the following PushToTest TestMaker provides a Monitor to correlate performance hotspots to testusecase activity. The Monitor installs on TestNodes and the target system. TestMaker TestScenarios use <monitoring> to identify the target host and turn monitoring on or off when presenting results:
<monitoring enablednodes="true">
<host name="host1" location="http://192.168.1.102:8011/targethost1" enabled="true"/>
<host name="host2" location="http://192.168.1.102/targethost1" enabled="true"/>
<host name="host3" location="http://192.168.1.102/targethost1" enabled="false"/>
</monitoring>
TestMaker provides an special form of the <testnodes> <node> tag to identify a TestNode and a PTTMonitor.
<testnodes>
<node
name="node1"
location="http://localhost:8080/TestNetwork/ws/TestNode"
monitor="http:///localhost:51111"/>
</testnodes>
<run> and Timeout

The <run>, <setup> , and <teardown> elements of a TestScenario runs a unit test that may return long after the testuecase finishes. The timeout attribute in <run>, <setup> , and <teardown> causes these to throw a TimeoutException if the unit test does not complete in the defined number of milliseconds
<usecase name="Examples_usecase">
<sequence name="Examples_sequence" proportion="100">
<run name="MyTest?" testclass="PTT_Examples_UnitTest.testgen4web"
method="testGen4Web" langtype="testgen4web" timeout="1500"/>
If the <run> element call takes more than 1500 milliseconds then a TimeoutException is triggered.
<Run>, <Setup>, <TearDown>

<run> indicates the call to a function or a method to operate the step of a test. <run> has various behaviors depending on the langtype. For example, Selenium and TestGen4Web run a testcase or a transaction file respectively. <setup> is used to initialize the test and envnironment. <teardown> is used to finalize the environment after the test operates. Both tags can be used several times in the scenario. Their meaning differs according to the location and they are optional.
<usecases>
<startup name="NodeStartup"/>
<usecase name="Untitled_usecase">
<startup name="UsecaseStartup"/>
<sequence name="Untitled_sequence" >
<startup name="AgentStartup"/>
<test>
<startup name="TransactionStartup"/>
<run module="myJythonScript"/>
<teardown name="TransactionTeardown"/>
</test>
<teardown name="AgentTeardown"/>
</sequence>
<teardown name="UsecaseTeardown"/>
</usecase>
<teardown name="NodeTeardown"/>
</usecases>
Examples of the above <startup>:
• NodeStartup: Initialize the node. There can be only one NodeStartup and it is executed right after the scenario is loaded. It is useful to set up global information.
• UsecaseStartup: Initialization at the beginning of the usecase. There can be only one startup per usecase.
• AgentStartup: Initialize the agent (thread). A testcase is composed by a usecase with certain data index and certain number of agents. Every time a test case is run, new agents are created. AgentStartup is executed to initialize these agents, and it is executed right after the agents are created. Useful to open connections to servers.
• TransactionStartup: Indicates an initialization in a transaction. Its time is taken into transaction time, then even when it syntactically differs from a run, its behavior is the same of a run.
Examples of the above <teardown>:
• TransactionTeardown: Same as the TransactionStartup, It is a run with a different mane. Useful to indicate the finalization of a transaction.
• AgentTeardown: Indicates the finalization of the agent. It is run by every agent after the test time and the cold down time is done. Useful to close connections to server.
• UsecaseTeardown: Indicates the finalization of the usecase. It is run after all the threads had exhausted their test time and cold down time, and done their AgentTeardown (if any).
• NodeTeardown: Indicates the finalization of a scenario. It is run at the end of the scenario, before sending the xml files to the console.
Types of <Run>

As mentioned before the demeanor of each transaction depends on its language type. The following sections show <run> for each language type.
Java
A standard call to Java:
<run name="javacall" testclass="com.examples.PrintOne" method="runTest" langtype="java">
<argument name="testval" value="b"/>
</run>
TestMaker maps the above <run> method to to call the Java sequence show in the following code:
com.examples.PrintOne obj = new com.examples.PrintOne();
obj.runTest(“b”);
TestMaker handles data type conversion automatically. For example, when an argumentn value expected by the Java method's runTest is a number, TestMaker will try to change the value to a number.
<run name="javacall" testclass="com.examples.PrintOne" method="runTest" langtype="java">
<argument name="testval" value="5"/>
</run>
com.examples.PrintOne obj = new com.examples.PrintOne();
obj.runTest(5);
Data Production Library (DPL) Argument For Data Driven Tests
DPL's provide operational test data to a <run> method in a TestScenario. The following gives an example DPL use:
<dpl name="mydpl" type="HashDPL">
...
</dpl>
…
<run name="javacall" testclass="com.examples.PrintOne" method="runTest" langtype="java">
<argument dpl="mydpl" name="DPL_Properties" value="getData"/>
</run>
The run can be mapped to the next java sequence:
HashDPL mydpl = new HashDPL();
…
com.examples.PrintOne obj = new com.examples.PrintOne();
obj.runTest(mydpl.getData());
TestMaker supports DPL use with langtypes, including Selenium, Java, soapUI, and the script languages (Jython, Groovy, and others.)
Instance System
Many times a test needs to run methods within the same instance of a test object. For example, a test implements methods to connect to a server, make a transaction, check that the transaction is finished, and close the connection. Using the instance option, the first <run> instantiates the test object and calls the connect-to-a-server method and then uses the same object instance to call the other methods. The following shows an example:
<run name="javacall" testclass="com.examples.PrintOne" method="runTest" langtype="java">
<argument name="testval" value="5"/>
</run>
<run name="javacall" testclass="com.examples.PrintTwo" method="runTest" langtype="java">
<argument name="testval" value="7"/>
</run>
TestMaker transforms these to:
com.examples.PrintOne Object@1abc7b9 = new com.examples.PrintOne();
Object@1abc7b9.runTest(5);
com.examples.PrintOne Object@c55e36 = new com.examples.PrintOne();
Object@c55e36.runTest(7);
The following uses an instance attribute:
<run name="javacall" testclass="com.examples.PrintOne" method="runTest" langtype="java" instance="counter">
<argument name="testval" value="5"/>
</run>
<run name="javacall" testclass="com.examples.PrintTwo" method="runTest" langtype="java" instance="counter">
<argument name="testval" value="7"/>
</run>
TestMaker transforms the above into:
com.examples.PrintOne counter = new com.examples.PrintOne();
counter.runTest(5);
counter.runTest(7);
For two calls to use the same method, it is required to both calls contains the same langtype, testclasss and instance. Instance system could be used with langtypes selenium, seleniumrc, java, script languajes (jython, groovy, etc..)
Array Argument System
TestMaker supports a system to pass an array of data values to a <run>.
<run name="javacall" testclass="com.examples.PrintOne" method="runTest" langtype="java">
<argument name="testval" value="a"/>
<argument name="testval" value="b"/>
<argument name="testval" value="c"/>
</run>
com.examples.PrintOne obj = new com.examples.PrintOne();
testval = new String[3];
testval[0] = “a”;
testval[1] = “b”;
testval[2] = “c”;
obj.runTest(testval);
TestMaker handles data type conversion automatically. For example, when an argumentn value expected by the Java method's runTest is a number, TestMaker will try to change the value to a number in the array.
<run name="javacall" testclass="com.examples.PrintOne" method="runTest" langtype="java">
<argument name="testval" value="1"/>
<argument name="testval" value="2"/>
<argument name="testval" value="2>"/>
</run>
com.examples.PrintOne obj = new com.examples.PrintOne();
testval = new int[3];
testval[0] = “1”;
testval[1] = “2”;
testval[2] = “2”;
obj.runTest(testval);
Currently Array argument system could be used with langtype java only.
Script Languages Support: Java, Jython, Groovy, JRuby, Perl, PHP
TestMaker supports the Java 1.6 ScriptEngine API (JSR 223) to run test cases written in Java, Jython, Groovy, JRuby, and several other scripting languages. To add a resource tag you first need to add the file where the script is in the resources, as a module.
<resources>
<module name="myJythonScript" path="./example_agents/Miscellaneous/SleepTest/printone.py"/>
</resources>
…
<run module="myJythonScript" instance="i1" name="printone" testclass="PrintOne" method="runTest" langtype="jython">
<argument name="testval" value="a"/>
</run>
In the run target you need to indicate the module from were you are running the script. Given the fact that you can not create directly script objects with the java script engines, you need to define a function to create the object. The function should have the name “get” plus to testclass method. Then in our example at the end of script file, there should be a function called getPrintOne, similar to:
def getPrintOne():
return PrintOne();
Selenium
TestMaker runs a Selenese file using the headless HTMLUnit browser. This is useful for load test because it is less memory intensive because there is no graphical interface. In order to use Selenium, declare the file in the resource as a Selenese resource.
<resources path="./test/data">
<selenese path="calendar.selenium"/>
</resources>
…
<run langtype="selenium" name="testweb" testclass="ptttest.selenium"/>
TestMaker passes operational test data using the HashDPL to a Selenium test operation.
<dpl name="mydpl" type="HashDPL">
</dpl>
…
<run name="CalendarTest" testclass="calendar.selenium" langtype="selenium">
<argument name="hashdata" dpl="mydpl" value="getNextData"/>
</run>
SeleniumRC
TestMaker runs a Selenese test file in a real browser using SeleniumRC and TestNode technology. TestMaker requires the browser identifier.
<resources path="./test/data">
<selenese path=" ptttest.selenium"/>
</resources>
…
<run langtype="seleniumrc" method="*firefox" name="testweb" testclass="ptttest.selenium"/>
…
<options>
<selenium rc="true"/>
</options>
Additionally, SeleniumRC instructs TestMaker to start the Selenium server. Also, TestMaker supports the DPL and argument system for Selenese tests.
TestGen4Web
Run a TestGen4Web file in TestMaker. The file should be added in the resource section as a TestGen4Web element. This Script Runner uses the headless HTMLUnit browser. Also, TestMaker supports the DPL and argument system for TestGen4Web tests.
<resources>
<testgen4web path="BrewBizWeb.testgen4web"/>
</resources>
….
<run name="testweb" testclass="BrewBizWeb.testgen4web" langtype="testgen4web">
<argument dpl="mydpl" name="DPL_Properties" value="getData"/>
</run>
soapUI
TestMaker operates soapUI tests.
<run name="BrewBizService" testclass="TestSuite" method="TestCase" langtype="soapui"/>
The test class is the name of the test suite. The method should be the test case of the suit, which will be run.
The parameters system in soapUI is a bit different. First, you need to have a properties step:
Inside the soapUI test, use Properties as usual. Then, in the scenario, you need to add a DPL argument. The argument name must be the same name of the properties step and the DPL should return a map object.
<run name="BrewBizService" testclass="TestSuite" method="TestCase" langtype="soapui">
<argument dpl="mydpl" name="DPL_Properties" value="getData"/>
</run>
The name that appears in the properties step will be search in the map, if there is and object different from null in the DPL map, the DPL map value will be set in the properties.
Test Object Oriented Library (TOOL)
The Test Object Oriented Library (Tool) is a library of test objects that handle all the communication with HTTP, HTTPS, soap, .NET, XML-RPC, Telnet, eMail, and JDBC hosts. TOOL is designed to be called from a high level language, such as unit tests written in JAVA, Jython, Groovy, Ruby, PHP, and the other supported script languages.
Goals

Modern software test automation tools need to meet these criteria:
- 1. Test suites need to be intelligent. Testing Web application and soap-based Web Services software requires a test to intelligently drive the application as a typical user would.
- 2. Test suites need to test systems for scalability and performance under near-production loads.
- 3. Test tools need to be used. Many engineers do not have access to test tools due to cost or corporate standards.
TOOL is a free open-source design for a library of test objects. The TOOL design enables developers to build and run intelligent test agents. The test agents drive Web applications and soap-based Web Services as a typical user would. Multiple concurrent agents test an application for scalability and performance closely simulating production settings.
The design of TOOL should be language and implementation independent. TOOL does not need to be implemented in a language that explicitly supports OO structures (e.g., a pure C implementation - using OO techniques in C should be possible) independtly of using good Object Oriented design and architecture.
Design

TOOL is a library, which on it’s own wont accomplish anything, and can’t be used without a user interface. It is intended to be used in other projects that offer a user interface, so the audience for TOOL is software developers. TOOL offers software developers a flexible framework for building test suites to test Web systems.
Class Heirarchy

(or namespace or modules depending on what language is used)
datasource
These Objects get data for use with making requests or for other things that require access to data files, databases, etc.
protocolhandler
This contains the Objects related to making requests via a specific protocol. This is the request portion of a transaction.
Object Relationships

(Hopefully the pseudo-UML in the following section makes a sense to you.)
- DataSource - An interface that needs to be implemented by DataSource
implementations to allow access to the data.
- Csv - Access data in a Comma Separated Values flat file.
- Tsv - Access data in a Tab Separated Values flat file.
- Db - Access information that is stored in a Database. If needed
by the language, make Database specific implementations of the
Db to access a specific database type.
Db <-- PostgreDb (if necessary)
- Protocol - Interface to implement to create a new Protocol type.
- Header - An interface to setting Header values for a protocol. Protocol
specific implementations will need to be provided.
- Body - An interface to setting the Body of a Protocol request. Protocol
specific implementations will need to be provided.
- ProtocolHandler - A facade in front of all of the Protocols that allows an
easy way to instantiate new objects (factory methods) and call methods on a
Protocol regardless of which specific type it is.
- *Protocol - The specific implementations of the different Protocol handlers.
- Response - Interface to implement to define a response that will be returned
by a specific protocol.
- ResponseLink - An interface that defines the access to Response items that
can be chained together with the ResponseChain to define how to deal with a
Response object. This is how searching responses and things of that sort
- ResponseLinkConfig - An Object that is created to hold values used to
- *Response - The implementations of Protocol specific response types.
- ResponseChain - A Chain of Responsibility pattern class that allows a
response to be passed among many ResponseLinks.
ResponseLink <-- HTTPSearchLink
ResponseChain <>-- ResponseLink
- Codec - Interface to encoding/decoding methods.
- Crypt - Interface to cryptographic routines.
- Lingo - Utility that creates pseudo-text to use as subjects or bodies of
- Queue - For languages where there is no Queue class, this provides a Queue
- PropertyFinder - A class that hides the details of loading property files
that contain strings and other configuration directives and handles
JavaDoc API Documentation for TOOL

TOOL is written in JAVA and comes with JAVAdoc code documentation . JAVAdoc is the standard way JAVA engineers annotate their code. The JAVAdoc code documentation for TOOL is also found on-line at docs.pushtotest.com .
![]() |
Additional documentation, product downloads and updates are at www.PushToTest.com . While the PushToTest testMaker software is distributed under an open-source license, the documenation remains (c) 2008 PushToTest. All rights reserved. PushToTest is a trademark of the PushToTest company. |

