jmeter is an open source testing software. It is 100% pure Java application for load and performance testing.

Similar documents
Adobe Flex Tutorial i

Before you start with this tutorial, you need to know basic Java programming.

This tutorial will take you through simple and practical approaches while learning AOP framework provided by Spring.

This tutorial provides a basic understanding of how to generate professional reports using Pentaho Report Designer.

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. Jenkins

This tutorial is designed for all Java enthusiasts who want to learn document type detection and content extraction using Apache Tika.

AN INTRODUCTION TO PERFORMANCE TESTING USING JMETER

Guide to Install J Meter

This tutorial explains how you can use Gradle as a build automation tool for Java as well as Groovy projects.

This is a brief tutorial that explains how to make use of Sqoop in Hadoop ecosystem.

Using JMeter. Installing and Running JMeter. by Budi Kurniawan 01/15/2003

About the Tutorial. Audience. Prerequisites. Copyright and Disclaimer. PySpark

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. HCatalog

This tutorial will teach you how to use Java Servlets to develop your web based applications in simple and easy steps.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. RichFaces

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

This tutorial has been prepared for beginners to help them understand the basic functionalities of Gulp.

About the Tutorial. Audience. Prerequisites. Copyright and Disclaimer. Logstash

This tutorial explains the key concepts of Web Dynpro with relevant screenshots for better understanding.

This tutorial is designed for software programmers who would like to learn the basics of ASP.NET Core from scratch.

Introduction Installation and Startup JMeter GUI

JPA - INSTALLATION. Java version "1.7.0_60" Java TM SE Run Time Environment build b19

You must have a basic understanding of GNU/Linux operating system and shell scripting.

Memcached is an open source, high-performance, distributed memory object caching system.

SAP Lumira is known as a visual intelligence tool that is used to visualize data and create stories to provide graphical details of the data.

This is an introductory tutorial, which covers the basics of Jython and explains how to handle its various modules and sub-modules.

This is a small tutorial where we will cover all the basic steps needed to start with Balsamiq Mockups.

This tutorial also elaborates on other related methodologies like Agile, RAD and Prototyping.

This is an introductory tutorial designed for beginners to help them understand the basics of Radius.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. Django

Parrot is a virtual machine designed to efficiently compile and execute bytecode for interpreted languages.

So, this tutorial is divided into various chapters and describes the 5G technology, its applications, challenges, etc., in detail.

Testing is the process of evaluating a system or its component(s) with the intent to find whether it satisfies the specified requirements or not.

Microsoft Excel is a spreadsheet tool capable of performing calculations, analyzing data and integrating information from different programs.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer ASP.NET WP

This tutorial will show you, how to use RSpec to test your code when building applications with Ruby.

Before proceeding with this tutorial, you must have a good understanding of Core Java and any of the Linux flavors.

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright DAX

Spring framework was initially written by Rod Johnson and was first released under the Apache 2.0 license in June 2003.

JOGL INSTALLATION. Installing JOGL. System Requirements. Step 1 - Verifying Java installation on your machine

JMETER - TEST PLAN ELEMENTS

Scalable Vector Graphics commonly known as SVG is a XML based format to draw vector images. It is used to draw twodimentional vector images.

You should have a basic understanding of Relational concepts and basic SQL. It will be good if you have worked with any other RDBMS product.

This tutorial provides a basic understanding of the infrastructure and fundamental concepts of managing an infrastructure using Chef.

Prepared by JMeter Group, Summer Interns

In this tutorial, we are going to learn how to use the various features available in Flexbox.

Artix Orchestration Installation Guide. Version 4.2, March 2007

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Meteor

In this brief tutorial, we will be explaining the basics of Elasticsearch and its features.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Haskell Programming

This tutorial will help you understand JSON and its use within various programming languages such as PHP, PERL, Python, Ruby, Java, etc.

This tutorial will guide users on how to utilize TestLodge in reporting and maintaining the testing activities.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Drupal

WA1958 Mobile Software Design Patterns and Architecture Android Edition. Classroom Setup Guide. Web Age Solutions Inc.

Purpose. Why use Java? Installing the Software. Java

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer DBMS

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. WordPress

vsphere Web Client SDK Documentation VMware vsphere Web Client SDK VMware ESXi vcenter Server 6.5.1

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Gerrit

This tutorial will help you in understanding IPv4 and its associated terminologies along with appropriate references and examples.

Choose OS and click on it

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. TurboGears

Dart is an open-source general-purpose programming language. It is originally developed by Google and later approved as a standard by ECMA.

Sentences Installation Guide. Sentences Version 4.0

Platform SDK Deployment Guide. Platform SDK 8.1.2

About Tutorial. Audience. Prerequisites. Disclaimer & Copyright. Euphoria

TEMPO INSTALLATION I O A. Platform Independent Notes 1. Installing Tempo 3. Installing Tools for the Plugins 5. v0.2.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

This tutorial introduces you to key DynamoDB concepts necessary for creating and deploying a highly-scalable and performance-focused database.

This tutorial covers a foundational understanding of IPC. Each of the chapters contain related topics with simple and useful examples.

CA Mediation Manager. Installation Guide. Release 2.1.4

Before proceeding with this tutorial, you should have a good understanding of the fundamental concepts of marketing.

Apache Tomcat Installation guide step by step on windows

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Laravel

This tutorial is prepared for beginners to help them understand the basic-to-advanced concepts related to GPRS.

This tutorial will give you a quick start with Consul and make you comfortable with its various components.

Running Java Programs

This tutorial has been designed for beginners interested in learning the basic concepts of UDDI.

Oracle Weblogic products are available at

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright CICS

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Joomla

This tutorial helps the professionals aspiring to make a career in Big Data and NoSQL databases, especially the documents store.

Certified Core Java Developer VS-1036

This tutorial has been prepared for beginners to help them understand the simple but effective SEO characteristics.

CA Mediation Manager and CA Mediation Manager for Infrastructure Management

This is a simple tutorial that covers the basics of SAP Business Intelligence and how to handle its various other components.

This tutorial provides a basic level understanding of the LOLCODE programming language.

Installation guide for Java. Step by Step Guide. A C A D G I L D Page 1

This tutorial will help computer science graduates to understand the basic-to-advanced concepts related to data warehousing.

Installer Apache Manually Windows Server Bit

Performance Testing: A Comparative Study and Analysis of Web Service Testing Tools

Nimsoft Monitor. websphere Guide. v1.5 series

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Apache Bench

This brief tutorial provides a quick introduction to Big Data, MapReduce algorithm, and Hadoop Distributed File System.

Merge Sort Quicksort 9 Abstract Windowing Toolkit & Swing Abstract Windowing Toolkit (AWT) vs. Swing AWT GUI Components Layout Managers Swing GUI

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

This tutorial is designed for those who would like to understand the basics of i-mode in simple and easy steps.

RadBlue s S2S Quick Start Package (RQS) Developer s Guide. Version 0.1

Before you start proceeding with this tutorial, we are assuming that you are already aware about the basics of Web development.

Transcription:

i

About the Tutorial jmeter is an open source testing software. It is 100% pure Java application for load and performance testing. jmeter is designed to cover various categories of tests such as load testing, functional testing, performance testing, regression testing, etc., and it requires JDK 5 or higher. This tutorial provides an in-depth coverage of jmeter framework including its test plans, listeners, functions, and regular expressions. Audience This tutorial is designed for software professionals in the domain of Testing who are required to test enterprise-level applications for robustness and reliability. Prerequisites Before proceeding with this tutorial, you should have a basic understanding of Java programming language. As you are going to use jmeter to perform all types of testing (regression, functional, load, performance, etc.) at different stages of a Java project, it is recommended that you have a good grip over software development and software testing processes. Copyright & Disclaimer Copyright 2015 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at contact@tutorialspoint.com i

Table of Contents About the Tutorial... i Audience... i Prerequisites... i Copyright & Disclaimer... i Table of Contents...ii 1. JMETER OVERVIEW... 1 What is JMeter?... 1 JMeter Features... 1 How JMeter Works?... 2 2. JMETER ENVIRONMENT... 3 System Requirements... 3 3. JMETER TEST PLAN... 7 What is a Test Plan?... 7 Writing a Test Plan... 7 4. JMETER TEST PLAN ELEMENTS... 12 Thread Group... 12 Controllers... 13 Listeners... 15 Timers... 15 Assertions... 16 Configuration Elements... 17 Pre-processor Elements... 18 Post-processor Elements... 18 Execution Order of Test Elements... 19 ii

5. JMETER WEB TEST PLAN... 20 Start JMeter... 20 Rename the Test Plan... 20 Add Thread Group... 21 Add Sampler... 22 Add Listener... 24 Run the Test Plan... 24 View the Output... 25 6. JMETER DATABASE TEST PLAN... 28 Create JMeter Test Plan... 28 Adding JDBC Requests... 29 Create Listener... 31 Save and Execute Test Plan... 32 7. JMETER FTP TEST PLAN... 34 Rename Test Plan... 34 Add Thread Group... 34 Add Sampler FTP Request... 35 Add Listener... 36 8. JMETER WEBSITE TEST PLAN... 40 Create Webservice Project... 40 Create JMeter Test plan... 43 9. JMETER JMS TEST PLAN... 49 Building a JMS Point-to-Point Test Plan... 50 Building a JMS Topic Test Plan... 55 iii

10. JMETER MONITOR TEST PLAN... 63 Setup Tomcat Server... 63 Write JMeter Test Plan... 65 11. JMETER LISTENERS... 71 Default Configuration... 71 CSV Log format... 72 Saving Response Data... 73 Loading (Reading) Response Data... 73 Saving the Listener GUI Data... 73 12. JMETER FUNCTIONS... 74 JMeter Functions and User Variables... 74 List of Functions... 74 Where to Use Functions and Variables?... 76 Referencing Variables and Functions... 77 The Function Helper Dialog... 77 Pre-defined Variables... 78 Pre-defined Properties... 78 13. JMETER REGULAR EXPRESSIONS... 79 14. JMETER BEST PRACTICES... 84 iv

1. JMETER OVERVIEW JMeter Before going into the details of JMeter, let us first understand a few jargons associated with the testing of any application. Performance Test: This test sets the best possible performance expectation under a given configuration of infrastructure. It also highlights early in the testing process if any changes need to be made before the application goes into production. Load Test: This test is basically used for testing the system under the top load it was designed to operate under. Stress Test: This test is an attempt to break the system by overwhelming its resources. What is JMeter? JMeter is a software that can perform load test, performance-oriented business (functional) test, regression test, etc., on different protocols or technologies. Stefano Mazzocchi of the Apache Software Foundation was the original developer of JMeter. He wrote it primarily to test the performance of Apache JServ (now called as Apache Tomcat project). Apache later redesigned JMeter to enhance the GUI and to add functional testing capabilities. JMeter is a Java desktop application with a graphical interface that uses the Swing graphical API. It can therefore run on any environment / workstation that accepts a Java virtual machine, for example: Windows, Linux, Mac, etc. The protocols supported by JMeter are: Web: HTTP, HTTPS sites 'web 1.0' web 2.0 (ajax, flex and flex-ws-amf) Web Services: SOAP / XML-RPC Database via JDBC drivers Directory: LDAP Messaging Oriented service via JMS Service: POP3, IMAP, SMTP FTP Service JMeter Features Following are some of the features of JMeter: 5

Being an open source software, it is freely available. It has a simple and intuitive GUI. JMeter can conduct load and performance test for many different server types: Web - HTTP, HTTPS, SOAP, Database via JDBC, LDAP, JMS, Mail - POP3, etc. It is a platform-independent tool. On Linux/Unix, JMeter can be invoked by clicking on JMeter shell script. On Windows, it can be invoked by starting the jmeter.bat file. It has full Swing and lightweight component support (precompiled JAR uses packages javax.swing.* ). JMeter stores its test plans in XML format. It means you can generate a test plan using a text editor. Its full multi-threading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups. It is highly extensible. It can also be used to perform automated and functional testing of the applications. How JMeter Works? JMeter simulates a group of users sending requests to a target server, and returns statistics that show the performance/functionality of the target server/application via tables, graphs, etc. Take a look at the following figure that depicts how JMeter works: 6

7

2. JMETER ENVIRONMENT JMeter JMeter is a framework for Java, so the very first requirement is to have JDK installed in your machine. System Requirements JDK 1.6 or above. Memory No minimum requirement. Disk Space No minimum requirement. Operating System No minimum requirement. Step 1 - Verify Java Installation First of all, verify whether you have Java installed in your system. Open your console and execute one of the following java commands based on the operating system you are working on. OS Task Command Windows Open Command Console c:\> java -version Linux Open Command Terminal $ java -version Mac Open Terminal machine:~ joseph$ java -version If you have Java installed in your system, you would get an appropriate output based on the OS you are working on. OS Output Windows java version "1.7.0_25" 8

Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode) Linux java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode) Mac java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode) If you do not have Java installed, install the Java Software Development Kit (SDK) from http://www.oracle.com/technetwork/java/javase/downloads/index.html. We are assuming Java 1.7.0_25 as the installed version for this tutorial. Step 2: Set Java Environment Set the JAVA_HOME environment variable to point to the base directory location, where Java is installed on your machine. For example: OS Output Windows Set the environment variable JAVA_HOME to C:\Program Files\Java\jdk1.7.0_25 Linux export JAVA_HOME=/usr/local/java-current Mac export JAVA_HOME=/Library/Java/Home Append Java compiler location to System Path. OS Output Windows Append the string; C:\Program Files\Java\jdk1.7.0_25\bin to the end of the system variable, Path. 9

Linux export PATH=$PATH:$JAVA_HOME/bin/ Mac not required Verify Java Installation using java -version command as explained above. Step 3: Download JMeter Download the latest version of JMeter from http://jmeter.apache.org/download_jmeter.cgi. For this tutorial, we downloaded apache-jmeter-2.9 and copied it into C:\>JMeter folder. The directory structure should look like as shown below: apache-jmeter-2.9 apache-jmeter-2.9\bin apache-jmeter-2.9\docs apache-jmeter-2.9\extras apache-jmeter-2.9\lib\ apache-jmeter-2.9\lib\ext apache-jmeter-2.9\lib\junit apache-jmeter-2.9\printable_docs You can rename the parent directory (i.e. apache-jmeter-2.9) if you want, but do not change any of the sub-directory names. Step 4: Run JMeter After downloading JMeter, go to the bin directory. In this case, it is /home/manisha/apache-jmeter-2.9/bin. Now click on the following: OS Output Windows jmeter.bat Linux jmeter.sh Mac jmeter.sh 10

After a short pause, the JMeter GUI should appear, which is a Swing application, as seen in the following screenshot: This is the main page and the default page of the tool. 11

3. JMETER TEST PLAN JMeter What is a Test Plan? A Test Plan can be viewed as a container for running tests. It defines what to test and how to go about it. A complete test plan consists of one or more elements such as thread groups, logic controllers, sample-generating controllers, listeners, timers, assertions, and configuration elements. A test plan must have at least one thread group. Writing a Test Plan Follow the steps given below to write a test plan: Step 1: Start the JMeter Window Open the JMeter window by clicking /home/manisha/apache-jmeter-2.9/bin/jmeter.sh. The JMeter window will appear as shown below: This is a plain and blank JMeter window without any additional elements added to it. It contains two nodes: Test Plan node: It is where the real test plan is kept. 12

Workbench node: It simply provides a place to temporarily store test elements while not in use, for copy/paste purposes. When you save your test plan, Workbench items are not saved with it. Step 2: Add/Remove Elements Elements (which will be discussed in the next chapter Test Plan Elements) can be added to a test plan by right-clicking on the Test Plan node and choosing a new element from the "add" list. Alternatively, you can load an element from a file and add it by choosing the "merge" or "open" option. For example, let us add a Thread Group element to a Test Plan as shown below: To remove an element, make sure the element is selected, right-click on the element, and choose the "remove" option. 13

Step 3: Load and Save the Elements To load an element from file: Right-click on the existing tree element to which you want to add the loaded element. Select Merge. Choose the file where you saved the elements. JMeter will merge the elements into the tree. By default, JMeter does not save the element, you need to explicitly save it. 14

To save a tree element: Right-click on the element. Choose the Save Selection As... option. JMeter will save the element selected, plus all the child elements beneath it. By default, JMeter doesn't save the elements, you need to explicitly save it as mentioned earlier. Step 4: Configure the Tree Elements Any element in the Test Plan can be configured using the controls present in JMeter's righthand side frame. These controls allow you to configure the behavior of that particular test element. For example, the Thread Group can be configured for a number of users, ramp up periods, etc., as shown below: 15

Step 5: Save the Test Plan You can save an entire Test Plan by using either Save or "Save Test Plan As..." from the File menu. 16

Step 6: Run the Test Plan You can run the Test Plan by clicking Start (Control + r) from the Run menu item. When JMeter starts running, it shows a small green box at the right-hand end of the section just under the menubar. The numbers to the left of the green box are the number of active threads / total number of threads. These only apply to a locally run test; they do not include any threads started on remote systems when using client-server mode. Step 7: Stop the Test Plan You can stop your test in two ways: Using Stop (Control + '.'). It stops the threads immediately if possible. Using Shutdown (Control + ','). It requests the threads to stop at the end of any current work. 17

End of ebook preview If you liked what you saw Buy it from our store @ https://store.tutorialspoint.com 18