Running a module from another module

Ask general questions here.
Saf2
Posts: 6
Joined: Thu Oct 01, 2020 9:34 am
Location: Tampere, Finland

Running a module from another module

Post by Saf2 » Thu Oct 22, 2020 1:47 pm

Hello,

I need to run a module from another module.

Code: Select all

ITestModule module = new my_module();
 TestModuleRunner.Run(module);
The code works, but the module variables of my_module are empty. How do I pass parameters to the module so that it initialises its module variables?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Running a module from another module

Post by odklizec » Thu Oct 22, 2020 2:40 pm

Hi,

Calling one module from another is definitely not recommended approach. If for nothing else a module loaded outside the TestSuite is not connected to its parameters. Therefore, it's somehow complicated to pass the parameters to/from such module. Additionally, it makes the solution "unreadable" and hard to debug. Why you don't simply add the module to the test suite, enclose it in Smart Folder and make the Smart Folder conditional? It's way better option than calling module from another module ;)

If you still insist on using this approach, then check this topic:
viewtopic.php?f=16&t=12370&p=49604
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Saf2
Posts: 6
Joined: Thu Oct 01, 2020 9:34 am
Location: Tampere, Finland

Re: Running a module from another module

Post by Saf2 » Tue Oct 27, 2020 12:23 pm

I need to run the module in the middle of a test, that's why I don't think your solution is ideal. The two modules are in the same test suite though, does that make a difference?