Working with TestNG scripts

In this lesson, you will learn how to use TestNG scripts to load test a web application.

About TestNG

TestNG is a testing framework used most often in Unit Testing. For more information about TestNG, visit http://testng.org/.

TestNG Exercise

  1. Open Appvance IQ.
  2. Click Build.
  3. Click Scenario Editor.
  4. Select File > New.
  5. The Scenario Test Type is Unit Test.

Select Test Management.

The scenario test cases are specified to repeat 1 time.

Select Test Cases.

  1. From theTest Casestab, clickAdd a Test Case Execution.
  2. Enter a name for the test case in theTest Case Namebox.
  3. Enter a name for the script in theScript Namebox.
  4. Click theScript Typebox and selectTestNG.

5. Click Browse(to the right of the Resource box)
The Open window appears

The Script Type is set to TestNG, and the test case Resource points to the JAR file located in the respective TestNG directory.
A class from within the jar file (packagename.classname) is specified.
As the test is data enabled, a data connection, described later in this exercise in more detail, is specified, as well as how to use the data (Get Next Row of Data).

  1. Click Cancel.
  2. Select Resources.

All resources related to the Scenario are summarized, including the test case specified in Test Cases. Most notably, the Data Sources contains a connection to data, used in the TestNG test case, using a query to a SQL database.

  1. Click Play Scenario to execute the scenario.
  2. The Scenario loads in a new browser tab.
  3. As the scenario executes, details pertaining to the execution display in Live Reports.
  4. Once the execution completes, indicating a status of Execution Done, select Test case Executions.
  5. Select individual executions listed to view additional detail pertaining to the success or failure of the execution.