Showing posts from 2012

What is AJAX ...!

AJAX is Asynchronous JavaScript And XML. This is a web development technique for creating interactive web applications, It allows exchanging small amounts of data with the server behind the scenes, without the page having to reload each time. It helps in increasing web pages interactivity, speed, and customer usability

Comparing 2 Text Files Using Vbscript/QTP

How to compare 2 text files The following function can be used to check and compare the content of the two files. Note:
This function is not part of QuickTest Professional/Astra QuickTest. It is not guaranteed to work and is not supported by Mercury Interactive Technical Support. You are responsible for any and all modifications that may be required. CompareFiles (FilePath1, FilePath2) FilePath1
The path to the first file to compare FilePath2
The path to the second file to compare Public Function CompareFiles (FilePath1, FilePath2)
Dim FS, File1, File2
Set FS = CreateObject(“Scripting.FileSystemObject”) If FS.GetFile(FilePath1).Size FS.GetFile(FilePath2).Size Then
CompareFiles = True
Exit Function
End If
Set File1 = FS.GetFile(FilePath1).OpenAsTextStream(1, 0)
Set File2 = FS.GetFile(FilePath2).OpenAsTextStream(1, 0) CompareFiles = False
Do While File1.AtEndOfStream = False
Str1 = File1.Read(1000)
Str2 = File2.Read(1000) CompareFiles = StrComp(Str1, Str2, 0) If CompareFiles 0 The…

Using Dictionary Objects in QTP

Dictionary Object stores data key, item pairs. A Dictionary object stores the items in the array. Each item is associated with a unique key. The key is used to retrieve an individual item and is usually an integer or a string, but can be anything except an array. Adavntages of using it in QTP: 1. can be used as Global variable declaration. so that any test can access the values from it in the run time. 2. You can store and retrive any number of run time values in to dictonary. 3. It is one of the Parameterization techique we can use in QTP Disadvantages: we can not specify the values in the desingn time like Datatable , Action parameters, environment variable. So it is useful only in Run time , not design time Methods: Add Method Adds a key and item pair to a Dictionary object. object.Add (key, item) Arguments object Required. Always the name of a Dictionary object. key Required. The key associated with the item being added.item Required. The item associated with the key being ad…

Third Party Libraries For Handling Test Data In Selenium

There are multiple open source solutions available to read/write date from external file in Selenium, few of them are as follows –

JUnit as the test driverTestNG as the test driverApache POI libraryJExcel API LibraryFilo -1.4.jar libraryYAMLSQLite

Selenium : Read Excel file using JExcel API

Code to readvalue from Excel file using selenium WebDriver & Java is as follows -

inputWorkbook = new File("C:\\Controller.xls"); //specify excel file path
    Workbook w; try { try {
                        w = Workbook.getWorkbook(inputWorkbook);
sheet = w.getSheet("Sheet1"); //Worksheet name
                        } catch (IOException e) {                                     error("Reading Master Sheet :-" +e);                         } suite = new String[sheet.getRows()][sheet.getColumns()]; for (int j = 0; j < sheet.getColumns(); j++){ for (int i = 0; i < sheet.getRows(); i++){                                                 Cell cell = sheet.getCell(j, i); if (cell.getContents()!= null){ suite[i][j]=cell.getContents();                                                 }                                     }

Selenium WebDriver : - How to capture screenshot

Selenium WebDriver : - How to capture screenshot Java code to capture browser screen shot is as follows –

File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); //take picture of browser screenshotpath = "C:\\”+ "file1.png"; //path & file name of picture try {   FileUtils.copyFile(scrFile, newFile(screenshotpath)); //.png file is copied from memory   to file system } catch (IOException e) {             e.printStackTrace();

QTP vs. Selenium

This article demonstrates bird eye comparison between HP QuickTest Professional and Selenium. These are popular test automation tool, specially, for functional & regression testing. Purpose of this comparison is not to say which is better tool, it consists of comparison of tool based on different criteria like supported O/S, browser, object spy, object repository, license cost etc. This article is targeted for readers having prior working knowledge of automation approach & at-least one automation tool. Quick overview of tools is as follows –
Introduction HP QuickTest Professional is a graphical user tool & provides solution for functional test and regression test automation. This next-generation automated testing solution deploys the concept of keyword-driven testing to enhance test creation and maintenance. QuickTest Professional meets the needs of both technical and non-technical users. It works hand-in-hand with HP Business Process Testing to bring non-techn…