ISTQB Certified Software Test Engineer

Monday, October 29, 2012

VBScript Selenium WebDriver

Selenium Web driver supports a wide variety of client drivers implemented in different languages,but it does not support Vb script client drivers which is playing a key role in QTP automation. QTP and Selenium are the two widely used functional automation tools which are always different(in terms of licensing ,the languages they support for scripting). But now VBS webdriver is an api used to implement selenium web driver using VB script(Now This is common for QTP & Selenium:)). Now one can automate their application using selenium ,choosing vbscript as their scripting language. Please see the below link for more details VBS Webdriver.

Tuesday, April 24, 2012

Handling Element not visible exception in Selenium


While working with Selenium Web driver in your project,there will be some scenarios like handling Smart Menus(Drop down menus),hidden buttons,hidden links etc...
Some times using wait's will solve the problem of handling hidden elements,but not every time.

For example if we are using drop down menu,when we click on Main menu,the drop down will be populated.When we change the mouse position the drop down will close.In such scenarios it will be difficult to click on sub menu.

This can be handled by using JavaScriptExecutor Class of Web driver.Using this class we need to change the CSS property of that web element(By default this element is invisble)as below.
JavascriptExecutor js=(JavascriptExecutor)driver; js.executeScript("$('"+CssSelector+"').css({'display':'block'});");

Example:
<span class="main">Outer Span
<span>Inner Span</span>
<ul style="display:none">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</span>
The list in the inner span is invisible,assume that it will be visible when we place mouse on the outer span. This scenario is difficult to handle using web driver,because when we change mouse position the list may go invisble. This case will be handled in web driver by using the following piece of code.

driver.findElement(By.ClassName("main")).click();
//click on Span,then change CSS property of UL using JavaScript Executor
JavascriptExecutor js=(JavascriptExecutor)driver;
js.executeScript("$('span.main ul').css({'display':'block'});");

Thursday, March 29, 2012

Running a Selenium Script Parallelly using Web Driver

If we want to run a Selenium Script across multiple machines parallelly we are using Selenium Grid.
Using Selenium web driver we can achieve this parallel execution with the help of Remote Web driver class and starting Standalone jar on the remote machine(remote machine may be your local some times).
But with this approach you can run the script in multiple browsers in the same
machine.
The prerequisites to implement this using web driver are
1.Browsers to be installed in the machine
2.Standalone Selenium Server jar has to be started.
Here is the sample code


import static org.junit.Assert.assertTrue;

import java.net.MalformedURLException;
import java.net.URL;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class GoogleTest {

public static WebDriver driver;
@BeforeClass
public static void main(String args[]) throws Exception{

DesiredCapabilities browsers[] ={DesiredCapabilities.firefox(),DesiredCapabilities.internetExplorer()};

for(DesiredCapabilities capabilities :browsers){

System.out.println("Executing Google Test in"+capabilities.getBrowserName());
driver =new RemoteWebDriver(new URL("http://127.0.0.1:4444/wd/hub"), capabilities);

driver.get("http://google.com");
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Cheese!");
element.submit();
System.out.println("Page title is: " + driver.getTitle());
assertTrue(driver.getTitle().contains("cheese!"));


}

}
}

Monday, February 6, 2012

WebDriver Backed Selenium---Selenium RC Integrated with WebDriver

Selenium Launched its version2 and they named it as Webdriver.The working and api of this webdriver is quite simple when compared with the Selenium RC which is implemented on JavaSCript and whose api is quite complex.

Many people started working in RC and they are getting familiar with this api, Thought works released their version 2 suddenly which is different from their version 1 .This makes the selenium testers a bit confusion.

Later in their second version they integrated Selenium RC api and they named it as Webdriver backed selenuim,using which testers can write their Test cases using RC as well as Webdriver apis.

Monday, January 9, 2012

Clustering atechnique for improving test case Prioritization

Providing a quality product is a challenge for every originization.Different organizations follow different approaches for improving their quality standards,but for every approach a TestPlan and testcases are needed.

Consider an application which is having some hundreds of Test cases,if we need to perform a sanity test over the application ,How can we test??

What are the test cases that we need to test in sanity testing??'


For each and every test case we will assign some priority and we start testing high priority test cases in this situation.Now the question is How can we assign priority??
There are many ways to assign priority but one efficient technique is to use Clustering approach(Data Mining concept).
Clustering is a Datamining technique in which the objects(for us test cases)are divided into groups and objects in the same group will have similar futures.These groups are also called clusters.


How can we performing clustering on test cases??
The closest test cases in terms of code coverage are grouped into cluster.


How can we prioritize those test cases??

We can Prioritize them using
1.Code COverage
2.Code complexity
3.Fault History Information.


"A clustering approach to improve testcase prioritization" by Ryan Carlson an employee of "Microsoft" explained this process in IEEE international conference on software Maintenance.