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 execute java webdriver test scripts using maven build tool

In this post, I will explain how to execute webdriver java testNG test script using ant maven tool for this first we need to setup following in our machine.
  • Java should be installed on machine.
  • maven should be installing and setup path in system environment variable. 
Maven Project: 

Create maven project for eclipse by using post “” as mentioned in if you have not experience how to create maven eclipse project.
Create webdriver testNG test script and put into “src/test/java”  source folder. Also create testNg suite file for same test script and put into desire directory as I put into “src/test/resources” folder.
Your maven eclipse project looks like as below:


I have created a webdriver test scripts and put into “com.test.example” package under “src/test/java” source folder below is my webdriver test script “SearchCountry.java”.
package com.test.example;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;

public class SearchCountry {
                   
                     private WebDriver driver;
                     private String baseUrl;
                     
                      @BeforeSuite
                      public void setUp() throws Exception {
                        driver = new FirefoxDriver();
                        baseUrl = "http://www.wikipedia.org/";
                        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
                      }

                      @Test
                      public void testSearchCountry() throws Exception {
                        driver.get(baseUrl + "/");
                        driver.findElement(By.xpath("//a[contains(@title, \"English — Wikipedia\")]")).click();
                        driver.findElement(By.id("searchInput")).clear();
                        driver.findElement(By.id("searchInput")).sendKeys("India");
                        driver.findElement(By.id("searchButton")).click();
                        String searchedResult = driver.findElement(By.xpath("//h1[@id='firstHeading']/span"))
                                                             .getText();
                        Assert.assertTrue(searchedResult.equals("India"));
                      }

                      @AfterSuite
                      public void tearDown() throws Exception {
                        driver.quit();              
                      }
}
  
Below is testng suite “TestNGSuite.xml” file which I have created for above test script.

Road to create java maven project.

In this post I explain the procedure to create java maven project.  Before creating maven project you must have following setup in your system.
  1. Java 
  2. Maven
  3. Eclipse
Create Maven project:  create a folder in your system as I created “MavenProject” folder in D drive. Open command prompt, go to created project and run below command.

mvn archetype:generate -DgroupId={ProjectPackage} -DartifactId={ProjectName} -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Road to execute java webdriver testNg suite using ant build.

In this post, I will explain how to execute webdriver java test script using ant build tool.for this first we need to setup following in our machine.
  1. Java should be installed on machine.
  2. Selenium2 jar file.
  3. TestNG jar file.
  4. Ant should be installing and setup path in system environment variable.
Webdriver Test scripts.
I have created two webdriver test scripts in java on Wikipedia web application as mentioned below.
NavigateURL.java

package com.webdriver.test;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;

public class NavigateURL {
                   
                    private WebDriver driver;
                    private String baseUrl;
                     
                    @BeforeSuite
                    public void setUp() throws Exception {
                       driver = new FirefoxDriver();
                       baseUrl = "http://www.wikipedia.org/";
                       driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
                     }

                     @Test
                     public void testUntitled() throws Exception {
                       driver.get(baseUrl + "/");
                       driver.findElement(By.xpath("//a[contains(@title, \"English — Wikipedia\")]")).click();
                       driver.findElement(By.linkText("Contents")).click();
                       driver.findElement(By.cssSelector("a[title=\"Featured content – the best of Wikipedia\"]")).click();
                       driver.findElement(By.cssSelector("a[title=\"Find background information on current events\"]")).click();
                       driver.findElement(By.linkText("Random article")).click();
                     }

                     @AfterSuite
                     public void tearDown() throws Exception {
                       driver.quit();               
                     }
}
SearchCountry.java


package com.webdriver.test;

import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;

public class SearchCountry {
                   
                    private WebDriver driver;
                     private String baseUrl;
                     
                      @BeforeSuite
                      public void setUp() throws Exception {
                        driver = new FirefoxDriver();
                        baseUrl = "http://www.wikipedia.org/";
                        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
                      }

                      @Test
                      public void testUntitled() throws Exception {
                        driver.get(baseUrl + "/");
                        driver.findElement(By.xpath("//a[contains(@title, \"English — Wikipedia\")]")).click();
                        driver.findElement(By.id("searchInput")).clear();
                        driver.findElement(By.id("searchInput")).sendKeys("India");
                        driver.findElement(By.id("searchButton")).click();
                        String searchedResult = driver.findElement(By.xpath("//h1[@id='firstHeading']/span"))
                                                             .getText();
                        Assert.assertTrue(searchedResult.equals("India"));
                      }

                      @AfterSuite
                      public void tearDown() throws Exception {
                        driver.quit();              
                      }
}


Now we create testNg suite file as in my case, below is testng suite file created for the above test scripts


Road to handle http authentication in webdriver

One of my applications had Http authentication for security purpose and I had need to automate using webdriver. As we know http authentication is not a part of DOM object so we cannot handle it using webdriver. Here is approach to handle such type situation.

We need to pass http credential with URL to skip http popup authentication window. Below is URL format.


User above formatted URL in webdriver get method:


After using above approach, http authentication popup window disappear. But in Internet explorer, it raise error with message “wrong format url”. To accept same type url in internet explorer browser we need to add a DWORD value named exploere.exe and iexplore.exe  with value data 0 in below registry.
To open registry, open "regeidt" from run command.

  1. For all users of the program, set the value in the following registry key: HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE
  2. For the current user of the program only, set the value in the following registry key: HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE 
  3. If you are using 64 bit machine, set the value in the following registry key. HKEY_CURRENT_USER\Software\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE