Monday, October 12, 2020

HTTP 419 Page Expire Issue in Jmeter due to multipart request or Webkitformbounday

While working on the POST request , we re encountering HTTP 419 and Page expiration response in the response of request  

This is the most common issue that we encountered during many of our assignment where we have to upload a file or where there is content type of multipart or webkitformboundary

So below are the possible steps to remove the issue

1. Select the Follow redirect(If redirection are there) , Use Multipart/form-data 





2. Delete the Content- Type header from the request headers 


This will most probably resolve the issue


Happy Testing... with Perfeasy... AI based automated tool for performances testing







Thursday, July 4, 2019

Recording /Testing Curl APIs Using Jmeter

Many times we came across the situation to test the Curl Rest APIs but the challenge is to record them as making custom HTTP request embed error most of the times while preparing scripts for them.

There are mainly two ways to record the curl APIs when we are taking in regard to the Jmeter.One process can be used to capture the CURL request in any type of proxy

Method 1 : Curl To Test Plan convertor in Jmeter 5.1
 New functionality has been introduce in Jmeter 5.1 in which we can give curl as input to the jmeter and it gets converted to the HTTP test plan.Below are the step for the same.

Step 1: Select "Import from Curl" from Tools in JMeter 5.1







Step 2: Past the required Curl command  and press convert to http plan








Step 3: You can see that Curl has been converted to normal HTTP request now you can test the same





Method 2:
There are some situation when jmeter is not able to parse the complex Curl using the convert utility.
at this time we would require method of capturing CURL using proxy on command line

for this we need to install the CURL in windows machine then then need to download the curl certification and then set the path of curl.exe to PATH in environment variables and then capture the CURL by configuring proxy on system and executing CURL on command line as follows

Step 1: Installing CURL

macOS: Already available 

If you have Windows, you can download and install cURL as follows.
  1. In Windows, create a new folder called curl in your C: drive.
    C:\curl
  2. Go to http://curl.haxx.se/download.html and download one of the following zip files:
    • If you have a Windows 64 system, scroll to the Win64 - Generic section and look for the latest Win64 ia64 zip version with SSL support. It's normally second in the list. Click the version number to start the download.
    • If you have a Windows 32 system, scroll to the Win32 - Generic section and look for the latest Win32 zip version with SSL support. It's normally second in the list. Click the version number to start the download.
  3. Unzip the downloaded file and move the curl.exe file to your C:\curl folder.
  4. Go to http://curl.haxx.se/docs/caextract.html and download the digital certificate file named cacert.pem.
    The PEM file contains a bundle of valid digital certificates. The certificates are used to verify the authenticity of secure websites. They're distributed by certificate authority (CA) companies such as GlobalSign and VeriSign. The PEM file allows cURL to connect securely to the Zendesk API using the Secure Sockets Layer (SSL) protocol.
  5. Move the cacert.pem file to your C:\curl folder and rename it curl-ca-bundle.crt.
  6. Add the curl folder path to your Windows PATH environment variable so that the curl command is available from any location at the command prompt. Update the variable as follows:
    1. In the Start menu, right-click This PC and select More > Properties.
      Note: In Windows 7, right-click Computer and select Properties.
    2. Click Advanced System Settings.
    3. In the Advanced tab, click the Environment Variables button on the lower right side.
    4. Select the "Path" variable in System Variables, and click Edit.
    5. In the Edit environment variable dialog box, click New and add the path to the curl.exe file. Example: C:\curl.

      Windows 7: In the Variable Value textbox, append a semicolon to the value, followed by the path to the curl.exe file. Example: ;C:\curl


    1. Keep clicking OK to accept the change and close the dialog box.
Step 2:  Configure System Level Proxy :
Refer to the http://www.lalitgarg.in/2017/01/load-test-desktop-applications-using-jmeter.html

Step 3: Configure and Start proxy on Jmeter/Burpsuite/ any proxy tool

Step 4: Execute Curl command with --proxy localhost:port arguments and you will see the Request  captured in






Happy Testing !!!!!
  

Tuesday, November 13, 2018

Distributed (Remote) Testing Using Jmeter


JMeter: Distributed (Remote) Testing

JMeter is popular open source load testing software from Apache and it is a Java Graphical application. The easiest way to run it in Amazon EC2 is in a windows server so it could be easily access via RDP.

JMeter has a master/slave architecture where the client is the master and multiple JMeter servers are slaves running tests in a scalable fashion. I tried to set up an environment where the master instance would be hosted by my workstation behind corporate firewall but due to the corporate polices with regards to setting up inbound rules in the firewall it proved to be a challenge.

So, I gave up and went with the approach where I set up  both the master and client(s) in Amazon EC2, the master on a large instance so it has the CPU to process the graphs and the slave(s) on medium instances that have the network capacity to run the tests.
In order to be able to set up distributed environment you have to have some basic knowledge of how to spin up and Amazon server image and set up security groups (and the concept of AWS security groups). You have to be logged into AWS console in order to accomplish it.

Terminology
Before we dive into the step-by-step instructions, it's a good idea to define the terms and make sure the definition is clear.
Master– the system running Jmeter GUI, which controls the test
Slave– the system running jmeter-server, which takes commands from the GUI and send requests to
the target system(s)
Target– the webserver to stress test

Important notes

Make sure that all the nodes (client and servers) :
  • are running exactly the same version of JMeter.
  • are using the same version of Java on all systems. Using different versions of Java may work but is discouraged. I had to download in install the same version of JDK across all servers that I used in the test.
If the test uses any data files, note that these are not sent across by the client so make sure that these are available in the appropriate directory on each server. In my test, on the server machine I had to define the following path, that I had defined in the 'User Defined Variables' section of my Java script.


Step-by-step guide

  • Log in AWS console.
  • Define two security groups, one to be used by the master and another one by the slave. Go with default values, you will tailor them later once you have spun up the server images.
  • Pick an Amazon Windows Image. In my case I selected  64 bit Windows 2008 R2 Server image (the same was selected for the second image). Launch a large instance (for the master). Take note of its public IP addresses. In my case I had '54.86.105.11'. Make sure that port 3389 (security group) open for RDP, the same would apply for the second image (see below)
  • Launch a medium instance to be used as a host for a slave. In a case when a few slaves are required then more instances should be launched. Take note of their public IP addresses. I spun a single instance with the following IP address: '54.166.224.129'
  • Edit the (master) security group with the following inbound rule (see the screenshot below). The IP address of the slave's host should be used with the CIDR notation, that is the /32 prefix should be appended to the IP address. Note, I picked an arbitrary port 51000. Could be any port as long as it is not in use by any other process. Once you have edited it, the changes will be applied on the fly to the created image.
  • This port would be used to transfer test results from the slave server over to the master.
  • Edit the (slave) security group with the following inbound rule (see the screenshot below). The IP address of the slave's host should be used with the CIDR notation, that is the '/32' prefix should be added to the IP address. Note, I picked an arbitrary port 4000. Could be any port as long as it is not in use by any other process.
  • This port will be used for the master server to pass a set of test instructions to the slave machine. The master will be listening to this one port only to receive results. That means that all of the slaves will be sending their results back through this port.
  • Now, navigate to the slave host and into the [JMETER_HOME]/bin directory. Open jmeter.properties file and make sure to edit the following properties in the Remote hosts and RMI configuraion section of this file:
  • Now, on the slave host in the same [JMETER_HOME]/bin directory launch the JMeter application via command line, making sure to pass the public IP address of the slave's host. YOu are going to end up with the following output:

  • On the master machine similar to step one edit a few properties as indicated below in the jmeter.properties file
  • On the master machine launch JMeter GUI and select the  slave's host in the shortcut menu which should get the test going:


















*********************************************************************************

Hope this information will be useful, please provide your valuable feedback/suggestions !! Happy Testing.

Wednesday, March 21, 2018

Essential Skills for Performance Tester

Based on the discussion we had among the experienced performance testers/ engineers we came up with the essential skills that is required to be in Performance Testers

17 essential skills for growing web performance engineers
Requirement Gathering and System Level Skills:

1) Able to Understand the System Architecture (Knowledge of components ,OS , techology etc)
2) Have Basic understanding of System hardware Resource Like CPU , Memory, Network, Disc etc
3) Should Know about the Diffrent Types of Test Environments
4) Able to Know and understand  Functional Level Workflows
5) Able to gather information about Scenario of Currnt Production Load and Expected Load
6) Able to gather the information about SLAs

Scripting and Testing Skills:

1) Able to Install and Configure testing tools
2) Able to record and enhance the scripts
3) Understand and Prepare the Test Data
4) Able to create different scenarios (Load,Stress, real Life ) based on the expectations
5) Running the load test executions for the above created scenarios

Monitoring and Result Analysis Skills:

1) Able to analyze the load test tool results
2) Configure server monitoring counters
3) Bottleneck Identification
4) Reporting


Feel free to add in comments if i have missed anything

Tuesday, January 9, 2018

Using JSON extractor in Jmeter: How to deal with dynamic values in JSON response

How To use JSON Extractor in Jmeter

Json extractor is used like regular expression extractor to capture some dynamic values from the response but used for json only.

By using this we can fetch the values of variables in the Json.

Let me take an example

Below is the Json and its corresponding response:


Here we want to extract the value of variable name "label" or "val"
 which are changing dynamically

We can use Json extractor to fulfil thie purpose here

below is the JSON values that can be used



In this Json extractor blow are the parameters and their corresponding values

Variable Name: Name of the variable (can be used anything logical, here we have used the same as we are getting in response)

JSON Path expression: It is the most important part for JSON configurations, We should use the path extractor expression here.
 Here we have used $..lable , Here two dot means we have json variable in two nested blocks, For normal JSON where there is only one tag , we used single dot.

Match Number: 0 means any random value, here we can use 1 or 2 to get first value or second value and so on, we can also use -1 for getting all possible values to be stored in array (with variable name as mentioned above)

Default Values: this values that can be passed when we didnt got the expected value.


TO varify the value captured in Json extractor:

We can use the Debug Sampler on the thread group to validate the value captured using Json extarctor, Debug sample is used to print all the used defined configured variable in jmeter.


Here we can see that variable "label": captured SpiceJet , and lable_matchNr having value as 10 because there are 10 occurrence of the values corresponding to the expression we have defined for variable label in JSON extractor.


Feel Free to add if i have missed anything.



Tuesday, December 12, 2017

Client Side Response Time/Rendering Time and Server Side Time of Mobile app/Web Application

When we talk about the performance testing of any application weather it is web application of Mobile App. First question comes in our mind is about the user experience of the application.

Most of the tools that are available in the market gives the stats of only one component of this scenario i.e. they only provide the server-side response time. 

But client-side loading time/rendering time is also point of interest if we are taking about the end to end response time.

though not very useful information is available over the google from where you can get the client-side response time and server-side response time as well., but when there is an issue with the performance of the application then it becomes necessary to segregate even if the issue is at server side of at client side.

We can achieve this by a simple formula:

Capture over all page load time
Capture TTFB [Time to first buffer] 

1) There is an issue in page at server side if TTFB is high and difference of load time and TTFB is very low
2) There is an issue at client side if TTFB is very low and high page load time is there

Even we can get the segregation of server-side response time as well as client side response time using the Fiddler while capturing the Mobile App/Web App requestes:

You can easily understand these from the below screenshot:






Below parameters will give us this segregate results:

·  FiddlerBeginRequest – The time at which Fiddler began sending the HTTP request to the server.
·  ServerGotRequest - Exact time that Fiddler finished (re)sending the HTTP request to the server.
·  ServerBeginResponse - Exact time that Fiddler got the first bytes of the server's HTTP response.
·  ServerDoneResponse - Exact time that Fiddler got the last bytes of the server's HTTP response.
·  ClientBeginResponse - Exact time that Fiddler began transmitting the HTTP response to the client browser.
·  ClientDoneResponse- Exact time that Fiddler finished transmitting the HTTP response to the client browser.




Capturing Response time for Andriod App Launcher

Below are the scenario that we have tried to capture the response time of Google Now Launcher activities .

We have tried to capture the response time of below activities taking it as Minor Project : 

Minor Project – QA
Evaluate the performance of Google Now Launcher from Play Store.
• Install the latest version of Google Now Launcher
• Report the average application opening time of Hot-seat icons
• Report the average time to navigate to App Drawer
• Report the average application opening time of App Drawer icons
• Test that on long press the Launcher enters overflow mode
• Test that user is able to change wallpaper of Launcher

All the activities that are mentioned above are client side only and leg time for the same depend on the RAM in the test device, Though we can easily get the matrix for CPU, Memory,Network utilization on device but for capturing leg time, I have tried the following scenarios


1) Manually Using Stopwatch:
                 Major drawback of capturing Response time/Lag Time using this scenario is the non accuracy of the results as response time is in less than a second.
 
2) Using ADB Logs
                  We were expecting the time to be logged in Activity manager line item in the ADB logs, but for application(Purely Client side) like Launchers will not have any activity Manager line item in Logs., This is possible for Native app to get the response time of user activity 

Inline image 1

3) Using Debug Proxy : Not able to record any client side request in Google Now Launcher

4) Using Fiddler : Seems it can give the client side response time, we have tried for some web apps, (refer to attached snapshot), we are facing some issue while downloading and installing fiddler certificate for Andriod and trying to get the same.

5) Using Automation tools(Thought):
                 We can capture the client side response time using  the customization logs in the automation scripts to capture the time stamps , But when we tried this solution for app launhers, we were not able to get the response time for the same.

Apart from these , i have also tried many other things that i found on google, but was unabale to capture the same.