Page 1 of 1

Map several similar windows to teh same repository

Posted: Wed Oct 24, 2012 4:20 pm
by PPChailley
Hi,

I have an application under tests that uses each of its windows in two separate flavors: modal and MDI child. As an example, the "customer detail" window can be called
* independently through the menus, thus becoming a normal MDI child window of the main window frame
* or as a quick-reference modal window from a button on the invoice window, designed to be consulted once and discarded to return to the invoice

Those two windows have exactly the same structure but their Ranorex Paths differ from their root elements:
// MDI Window
/form[@controlname='Main']/element[@controltypename='MdiClient']/form[@controlname='Customer'] 

//Modal window
/form[@controlname='Customer']
I'm using RxRep files that export to C# (not the recorder) and custom testing code. For lots of reasons I'd like to handle those two windows with the same CustomerWindow generated class, but I'm reluctant to try to hack Ranorex generated code for doing this.

Is there a "good" way to proceed?

Thanks in advance for any clue on this

Re: Map several similar windows to teh same repository

Posted: Thu Oct 25, 2012 10:39 am
by artur_gadomski
We had almost exact problem just recently. We solved it using dynamic keyword in C# this way:
  • create 2 repositories with exact same structure.
  • define your repository variable as dynamic
  • on run time/or whenever determine which repository you need to use and instantiate repository variable with proper repository class.
We use it to run same code on a WPF and Winform version of out AUT.