Road to verify 200 response code of web application in java webdriver

This post will help to verify HTTP response code 200 of web application using java webdriver. As webdriver does not support direct any function to verify page response code. But using "WebClient" of HtmlUnit API we can achieve this.

Html unit API is GUI less browser for java developer, using WebClent class we can send request  to application server and verify response header status.

Below code, I used in my webdriver script to verify response 200 of web application

 String url = "http://www.google.com/";
 WebClient webClient = new WebClient();
 HtmlPage htmlPage = webClient.getPage(url);

 //verify response
 Assert.assertEquals(200,htmlPage.getWebResponse().getStatusCode());
 Assert.assertEquals("OK",htmlPage.getWebResponse().getStatusMessage());

Road to accept certificates in internet explorer using webdriver

One of my projects, I need to verify application certificates during test case execution . It was working fine on firefox and google chrome browser as webdriver automatically accept certificate.  But Internet Explorer webdriver was not accepted automatically after doing a lot of observation, finally I got solution by navigating below java script code with webdriver object.

 driver.navigate().to("javascript:document.getElementById('overridelink').click()");

Road to verify PDF file text using java webdriver

In this post I will explain the procedure to verify PDF file content using java webdriver. As  some time we need to verify content of web application pdf file, opened in browser.
Use below code in your test scripts to get pdf file content.

Jenkins Hudson

Jenkins is an open source continuous Integration tool written in java originated by Hudson.  Jenkins is most popular continuous integration tool in market. The reason is Jenkins is easy to use, open source, intuitive user interface and powerful features, supported variety of languages, technologies including Java .net, PHP, Ruby, Python, and Groovy etc.

Junit Test with Maven

In this post I will explain how to create and run JUnit test using maven. download Apache maven from link “download”, extract zip package into you machine and setup path maven bin folder into your system  environment variable. following are the steps to create JUnit test for maven and maven commands.

JUnit Test creation:

Create source folder in your eclipse “src/test/java” and “src/main/java” as below screen:

Procedure to run AutoIt script using ant (build.xml) tool.

In this post I will cover the procedure of AutoIT script execution with the help of ant build tool. As we know ant has java based library. But here I have set AutoIT compiler with Ant's build.xml file and can execute AutoIT scripts
  1. Ant path must be set in to system environment variable.
  2. AutoIT installation directory path must be set in to system environment variable.
    Below is a sample build.xml file for AutoIT script execution.

PHP Selenium RC data driven testing

In this post I will cover the procedure of data driven testing in selenium RC with phpunit framework.  PHP unit provide @dataProvider provider annotation.

In this post I have created a data driven test script in phpunit on Wikipedia where I put some country data in to excel file.

Soap UI Assertions

In this post I am going to explain what assertion in soapui is and how we can apply script assertion.

Assertion

Assertion functionality in SoapUI is used to validate the response of request received by the Test Steps at the time of execution. Usually assertion is to compare a part of message (or the entire message) to some expected value.
Assertion applied in SoapUI at response of request, if any assertion failed then test marked as failed. Failed test can be verify and find out the reason.

Data driven testing using java webdriver TestNg framework

In this post I implemented that how to perform data driven testing using java Webdriver  TestNg framework. As we know testNg provide @DataProvider annotation, using this I can pass a set of data into our Webdriver test method.  I have created a sample test script for Wikipedia where I use a set of country data, with Wikipedia search functionality and verify searched country.

Ant build tool

Apache Ant is java based library and command line tool. Ant drive application using build xml file, control behavior of build, compile and run targets define in build xml file.

Basically ant build is a java based application. It can be Also  build non java applications such as C, C++, PHP, Python etc by passing their compile/interpreter. Ant is written in java so ant user can be develop their own library. Ant is easy to use it does not impose coding convention or directory layouts to the java projects.

Ant use a configuration xml file, default name of file is build.xml. ant directly call target define in build file. Targets can be define their dependencies, ant will automatically execute dependent target.

Here is a sample of ant buid.xml file.