Thursday, 23 July 2015

LIBRARYFILES IN QTP


Using Library files in QTP

             

Keywords:

QTP, Quick Test, Quick Test Pro

Introduction:

This document demonstrates on who to use Library files in QTP

Library files:

Library file is nothing but a VB script file containing code in VB Script format. Library files in QTP are used to declare functions that are needed to be used across actions. There are two ways to load a Library file in to your test:

1.    Specify the Library file in the settings of the script

Create the VB Script file that you need and save to your PC

In QTP go to Test->Settings… Menu as shown in the image below

Go to the Resources tab of the Test Settings window and Click on “+” button. A new line in the list box will appear

Click on “…” button to choose the location of the file

If you specify 2 or more library having a function with same name then QTP will execute the one that comes first i.e. by looking at the order you specify the files. There is no need to specify an order for dependent library file Ex- if file2 uses functions defined in file1 then it is not necessary to specify file1 above file2 any order will work fine.

Click on the “Check Syntax” button to verify that the script is a valid one

The VB script file has been associated with your test and functions it can be used in all the actions present in the script. If you click on the “Set as Default” button then all the library files specified in your current test would be automatically added to the new tests that you create from now on.

Variables, classes, functions etc… declared in the Library files are accessible to all the Actions present with in the test. Specifying library files using this method makes it impossible to restrict the use of the Library to specific actions.

2.    Loading the library file at run-time

Instead of specifying the library file in test settings we can load it at run-time by using the execute file function.

ExecuteFile “C:\Documents and Settings\tarun_lalwani\Desktop\Demo.vbs”

This would load all the variables, classes, structures etc… declared in the Library but they would be accessible on in the action that has called the ExecuteFile function i.e. if Action1 loads a library file using ExecuteFile then everything present in the library file would only be accessible to Action1 and not any other action.

To Load a library file present in Test Director the path can be specified as “[Quality Center] Subject\PathInTD”

Once a Library file is loaded using ExecuteFile it can’t be unloaded. It is unloaded automatically when the action ends.

The below table gives advantages of both the methods

Specifying Library File in Test Setting

Loading Library File at Run-Time

For declaring Global Variable, Functions, classes etc…

Add all global variables to a VB Script file and specify it in settings.

For restricting functions of the library to specific Actions

For loading libraries depending upon conditions at run-time. Ex-

If Condition1 then

    ExecuteFile “C:\File1.vbs”

Else

     ExecuteFile “C:\File2.vbs”

End If

 

 

 

 

 

 

 

 

Reference:
1.      “Mercury QuickTest Professional, User’s Guide, Version 8.0.1”

Wednesday, 22 July 2015

Introduction to SQL Server Management Studio


Introduction to SQL Server Management Studio

The SQL Server administrator’s primary tool for interacting with system is SQL Server Management Studio. Both Admin and end users can use this tool to administer multiple severs, develop databases.

To open this tool, click START menu, Programs, Microsoft SQL Server2005 and then SQL Server Management Studio then it shows the Connect to Server
Dialog box which appears right after choosing SQL Server management Studio .


1.      For Server type and Server name we need not enter anything
2.      We have 2 authentications in Authentication list box
a.      Windows Authentication : you will be connected to SQL Server using windows account
b.      SQL Server Authentication: you will be connected to SQL Server using own.
       Note: Default login name is sa and password is sa123









After connecting to SQL Server ,then it appears as follows


Click on New Query (available under File menu) to get Query Editor in which you can create queries.

HOW TO WORK WITH SELENIUM WEBDRIVER USING XPATH


Install firebug add on to Firefox browser then ( if you are using Firefox as Ur browser)
Install firepath add on ( for finding xpath of an element)
Above two things make us to identify elements very easily in a web page, almost like object spy in QTP.
Firebug: firebug is a add on of Firefox which is used for inspecting the web elements in the web application and knowing the information about them.
Firepath: firepath is a add on of Firefox which is used for specially showing the xpath of a web element.
Xpath: xpath is a unique locator of a web element in a webpage.
Navigation for firebug in the Firefox:
Open Firefox browser
Activate menu item tools
Go to web developers then
Go to firebug
Click on open firebug
To avoid above navigation press f12 we can directly open firebug.
package pack1;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class web {

          public static void main(String[] args) {
                   WebDriver wd =new FirefoxDriver();
wd.get("http:yahoomail.com");

wd.findElement(By.xpath(".//*[@id='username']")).sendKeys("akhilreddyhyd@yahoo.com");
wd.findElement(By.xpath(".//*[@id='passwd']")).sendKeys("venkannaAAA143");
wd.findElement(By.xpath(".//*[@id='.save']")).click();
          }

}
Write a java program to demonstrate selenium webdriver:
FIRST SELENIUM PROGRAMME:
package aa;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class a {

          public static void main(String[] args) throws InterruptedException {
                   WebDriver wd= new FirefoxDriver();
                   wd.get("http:gmail.com");
                    wd.findElement(By.xpath(".//*[@id='Email']")).sendKeys("akhilreddyhydAAAA@gmail.com");
                   wd.findElement(By.xpath(".//*[@id='Passwd']")).sendKeys("venkanna143");
                   wd.findElement(By.xpath(".//*[@id='signIn']")).click();
                   Thread.sleep(5000);
                   wd.findElement(By.xpath(".//*[@id=':b7']/div/div")).click();
                   Thread.sleep(5000);
                    wd.findElement(By.xpath(".//*[@id=':14i']")).sendKeys("akhilreddyhyd@gmail.com");
                   wd.findElement(By.xpath(".//*[@id=':161']")).sendKeys("Hi h r u");
                   wd.findElement(By.xpath(".//*[@id=':16i']")).click();
                   Thread.sleep(5000);
                   wd.findElement(By.xpath(".//*[@id='gbgs4d']/span[2]")).click();
                   wd.findElement(By.xpath(".//*[@id='gb_71']")).click();
          }

}


WAY2SMS.COM   


public class way {


public static void main(String[] args) {
                   WebDriver wd=new FirefoxDriver();

          wd.get("http://site3.way2sms.com/content/index.html");
                  
                   wd.findElement(By.xpath(".//*[@id='username']")).sendKeys("9440592994");
                  
                   wd.findElement(By.xpath(".//*[@id='password']")).sendKeys("XXXXXXX");
                   wd.findElement(By.xpath(".//*[@id='button']")).click();
                   }

}