Batch Testing in UFT


Batch Testing in UFT

Batch Testing or Batch Execution

Executing Series of Tests is called Batch Testing.

It is one of the advantages of Test Automation, Test Tool can execute Series of Tests without user(Tester) interaction.

If it is Manual Testing, for every Test case execution user interaction is mandatory.

In Four ways we can conduct Batch Testing in UFT:
i) Using "Test Batch Runner" tool

ii) Using AOM Script (QTP Application Object)

iii) Using Driver Script (UFT Test Script)

iv) Using ALM / QC Tool
------------------------------------------
i) Using "Test Batch Runner" tool

Steps for Batch Testing using "Test Batch Runner" Tool
a) Generate basic Tests and run them once.

b) Launch "Test Batch Runner" tool and create Test batches.

c) Provide permission to "Test Batch Runner" to execute Tests.

d) Run Test batches.
-------------------------
Advantage:

Test Batch Runner tool can execute entire Test batch or part of the Test batch.

Disadvantage:

Test Batch Runner tool doesn't provide Batch wise Test result, provides only Test wise result.

Test Execution Process:

It launches UFT tool, provides instructions to UFT, UFT executes tests one by one based on Test Batch Runner instructions.
----------------------------------------
Test Batch file extension is .mtb

Navigation to provide Permission To Test batch runner to execute Tests.

Tools menu -> Options -> GUI Testing -> Test Runs
-> Check "Allow other HP products to run Tests and components" option
-> OK
----------------------------
How to view Test Results:

i) Click "Test Result Link" in Test batch runner

Or

ii) Launch "Results viewer", open the Test and select the Result.

Or

iii) In UFT, Launch "Result viewer, open the Test and select the Result.
-------------------------------------------------------------------
Deleting Test Results:

Using Test Results Deletion tool we can delete Test Results.

Launch Test Results deletion tool

-> Browse path of the Test

-> Select Test Results -> Delete
-------------------------------
ii) Batch Testing using AOM Script

AOM - Automation Object Model
It is Private object model, created only for UFT test automation.

Note: File System object model, Excel object model, Database object models etc... are global object models, can be used for all types of Scripting(Client side scripting in the web, Server side Scripting in the web, Network Administration, System Administration and Test Automation).

Create QTP Application Object

Set Variable = CreateObject("QuickTest.Application")

QTP Application Object is used to automate UFT tool operations.

Using QTP Application object we can conduct batch testing, but QTP application object not only for batch testing.

AOM script file extension is .vbs

Create AOM Script:

i) Type Script in UFT tool editor, copy the script, paste in Notepad and save as .vbs file

Or

ii) Launch Notepad, Type Script and save as .vbs file.

Note: UFT tool editor provides context help.

Execute AOM Script:

Run .vbs file (External file)
---------------------------------------------
Example:

1) AOM script for batch Testing

Dim objQTP
Set objQTP = CreateObject("QuickTest.Application")
objQTP.Visible = True 'To view the UFT tool during execution

objQTP.Launch 'To launch the UFT tool

objQTP.Open "C:\Users\gcreddy\Desktop\Tests\Login" ' open the Test
objQTP.Test.Run 'Run the Test
objQTP.Test.Close 'Close the Test

objQTP.Open "C:\Users\gcreddy\Desktop\Tests\OpenOrder"
objQTP.Test.Run
objQTP.Test.Close

objQTP.Open "C:\Users\gcreddy\Desktop\Tests\FaxOrder"
objQTP.Test.Run
objQTP.Test.Close

objQTP.Quit 'To close UFT tool
Set objQTP = Nothing
--------------------------------------------------
2) Read Test paths from a text file and conduct batch testing using AOM.

Dim objFso, objTextstream, objQTP, testpath
Set objFso = CreateObject("scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile ("C:\Users\gcreddy\Desktop\testPaths.txt")

Set objQTP = CreateObject("QuickTest.Application")
objQTP.Visible = True
objQTP.Launch

Do Until objTextstream.AtEndOfStream = True
testpath = objTextstream.ReadLine

objQTP.Open testpath
objQTP.Test.Run
objQTP.Test.Close
Loop

objQTP.Quit
objTextstream.Close

Set objQTP = Nothing
Set objTextstream = Nothing
Set objFso = Nothing
---------------------------------------------
Regular Expressions in UFT

What is Regular Expression?
It is a Formula for matching patterns.

Constant matching

india.doc - india.doc
 

Pattern Matching

i*.

ia....
ib.....
.
.
india.doc
--------------------------------------
Usage of Regular Expressions in UFT:
i) To handle Dynamic objects


How to use Regular Expressions:

If it is Object Repository based Test, open Object Repository, select the object and provide Regular expression.

If it is Descriptive programming, Provide Regular expression directly in the Test Script.

[0-9]
[A-Z]
[a-z]

Ex:
For ord = 8 To 11 Step 1
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set ord
wait 2
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Window("Flight Reservation").WinMenu("Menu").Select "File;Fax Order..."
Window("Flight Reservation").Dialog("text:=Fax Order No. [0-9]*").Activate
Window("Flight Reservation").Dialog("text:=Fax Order No. [0-9]*").ActiveX("progid:=MSMask.MaskEdBox.1").Type "1111111111"
Window("Flight Reservation").Dialog("text:=Fax Order No. [0-9]*").WinButton("text:=&Send").Click
Next

'Regular expressions in Checkpoints

For i = 1 To 10 Step 1
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set i
wait 2
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Tickets:").Check CheckPoint("Tickets:")
Next
--------------------------------------
Regular Expression ObjectUsing New and RegExp keywords we can create Regular expression object.

Syntax:

Set variable = New Regexp

ii) For Search operations

------------------------------------

0 comments:

Post a Comment