Module Folder type?

Ranorex Spy, Recorder, and Studio.
cliving
Posts: 5
Joined: Wed Aug 13, 2014 9:21 pm

Module Folder type?

Post by cliving » Wed Aug 13, 2014 9:40 pm

I have a project with the following format -

Web1/login.rxrec
Web1/foo1.rxrec
Web1/foo2.rxrec
Web1/logout.rxrec

Web2/login.rxrec
Web2/foo1.rxrec
Web2/foo2.rxrec
Web2/logout.rxrec

etc.

Basically, each website has a set of recorded modules, with a specific naming structure. Each website has its own folder.

Then, a c# code module parses data corresponding to the various websites, logs in to the website, does stuff, and a finally logs out.

The code for login, for example, would be something like:

Code: Select all

public static void doLogin(string condition)
{
   if (condition == condition1)
      Web1.login.Start();
   else if (condition == condition2)
      Web2.login.Start();
   else if ...
}
This works, but the if-else structure will get tedious, at best, as the project grows beyond the pilot stages.

Is there a way to change it to something like:

Code: Select all

public static void doLogin( <sometype> moduleFolder)
{
   moduleFolder.login.Start();
}

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Module Folder type?

Post by Support Team » Thu Aug 14, 2014 12:15 pm

Hello cliving,

I would consider a data driven approach in your case. I’m not exactly sure how many parts of your websites and test steps diverge from each other but I could imagine a structure as shown below:
ClivingSolution.png
ClivingSolution.png (25.06 KiB) Viewed 783 times
ClivingSolution_DataSource.png
ClivingSolution_DataSource.png (19.68 KiB) Viewed 783 times
Further information about data driven testing can be found here:
http://www.ranorex.com/support/user-gui ... sting.html

Regards,
Robert
.
Image