Map several similar windows to teh same repository

Class library usage, coding and language questions.
Posts: 2
Joined: Thu Oct 18, 2012 8:12 pm

Map several similar windows to teh same repository

Post by PPChailley » Wed Oct 24, 2012 4:20 pm


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

//Modal window
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

User avatar
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark

Re: Map several similar windows to teh same repository

Post by artur_gadomski » Thu Oct 25, 2012 10:39 am

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.