Data Driven Framework - XML

I am not going to explain what is data driven framework or what is its benefits. All of them are pretty well-known . If not, just google it. Here I am going to explain a sample code which can be used to read from xml data files. This will be helpful to implement a data driven frame work for BDD testing , using Specflow or Cucumber Pre - requiste Code is written in Csharp . We need to add below reference to visual studio solution ...

July 29, 2016 · Aby George A

Data Driven Framework - Excel

In previous blog post, I have explained about how use XML for making a data driven framework for automation testing . It can be found here. I have also written about how to use jxl library for reading from excel and writing into Excel. Below is another code snippet to read all values of a row and save it into a hash map for accessing later during automation test. public HashMap GetAllDataForARow (String sheet, int Row){ HashMap DataMap = new HashMap(); try { Workbook wrk1 = Workbook.getWorkbook(new File(dataPath)); //Obtain the reference to the first sheet in the workbook Sheet sheet1 = wrk1.getSheet(sheet); int x =0; Cell colArow1 , colArow2; do { colArow1 = sheet1.getCell(x,0); colArow2 = sheet1.getCell(x,Row); DataMap.put(colArow1.getContents(), colArow2.getContents()); x=x+1; }while (colArow1.getContents() != ""); } catch (BiffException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }catch (IndexOutOfBoundsException e){ } return DataMap; }

July 30, 2016

Nodejs

This post is just for making notes during my learning of Node.js through various courses and online material. This will be always a work in progress blog post Node.js is an open source server side runtime environment, which is cross platform.It uses Javascript as its language check node version node --version Making web request in Node we can make webrequest by using inbuilt http or by using ‘request’ example : For making web request by http ...

July 12, 2016

Volunteering Experience

A couple of months back , I helped out to organize clinical examination for RACP. I created a tool ( Excel Macro) for finalizing exam schedules for all attendees. The roster should consider employee preference, examiner availability, timeslot, venue and other parameters. Below is what I got in return ( even though they misspelled my name).

October 16, 2015

Selenium

Difference between / and // in XPath / is used to create absolute XPath which starts from root. This is highly brittle since any changes to UI will change element locator. // is used to create relative XPath . The XPath is created relative to another element in UI Difference between driver.get() and driver.navigate().to() Both driver.get() and driver.navigate().to() will try to open a webpage and wait for the page to load. It means, it will wait till Onload event has fired. But it will not wait for all AJAX calls to trigger and process. Both of them are essentially the same. How ever Navigate() interface exposes the ability to move backward and forward in browser history. ...

June 22, 2015

Java - Writing Into specific cell in Excel

In my previous blog post , I have mentioned how to read from an excel file using jxl jar files in Java. It can be found here In this post, I will explain how to write into an excel using same library. Below example will update the excel cell content with the value passed and also update its formatting . The color of the cell will change depending on value we pass. We can use similar functions for updating any other cell format. ...

June 10, 2014

Java - Reading a specific cell in Excel

Below is a code snippet for reading a specific cell from Excel using Java. It is done by using importing jxl jar files which can be found here. Import below in class file import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.format.Colour; import jxl.read.biff.BiffException; import jxl.write.*; Below is function for reading value from specific cell in Excel public String readexcel(String sheet, int intRow, int intCol){ try { //Create a workbook object from the file at specified location. //Change the path of the file as per the location on your computer. Workbook wrk1 = Workbook.getWorkbook(new File(dataPath)); //Obtain the reference to the first sheet in the workbook Sheet sheet1 = wrk1.getSheet(sheet); //Obtain reference to the Cell using getCell(int col, int row) method of sheet // Add " - 1" to both intRow , intCol depending how whether we consider excel start with row & column number as 0 or 1 Cell colArow1 = sheet1.getCell(intRow , intCol ); //Read the contents of the Cell using getContents() method, which will return //it as a String String strReturn = colArow1.getContents(); return strReturn; /* //Display the cell contents System.out.println("Contents of cell Col A Row 1: \""+str_colArow1 + "\""); System.out.println("Contents of cell Col B Row 1: \""+str_colBrow1 + "\""); System.out.println("Contents of cell Col A Row 2: \""+str_colArow2 + "\"");*/ } catch (BiffException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return sheet; } Below is an example of how to read from a cell based on row number and Column NAME ...

June 1, 2014

Hello world

Redirect

May 21, 2014