Wednesday, September 27, 2017

Part 1: HOW TO RUN PERFORMANCE TESTS USING JMETER ON MOBILE APPS

Introduction:
In this tutorial, we will look like overview of how to install and start Jmeter 3.2 and we will also learn about the basic Jmeter and how to run performance tests on mobile apps.
What is Jmeter?
JMeter is a 100% Java application, open source software, designed to load test for analyzing and measuring the performance of variety of applications , with a focus on web applications.
Why Jmeter?
  • Open source testing tool and the most popular performance tool.
  • Easy to download and install.
  • Have huge community support.
  • Can test for web app or mobile app
  • Can view result by table, graph
Prequities:
  • JMeter now requires Java 8.
  • JMeter logging has been migrated to SLF4J and Log4j 2.
Downloading and Installing Jmeter
Step 1: Download file and Install the latest  JRE or JDK. This is needed as JMeter is a pure Java application.
Step 2:  Download file and Install the latest  Jmeter (version 3.2)

  • Unzip the file on your desired path.

  • Steps to Launch JMeter : Go to your JMeter bin folder to launch JMeter, then run jmeter.bat (in windows )  file or jmeter.sh (in linux, MacOS) in here.
Launch of Jmeter




  • Example : How to run performance an App in Mobile with Jmeter
    Step 1: Create a Thread Group and Add Recording Controller.
    • First, add a Thread Group to Test Plan: Right-click on Test Plan > Mouseover Add > Mouseover  Threads (Users) > Click on Thread Group

    • Add User Defined Variables : - Click on Thread Group > Mouse over Add > Mouseover Config Element> Click on User Defined Variables



    • Then,  add a Recording Controller: Right-click on Thread Group > Mouse over Add > Mouseover Logic Controller > Click on Recording Controller


  • Step 2: Create a test script. First, add a HTTP(s) Test Script  Recorder to Test script: Right-click on WorkBench  > Mouseover Add > Non-Test Elements > Click on  HTTP(s) Test Script  Recorder
    • Add ‘8080’ as Port value and click the Start button. This will start the JMeter proxy on localhost


  • Step 3: On Android phone, get  CRT file from  apache-jmeter-3.2\bin and install on mobile. Then configure proxy of mobile



  • Android proxy configuration:
Go to Settings>Wi-Fi option > connected network and click the “Modify Network” option > Check the “Advanced options” check box > Set ‘Proxy’ option to “Manual” > Set “Proxy hostname” as your computer’s IP address and ‘Proxy port’ to 8080 as we have set up in JMeter configuration > Click “Save” option.

Step 4: Add Listener and  Run the Test Plan. Right-click the Thread Group (Users) > Choose Add > Listener > View Results Tree / Summary Report

  • Then click Start button

The way to create scenario and activities
* Input data to test by CSV file. 
First, create CSV file.  In This example, I saved the file as “xxx.csv” (telephone and code country)

  • Then go into JMeter and find the HTTP request step that you want to modify to use the values in this CSV file. Right click on it and go to Add > Config Element > CSV Data Set Config.


  • Next click on the CSV Data Set Config step to modify it
You’ll need to fill in at least 3 values on this screen:
 + Filename: if your file is in the /bin directory, this can be just the filename.
If it’s somewhere else, use the full path to the file.
 + Variable names: this is the equivalent to a “column name” in a spreadsheet.

 Delimiter: comma is the default delimiter.

After the CSV step is filled out correctly, go back to your HTTP request and change the value of the “phone” and “zone” fields to variables.

*The number users to test. Right-Click the Thread Group and add User Defined Variables Config Element in your JMeter test


  • Create a new variable: protocol with value https


  • Go to the HTTP Request and add the variable name where you want to be replaced with its value, use ${protocol}


  • Result -> CSV file -> report. Right click Thread Group and Add -> Listeners -> Aggregate Report


    • Configure the filename in the Filename field of the Aggregate Report. 
     Ex: [FULLPATH]/results.csv
    • Run the test script and  file with the results.csv name should now be created at the path specified
HoaLe





6 comments:

  1. Hi,
    Best article, very useful and well explanation. Your post is extremely incredible.Good job & thank you very much for the new information, i learned something new. Very well written. It was sooo good to read and usefull to improve knowledge. Who want to learn this information most helpful. One who wanted to learn this technology IT employees will always suggest you take Best Training institutes for python course in BTM Layout

    ReplyDelete
  2. Facilitating self-awareness through blogs ensures that audience are able to see the true picture of the society. You are writing blog to be the best in this industry and giving everyone equal opportunities to express their opinions. Apartment Buildings for Sale

    ReplyDelete
  3. Central above off run baby general someone. Idea artist skill model step.career-news

    ReplyDelete
  4. Tough history price like various. Scene among dream number whatever both economic.education

    ReplyDelete