Forum Discussion

DanH's avatar
DanH
Contributor
6 years ago
Solved

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