Road to automate webview using Calabash

Calabash only supports web view which is in build in mobile application and not supported web application opened on mobile browser. I have searched such type application and finally got from MonketTalk sample application. In this I have created step definition and automated below form:

Road to identifying elements using Calabash's query command

In this post, I will show you the way, how to identify application elements. Before going below, make sure you resigned and created test server of your application.
Now open commands prompt, go to directory application and run below command:
 calabash-android console {ApkfileName} 
Calabash console should be opened. Following are the some basic way to find element details using query commands.

Road to data driven testing in SoapUI using groovy script with excel file

SoapUI Pro has a feature to read data from external files like: excel, csv etc. But SoapUI does not provide such feature to read data from excel file. So for reading data from excel file in SoapUI, we need to write some code in groovy script.
I this post I will show you, how to read data from excel file.I am using poi jar files to read data from excel file in groovy, download following jar files and put into SoapUI lib folder.
  • poi-3.8-beta5-20111217.jar
  • poi-examples-3.8-beta5-20111217.jar
  • poi-excelant-3.8-beta5-20111217.jar
  • poi-ooxml-3.8-beta5-20111217.jar
  • poi-ooxml-schemas-3.8-beta5-20111217.jar
  • poi-scratchpad-3.8-beta5-20111217.jar 
  • dom4j-1.6.1.jar

Script assertion in Soap UI for WSDL API methods

In this post I will show you how to add script assertion in SoapUI response of wsdl api test methods.
Here I have an example of CurrencyConvertor, I created a SoapUI project and added test case for this method as you can see in below window.

Now here in response body I will add assertion that verify the “ConversionRateResult” value is always 104 for given input value.

BDD framework in Webdriver using C#

In my previous post, I have posted BDD framework in Webdriver using Java. In this post I will show you how to create BDD framework using C#. To achieve this I will use SpecFlow. This is same as Cucumber and you can write specs (features) file by using the same Gherkin language.
Setup:
1. Install Visual studio.
2. Download and install SpecFlow from link :”click” For more detail about SpecFlow go to link ”click
3. Download NUnit Test Adapter from link:”click”.
Steps to create project: 
1. Go to File >>New >>Project and click.
2. Select Visual C# >> Class Library.
3. Enter project name into name filed and click on "OK" button, as below screen.

Java WebDriver BDD framework using Cucumber-JVM

In this post I will show you how to create BDD framework in webdriver selenium using cucumber-jvm. Cucumber –JVM is based on cucumber framework which allows to writes feature file in plain text using Gherkin language, This feature is supported by step definitions file which has implemented automation code of Webdriver.
This post cover maven based java webdriver BDD framework using cucumber for Google advance search scenario, Following are the steps to write scenario for BDD framework:
1.  First create a maven eclipse project.
WebdriverBDD
                    src/main/java                 
                   
                    src/test/java
                    ******** com/maven/test
                       
                    src/test/resources
                    ******** com/maven/test
                    pom.xml


Java junit client of WSDL webservices

In this post, I will show you how to create java client for WSDL web services.
I will Create a example of currency converter,  This is wsdl URL  for same. “currency converter

Request of “ConversionRate” method:

Webdriver implicit and explicit wait for element locator.

Today most of web application using Ajax, When page is load some element load in a different time of interval or some time request send without page loading if the element not present then it through element not found exception or not visible element etc.. To handle this Webdriver provides two type of wait “implicit” and “explicit” wait

Implicit Wait: implicit wait provide to load DOM object for a particular of time before trying to locate element on page. Default implicit wait is 0. We need to set implicit wait once and it apply for whole life of Webdriver object. Add below line of code in test for implicit wait. However implicit wait slow down execution of your test scripts if your application responding normally.

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

Calabash android predefined steps.

Calabash android has some predefined steps, you don’t need to define these steps in your steps definition ruby file. Just call these functions in your  feature file by passing valid argument.

Assertion steps:
Following are the some steps definition for the assertion

Then /^I see the text "([^\"]*)"$/  

Then /^I see "([^\"]*)"$/

Then /^I should see "([^\"]*)"$/ do

Then /^I should see text containing "([^\"]*)"$/ do

Then /^I should not see "([^\"]*)"$/ do

Then /^I don't see the text "([^\"]*)"$/ do

Then /^the view with id "([^\"]*)" should have property "([^\"]*)" = "([^\"]*)"$/ do

Then /^the "([^\"]*)" activity should be open$/ do


Road to verify css properties value using Webdriver

To get css values of any locator, we will create java script function with the use of “getDefaultComputedStyle”function. We will execute java script function using webdriver and fetch css properties value.
getDefaultComputedStyle () gives  default computed value of all css properties of an element.
Here I have created a sample example in which I am verifying Google home page menu bar css properties color, height and width.

package com.test;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.JavascriptExecutor;
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 WebdriverCSSValue {

   private WebDriver driver;
   private String baseUrl;

   @BeforeSuite
   public void setUp() throws Exception {
         driver = new FirefoxDriver();                    
         baseUrl = "https://www.google.co.in/";
         driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
   }

   @Test
   public void testCSSvalueVerifying() {
         driver.get(baseUrl + "/");
              
         // js scripts
         String js = "return window.document.defaultView.getComputedStyle(" +
                                       "window.document.getElementById('gbx3'))";
         String jsColor = js+".getPropertyValue('color')";
         String jsHeight = js+".getPropertyValue('height')";
         String jswidth = js+".getPropertyValue('width')";

         // execution of js scripts to fetch css values
         JavascriptExecutor jsexecuter = (JavascriptExecutor) driver;
         String color = (String) jsexecuter.executeScript(jsColor);
         String height = (String) jsexecuter.executeScript(jsHeight);
         String width = (String) jsexecuter.executeScript(jswidth);
              
         //assertion
         Assert.assertTrue(color.equals("rgb(34, 34, 34)"));
         Assert.assertTrue(width.equals("986px"));
         Assert.assertTrue(height.equals("29px"));
              
         // print css values
         System.out.println(color);
         System.out.println(height);
         System.out.println(width);
   }
  
   @AfterSuite
   public void tearDown() throws Exception {
         driver.quit();
  }