Saturday, April 30, 2011

DDT Code

//Data Driven Test Framework using Selenium and TestNG
//This Test performs search for the movie and looks for the attributes on the result page
//Data is read from the Excel SS - imdb_data1.xls
package script;

import com.thoughtworks.selenium.*;

//import org.junit.AfterClass;
import org.openqa.selenium.server.SeleniumServer;
import org.testng.annotations.*;

import jxl.*;

public class dataProviderExample extends SeleneseTestCase{

public void setUp() throws Exception {
SeleniumServer seleniumserver=new SeleniumServer();
setUp("", "*firefox");"/");

@DataProvider(name = "DP1")
public Object[][] createData1() {
Object[][] retObjArr=getTableArray("test\\resources\\data\\imdb_data1.xls",
"DataPool", "imdbTestData1");

@Test (dataProvider = "DP1")
public void testDataProviderExample(String movieTitle,
String directorName, String moviePlot, String actorName) throws Exception {
//enter the movie title
selenium.type("q", movieTitle);
//they keep switching the go button to keep the bots away
if (selenium.isElementPresent("nb15go_image"))"nb15go_image");

//click on the movie title in the search result page"xpath=/descendant::a[text()='"+movieTitle+"']");
//verify director name is present in the movie details page
//verify movie plot is present in the movie details page
//verify movie actor name is present in the movie details page

public void tearDown(){

public String[][] getTableArray(String xlFilePath, String sheetName, String tableName){
String[][] tabArray=null;
Workbook workbook = Workbook.getWorkbook(new File(xlFilePath));
Sheet sheet = workbook.getSheet(sheetName);
int startRow,startCol, endRow, endCol,ci,cj;
Cell tableStart=sheet.findCell(tableName);

Cell tableEnd= sheet.findCell(tableName, startCol+1,startRow+1, 100, 64000, false);


System.out.println("startRow="+startRow+", endRow="+endRow+", " +
"startCol="+startCol+", endCol="+endCol);
tabArray=new String[endRow-startRow-1][endCol-startCol-1];

for (int i=startRow+1;i<endRow;i++,ci++){
for (int j=startCol+1;j<endCol;j++,cj++){
catch (Exception e) {
System.out.println("error in getTableArray()");


}//end of class

Sunday, April 24, 2011

Android Apps Testing Tool-kit

Playing around with idea to develop a testing tool-kit for Android. With so many applications being built, there is a dire need to shorten the time to market. That is the main reason, most of the applications available in the market either crash or do not meet user expectation. It is apparent that the quality is veiong sacrificed in order to mee the deadlines. To ensure that the Android apps are delivered with quality and also in time, there is a need for a testing framework that can check on the quality of apps on certain standard parameters as below:

1. Installation testing:
Tester’s need to focus on installation & uninstallation of the app. User will install the app through Market place, but since the app is not in market place testers can use the app installer from marketplace for installation tests.

2. Requirement (Functionality) Testing:
Test for the application functionality according to designed test cases.

3. Widget testing:
Test the widget by adding widget, using widget as per functionality i.e. music widget should play music, deleting widget.

4. Phone Interrupt testing:
Test the application behavior on phone call, SMS & other notifications.

5. Stress testing (monkey test):
There is a command in android where it generates series of events at different frequencies.
Make sure your app passes this monkey test

6. UI testing:
Testing for UI can be done to verify that the app meets standard guidelines.

Refer the link below:

7. Compatibility Test:
Developers do the unit testing on the emulators. Testers need to test on actual environment i.e. devices. There are multiple devices of different resolutions & having various OS i.e. Android 1.5, 1.6. 2.1 & 2.2. We need to check for compatibility on maximum devices.