transaction code testing in QTP
Good day all,
Currently in my testing i have reached a specific test i must carry out in the system whereby i must settle outstanding debts on the system by selecting the transactions from a list. The code is as follows:
[COLOR="Red"]VbWindow("MDIMain_3").Window("Recon # 7455").ActiveX("InsSettle.ctlInsSettle").VbListView("lsvComm").Select "77405"
VbWindow("MDIMain_3").Window("Recon # 7455").ActiveX("InsSettle.ctlInsSettle").VbListView("lsvComm").SelectRange "79012"
VbWindow("MDIMain_3").Window("Recon # 7455").ActiveX("InsSettle.ctlInsSettle").VbButton("OK").Click
VbWindow("MDIMain_3").Dialog("Payment Method").WinButton("Yes").Click
VbWindow("MDIMain_3").Dialog("Outstanding").WinButton("Yes").Click
VbWindow("MDIMain_3").Dialog("Outstanding").WinButton("Yes").Click
VbWindow("MDIMain_3").Dialog("Outstanding").WinButton("Yes").Click
VbWindow("MDIMain_3").Dialog("Outstanding").WinButton("Yes").Click[/COLOR]
The problem i am having is that when settling these transactions the list updates along with the transaction numbers (numbers after 'select' and 'selectRange') and also the last few lines of code show clicking on yes on a dialog box to accept the settlement, this box comes up for each transaction to be settled, and thus i need help with:
a) how to get QTP to select a set amount of items on the list of transactions menu without the need to recognize the transaction numbers
and
b) How to make the above work so that i can set a certain number of box clicks.
any help is as always greatly appreciated.
James.
Re: transaction code testing in QTP
I read your question a couple of times but to me, things are still unclear.
1. Are transaction numbers (numbers are SELECT and SELECTRANGE) dynamic? That is, do they change everytime the VbWindow refreshes/loads?
2. What is the list of transactions menu?
3. What determines the number of box clicks?
4. Which list updates along with the transaction numbers? Are you talking about the Child Object VbListView("lsvComm")?
Is it possible for you to provide me with a snapshot? If its not appropriate to post it here, could you mail it to me?
1 Attachment(s)
Re: transaction code testing in QTP
Ok i have a screenshot for you to view.
the transactions listed in the window update each time a new policy transaction is carried out, however if no transactions have been carried out then this stays the same.
The number of box clicks relates to the amount of transactions that have been selected to be settled.
The list itself ~(i think it is child view) updates as above, when new policy transactions are carried out where there will be an amount owing to pay the policy.
hope this is of some help.
regards James.
Re: transaction code testing in QTP
[QUOTE]a) how to get QTP to select a set amount of items on the list of transactions menu without the need to recognize the transaction numbers[/QUOTE]
Would you like to store these set values in the DataTable? Or would you like to retrieve a value from the form and feed it here?
If its the first one then:
1. Make a column in the DataTable and name it let's say "someVal"
2. sInValue = DataTable("someVal",dtGlobalSheet)
If its the second one then there are several ways it can be done.
[QUOTE]b) How to make the above work so that i can set a certain number of box clicks.[/QUOTE]
Wait(1)
While VbWindow("MDIMain_3").Dialog("Outstanding").WinButton("Yes").Exist
VbWindow("MDIMain_3").Dialog("Outstanding").WinButton("Yes").Click
Wait(1)
Wend
You can remove the "Wait()" part. I have included that just in case it takes a second or so for the dialog to appear.
I hope this is what you were looking for..
Re: transaction code testing in QTP
Hello,
Id like to retrieve the value from the actual form itself as a data table is not really feasable at this stage of testing.
the second part will be fine in regard to the dialog boxes so thank you.
any help on the first point with regards to retrieving the value from the form would be of much help.
regards James.
Re: transaction code testing in QTP
Try this:
listVal = 1
VbWindow("MDIMain_3").Window("Recon # 7455").ActiveX("InsSettle.ctlInsSettle").VbListView("lsvComm").GetItem(listVal)
You can try this with listVal = 2, listVal = 3 etc.
Re: transaction code testing in QTP
Hello again,
I have tried the code you gave and QTP advises that it cannot recognize the VBListView ( "lsvcomm").
Have you any thoughts on this?
thanks James.
Re: transaction code testing in QTP
It is possible that the VBList is a dynamic object, that is, its properties can change during runtime. Is it a dynamic object? If it is, then before we get any further, we will have to make sure QTP recognizes the List object every time the script is run.
Re: transaction code testing in QTP
Im not totally 100% on this, but i believe that it is not a dynamic object as there is not any reason for it to change.
Re: transaction code testing in QTP
James, I am not sure why it fails to work. I copied the code you posted in the original post. It should work. Maybe you can try to check if the VbList properties in the application and in your OR are the same?
Re: transaction code testing in QTP
hello,
sorry for the late reply,
I have checked and it is the same in the or, however qtp advises that:
Cannot find the "lsvComm" object's parent "Recon # 7455" (class Window). Verify that parent properties match an object currently displayed in your application.
any ideas?
regards James.
Re: transaction code testing in QTP
VbWindow("MDIMain_3").[COLOR="DarkRed"]Window("Recon # 7455")[/COLOR].ActiveX("InsSettle.ctlInsSettle").VbListView("lsvComm").Select "77405"
There is the problem (the part in red). QTP is not able to recognize the part. Its probably because the part after Recon # changes at runtime. You can use a regular expression there or the .* wildcard.