[Dev] More TM 5 TestScenario examples

Frank Cohen fcohen at pushtotest.com
Thu Nov 30 19:00:29 PST 2006


I received much good feedback and ideas on the TestScenario.xml test  
description file format for TestMaker 5. Below is an example I put  
together. Feedback, comments, ideas are welcome. -Frank

--

<!-- This file contains examples of the possible test definitions in  
a TestScenario.xml file

     This is part of the TestMaker 5 project - the open-source SOA  
test automation tool.
     (c) Frank Cohen. All rights reserved.
     This file and the rest of TestMaker is distributed under a GPL  
open-source license.
     See the license.html file for your rights to use and modify this  
file.
-->

<!-- We start with the simplest possible test.

     This test runs for the default time of 2 minutes. During that  
time TestMaker
     instantiates a Java com.pushtotest.examples.test class and calls  
the runTest, and
     then repeats.

     Once the test duration finishes, TestMaker creates a report  
showing how many times
     the test was called, the average, minimum and maximum time it  
took to call the method.
-->

<testusecase>
     <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="runTest"  
langtype="java"/>
</testusecase>


<!-- The same test using a Jython script

     TestMaker calls the runTest method defined in the mytest module.
-->

<testusecase>
     <runTest name="geo_insert" testclass="mytest" method="runTest"  
langtype="jython"/>
</testusecase>


<!-- A simple test with setup and teardown operations

     This test is the same as above with the addition of calling the  
setUp before and tearDown
     method after the runTest method.
-->

<testusecase>
     <setUp name="geo_setup" testclass="com.pushtotest.examples.test"  
method="setUp" langtype="java"/>
     <runTest name="geo_run" testclass="com.pushtotest.examples.test"  
method="runTest" langtype="java"/>
     <tearDown name="geo_teardown"  
testclass="com.pushtotest.examples.test" method="tearDown"  
langtype="java"/>
</testusecase>


<!-- Suppose you need to call the setUp method before the duration of  
the test case.

     The following calls the setUp method, then repeatidly calls the  
runTest method during
     the duration of the test, and then calls the tearDown method.
-->

<setUp name="geo_set" testclass="com.pushtotest.examples.test"  
method="setUp" langtype="java"/>
<testusecase>
     <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="runTest"  
langtype="java"/>
</testusecase>
<tearDown name="geo_teardown"  
testclass="com.pushtotest.examples.test" method="tearDown"  
langtype="java"/>


<!-- Many times you will find tests are a sequence of functional test  
steps.

     This test runs for the default time of 2 minutes. During that  
time TestMaker instantiates
     the com.pushtotest.examples.test class and calls the  
insertRecord method. TestMaker then
     calls queryRecord, updateAmount, confirmUpdate, and deleteRecord  
one method at a time. It
     then repeats the sequence of methods beginning with insertRecord  
until the test case
     duration finishes.
-->

<testusecase>
     <runTest name="geo_1" testclass="com.pushtotest.examples.test"  
method="insertRecord" langtype="java"/>
     <runTest name="geo_2" testclass="com.pushtotest.examples.test"  
method="queryRecord" langtype="java"/>
     <runTest name="geo_3" testclass="com.pushtotest.examples.test"  
method="updateAmount" langtype="java"/>
     <runTest name="geo_4" testclass="com.pushtotest.examples.test"  
method="confirmUpdate" langtype="java"/>
     <runTest name="geo_5" testclass="com.pushtotest.examples.test"  
method="deleteRecord" langtype="java"/>
</testusecase>

<!-- Run a sequence of functional test steps concurrently

     This test operates increasing levels of concurrently running  
threads, with each thread
     operating the <testusecase> defined functional test. The result  
is a load test to determine
     a Scalability Index for the target host service. The test begins  
a use case by instantiating
     2 threads. Each thread instantiates a  
com.pushtotest.examples.test class and repeatidly
     calls the insertRecord method. When the test period is over,  
TestMaker ends the threads
     and the repeats the test at the next level of concurrent  
requests, in this case 4 CRs.
     TestMaker conducts the same test at 8 CRs and then ends the test  
use case and reports the
     results.

-->

<testusecases>
     <crs>
         <crlevel value="2"/>
         <crlevel value="4"/>
         <crlevel value="8"/>
     </crs>

     <testusecase>
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="insertRecord"  
langtype="java"/>
     </testusecase>
</testusecases>


<!-- Run a sequence of functional test steps concurrently with  
multiple dimensions

     This test operates increasing levels of concurrent running  
threads and increasing
     level of message payload sizes. For instance, the first test  
operates 2 concurrently
     running threads with each thread instantiating its own  
com.pushtotest.examples.test
     class. TestMaker repeatidly calls the insertRecord method of the  
test class. TestMaker
     directs the test to use a message size value of 1. When the test  
use case period ends
     TestMaker operates the next test use case at 2 threads and a  
message size value of 2.
     TestMaker operates all 9 test cases (3 cr levels times 3 message  
size values) in
     sequence. The functional test understands the context of the  
message size values.

-->

<testusecases>
     <crs>
         <crlevel value="2"/>
         <crlevel value="4"/>
         <crlevel value="8"/>
     </crs>

     <messagesizes>
         <messagesize value="1"/>
         <messagesize value="2"/>
         <messagesize value="3"/>
     </messagesizes>

     <testusecase>
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="insertRecord"  
langtype="java"/>
     </testusecase>
</testusecases>


<!-- Run multiple sequences of functional test steps concurrently

     This test operates increasing levels of concurrently running  
threads. The first test
     case operates 10 concurrently operating threads. Each thread is  
assigned a proportion of
     the two defined sequences. The first sequence acts like a  
customer - viewing and buying
     products from a catalog. The second sequence acts like a manager  
- viewing sales records
     and rewarding sales people commissions. For instance, of the 10  
threads created in the
     first test case, TestMaker operates the customer sequence in 6  
of the 10 threads (60%)
     and operates the manager sequence in 4 of the 10 threads (40%).

-->

<testusecases>
     <crs>
         <crlevel value="10"/>
         <crlevel value="20"/>
         <crlevel value="40"/>
     </crs>

     <sequence name="customer" proportion="60">
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="viewProducts"  
langtype="java"/>
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="orderProduct"  
langtype="java"/>
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="pay" langtype="java"/>
     </sequence>

     <sequence name="manager" proportion="40">
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="viewSales"  
langtype="java"/>
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="rewardSalespeople"  
langtype="java"/>
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="sendThankYous"  
langtype="java"/>
     </sequence>
</testusecases>


<!-- Each runTest, setUp, and tearDown element in a test scenario  
definition passes-in test
     parameters using the <arguments> operator.

     This test instatiates the com.pushtotest.examples.test class and  
passes in a hashmap of
     argument name/value pairs. The test class then decides what to  
do with the target argument
     value.
-->

<testusecase>
     <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="runTest"  
langtype="java">
         <argument name="target" value="http:// 
examples.pushtotest.com"/>
     </runTest>
</testusecase>


<!-- Run a totally crazy and cool test

     You get to figure out this one! :-)

-->

<testusecases>
     <crs>
         <crlevel value="10"/>
         <crlevel value="20"/>
         <crlevel value="40"/>
     </crs>

     <messagesizes>
         <messagesize value="1"/>
         <messagesize value="2"/>
         <messagesize value="3"/>
     </messagesizes>

     <setUp name="createdb" testclass="database_configure"  
method="createdb" langtype="jython"/>

     <sequence name="customer" proportion="60">
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="viewProducts"  
langtype="java"/>
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="orderProduct"  
langtype="java"/>
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="pay" langtype="java"/>
     </sequence>

     <sequence name="customer" proportion="10">
         <setUp name="update" testclass="database_configure"  
method="updatedb" langtype="jython"/>
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="viewProducts"  
langtype="java"/>
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="orderProduct"  
langtype="java"/>
         <runTest name="geo_insert"  
testclass="com.pushtotest.examples.test" method="pay" langtype="java"/>
         <tearDown name="geo_insert"  
testclass="com.pushtotest.examples.test" method="tearDown"  
langtype="java"/>
     </sequence>

     <sequence name="manager" proportion="30">
         <setUp name="createdb" testclass="database_configure"  
method="createdb" langtype="jython"/>

         <runTest name="geo_insert" testclass="mytest"  
method="runreports" langtype="jython">
             <argument name="target" value="http:// 
examples.pushtotest.com"/>
         </runTest>
         <runTest name="geo_insert" testclass="mytest" method="query"  
langtype="jython">
             <argument name="region" value="southwest"/>
         </runTest>
         <runTest name="geo_insert" testclass="mytest"  
method="commissions" langtype="jython">
             <argument name="rate" value="8"/>
         </runTest>
     </sequence>

     <tearDown name="geo_insert"  
testclass="com.pushtotest.examples.test" method="tearDown"  
langtype="java"/>

</testusecases>



More information about the Dev mailing list