View
217
Download
1
Category
Preview:
Citation preview
Dani Vainstein & Monika Arora GauDani Vainstein & Monika Arora Gautamtam
1
Requirement Req0001
Implementation of Requirement Req0001
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 2
Topics covered
Create a new business module. Open an existing test. Analyzing and designing requirements. Creating an Environment File. The Environment Object. Insert Step Using Step Generator. Insert calls to Existing action. Passing arguments to reusable actions.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 3
What we have done till now?
We have built an infrastructure. Defined QTP global options and record & run
settings. We created the guiLogin module and reusable
actions “guiLogin” and “CheckDialog” module.
Mapped all the “Login” dialog objects. Learned how to use object spy. Created and saved a function library. Used function and step generator.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 4
Before You Start Before starting this presentation, read the following topics
from QTP help. Environment Object. Environment.LoadFromFile Method. Reporter.RunStatus Method. LCase Function. Select Case Statement. ExitAction Statement. Reporter Object. Parameter Object. BuildPath Method (Scripting.FileSystemObject) Desktop.CaptureBitmap Method.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 5
Before You Start Before starting this presentation, read the following topics
from QTP help. SystemUtil.CloseProcessByName Method. Dialog.Exist Property. Set and Nothing keywords. WindowState Property. PathFinder.Locate Method. Dictionary.RemoveAll Method.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 6
Requirement Req0001
1a1
b
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 7
Req0001a - Details
Action : To locate the Flight Application executable file from <installation dir>“\samples\flight\app\flightxx.exe”.
Executable
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 8
Req0001b - Details
Action : Invoke the Flightxx.exe from installation folder Expected : The Dialog “Login” should be displayed
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 9
Process Design
NoReq0001a?
ExitTest
Yes
ReportmicFail
End
Start
Req0001b
PassedFailedReportmicFail
ReportmicPass
Executable
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 10
Process Design
The script starts and checks Req0001a ( file exists )
This check is critical for the script flow. If it fails, it means that the executable file was not found, and there is no point to continue testing.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 11
Things to Remember…
The AUT embeds some ActiveX objects. When you first open QTP and see the Add-in
manager, be sure that only ActiveX option is checked.
Always open QTP before the AUT, otherwise new ActiveX object will identified as WinObjects.
Note : Ask your developers if the application is using ActiveX, .NET, Java or VB.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 12
busLogin Module
Create a new test and save it with the name “busLogin” under folder FR\RA\BL folder.
busLogin
LIB
RA
TESTS
RS
DOC
FR
DAT
SETTING
RES
BATCH
ENV
Automation
BL
GL
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 13
busLogin Module - Properties
Description :
manages all the test-cases and business requirements on the Login form.
Remark : associated add-ins : ActiveX only
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 14
busLogin Module-Run Tab
Run one iteration only
Disable Smart Identification
During the run session
Pop up
Message box
Save The Test
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 15
busLoginMng ( Business Requirements ) From Menu Edit Action Action Properties
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 16
busLoginMng - General Tab
Follow the modifications.
Change
Action Name
Add
Description
Mark
Reusable
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 17
busLoginMng - Parameters Tab Add a new Input Parameter ( Click on + )
Add busCode
Input Parameter
Type : String
Add
Description
Default
Leave Blank
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 18
busLogin Module
The busLogin module manages all the test-cases and business requirements on the Login form.
A test-case can be a single requirement or/and a business process in the application e.g. Create New Order.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 19
busLogin Header
'***********************************************************************
'@Author : advancedQTP
'@Date Created : <ddd MMM dd, yyyy>
'@QTP Version : 9.2
'@Description : Manages all the test-cases and business requirements on the Login form.
'@Input Parameter : Name:=busCode, Type:=String, Default:=, Description:=The business action code name.
'@Out Parameter : None.
'@Addins : ActiveX
'@Modifications : <#n By <Name>, Date: <dd-mmm-yyyy>> (Later modification on top)
' <#n-1 By <Name>, Date: <dd-mmm-yyyy>
'***********************************************************************
Option Explicit
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 20
Points to consider for Req0001a We need to check that the executable file is
under the installation directory. After reading this, you may probably ask
Where is the installation directory located? Which exe file we need to execute?
Usually the installation folder by default is under C:\Program Files\Mercury Interactive.
BUT, what if team has installed QTP in different drive let’s say on D:\ or F:\ ?
For this purpose we need to make generic scripts so that it “works” on all machines.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 21
Points to consider for Req0001a The second issue is the executable file. If you look in “\samples\flight\app\” you’ll see 3
different versions of Flight Reservation as also described in Req0001a – Details
Every time a new version is released we want to run the automation test-set.
So we want flexibility in order to run the desired version to test.
We want an independent place, where we can control this argument.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 22
Points to consider for Req0001a This information must be separated from
the scripts. That’s what we call “dynamic data” ( OO Methodology )
The solution is the Environment Object
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 23
Creating an Environment File – FR.xml Open the test settings dialog. From menu : File Settings Shortcut : ALT + F + G From Toolbar as shown below :
Test Settings
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 24
Environment Tab
User Defined
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 25
Creating Environment variable
Click Add ( + ) Variable
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 26
Creating Environment variable
Click Export Click Save The File
Name under Environment Folder
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 27
Creating Environment File
LIB
RA
TESTS
RS
DOC
FR
DAT
SETTING
RES
BATCH
ENV
Automation
BL
GL
FR.xml
Click Export Click Save The File
Name under Environment Folder
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 28
Creating Environment variable
Click Cancel
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 29
ENV\FR.xml
Don’t create this file under Test Settings, as it is created automatically by the export environment that we’ve just seen.
The Environment xml file must be in a specific format. Otherwise you’ll get a runtime error when loading the xml.
In other words, the xml file must be follow the XML schema. As you can see, only one parameter is defined, for now.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 30
Environment XML Schema
You can create your own Environment file. Type each variable name-value pair within
<Variable> elements in the following format:
<Variable> <Name>This is the first variable's name</Name> <Value>This is the first variable's value</Value> <Description> This text is optional and can be used to add comments. It is
shown only in the XML not in QuickTest</Description> </Variable>
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 31
busLoginMng Template
Option Explicit
Dim msg
Select Case LCase( Parameter.Item( "busCode" ) )
Case ...
Case ...
Case Else
Reporter.ReportEvent micWarning, "NotImplemetedException", Parameter( "busCode" )
ExitAction( micWarning )
End Select
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 32
Branching and Validation
The condition is busCode, for each keyword-value, we must provide an implementation.
In case that busCode is invalid ( user error ) a warning message will sent to the Reporter object.
The LCase VBScript function is used to reduce case-sensitive errors user mistypes.
Parameter.Item( "busCode" ) is the Parameter object we use to reference an action parameter( in our case, the input parameter ).
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 33
Implementing Req0001a
First we’ll call the FileExists function we have already implemented in FR.vbs.
The function receives the argument fileFullPathName.
To call the function, we need to associate the function library ( FR.vbs ) to the test.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 34
Permanently associate a Function Library Since FR.vbs is our main function library file, we
need to associate the library function to each QTP test.
QTP can help us with this repetitive task with its “Set as default” feature.
By using the “Set as Default” feature, every new test will automatically get associated with FR.vbs.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 35
Permanently associate a Function Library Associate the function to the busLogin test.
From menu select : File Settings Resources tab
Hotkey : ALT + F + G and move to resources tab. From toolbar as shown below.
Test Settings
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 36
Permanently associate a Function Library
ClickClick
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 37
Associating Keeping Relative Path
Keep Relative PathKeep Relative Path
Clicking “Set as Default”
Sets the current list of object repositories
as the default list to be associated with all new actions.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 38
Associating function libraries
Caution : if you see picture A, go to Options Folders Tab and add the Path to X:\Automation\FR, where “X” is the project driver.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 39
Permanently associating function Libraries By clicking “Set as Default” every new script will
be associated with the FR.vbs function Library File
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 40
Declaring Variables
Declare all variables that we are going to use, since we are using Option Explicit.
Dim msg, i
Dim fso, execPath, fullExeName, bExist
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 41
Implementing Req0001a
Set fso = CreateObject( "Scripting.FileSystemObject" )
' ** build the application path
execPath = fso.BuildPath( Environment( "ProductDir" ), APP_PATH )
fullExeName = fso.BuildPath( execPath, Environment( "EXE_FILE" ) )
Set fso = Nothing
We need to assemble the full path of the executable file. We will use the BuildPath method, of the
Scripting.FileSystemObject ( FSO ) object. We need to assign a reference to the FSO. After using BuildPath we release the fso object by setting
the value to Nothing.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 42
Implementing Req0001a
Set fso = CreateObject( "Scripting.FileSystemObject" )
' ** build the application path
execPath = fso.BuildPath( Environment( "ProductDir" ), APP_PATH )
fullExeName = fso.BuildPath( execPath, Environment( "EXE_FILE" ) )
Set fso = Nothing
Questions you’ll probably ask : What is Environment( “ProductDir” )? How to load Environment( “EXE_FILE” )? Where are we declaring APP_PATH?
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 43
Implementing Req0001a
To use the BuildPath method, we need to create the FileSystemObject and set the reference the fso variable.
fso is not a regular variable, is an object reference variable. To assign an object to a variable we must use the Set keyword.
After using BuildPath we release fso reference by setting variable to Nothing.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 44
Settings – Environment Tab
From Menu : File Settings Environment Tab See all available built-in environment values.
ProductDir
ProductDir
Value
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 45
Define APP_PATH
Since Environment( “ProductDir” ) returns only the qtp installation folder, we need to drill down to “\samples\flight\app” until we arrive the executables.
To keep a generic scripting OO methodology we will define APP_PATH as a Public Constant in FR.vbs
Public Const APP_PATH = "\samples\flight\app"
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 46
Implementing Req0001a cont.' ** Req0001a - Calling external function
If FileExists( fullExeName ) Then
msg = Environment( "EXE_FILE" ) & " was found under installation folder."
Reporter.ReportEvent micPass, "Req0001a", "File " & msg
Else
msg = Environment( "EXE_FILE" ) & " was not found under installation folder."
Reporter.ReportEvent micFail, "Req0001a", "File " & msg
ExitTest( micFail )
End If
This one is simple. If the function returns True, Req0001a was achieved successfully, otherwise we send an error message to Reporter object and finish the test.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 47
Insert a step – Using Step Generator Insert a call to function. Activate the Step Generator. Menu : Insert Step Generator Hotkey : Toolbar :
Step Generator
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 48
Insert a step – Using Step GeneratorCategory : Utility Objects
Object : SystemUtil
Operation : Run
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 49
Configure a value
Parameter Environment
Type
EXE_FILE
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 50
Insert a step – Using Step Generator
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 51
Implementing Req0001b
' ** Activating Application FR
SystemUtil.Run Environment.Value( "EXE_FILE" ), vbNullString, execPath, "open"
SystemUtil.Run method activates the executable file. The file name to execute is stored in
Environment( “EXE_FILE” ). Remark
You need to manually fix “execpath” ( String ) to execpath Variable ( only if used the Step Generator ).
Also the Value word after Environment is not coming by itself, enter it manually. Value is the default property of Environment, so Environment (“A”) is the same as Environment.Value (“A”)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 52
Implementing Req0001b
' ** Calling guiLogin/Req0001
RunAction "guiLogin [guiLogin]", oneIteration, "Req0001"
The RunAction command calls the reusable Action guiLogin in [guiLogin] test file.
The <action name> [File Name] syntax is automatically added by QTP when you call an external reusable action.
“Req0001” is the argument passed to the reusable action. Caution: You can’t just copy this line of code, it won’t work
in QTP, a call to an existing reusable action is required.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 53
Inserting a call to an existing action Menu : Insert Call to Existing Action… Type : Alt + I + T Toolbar as shown below :
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 54
Inserting a call to an existing action Open guiLogin Test…
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 55
Inserting a call to an existing action
After the current step
Keep Relative Path
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 56
Inserting a call to an existing action After you inserted the call successfully, you should see
in the action list combo-box two actions. The blue arrow means a “Local Reusable Action” The red arrow means a “External Reusable Action” External reusable action is always READ ONLY.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 57
busLoginMng – Final Look
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 58
Initialization Sub-Routine
To make QTP behaves the same, every time regardless of running scripts on same or different machines, we need an initialization routine.
The initialization routine, will be located in FR.vbs. The initialization routine is a sub-routine of type
Sub. To learn the differences between Functions and
Sub please refer to QTP help.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 59
Initialization Sub-Routine - Minimizing QTP
First we want to minimize the QTP window, to see our script working on the AUT.
QTP COM has a property “WindowState”, to access the properties we need to create an object reference to QuickTest.Application Set qtp = CreateObject( "QuickTest.Application" )
And immediately afterwards qtp.WindowState = "Minimized"
Set qtp = Nothing
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 60
Loading Environment Xml
We don't want to use hard-coded values in our script e.g. “C:\Program Files\Mercury… “ because in the next release, it might change. So the following programming technique is also a best practice.
We know that environment file is located under ENV folder by name “FR.xml”.
All we need, is to build a string that specifies the project folder + the file path.
In order to do so we will use LoadFromFile Method of Environment Object.
Since the LoadFromFile method, requires the full path file name, we will use Locate method of PathFinder Object.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 61
Loading Environment Xml
The PathFinder.Locate returns the full file path that QTP uses for the specified relative path ( resolves the path ) based on the folders specified in the Folders tab search list ( Tools Options Folders ).
This “Path” was specified in the First Presentation.
envXml = PathFinder.Locate( "ENV\FR.xml" )
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 62
Loading Environment Xml
Checking what Locate returns …. If envXml = vbNullString Then msg = "Environment file was not found in expected location."
Reporter.ReportEvent micWarning,Environment("ActionName"), msg
Exit Sub
End If
Loading xml…Environment.LoadFromFile envXml
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 63
Programmatically define Record and Run Settings
We will configure record and run settings. For more information on Using Environment
Variables to Specify the Record and Run Details for Your Test please refer to QTP documentation, topic
Defining Record and Run Environment Variables
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 64
“Killing” existing FR applications QTP is very sensitive to object recognition.
Duplicate objects might be a problem to QTP. We must avoid this state (multiple instances ).
Avoid This!!!
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 65
“Killing” existing FR applications The solution is simple, and is a built-in feature of
QTP. The CloseProcessByName method of
SystemUtil object closes a process according to its name.
The method needs a process name to “kill” it; How do we know the process name? Open the flight application. Press Alt + Ctrl + Delete to view the Task Manager
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 66
“Killing” existing FR applications
Flight4a.exe
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 67
“Killing” existing FR applications And, since the process name is identical
to the executable file name, we’d just loaded from environment file; we will use same executable file name.
SystemUtil.CloseProcessByName Environment( "EXE_FILE" )
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 68
Initializing Global Dictionary
The global dictionary is in run-time memory all the time.
Before running scripts it is recommended to remove all existing keys.
GDictionary.RemoveAll()
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 69
The initialization Routine – Final Look
Place the initializationroutine Sub in fileFR.vbs, just below the FileExists Function.Save the File.
EXE_ENV_1 : The executable files on which QuickTest
records operations when record and run sessions begin.
You can specify up to ten executable files. LNCH_ENV_1 : Whether to open the application when starting
the record and run session (for each corresponding application).
Possible values:
0 (do not launch the application)
1 (launch the application)
CHLD_ENV_1 : Whether to record and run on processes created
by the application during the record and run session.
Possible values:
0 (do not record on descendant processes)
1 (record descendant processes)
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 70
Implementing Req0001b
Req0001b requires GUI operations. GUI operation are implemented in the
GUI layer or in the Utils layer.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 71
Implementing guiLogin
Open the guiLogin reusable action by opening the test RA\GL\guiLogin
menu : File Open Test Hotkey : CTRL+O Toolbar :
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 73
GuiLogin Header
'***********************************************************************
'@Author : advancedQTP
'@Date Created : <ddd MMM dd, yyyy>
'@QTP Version : 9.2
'@Description : The guiLogin Module Stores all the actions required for the login process.
'@Input Parameter : Name:=StepName, Type:=String, Default:=, Description:=The Step code name.
'@Out Parameter : None.
'@Gui Window : Dialog "Login"
'@Addins : ActiveX
'@Modifications : <#n By <Name>, Date: <dd-mmm-yyyy>> (Later modification on top)
' <#n-1 By <Name>, Date: <dd-mmm-yyyy>
'***********************************************************************
Option Explicit
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 74
Implement Req0001 in guiLoginOption Explicit
Dim msg
Select Case LCase( Parameter.Item( "StepName" ) )
Case "req0001"
Case Else
msg = "StepName parameter not implemented."
Reporter.ReportEvent micWarning, "NotImplemetedException", msg
ExitAction( micWarning )
End Select
It is a similar template to busLogin, the difference is the input parameter StepName.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 75
Implement Req0001 in guiLogin
Case "req0001"
If Dialog( "Login" ).Exist( 5 ) Then
msg = "Dialog 'Login' is displayed"
Reporter.ReportEvent micPass, "Req0001b", msg
Else
msg = "Dialog 'Login' is not displayed after 5 seconds."
Reporter.ReportEvent micFail, "Req0001b", msg
Call Desktop.CaptureBitmap( Reporter.ReportPath & "\Req0001b.png", True )
ExitAction( micFail )
End If
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 76
Implement Req001 in guiLogin After activating the executable ( busLogin ), we
need to check if Dialog “Login” is displayed. Notice that the time out is now 5 seconds,
because a possible delay between activation and login can occur hence it is not considered as a defect.
Only if after 5 seconds, the Dialog “Login” is not displayed, then the test would fail.
And if the test failed for that reason we want to “Document” this incident by sending an image screenshot of the desktop.
Call Desktop.CaptureBitmap( Reporter.ReportPath & "\Req0001b.png", True )
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 78
Create Req0001 Test
Open a new blank Test and save it under Tests\Req0001
Req0001
LIB
RA
TESTS
RS
DOC
FR
DAT
SETTING
RES
BATCH
ENV
Automation
BL
GL
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 79
Test Settings
Modify The Test Settings…
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 80
Insert a step – Manually
We call the initialization process defined in FR.vbs If the initialization failed, the test will be terminated. Just type the call to Initialization.
Option Explicit
Dim msg, bExists
Call Initialization()
If Reporter.RunStatus = micFail Then
msg = "Initialization Process Failed.“
Reporter.ReportEvent micFail, Environment( "TestName" ), msg
ExitTest( micFail )
End If
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 81
Insert a Call to Existing Action
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 82
Insert a Call to Business Module
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 83
Insert a Call to Existing Action
After the current step
Use relative path
busLogin
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 84
Req0001 Test – Final Look
“Req0001” should be added manually while calling reusable-action busLogin
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 85
Check Syntax
It’s a good practice to check the script syntax after adding functionality and just before closing the test.
Menu : Tools Check Syntax Hotkey Ctrl + F7 Toolbar as shown below:
Check Syntax
Additional quick syntax check : Switch from expert view to Keyword view
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 86
Syntax Results
If you don’t see the Information pane.Menu : View Hotkey : Alt + V + IToolbar
Information pane
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 87
Syntax check Report
Valid syntax
Invalid syntax
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 88
Run the Test
Always run your test in debug mode. You are the developer, not the tester yet. Running tests, not in debug mode, will save all the results
in the hard disk, and this is not required when you’re “debugging” your scripts.
Temporary run results
folder
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 91
What’s Next?
Extending functionality on existing modules. Process design of a test. Build a new function. Adding single object to local repository. Checking single and multiple properties on an
object Standard and bitmap checkpoints. Create an initialization action. Create a generic login procedure. Calling to existing reusable-actions. Build a new test.
Dani Vainstein & Monika Arora GautamDani Vainstein & Monika Arora Gautam 92
Special Thanks To
Paul Grossman from USA, Chicago. Joydeep Das from India, Hyderabad. Tali Hizkia from Israel, Tel-Aviv. Richi Sharma from USA, New Jersey. Bharathi Babu from India, Pune.
Recommended