Jaffa Logo
 
SourceForge.net
Home Contact Us FAQs Site Map
Source Forge: Homepage Bugs @ Sourceforge Mailing Lists @ Sourceforge Task Manager @ Sourceforge CVS @ Sourceforge
Jaffa Site
Jaffa Runtime
Jaffa RAD
Sub-Projects
Tools / Testingorg.jaffa.tools.loadtest

Introduction

This document explains how to use the Load test module in JAFFA to perform scalability tests run against httpunit tests written for your application.

Overview

You may have a web application for which you already have httpunit tests written against it. Now wouldn’t it be nice to have some tool which will run these unit tests and do some scalability tests and give an estimate as to how well does your application scale across multiple threads, which simulate the users using the system.

LoadTest module is the solution to this. With just two xml files ,which include the configuration and the build file, you can run your httpunit tests and the results are logged in a csv file.

Prerequisite

The LoadTest module is part of the Jaffa tools and hence is packaged into jaffa-tools.jar. Hence you will require jaffa-tools.jar to run the Load Test .You should have your httpunit tests to test against.

Changes/Requirements to HttpUnit Tests

To comply with the LoadTest module you need to follow certain requirements while writing your httpunit tests.

  • All the Test Classes should extend the LoadTestCase class (org.jaffa.tools.loadtest.LoadTestCase)
  • Logon is performed via LoadTest module and hence use getWebConversation() and getWebResponse() to get the WebConversation and WebResponse object .If null , then perform your own custom logon.

How to Run LoadTest

As mentioned earlier to run the LoadTest (once the httpunittests are in place), you will need two xml files, one for the configuration and other to run the test.

Once you specify all the necessary parameters for running the test , the Test is run and the results are recorded into the csv format. The contents of the result set are discussed later in the section.

Configuration File

You can specify various parameters used to run the LoadTest using this configuration file. Below is a sample configuration file.To find out more about the tags for the xml file take a look at the xsd located at source\java\org\jaffa\tools\loadtest\domain\unitTestConfig_1_0.xsd

Example Config File
<?xml version="1.0" encoding="US-ASCII"?>
<load-testing>
<!--You can have multiple test set -->
  <test-set>
<!--This name will be used as the file name after to store the results of the LoadTest -->
    <name>LoadTest_20_20_Nightly</name>
<!--This is optional tag -->
    <description>Test the speed or various table read</description>
<!--This is the path where the result set , .csv file is stored -->
    <output-dir>C:\Mahesh\UnitTest</output-dir>
<!--This specifies the no of threads you want to run -->
    <threads>10</threads>
<!--This specifies how many tests you want to run when it reaches the size specified the Load
    test ends.Even if there is only one unit test specified and the batc-size is 10 the same unit test
    is run 10 times and if there are 10 different unit tests and the batch-size is 10 then each unit
    test is run once -->
    <batch-size>10</batch-size>
<!--This specifies the delay in milliseconds between each unit test .This is an optional tag-->
    <run-delay>2000</run-delay>
<-- This specifies how the tests should be run either sequentially or random -->
    <selection>sequential</selection>
<-- From this point on you specify which unit tests to be run for this test-set and other parameters -->
    <unit-tests>
     <unit-test>
<-- This is the class name for the unit test -->
        <class-name>usecase.module.sample.UserInqTest</class-name>
<-- This is the method-name for the class specified above which should be run -->
        <method-name>testUserInqForLoadTest</method-name>
      </unit-test>
    </unit-tests>
<-- This log-on section allows you to specify the logon information for the above tests specified -->
    <log-on>
<-- This is the class name which implements the Logon functionality -->
      <class-name>org.jaffa.tools.loadtest.LoadTesterLogOnImpl</class-name>
<--This specifies the url as a starting point for loggin into the application required to perform the tests  -->
      <webapp-root>http://localhost:8080/SampleApp</webapp-root>
<-- This specifies the title after successful logon-->
<logged-on-title>Welcome to JAFFA< /logged-on-title>
<-- This specifies the list of users who are valid users allowed to run the tests. Currently the users
    are picked randomly to run the tests -->
      <users>
        <user>
          <name>MAHESHD</name>
          <password>dummy</password>
        </user>
      </users>
    </log-on>
  </test-set>
</load-testing>

Run the LoadTest

Now once the parameters for configuring the LoadTest are specified run the class org.jaffa.tools.loadtest.LoadTester with the xml file specified above as an argument.

Make sure that the HttpunitTest.jar is created before running the LoadTest.

Here is a sample build file for running the LoadTest
<?xml version="1.0"?>
<project name="RunLoadTest" basedir="../../.." default="all">
  <path id="project.class.path">
    <fileset dir="lib">
    </fileset>
    <fileset dir="dist/httpunittest">
      <include name="**/*.jar"/>
    </fileset>
  </path>
  <target name="all" depends="createHttpUnitTestJar">
    <java classname="org.jaffa.tools.loadtest.LoadTester" failonerror="true" fork="yes">
    <classpath refid="project.class.path"/>
    <arg value="${basedir}/source/httpunittest/build/sample_loadtest_config.xml"/>
    </java>
  </target>
  <target name="createHttpUnitTestJar">
   <ant
      antfile    = "${basedir}/build/HttpUnitTestApp.xml"
      inheritall = "false"
      target     = "createHttpUnitTestJar"
      dir        = "${basedir}"
   />
  </target>
</project>


File: index.html, Last Modified: Thu Jun 26 2003 at 8:50:04am. This site has been built using PPWIZARD