Monday, July 7, 2014

OATS: How to Create a Scenario for Oracle Load Testing

This article is one of the Oracle Application Test Suite (OATS)[1] series published on Xml and More, which includes the following:
In this article, we will show how to create scenarios for Oracle Load Testing (OLT).


Oracle Load Testing


What is Oracle Load Testing?   Oracle Load Testing is a component of OATS, the centerpiece of the Oracle Enterprise Manager solution for comprehensive testing of Web applications.  It allows you to validate the performance and scalability of your Web applications. It can simulate hundreds of virtual users accessing the application simultaneously and measures the effect of the load on application performance.  Oracle Load Testing's virtual users can generate multithreaded browser requests while performing rigorous functional validation under load conditions.

Here is the typical workflow. For the sake of understanding, assume that script is created on machine A and OLT is on machine B.  In [2], we have shown how to export and import scripts to OLT.  Here we will show how to create scenarios using imported scripts for OLT.

Scenario


What is a scenarioScenario in OLT is an entity for configuring and simimulating virutal users.  Once you have defined a scenario and set the profile parameters, you submit the scenario to the Oracle Load Testing Autopilot. There are two ways to submit Scenarios to Autopilot:
  1. Submit without Starting the Scenario
    • This allows you to specify the start and stop times for running the scenario profiles.
  2. Submit and Start the Scenario
    • OLT automatically opens the Autopilot tab with the scenario loaded.
To submit a Scenario and start the scenario (i.e., 2nd approach), you can click on the "Submit and start test" button (see below).  Here we will focus only on the 1st approach.  After saving parameters to a scenario, later you can start it from a command line.




To add Profiles to a Scenario, you click the Scenario Detail button to display the Edit Scenario Details dialog box.


The most important parameters are shown at the top-level of Build Scenarios tab.  For example, we have configured 200 virtual users, selected "Recorded/Random" for Think Time, and chose "OLT Server" (default) to run the virtual users.  Since we have added "Random" modifier in the Think Time, we need to go down to the detail-level to specify the lower and upper limits (i.e., 15% to 185% of the original recorded time).



Set up Autopilot


As mentioned before, we are taking the 1st approach to save settings to a scenario and sumbit it to Autopilot for future running.  In this case, we need to set up the parameters of autopilot by selecting the "Set up Autopilot" tab.


Here you can specify how virtual users will be ramped up and when to start or stop the load test.  In our case, we didn't use OLT ServerStats and it was not set up here. 

ServerStats lets you monitor a variety of server-side application, database, system, and Web server statistics. You can configure OLT ServerStats to display real-time performance statistics for the various hosts and services available from the server, such as percentage of CPU usage, memory usage, Web server statistics, etc.

Running Scenarios from the Command Line


You can run and stop scenario files using the command line Java file OLTCommandLine.jar located in the /lib directory under the installation directory. Use the following command syntax to start a scenario:

cd ${OATS_HOME}/lib
OLTCommandLine.jar -run -session=sessionName 
  -scenarioFile=${OLT_SCENARIO_DIR}/scenarioFile.scn 
  -OLTServer=hostName:portnumber
  -user=username -password=password [-log=logfilename]

Use the following command syntax to stop a scenario:

cd ${OATS_HOME}/lib

OLTCommandLine.jar -stop -session=sessionName -OLTServer=hostName:portnumber 
-user=username -password=password

The following are the command parameters:
  • run
    • Executes the selected scenario until the stop command is issued or the stop conditions specified in the scenario are reached.
  • session
    • Specifies the name to use for the session. If you do not do not provide a session name, Oracle Load Testing generates a session name.
  • scenarioFile
    • The scenario file to load. Specify the full path and file name of the scenario file. Scenario files have a .scn extension.
  • stop
    • Shuts down the specified session.
    • The Stop command is not required if the specified Scenario being run has a Stop condition of some defined time or number of iterations saved in the Autopilot settings.
    • You can not use both "-Run" and "-Stop" in the same command.
  • session
    • Specify the session to be shut down. The session name is automatically generated when you run the scenario. You can get the session name from the console or the log file specified with the scenario run command line parameters.
  • OLTServer
    • Specify the Weblogic server name which hosts OLT. The port number is required.
  • user
    • Specify the admin user name of the Weblogic server. The default username is "oats".
  • password
    • Specify the admin user password of the Weblogic server.
  • log
    • (Optional) Redirects console output to logfilename.
    • Specify the path and file name to use for the log file.

References

  1. Oracle Application Testing Suite (OATS)
  2. OATS: How to Export and Import Scripts from Windows to Linux

No comments: