Cross Column

Showing posts with label Load Testing. Show all posts
Showing posts with label Load Testing. Show all posts

Thursday, December 21, 2017

JMeter—Use Extractors (Post-Processor Elements) for Correlation



What Is Correlation


Correlation is the process of capturing and storing the dynamic response (e.g., "Session ID" in the above diagram) from the server and passing it on to subsequent requests. A response is considered dynamic when it can return different data for each iterating request, occasionally affecting successive requests. Correlation is a critical process during performance load test scripting, because if it isn’t handled correctly, your script will become useless.

Correlation is 2-step process:
  1. Parse and extract the dynamic value from the response of a step using a Post Processor element such as:
  2. Refer the extracted value in the request of a subsequent step
    • http://.../.../...?sessionID=${sessionId}#....


How to Use Regular Expression Extractor


Watching above video, you can learn how to create Regular Expression Extractors in JMeter in the following steps:[2]
  1. Create a Test Plan where you want to do dynamic referencing in JMeter
  2. Add Regular Expression Extractor in the Step from where response value(s) needs to be extracted
    • You can use RegExr—an online tool—to learn, build, and test Regular Expressions
  3. Refer the extracted value (referred by Reference Name) in subsequent step(s)
  4. Run and validate it


How to Use CSS/JQuery Extractor





Watching above video, you can learn how to create CSS/JQuery Extractors in JMeter in similar steps:[8]
  1. Create a Test Plan where you want to do dynamic referencing in JMeter
  2. Add CSS/JQuery Extractor[9]in the Step from where response value(s) needs to be extracted
    • You can find a detailed explanation of CSS syntax here. jQuery's selector engine uses most of the same syntax as CSS with some exceptions. For selecting an arbitrary locator, you can use field Match No. with the ‘0’ value, which returns a random value from all found results.
    • It is also worth mentioning there is a list of very convenient browser plugins to test CSS locators right into your browser. For Firefox, you can use the ‘Firebug’ plugin, while for Chrome ‘XPath Helper’ is the most convenient tool.
  3. Refer the extracted value (referred by Reference Name) in subsequent step(s)
  4. Run and validate it


How to Use JSON Extractor


Read the companion articles on this subject:

References

  1. Advanced Load Testing Scenarios with JMeter: Part 1 - Correlations
  2. JMeter Beginner Tutorial 19 - Correlation (with Regular Expression Extractor)
  3. Using RegEx (Regular Expression Extractor) with JMeter
  4. RegExr—an online tool (good)
  5. JMeter Listeners - Part 1: Listeners with Basic Displays
  6. Understand and Analyze Summary Report in Jmeter
  7. How to Automate Auth Token using JMETER
  8. How to Use the CSS/JQuery Extractor in JMeter (BlazeMeter)
  9. How to Use the CSS/jQuery Extractor in JMeter  (DZone)
  10. JMeter: How to Turn Off Captive Portal from the Recording Using Firefox (Xml and More)
  11. JMeter―Select on Multiple Criteria with JSONPath  (Xml and More)
  12. JMeter: How to Verify JSON Response?  (Xml and More)

Saturday, November 2, 2013

How to Create Load Testing Scripts Using OpenScript

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 load testing scripts using OpenScript[2]

Introduction to OpenScript


Application Testing Suite (OATS) is comprised of several tightly integrated products.[1] The script designer —OpenScript—only runs on Windows, but all the runtime components are available for both Linux and Windows. OpenScript is a scripting platform for creating automated test scripts in Java.

You can use OpenScript to create scripts for different testings. For example, OATS supports
  • Functional Testing
  • Load Testing
In this article, we will show you how to create load testing scripts in OpenScript.

The Platform


Scripting platform is based upon the Eclipse open source development environment. Initial OpenScript product provides access to a limited set of the Eclipse development environment.

The workbench is the base layer of software and code that provide the foundation on which the OpenScript Modules and Application Programming Interfaces (APIs) operate. Each Workbench window contains one or more perspectives. OpenScript Workbench provides the following perspectives:
  • Tester perspective
  • Developer perspective
  • Reset perspective
Workspaces are created in Oracle OpenScript. Workspaces store project-related script files and Results Log files. You can use them to organize your various testing projects. Three levels of management are provided:
  • Scripts (lowest)
  • Folders
  • Repositories (highest)
You can download OATS from [3]. The version used in this demonstration is
Version: 12.3.0.1 Build 376

Cheat Sheet


Like every recording task, you need to rehearse and make sure all glitches are resolved before the final recording. If you have decided the click path, prepare a cheat sheet like below:

[1] Bring_up_FUSE_URL
[2] Login_SALESREPUSER00001_Welcome1
[3] Click_the_Opportunities_Card
[4] Select_Quarter_2_2013
[5] Drilldown_on_Pinnacle_Server
[6] Click_on_Sales_Account_Picker
[7] Search_for_CUSTOMER_101328336
[8] Click_Cancel
[9] Click_Add_Revenue_Item
[10] Select_Type_Item
[11] Click_Product_LOV_and_Search
[12] Search_for_Elite_Pro_DG_452
[13] Select_Product_and_click_Ok
[14] Click_Cancel
[15] Logout

The numbering of step is for human readers and can help the recording. Each row on the list corresponds to a click in your click path and will become the title of step group in OpenScript recording.

OpenScript Preferences


Before recording, there are some preferences you want to set. To set them, you click on View and then OpenScript Preferences. For example, we would like to control the grouping, naming and numbering of step groups by ourselves (see "Cheat Sheet"). So, set your "ADF Load" preferences as below:


Creating a New Project


In this demonstration, we will create an open script for load testing (File > New...). Our web application is CRM FUSE. So, we have selected "Oracle Fusion/ADF" wizard from the New Project (see above).
  • Oracle Fusion/ADF
    • This option lets you create a new script for load testing of Oracle Application Development Framework (ADF)-based applications and other applications that utilize HTTP and ADF protocols at the protocol level.

At the next step, you are asked to provide a Script Name. So, we set them as follows:
  • Create script as a Function Library (unchecked)
  • Script Name: FUSE_Saleopty_oct07_wrk
Finally click Finish to create a new script. The resulting script will contain the Initialize, Run, and Finish nodes. The Run node will contain recorded HTTP protocol navigations based upon the defined Step Group preferences and the navigations and ADF protocol for actions performed during recording. You can edit the script tree or Java code to customize the script.[4]

In the following sections, we will demonstrate how to create:
  • First step group
  • Remaining step groups

Creating First Step Group


Creating the first step group is a bit different from the rest. So, we describe it separately. Note that we have NOT clicked on the record button yet.

Before we click on the record button (i.e., red circle), create the first message group as shown below:
Open your notepad and copy the first row into the title field as shown below. Then click OK.

Note that we have chosen "No delay" for the first step. But, for other steps, we will specify "Delay 44 secs."

Start Recording


Now click the record button. Your chosen browser (for our demonstration, it's Firefox) will be brought up. Copy your URL:
http://www.mycompany.com:9006/customer/faces/CrmFusionHome
into the address field and hit Enter. This finishes the recording of the first step group.

Next repeat the following subtasks for the remaining groups until it finishes:
  1. Creating a new step group in OpenScript
    • Right select previous Step Group to bring up context menu and select New > Step Group
  2. Copying the next row of click path from Notepad
  3. Clicking next step in your Browser


Finally, don't forget to stop the recorder.

Exporting Script


If your runtime environment is Linux, you need to export script created in OpenScript as follows:
File > Export Script...

For example, a new zip file was created in our default repository:
D:\OracleATS\OFT\FUSE_Saleopty_oct07_wrk.zip
You can then copy it to your Linux box:
scp FUSE_Saleopty_Server1_wrk.zip aime1@mylinuxserver:/scratch/aime1/work

References

  1. Oracle Application Testing Suite
  2. OpenScript for Load Testing Script Troubleshooting (Tutorial)
    • Version: 12.3.0.1 Build 376 was used in this article.
    • This version requires Firefox 10.0 ESR (Windows download).
  3. Oracle Application Testing Suite Downloads
  4. Oracle Application Testing Suite 12.x: Oracle Load Testing Overview
  5. OATS: Tie All Processes Together — from OpenScript to Scenario (Xml and More)

© Travel for Life Guide. All Rights Reserved.

Analytical Insights on Health, Culture, and Security.