How to map multiple instances of the same form
Hello,
I've got a bit stuck with a test which runs two instances of the same form.
The situation is:
We have a Winforms application which has a form frmInvoice, this is used for a wide range of invoice types.
On the whole this isn't a problem as I can simply use the mapped frmInvoice for which ever type of invoice I am testing.
However, there are a number of tests where an instance of frmInvoice will open up a fresh instance of frmInvoice whilst remaining open, e.g. an instance dealing with Purchase Invoices can open an instance for Purchase Credit Notes. I have recorded a test which does this but it will not play back correctly as when the code to enter text into a control on the second instance of frmInvoice (Purchase Credit Note) is hit, the control on the first instance of frmInvoice (Purchase Invoice) is the target.
I have tried mapping the two instances of frmInvoice, as e.g. frmInvoicePI and frmInvoicePCN, but I have not been able to do this. If I try to map a fresh instance of the form, TestComplete says it is already mapped. I have tried looking in the Object Browser: I can see both instances of frmInvoice, but again, I cannot change their mapping to distinguish between them.
Would anyone have an idea how I might start distinguishing between the two instances?
Thanks in advance,
Dan
are the invoice forms precisely the same for every single kind? purchase, credit note, etc?
If not, I'd suggest creating a persisten project level variable, and using those variables as a unique identifier within the name mapping properties of that invoice object within the name mapping repo.
So at the top , it may say something like (object type- something) for the form, but you can edit and add in additional properties, say perhaps a txt identifer of some kind, that points to that persistent variable that tells testcomplete which invoice form you want to perform the settext or keys operations on.