Skip to main content

Posts

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 = "...

Send Mail from Automation Scripting

Often we have scenarios to send the reports after execution of scripts via scripting. Here is an example... Dim msg Set msg = CreateObject("CDO.Message") msg.From="abcd @gmail.com " msg.To="efgh @gmail.com " msg.Subject="Testing1 Sub" msg.TextBody="Testing1 Body" msg.AddAttachment("C:\\test.xls") msg.Send set msg=nothing msgbox "Finished" If you guys want to send with detailed things,  Refer CDO.Message Object reference... Below lines are optional. But sometimes we need to add these lines to pass.... msg.Configuration.Fields.Item( " http://schemas.microsoft.com/ cdo/configuration/smtpserver ") =" smtp.gmail.com " msg.Configuration.Fields.Item( " http://schemas.microsoft.com/ cdo/configuration/ smtpserverport ")=25 msg.Configuration.Fields.Item( " http://schemas.microsoft.com/ cdo/configuration/sendusing ")= 2 msg.Configuration.Fields.Item( " http://schemas.microsoft...

Steps to create COM Exposed DLL

Open Visual Studio and Create a Project. 1. Create a CLass Library 2. Inside the .vb file, Create a Interface first. 3. Create class by inheriting from Interface. 4. Create Strong Name under "Signing" TAB of Properties. 5. Enable the "Register for Com Interop" under "compile" TAB of Properties 6. Enter the Assembly Information under "Application" TAB of Properties 7. Build the Solution. After this, 1. Goto "Visual Studio 2010 Command Prompt" 2. Navigate to dll path 3. Register the dll using "regasm" like regasm test.dll /tlb:test.tlb Now Registry Entries will be done under CLSID and Interface. Then 4. Export to GAC(Global Assembly Cache ie. C:\Windows\Microsoft.Net\Assembly\) using "gacutil.exe" like gacutil /i test.dll That's all.... We can use the COM application.... Refer the links: =============== http://www.codeproject.com/KB/COM/nettocom.aspx http://www.15seconds.com/issue/040721....

Selenium Start...

Selenium Start.... - Have wrapper libraries to Selenium methods so that it is easy for testers to use them e.g. Launching browser etc. - Have separate library for methods specific for module which can be called by multiple TCs - Externalize locators in a separate file. If you don't have IDs, however preferred, you may use Xpaths - Externalize data on separate xmls and plan to have individual xml for each language which gets called based on locale set Hope it will guide the novice users to start with selenium...