Showing posts with label Jmeter. Show all posts
Showing posts with label Jmeter. Show all posts

Integration of Junit test with Jmeter

In this post I will show you how to integrate and execute Junit test with Jmeter .

Junit test:

Here I have created two Junit test:
1. JunitFirstTest.java:
package com.test;

import org.junit.*;

public class JunitFirstTest {

    @BeforeClass
    public static void beforeClassAnnotation() {        
         System.out.println("@BeforeClass - for junit class 1");
    }

    @AfterClass
    public static void afterClassAnnotation() {       
         System.out.println("@AfterClass - for junit class 1");
    }  

    @Test
    public void testAnnotation() {       
        System.out.println("@Test - first class test method");
    }    
}

Road to save Jmeter test results.

Jmeter test execution report will automatically  save in xml, csv format into your machine by adding "Simple Data Writer" listener to "Thread Group".
Add “Simple Data Writer” listener to your Jmeter thread group. Browse result file from your machine in which you want to save result.


Click on “Configure” button and set up result configuration.


After execution reports are saved in mentioned file.

Road to apply assertions in jmeter wsdl web services.

Assertion or verification is important in testing, by using this we can ensure that our testing is going in right direction. Suppose we sent a request to server and get some response but here how we ensure whether we are getting correct response or not. So by using assertion we can ensure for correct response at run time, if response is not correct then test will fail for that request.

In my previous post, I posted “http://roadtoautomation.blogspot.com/2013/05/road-to-jmeter-data-driven-testing-of.html”, today I continue from that post so you need to read previous post before this.

Road to Jmeter data driven testing of wsdl web services.

Data driven testing is play most important roles in testing, it means that Jmeter test execute with a set of values pass from external files. In this post, I am going to explain the way to perform data driven testing in Jmeter soap request.

Before reading this blog you must read my previous post “Road to Jmeter test of wsdl web services.”

You need to put all your data in csv file as in my case I put data in csv file separated with comma and saved file in my system. Below is the csv data format:

Road to Jmeter test of wsdl web services.

In this post, I am going to explain how to create jmeter test for wsdl api testing to perform load testing. Before creating test you need following set up in your machine.

Set Up:
  1. Download and setup java path in your system environment path. 
  2. Download and install Jmeter.
  3. Download and install soapUI.
Here I am using wsdl url “http://www.webservicex.com/CurrencyConvertor.asmx?wsdl”.

Road to jmeter test execution with maven

In this post I explain the procedure of Jmeter test execution using maven build tool. 

Setup:

1. Download and setup java path in your system environment path.
2. Download and install Jmeter.
3. Download and setup maven bin path in your system environment path

Road to correlation in Jmeter test script

Today, I continue posting regarding jmeter, in my previous two post I explained how to create jmeter test script and how parameterize test scripts from external file? In this post I am going to explain about correlation in jmeter

What is Correlation: correlation play most important role in jmeter scripting. It is a procedure by which fetching dynamic data from a request’s response and passing it into next request.

Why need Correlation: 
Suppose we have a login scenario in which.
     1. User enter credential and click on submit button.
     2. At dashboard click any tab.
Now, if I recoded above scenario and replay back using jmeter then test will fail. The reason behind it that authentication mechanisms use here. As when I recorded test script server automatically generated a dynamic session id which passed in next request of test for validating authentication of user. So when I executed test scripts every time a new session Id generated dynamically as user login request sent, we need to pass same session Id in next request. So these types of scenarios we need to handle using correlation of jmeter

Road to parameterization in Jmeter test script

Parameterization is process by which user input some values to test script at execution time using external files such as csv, xls, txt, xml etc. In Jmeter test, suppose we need to check login functionality with 100 set of user so in this case we parameterize users from external file. At execution time user picked dynamically .

Steps Jmeter parameterization.

1. After capturing request and responses of your web application you need to create a csv file and put data in file separated with comma. As I created below  csv file for urls parameterization


Road to Jmeter - procedure to create first test script for the beginners

Set up and installation:

1. Download java(JDK) from link "“http://www.oracle.com/technetwork/java/archive-139210.html” and setup path in your system environment variable.
2. Download apache Jmeter from link “http://jmeter.apache.org/download_jmeter.cgi”.
3. Unzip downloaded Jmeter package in your machine, go to extracted folder and open bin folder.
4. Click on “jmeter.bat” file you should see that a cmd screen and Jmeter console should opened as below.


After completing above steps you are ready to create First Jmeter script.