Steps for Automating a Test Case – An Example
Problem: A new user wants to register in rediff.com. The website supports multiple languages and it needs to be tested for multiple languages too. This test needs to be automated.
Steps to automate the test
1. Define a test case “Register User”
2. Define a datasheet and make the test data-driven.
3. Define a properties file and capture field names and table names for the registration screen.
Example,
ROOTPATH = "C:\TestScripts\"
BrowserType = "iexplore.exe"
URL = "http://login.rediff.com/"
SheetName = "English"
MainBrowser = "Rediffmail"
MainPage = "Rediffmail"
EditHtmlTag = "html tag:=INPUT"
ListHtmlTag = "html tag:=SELECT"
ButtonType = “type:=button”
ResetType = “type:=reset”
***************Register User Screen Start *************************
If (ScreenName = "RegisterUser - Add") Then
LoginNameField = "name:=login," & EditHtmlTag
PasswordField = "name:=passwd," & EditHtmlTag
RetypePasswordField = "name:=passwd1," & EditHtmlTag
FirstNameField = "name:=fname," & EditHtmlTag
LastNameField = "name:lname" & EditHtmlTag
GenderField = "name:=gender" & ListHtmlTag
StateField = "name:=state" & ListHtmlTag
PinCodeField = "name:=zip" & EditHtmlTag
EducationField = "name:=edu" & ListHtmlTag
OccupationField = "name:=occupation" & ListHtmlTag
AlternateEmailField = "name:=emailaddress" & EditHtmlTag
End If
***************Register User Screen End *************************
4. As Button and Link names change with languages, capture these constants in the corresponding
Example,
RegisterMeButton = "name:= Register Me," & ButtonType
ResetButton = "name:= Reset," & ResetType
5. Identify and place all module specific functions in the module-specific VBScript. Functions that can be used across the application can be placed in the generic VBScript. When the desired function is not available, define the function based on the following guidelines:
· Decide the purpose of the function
· Provide a descriptive name for the function
· Determine input parameters
· Determine return values, if required
· Implement the function.
6. Reuse the Reusable Actions for frequently performed tasks like clearing and resetting the fields, browsing records, login application, logout application etc.
7. Using the Reusable Actions and functions (common and module specific) build the specific script Register User
8. Using the Reusable actions and specific script, build the driver script “Register”.
9. Execute the driver script.
10. View results in the Test Results file generated by QTP.
No comments:
Post a Comment