HTTP Proxy Server in JMeter: Record Example Script-chapter 11


Record Testing help tester to record & run their activity against test target. It is a type of automated testing but for multiple users. This tutorial guides you how to use Proxy Server to record your test.
The Proxy Server allows JMeter to watch and record user activity while they are browsing web application with a normal browser.
In this tutorial, you will learn
  • Step 1) Setting HTTP Proxy server
  • Step 2) Record your activity
  • Step 3) Run your Test Plan
  • Step 4) Save your test result
Here is the roadmap of this practical example
HTTP Proxy Server Testing using Jmeter

Step 1) Setting the HTTP Proxy server

This is a Step-by-step guide to setup proxy
  1. Start JMeter
  2. Select Test Plan on the tree
  3. Add Thread Group
    Right click on the Test Plan and add a new thread group: Add => Threads (Users) =>Thread Group
HTTP Proxy Server Testing using Jmeter
  1. Add HTTP Request
    Select the Thread Group; right click Add => Config Element => HTTP Request Defaults
HTTP Proxy Server Testing using Jmeter
In new HTTP Request Defaults element: In Server name or IP, enter "google.com". You should keep the others fields blank

HTTP Proxy Server Testing using Jmeter
  1. Add Recording Controller
    Right click on the "Thread Group" and add a recording controller: Add => Logic Controller =>
    Recording Controller
HTTP Proxy Server Testing using Jmeter
  1. Add Proxy Server to WorkBench
    Right click on the Workbench and add the http proxy: Add => Non-Test Elements => HTTP Proxy Server  
    HTTP Proxy Server Testing using Jmeter
  2. Set Target Controller where your recorded scripts will be added
HTTP Proxy Server Testing using Jmeter

  1. Start Proxy Server
    Return to HTTP Proxy Server, and click the Start button at the bottom. Now your JMeter proxy server start
    HTTP Proxy Server Testing using Jmeter  
  2. Start your Browser  choose Tool => Option => Advanced => Network => Setting => Enter HTTP proxy as figure below
     
    HTTP Proxy Server Testing using Jmeter

Step 2) Record your activity

  1. Now Launch http://www.google.com in your web browser (JMeter still open)
  2. Do activities search the keyword "apache".
  3. Back to JMeter, in HTTP Proxy Server, click Stop when finished
     

  4. After finishing recording, you will see JMeter automatically created a new HTTP request as the figure below
    HTTP Proxy Server Testing using Jmeter
    JMeter has already recorded a user request to the Home Page of Google website. Http://www.google.com/
    The other HTTP requests display in above figure, you should remove them. Because sometime JMeter also records some advertising links while you are searching keyword on Google. We should ignore them in our Test Plan
  5. Click File => Save your Test Plan as
    HTTP Proxy Server Testing using Jmeter
  6. A Dialog box display => enter a name of your test plan at File Name field => Click Save
    Now your Test Plan is saved under name RecordingTestPlan.jmx
HTTP Proxy Server Testing using Jmeter

Step 3) Run your Test Plan

  1. Select Thread Group => Add => Listener=> Summary Report

HTTP Proxy Server Testing using Jmeter
  1. The Summary Report will show some basic statics
    HTTP Proxy Server Testing using Jmeter
  2. Select Thread Group, enter information as the figure below
HTTP Proxy Server Testing using Jmeter


  1. Before you start the test, select "Summary Report". When you ready to run a test, select Run => Start (Ctrl+R). JMeter will playback your activity in 100 times
    As the test runs, the statistics will change until the test is done.
    HTTP Proxy Server Testing using Jmeter

Step 4) Save your test result

  1. Click Save Table Data to save test result to file
HTTP Proxy Server Testing using Jmeter
  1. Enter the name of the test result and click Save. Test Result in JMeter is saved in *.csv format as default
HTTP Proxy Server Testing using Jmeter

What is JMeter? Why it is used?-Chapter 1


The Apache JMeterTM is pure Java open sourcesoftware, which was first developed by Stefano Mazzocchi of the Apache Software Foundation, designed to load test functional behavior and measure performance.
 You can use JMeter to analyze and measure the performance of web application or a variety of services.
Performance Testing means testing a web application against heavy load, multiple and concurrent user traffic. 
JMeter originally is used for testing Web Application or FTP application. Nowadays, it is used for a functional test, database server test etc.

Why JMeter?


Have you ever tested a web server to know how efficiently it works? How many concurrent users can a web server handle?
Let say that one day, your boss asks you to do performance testing of www.google.com for 100 users. What would you do?

It's not feasible to arrange 100 people with PC and internet access simultaneously accessing google.com Think of the infrastructure requirement when you test for 10000 users (a small number for a site like google). Hence you need a software tool like JMeter that will simulate real-user behaviors and performance/load test your site.

JMeter Advantages

JMeter advantages are described as figure below
Introduction to JMeter
  • Open source license: JMeter is totally free,  allows developer use the source code for the development
  • Friendly GUI: JMeter is extremely easy to use and doesn't take time to get familiar with it
  • Platform independent: JMeter is 100% pure Java desktop application. So it can run on multiple platforms
  • Full multithreading framework. JMeter allows concurrent and simultaneous sampling of different functions by a separate thread group
  • Visualize Test Result: Test result can be displayed in a different format such as chart, table, tree and log file
  • Easy installation: You just copy and run the *.bat file to run JMeter. No installation needed.
  • Highly Extensible: You can write your own tests. JMeter also supports visualization plugins allow you to extend your testing
  • Multiple testing strategy: JMeter supports many testing strategies such as Load Testing, Distributed Testing, and Functional Testing.
  • Simulation: JMeter can simulate multiple users with concurrent threads, create a heavy load against web application under test
  • Support multi-protocol: JMeter does not only support web application testing but also evaluate database server performance. All basic protocols such as HTTP, JDBC, LDAP, SOAP, JMS, and FTP are supported by JMeter
  • Record & Playback Record the user activity on the browser and simulate them in a web application using JMeter
  • Script Test: Jmeter can be integrated with Bean Shell & Selenium for automated testing.

How does JMeter work?

The basic workflow of JMeter as shown in the figures below
JMeter simulates a group of users sending requests to a target server, and return statistics information of target server through graphical diagrams
Introduction to JMeter
The completed workflow of JMeter as shown in the figure below
Introduction to JMeter

Jmeter Version History

VersionDescription
1first official release
2.13Java 6+
3Java 7+
3.1Java 7+
3.2Java 8+
3.3Java 8
4Java 8 / 9

Node.js Vs Python: What's the Difference

Node.js is a server-side platform built on Google Chrome's JavaScript Engine. It uses a non-blocking, event-driven I/O model. It allows developers to create data-intensive real-time applications that run across distributed devices. Its applications are written in JavaScript. It can be run on OS X, Microsoft Windows, and Linux operating systems. It is widely used to run real-time server applications.

What is Python?

Python is an object-oriented, high level, dynamic and multipurpose programming language. Python's syntax and dynamic typing with interpreted nature, make it an ideal language for scripting.
It supports multiple programming patterns, including object-oriented programming, functional programming, or procedural styles. Moreover, it an interpreted language which means it cannot convert to computer-readable code before its runs at runtime.
In this compariosn, we will cover
  • Features of Node js
  • Features of Python
  • Node JS Vs. Python
  • When to use Node js?
  • When to use Python?

Features of Node js

  • It uses a single threaded model with event looping. This type of event mechanism benefits the server to respond in a non-blocking way.
  • It is built on V8 JavaScript Engine makes it fastest code execution library.
  • There is no buffering in Node.js as applications output the data in pieces.

Features of Python

  • It allows low-level modules inclusion to the Python interpreter. These modules allow programmers to add or customize their tools.
  • It provides interfaces to all major commercial databases.
  • It supports functional and structured programming methods as well as OOP.
  • It offers high-level dynamic data types and supports dynamic type checking.
  • It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

Node.JS Vs. Python

Node.JSPython
Node.js is best suited for asynchronous programmingPython is not exactly the best option for asynchronous programming.
Node.js is pure JavaScript, so its basics remain simple for the developers to learn.The biggest advantage of using Python is that developers need to write fewer lines of code.
Node.js lacks the clean coding standards. That's why it cannot be recommended for larger projects.It is ideal for a large project as it can do anything that can be done using PHP code.
Node.js is an ideal platform available right now to deal with real-time web applications.Not an ideal platform to deal with real-time web applications.
It best suited for small projects to enable functionality which needs less amount of scripting.Python is suited for developing larger projects.
Best for memory intensive activities.Not advisable for memory intensive activities.
Node.js is a better choice if your focus is on web applications and website development.Python is an ideal platform to do multiple things - web applications, integration with back-end applications, numerical computations, machine learning, and network programming.
Node.js utilizes JavaScript interpreter.Python using PyPy as Interpreter.
Node.js supports callback. Its programming is based on event/callback that makes it process Faster.It supports generators which makes it much simpler.
Selecting a development platform is significant steps in the app development phase. Node.JS and Python are certainly two highly discussed languages nowadays. Let where we can use Node JS and when to use python.

When to use Node js?

As Node.js is a platform built on Chrome's JavaScript runtime it helps to develop building scalable network applications. It uses an event-driven, non-blocking I/O model which makes it an ideal option for developing for data-intensive real-time applications.
Node.js offers greater performance and speed. It is an ideal solution for developing messaging or chatting applications. It is also useful for developing heavy-load applications and e-commerce sites that depend on the speed of processing.
Apps best suited with Node JS:
  • I/O bound Applications
  • Data Streaming Applications
  • Data Intensive Real-time Applications (DIRT)
  • JSON APIs based Applications
  • Single Page Applications

When to use Python?

Python has a library of open source data analysis tools, web frameworks, and testing instruments. Therefore, its ecosystem one of the largest out of any programming community.
Python is a most accessible language for new programmers as community provides many introductory resources. The language is also taught in universities and used for working with beginner-friendly devices such as the Raspberry Pi.
Python is also featuring consistency, stability, and easiness of use. It is highly preferred for developing scientific applications, big data solutions, and government projects.
Apps best suited with Python

Conclusion:

  • Node.js is a server-side platform. It is built on Google Chrome's JavaScript Engine. It offers features like single thread, very fast performance and no buffering.
  • Python is an object-oriented, high level, dynamic and multipurpose programming language. It has features like support for major databases, functional and statured programming, etc.
  • Node.js can be used for client and server web development.
  • Python is best suited for developing scientific and big data solutions.