Thursday, February 7, 2013

On Shore/ Off Shore/ Development Sanity Testing Strategy

With the advent of Globalization the current project development model is changed in such a way that people from various part of the world will check in code for the same project. Every day when we check out the code we may want to make sure the current build is stable or not.

For web application there are several ways to make the manual work automated by using various tools.
When i was working for start-up company in silicon valley, there was close to 20 developers check-in code from different part of the world.

So i decided to automate the process by using automation tools. Since it was a .net application i decided to go with Code It Test. I had visual studio 2010 professional at that time and it was not supported and i couldn't make any progress.

If you are interested 

The i decided to shift to Selenium IDE automation. It is a simple fire fox plug-in and easy to install.

Selenium IDE

1) Browse the URL https://addons.mozilla.org/en-us/firefox/addon/selenium-expert-selenium-ide/  using Firefox
2) Go to Firefox menu and click Tools -> Selenium ID. 
3) Choose record and play option
4) Run your test case
5) Stop recording and play your test case.

       Record and play option which comes with that IDE is very handy. It is managers favorite tool. All Development as well as Project managers will like it for its simplicity. Just click and watch the entire show and if there is any error due to latest check-in shoot email.

Selenium Web-drive
Next step is use Web Drive. Understanding of each and element and its functionality is very important to create test cases. To get quick idea of elements and its actions we can use firebugs.
1) Install firebug add-on from https://addons.mozilla.org/en-us/firefox/addon/firebug/
2) Browse the site you want to write test case. It could be your companies internet, intranet site or any web application written in any language.










3) Check the above screen shot to to learn how to find each and every element in a webpage. 
4) Firebugs will help you to understand the elements name or id or class name or action performed on it. Either it is client side java-script call or server side post call etc.
5)Download Selenium web http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.28.0.jar&can=2&q=

Open a new eclipse java project. Add the downloaded jar file. Below code is a sample to open amazon.com website and search .

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class AmazonSearchTest {
public static void main(String[] args) throws Exception {
        // The Firefox driver supports javascript 
        WebDriver driver = new FirefoxDriver();
        
        // Go to amazon home page
        driver.get("http://www.amazon.com/");        
  
       // Get Elements for search text box and click button
        driver.findElement(By.id("twotabsearchtextbox")).sendKeys("Sujatha");  
        driver.findElement(By.className("nav-submit-input")).click();              
     }

}

1 comment: