Monday, November 19, 2007

Functions in Test Partner

1)Right : Returns a Variant (String) containing a specified number of characters from the right side of a string.
Syntax : Right(string, length)
ex:dim k,str as string
str="foursoft"
k=right(str,len(str)-1)
msgbox k
Output :oursoft

2)Split: When we want a capture particular variable which is changing dynamically. Then instead of mid we can use split even if the variable is changing dynamically.
Syntax: Split (Variable,”Separator”)

Ex: Record Generated Sucessfully AP1023K
In This text I wanted to capture AP1023K
K= Record Generated Sucessfully AP1023K
In This text each word is counted as 1 variable and each one is taken into array count and an array is counted from ‘1’
K1=split (k,” “)
In the above text as Space is the separator we are taking space
Msgbox k1(4)
O/P - AP1023K

Suppose Ex:Record Generated Sucessfully : AP1023K
In the same example I have included ‘:’ before AP1023K
Then we can include separator as “:”
K1=Split(k,”:”)
Msgbox K1(1)
O/P - AP1023K

3)Mid : Returns a Variant (String) containing a specified number of characters from a string.
By using this statement we can get the exact value or character from a text area.
Syntax: mid (variable, position, length)

Ex Record generated successfully AP102KL3

To extract AP102KL3 into a variable we use this mid function

Dim k,k1
K=” Record generated successfully AP102KL3”
K1=mid (k,31,8)
Length of characters to be read.
Position of Required variable including count of space
Msgbox k1
O/P --- > AP102KL3

4) Now: Displays the current System Date and Time.
Ex: msgbox now
O/P= 04/01/2007 11:53A.M


i) If u want only present day then msgbox day(now)
O/p 04

ii) If u want only present month then msgbox month(now)
O/p 01

iii) If u want only present year then msgbox year(now)
O/p 2007

5)Date : To display only present system date

Ex : msgbox (date)
O/P = 04/01/2007
6)Time: To display only present system time.

Ex: msgbox (time)
O/P=12:02 P.M

Friday, October 12, 2007

scripting Techniques in Test Partner

There are Some Scripting Techniques should be followed in Test Partner.
Try to use set function in vb script so that it will reduce some time during writing scripts.
Syntax for Set function in Vb Scripting is
Set Variable=New Object Expression
Object Expression:Required. Expression consisting of the name of an object, another declared variable of the same object type, or a function or method that returns an object of the same object type.

So Suppose we use more often during scripting in TestPartner always using Window and HTMLBrowser for attachement.So inorder to reduce this we can follow this model.
Ex: I have an "Window("Application=NOTEPAD.EXE Caption='Untitled - Notepad'").attach
So inorder to write entire script in anywhere in the script for window i can directly assign some variable and use it in testpartner by following this below example

Dim win As TWindow
Set win=Window("Application=NOTEPAD.EXE Caption='Untitled -Notepad'").attach

so iam setting it as win variable anywhere i can use as win and directly give attach.
win.attach

Thursday, July 19, 2007

Event handling

Events are unscheduled occurrences or conditions to which you want the target application to respond in a specified manner.
TestPartner supports two categories of events: Waits and Whenevers.


A Wait event tells TestPartner to wait for a specified occurrence before proceeding. Wait events are useful in situations where you
cannot anticipate the amount of time a response will take. An example of a Wait event would be waiting for a system login prompt. When your script is running against a network-based application that requires the user to log in, the amount of time it takes for the login prompt to display may vary. To account for this variance, you can insert a Wait event that instructs your script to wait for the login prompt before
proceeding to type a user name and password.



A Whenever event tells TestPartner to watch for a specific occurrence and, if it occurs, perform a special set of steps. Whenever events are useful for trapping unexpected error conditions during a test run. For example, you can include events in your scripts to recognize when the connection to the server has been interrupted by a communications error or a network system message has been received,
so that the script can report or work around the problem.

In a script, TestPartner automatically inserts the Script_Whenever function by default to handle the whenever event. If a whenever event is inserted into a module, shared module, or class module, you must customize the whenever event handler code. To determine what is performed when a whenever event triggers, TestPartner uses the Script_Whenever function to handle the event

Wednesday, July 18, 2007

CheckPoints in Test Partner

Check: A check is a definition of what the application should be showing at any particular point.

Bitmap checks — Bitmap checks compare an actual bitmap with a defined bitmap. These checks are used to check the appearance of toolbars, the desktop,
and other windows that contain non-textual information

Clock checks — Clock checks measure the time the system takes to perform a process. Clock checks help you determine how the system performs under
varying CPU or network loads.

Content checks — Content checks test the contents of tables and list controls in a window or web page.This is used for creating checks in listbox.Through this content check we can check how many items are flowing in an list box and what is the default value of the listbox.

Field checks — Field checks enable you to conduct specific types of text comparisons, including date
and time, for individual fields you select in a window or area.

Property checks — Property checks verify the properties of the controls in a dialog or web page or Window.

Text checks — Text checks provide an exact comparison of the text in a window or individual area to defined text.
If you check a whole screen, areas that contain legitimately variable data — such as dates and login IDs — can be ignored.

Thursday, May 10, 2007

Test Partner

1) To Run TestPartner in Command Prompt Use

From the command line, type TP and you will see the format and some examples.

(or)

Step-1: Go to Run and Type cmd
Step-2: type tp -u userid -p password -d dsn name -r project name -s scriptname
Step-3: Click on enter

2) To invoke application automatically in TestPartner
Shell("Path of exe")


3) To Run Multiple Scripts in Test Partner
Run("Script Name")

4) To Invoke WebURL from I.E use
Shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE project URL"

5) To Run Functions from Module,include '$TPINCLUDE "Script Name"
Keep Function

6) Object Mapping:This is used to give alias name for better identification of the Object.
To record forcebily objects by testpartner we are using object mapping.

7) Examples of Test Partner Recorded Objects
i)Focus on a Window ---->Window("Window Name").Attach
ii)Attach a Frame ---->HTMLFrame("Name=Frame Name").Attach
iii)Type a Text in a Edit Box ---->HTMLEditBox("Name=Obj Name").SetText "Typed text"

iv)Click on Button ----->HTMLButton("Name=Object name").Click
v)Select an item in List Box ----->HTMLListBox("Name=Object Name").Select "Item No"

8) To Create Bat File and Run the test partner Scripts.Follow Below Navigation
Step-1:Open Notepad
Step-2:Type tp -u userid -p password -d dsn name -r project name -s scriptname
Step-3:Save the File in desktop with '.bat' extension and select file type as all files.
Step-4:When click on icon open application testpartner with automatically execute the scripts
9)Split:Returns a zero-based, one-dimensional array containing a specified number of substrings.
Syntax:Split(expression[, delimiter[, limit[, compare]]])