Skip to main content

Posts

Showing posts from August, 2011

QTP - Logging with folder structure

'QTP - Logging with folder structure for cases------ Function PushLog(StepName, StepDetail) Dim dicMetaDescription, intContext Set dicMetaDescription = CreateObject("Scripting.Dictionary") dicMetaDescription("Status") = micGeneral dicMetaDescription("PlainTextNodeName") = StepName dicMetaDescription("StepHtmlInfo") = " " + StepDetail +" " 'Some backdoor settings: 'dicMetaDescription("DllIconIndex") = 206 'dicMetaDescription("DllIconSelIndex") = 206 dicMetaDescription("DllPAth") = "C:\Program Files\HP\QuickTest Professional\bin\ContextManager.dll" intContext = Reporter.LogEvent("User", dicMetaDescription, Reporter.GetContext) 'Set the new report node as a parent 'From now on, all reports will be added under this node Reporter.SetContext intContext End Function Function PopLog() 'Now return to the parent l...

Help Links

Selenium Grid:- http://www.ibm.com/developerworks/web/library/wa-seleniumgrid/ http://selenium-grid.seleniumhq.org/run_the_demo.html Flash Selenium:- http://www.adobe.com/devnet/flash/articles/flash_selenium.html

Apache POI - Read Excel - For use of Selenium TestNG DataProvider

Here is the Class designed for reading Excel file... You can download the JAR files needed to work with Apache POI here . package Excel; import java.io.File; import java.io.FileInputStream; import org.apache.poi.ss.usermodel.*; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import java.util.Hashtable; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.dom4j.DocumentException; public class POI { int rowIndex = 0, columnIndex = 0; Workbook wb; Sheet ws; Row wr; String fileName, sheetName; Hashtable <String, String> [] data = null; public  void open() throws IOException  { if (fileName.indexOf("xlsx") < 0) { wb = new HSSFWork...

TestNG - DataDriven Custom Framework

Here is the sample code for DataDriven TestNG test... package Excel; import java.io.IOException; import java.lang.reflect.Array; import java.util.Hashtable; import org.testng.annotations.Test; import org.testng.annotations.DataProvider; import org.testng.annotations.BeforeClass; import org.testng.annotations.AfterClass; import org.openqa.selenium.*; import org.openqa.selenium.server.SeleniumServer; import com.thoughtworks.selenium.DefaultSelenium; import com.thoughtworks.selenium.Selenium; import Excel.POI; //Class POI contains methods to read Excel file public class Test1 { SeleniumServer server; Selenium sel; POI poi = new POI(); @BeforeClass public void beforeClass() throws Exception { server = new SeleniumServer(); server.start(); sel = new DefaultSelenium("localhost", 4444, "*iehta", "http://www.google.com/"); sel.start(); } @DataProvider public Object[][] dp() throws IOException { poi.fileName = "...