51
September 17 2007 Automation Testing Benefits Automation Testing Benefits Mulugu Sathish Chary

automation testing benefits

Embed Size (px)

Citation preview

Page 1: automation testing benefits

September 17

2007

Automation Testing Benefits Automation Testing Benefits Mulugu Sathish Chary

Page 2: automation testing benefits

Objective

Manual Vs Automation.

About Automation.

Automation Benefits.

Detail Discussion of the QTP Automation Tool.

Test Suite (Inter Linked) related to the QTP.

The objective of this presentation is to share the knowledge with the QA & QC Team’s

.Such that how we can be overcome with the Market by learning knowledge of

Automation Tools.

Page 3: automation testing benefits

Wh at is A ut o m at io n ?

D o `s a nd D o n' ts ?

H o w t h e A ut o m at io n Te s t e r be ne f it e d t h a n t h e M a nua l Te s t e r?

Wh at is m a nua l ?

D o ` s a nd D o n' ts ?

AUTOMA TIO N V S MAN UA LAUTOMA TIO N V S MAN UA L

Usage of steps defined within test cases to manually test the application to ensure

that it functions properly.

Automation of the manual testing process to all unattended execution and ensure repeatability

Page 4: automation testing benefits

Automation Fundamental Concepts

Automation saves time and effort which results in reduction of the Test life cycle…

Benefits of Automation

- Consistency of Test Execution- Reducing cycle time of regression test cycles- Data driven testing- Repeatability

- Coverage- Reliability- Reusability of test wares

Page 5: automation testing benefits

Automation Fundamental Concepts

● When Automation is applicable? Or When we can Automate the Application?§ Regression Testing Cycles are long and iterative.§ If the application is planned to have multiple releases / builds§ If it’s a long running application where in small enhancements / Bug

Fixes keeps happening§ Test Repeatability is required .

Page 6: automation testing benefits

Market Standards

Page 7: automation testing benefits

Te st Su it e

üWhat is the Test Suite ? It is a collection of Test cases that are intended to be used as input to a software . O RIt is a collection of Automated Tools which follow under one roof .Those tools are mentioned bellowüH P Mercury had released into the market as the Test Suite of there Tools.üQTP integrates with other Mercury testing solutions including:

TestDirector/Quality Center.WinRunner /Xrunner.LoadRunner .

Page 8: automation testing benefits

Overview of QTP

üQTP stan ds for Qui c k Tes t P rof ess ion al or Q uic k T es t Pro

üIt is an automated testing tool p rovidedby H P Mercury Interactive

üQTP rel eased in to th e M arket in the 2 0 0 2 ye ar.

üQTP V ers ion s 5 .6 / 6 .5 / 7 . 6 / 8 .0 / 8 . 2 / 9 .0 / 9 .2 / 9 .5.

üL ates t Ve rs ion of the QTP is 9.5 .

üQTP i s u sed f or the Functi on al Tes ti ng & R egress ion Tes ti ng.

üQTP C an be h andl ed by the Non -Tech nical an d Tech nic al P ers on .

üQTP Su p port s on th e P latfo rm s .

üQTP by defa ult V B Scri p t Lan gu age Gen era tes .( For More L angu ages

we can wri te a s V B Scri p t , J avaScri p t , VB, V C + + )

Page 9: automation testing benefits

Technologies Supported

Default S upport 1. Standard Windows applications 2. Web objects / Applications 3. ActiveX controls 4. Visual Basic applications

Additional QuickTestadd-ins S upport 1. Java

2. Oracle 3. SAP Solutions, 4. .NET Windows 5. Web Forms, 6. Siebel, 7. PeopleSoft, 8. Web services,

and terminal emulator applications(Main Frames Application)

”Intr oduct i on of QT P Intr oduct i on of QT P “ “ M ercu r y Adv anc ed K eywor d -d riven Testi ng “M ercu r y Adv anc ed K eywor d -d riven Testi ng “

Page 10: automation testing benefits

Add-in Architecture

üEnables QTP to provide support for multiple technologies.

üAdd-ins are software that need to be installed on a system that has QTP. It then becomes integrated with the QTP environment.

üUsers are able to select the specific add-ins for the technologies they are testing thereby reducing the memory footprint of QTP.

Page 11: automation testing benefits

QTP Add-ins

When QTP is started, you should select only the add-ins for technologies that are used with your application.

Some of the available add-ins areActiveX - For testing software written using ActiveX (also known as COM) technology. This technology allows people to create objects in one language and use those objects within other languages/applications.

Visual Basic - For applications written in the Visual Basic language.

Web - For testing web applications written in any language. In web applications, we interact with the application though a web browser and so the web application can be written in any language

Page 12: automation testing benefits

QTP Main Window

Page 13: automation testing benefits

Acti ve S creen A rea i n Q TP

Acti ve Screen Area :

The Active Screen provides a snapshot of your application in a recording session and

enables you to insert additional steps on the test objects captured in that screen after

the recording session.

Page 14: automation testing benefits

DATA Table in QTP

The Data Table contains one Global tab plus an additional tab for each action, or test step grouping, in your test. The Data Table assists you in Parameter zing your test.

We can Import or Export the Data table from the other External Environment

Syntax : DataTable.Import("C:\flights.xls") .

DataTable.Export ("C:\flights.xls") .

Page 15: automation testing benefits

Test Pane Area ● Test Pane Area is that Area where Technical and Non Technical Person

can Work or Can Create the Test Scripts.● Test Pane Area is divided in to 2 parts as

Keyword View (Tree View)

Expert View .

The Keyword view is beneficial to the Non-Technical Person. Quick Test Pro displays your test in the form of a collapsible, icon based tree…The Expert View is beneficial to the Technical . Quick Test Pro displays the source code (VB Script) of the tests in this view.

Page 16: automation testing benefits

Testing Process with QTP

Quick Test Pro involves 3 main stages:

Creating Test scripts

Running Tests

Analyzing Test Results

Page 17: automation testing benefits

How To Create the Test Script

Test Scripts can be prepared by Record and Play back.OR

Manually Coding into the Test Pane Area.

Page 18: automation testing benefits

How To Create the Test Script

Creating the Test Scripts will various on the language that we set in the Libraries .

By default the Script generate in VB Scripts .

The syntaxes various from application to the application for Example

For Web Application the syntax will be

Browser(“ Browser name”).Page( Page Name”).WebEdit(“ ___”).ClickNote : The above syntax generates when you click on the Web Edit Button.

Browser("Browser").Page("Country-Check Beta > Home").Image("LOG IN").Click

Note : The above syntax generates when you click on the any Image.

Browser("Browser").Page("Country-Check Beta > Home_2").Link("Analyse").Click

Note : The above syntax generates when you click on the any LINK.

Page 19: automation testing benefits

How To Create the Test Script

Browser("Google").Page("Google").WebRadioGroup("meta").Select "cr=countryIN“

Note : The above syntax generates when you click on the Radio Button.

We also can insert Logics as For Loop.

Switch Cases .

Do While (Conditions)

If Else and asl0 Nested If Else (statements for validations)

By using above all the Logic we can prepare the Test Script as per the Requirements.

Page 20: automation testing benefits

Logical Coding

How does For Loop function in the QTP for Example

As QTP by default it accept VBScript the For Loop Syntax will be

For I = 1 To 10

msgbox(I)

Next

The Syntax for the If Else Condition as follows:

If (sum=0) then

Sum =x+y

End if

Page 21: automation testing benefits

Logical Coding

Syntax by using the if else condition

If Browser("Google").Page("Google").WebButton("Google Search").exist Then

Reporter.ReportEvent 1, "Custom Step", "The user-defined step failed."

Else or

Reporter.ReportEvent micFail, "Custom Step", "The user-defined step failed."

End If

Syntax for the avoid Error during the run time

On Error Resume Next

Err.Raise6 ' Raise an overflow error.

MsgBox "Error # " & CStr(Err.Number) & " " & Err.Description

Err.Clear ' Clear the error.

Page 22: automation testing benefits

How to coding for the smallest of the Number

dim n(3)

for i=0 to 2

n(i)=cint(inputbox("Enter 3 numbers"))

next

if n(0)<n(1) and n(0)<n(2) then

if n(0) mod 2 =0 then

Msgbox ("first number is smallest and Even number")

else

Msgbox ("first number is smallest and Odd number")

end if

elseif n(1)<n(0) and n(1)<n(2) then

if n(1) mod 2 =0 then

Msgbox ("second number is smallest and Even number")

else

Msgbox ("second number is smallest and Even number")

else

Msgbox ("second number is smallest and Odd number")

end if

elseif n(2)<n(0) and n(2)<n(1) then

if n(2) mod 2 =0 then

Msgbox ("Third number is smallest and Even number")

else

Msgbox ("Third number is smallest and Odd number")

end if

end if

Page 23: automation testing benefits

Tea Break

Page 24: automation testing benefits

How to do Coding

● Quick Test Professional - Record & Run Modes.üRecording Modes

● Normal● Analog● Low level

üRun Modes● Normal● Fast● Update

Page 25: automation testing benefits

Analyzi ng T est R es ults

When a run session ends, you can view the run session results in the Test Results window. By default, the Test Results window opens automatically at the end of a run. If you want to change this behavior, clear the View results when run session ends check box in the Run tab of the Options dialog box.

The left pane of the Test Results window contains the test results tree.

The right pane of the Test Results window contains the details for a selected step in the test results tree

Page 26: automation testing benefits

Actions

● What is this Actions? How this Actions are used in QTP?

Actions are nothing but simplifying the Script into as simpler parts. This actions can be reusable.

These actions are divided into 2parts ü Global ( To all the Actions).ü Actions ( Particular Action (specified Action)).

And also this actions are divided into ü Call to New Action.( To create a New action)

.üCall to Copy Action.( To copy the previous action

at any place at last or in between the Action).üCall to Existing Action(To call the existing

action).üCall to Winrunner ( To call the Winrunner Script

through the QTP and run the Script).

Page 27: automation testing benefits

Actions

How to call Winrunner script ? Syntax

This Action is used to run or execute the script of the WR by calling into the QTP Script and the Result obtained will be in the QTP Test Result.

Syntax : TSLTest.RunTestEx "C:\WinRunner\Tests\basic_flight",TRUE, 0, "MyValue"

Choose Insert > Call to WinRunner > Test.

Page 28: automation testing benefits

Actions

Viewing the Results

Passing QuickTest Parameters to a WinRunner Function

TSLTest.CallFuncEx "D:\flightfuncs", "run_flight", TRUE, FALSE, DataTable("FlightUserName", dtGlobalSheet), DataTable("FlightPwd", dtGlobalSheet)

Page 29: automation testing benefits

Actions

How to Call the function Call MyFunction("Hello World")

Function MyFunction(text)

MsgBox text

End Function

Page 30: automation testing benefits

Connection to the Quality Center(Server)

The connection process has two stages. First, you connect QuickTest to a local or remote Quality Center server. This server handles the connections between QuickTest and the Quality Center project.

Choose File > Quality Center Connection or click the Quality Center Connection toolbar button . The Quality Center Connection - Server Connection dialog box opens.

Page 31: automation testing benefits

Savi ng T es ts to a Q ual ity Ce nter Pro jec t

When Quick Test is connected to a Quality Center project, you can create new tests in Quick Test and save them directly to your project. To save a test, you give it a descriptive name and associate it with the relevant subject in the test plan tree. This helps you to keep track of the tests created for each subject and to quickly view the progress of test planning and creation.

In Quick Test, click Save or choose File > Save to save the test. The Save Test to Quality Center dialog box opens and displays the test plan tree.

Page 32: automation testing benefits

When QuickTest is connected to a Quality Center project, you can open QuickTest tests that are a part of your Quality Center project. You locate tests according to their position in the test plan tree, rather than by their actual location in the file system. You can also open tests from the recent tests list in the File menu.

In QuickTest, click Open or choose File > Open > Test to open the test. The Open Test from Quality Center dialog box opens and displays the test plan tree.

Page 33: automation testing benefits

Creating Object Repository

You open the Object Repository Comparison Tool by choosing Tools > Object Repository Comparison Tool in the Object Repository Manager.

Repository Panes. Display a hierarchical view of the objects in the object repositories being compared. In the column to the left of the object hierarchies, each pane displays icons representing the comparison of each object.

The object repository panes display the hierarchies of the objects, and their properties and values, in the object repository files that you are comparing. The file path is shown above each object hierarchy.

To make it easier to see the status of an object at a glance, the text and background of object names in the object repositories are displayed using different colors, according to the type of difference found.

You can change the default colors used in the object repositories to indicate the

Page 34: automation testing benefits

Creating Object Repository

Objects are a representation of every item found in an application.

Objects are visual (e.g. Button, Textbox) and non-visual (e.g. Dictionary, Reporter) elements within an application. Each object has the following elements Properties, Methods & Events.

● PropertiesThese are characteristics of the object e.g. the text on a button.

QTP uses this to recognize the object● Methods

These are built in functionality of the object. The VBScript code that we write (or record) actually makes calls to the methods of an object e.g. Reporter.ReportEvent()Here ReportEvent is the method of the Reporter object

Page 35: automation testing benefits

Object Identification

Object IdentificationThe tool determines what properties

of

objects are recorded.

Object SpyAllows users to view the property of

an object without recording it.

Object RepositoryHolds information recorded about

each

object allowing the test to identify the object

during execution.

Page 36: automation testing benefits

Insert Checkpoints

● Click on the insert tab in the QTP window the list of the check points will be displayed .

● What is Check Point?

You can check objects in your application or Web site to ensure that they function properly.

● Checkpoints are of 9 types in QTP. They are

üStandard Check Point.(Page Check Point , Web Table Check Point)üText Check Point.üText Area Check Point.üBitmap Check Point.üData Base Check Point.üXML Check Point(From Application).üXML Check Point ( from Resources).

Page 37: automation testing benefits

Parameterization

What is Parameterization?When you test your application or Web site, you may want to check how it

performs the same operations with multiple sets of data.

Testing the application with the different set of test data is called the Parameterization.

Parameterize a Step

Parameterize the method argument of the from Port

In the Keyword View, click in the Value cell of the step and then click the parameterization icon . In the Value Configuration Options dialog box, select the Parameter radio button. In the Name box, rename p_item to Location.

Page 38: automation testing benefits

Parameterization

Click OK. The Location column is added to the Data Table.

Page 39: automation testing benefits

Creating Output Values

● You define the output type and settings for the output value in the Output cell. These determine where the output value is stored and how it is used during the component run session. When the output value step is reached, Quick Test retrieves each value selected for output and stores it in the specified location for use later in the run session.

● OUT PUT Values are of 6 types .They are

üStandard Output value.üText Out Put ValueüText Area Output Value.üDatabase Output value.üXML Output value.(From

Application )üXML Output value.( From

Resources)

Page 40: automation testing benefits

Break Points

You can use breakpoints to instruct Quick Test to pause a run session at a predetermined place in a test or function library. Quick Test pauses the run when it reaches the breakpoint, before executing the step. You can then examine the effects of the run up to the breakpoint, make any necessary changes, and continue running the test or function library from the breakpoint.

These break points are real help full a lot in the real time scenario.

For Example if you want to run 1000 of lines .so it impossible to check at particular line for every time .

So insert break point and execute the particular line.

Page 41: automation testing benefits

Data Driven Wizard

The Data Driver enables you to quickly parameterize several (or all) property values for test objects, checkpoints, and/or method arguments containing the same constant value within a given action.

Page 42: automation testing benefits

Quick Test Professional - Options Run

Best Practices for Options for Run Mode:nThis ensures that the execution arrow appears to help with trouble

shooting the tests.nSynchronization becomes better for the AUT (Application Under Test)

Running the Scripts in different methods asnRun Current Action.nRun from Step.nUpdate Run mode.(Update the Snap shots and Run)

Page 43: automation testing benefits

Test Folder

Datatable

Snapshots

Dependencies and test settings

• Environment variables

• The Datatable, each action is a separate sheet

• Action’s directories

• Result directory

Page 44: automation testing benefits

Test Folder at Action Level

• Snapshot directory

Dependencies and test settings (same as test.tsp but for action level)• Action1’s script

Page 45: automation testing benefits

Recovery Manager

Unexpected events, errors, and application crashes during a run session can disrupt your run session and distort results. This is a problem particularly when tests run unattended—the test pauses until you perform the operation needed to recover. To handle situations such as these, Quick Test enables you to create recovery scenarios and associate them with specific tests.

Recovery Scenario manager are of 4 types .They are

nPop Up window.nObject State.nTest Run Error.nApplication Crash.

Page 46: automation testing benefits

Script of QTP –SAP( Application)

This the Script Generated when you test on the SAP Applications .

Note : Remember that to generate this script by your QTP

Preconditions:

SAP Software Has to be installed at your

Machine.

In QTP Addins Manger of SAP should

Be added.

APGuiSession("Session").ResetSAPGuiSession("Session").SAPGuiWindow("SAP Easy Access SAP R/3").SAPGuiOKCode("OKCode").Set "/NMB1A"SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access SAP R/3").SendKey ENTER 'Enter Goods Issue : Initial ScreenSAPGuiSession("Session").SAPGuiWindow("Enter Goods Issue: Initial").SAPGuiEdit("Movement Type").Set strMovementType'"551"SAPGuiSession("Session").SAPGuiWindow("Enter Goods Issue: Initial").SAPGuiEdit("Plant").Set strPlant'"fr02"SAPGuiSession("Session").SAPGuiWindow("Enter Goods Issue: Initial").SAPGuiEdit("Storage Location").Set strStorageLocation'"0005"SAPGuiSession("Session").SAPGuiWindow("Enter Goods Issue:

Page 47: automation testing benefits

Script for the DOS(Command Prompt)

QuickTest Professional does not record against DOS windows

Dim oShell Set oShell = CreateObject ("WSCript.shell")oShell.run "cmd /K CD C:\ & Dir"Set oShell = Nothing

Page 48: automation testing benefits

Create the Script of the XML~~~~Start XML File~~~~~<Environment>   <Variable>      <Name>FirstName</Name>      <Name>LastName</Name>   </Variable></Environment>~~~~End XML File~~~~~ Set xmlDoc=XMLUtil.CreateXML() ' Create a document with Environment as the root nodexmlDoc.CreateDocument "Environment" ' Get the root nod element. The data type returned would be of type XMLElement Set root = xmlDoc.GetRootElement() ' Create a child element with Name "Variable" with no valueroot.AddChildElementByName "Variable","" ' Get the child element, Variable, created aboveSet children = root.ChildElements() Set child = children.Item(1)

' Add a child element (name = "Name" and value = "FirstName") to the "Variable" elementchild.AddChildElementByName "Name","FirstName"' Add a second child element (name = "Name" and value = "LastName") to the "Variable" elementchild.AddChildElementByName "Name","LastName" ' Save the xmlDoc to the "XMLExample.xml" in the C:\temp drivexmlDoc.SaveFile "C:\temp\XMLExample.xml"

This Code will help you to create the XML file and Save in the particular directory.

Page 49: automation testing benefits

Th ank Y

Page 50: automation testing benefits

Questions & Answers

Page 51: automation testing benefits

Feedback