07-23-2008, 04:56 AM
(This post was last modified: 07-23-2008, 04:58 AM by Gentoolicious.)
One of my tests is designed to create a user and then check to make sure the user actually exists.
When a user wants to log in they are displayed a list of buttons that have the account name and account picture displayed (imagine logging into Windows XP) where the account name is the name of the button.
My script does something like this:
So as you can see, the accountName variable is generated somewhat randomly and, at the end of the script, the variable accountName is just substituted for the button name.
The code works. The problem is that QTP checks to see of WpfButton(accountName) exists in the object repository. As the button did not exist before the start of the test, it will not exist in the object repository and QTP throws an error message causing all my tests to report as failed (when they're not failing).
Can anyone tell me if their is some way to dynamically create an object and then add it to the repository while a script is running?
When a user wants to log in they are displayed a list of buttons that have the account name and account picture displayed (imagine logging into Windows XP) where the account name is the name of the button.
My script does something like this:
Code:
Dim accountName
Randomize
accountName = DataTable("accountName", dtGlobalSheet) & int((99999*rnd)+1)
'Process to Register Account
WpfWindow("WindowName").WpfEdit("UserName").Set accountName
<snip>
'Process to Login
if WpfWindow("Window Name").WpfButton(accountName).Exists Then
MsgBox("Test Succeded.")
Else
MsgBox("Test Failed.")
Endif
So as you can see, the accountName variable is generated somewhat randomly and, at the end of the script, the variable accountName is just substituted for the button name.
The code works. The problem is that QTP checks to see of WpfButton(accountName) exists in the object repository. As the button did not exist before the start of the test, it will not exist in the object repository and QTP throws an error message causing all my tests to report as failed (when they're not failing).
Can anyone tell me if their is some way to dynamically create an object and then add it to the repository while a script is running?