isSetup/isTeardown property usage

Ask general questions here.
User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

isSetup/isTeardown property usage

Post by odklizec » Mon Feb 24, 2014 9:00 am

Hi,

I have a problem with declaring isSetup/isTeardown property (to detect if the module is in Setup/Teardown section). I'm quite sure it's because of my limited knowledge of C# ;) Any help will be greatly appreciated.

Here is what I've tried so far:
IModule module;
bool isModule = module.isSetup;
This throws me an error "Use of unassigned local variable 'module' (CS0165)"

So I tried this:
IModule module = Ranorex.Core.Testing.IModule;
bool isModule = module.isSetup;
This returns error "'Ranorex.Core.Testing.IModule' is a 'type', which is not valid in the given context (CS0119)"

The interesting thing is, that module is correctly recognized (in both examples) by the code completion and offers both isSetup and isTeardown properties.

Could you please guide me to the right direction? Thank you!
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

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

Re: isSetup/isTeardown property usage

Post by odklizec » Wed Feb 26, 2014 8:28 am

Hi folks,

Does anyone have any idea? I'm really stuck with this :(
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

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

Re: isSetup/isTeardown property usage

Post by Support Team » Wed Feb 26, 2014 11:24 am

Hi odklizec,

In order to access the “isSetup”- and “isTeardown”-property please use following code:
var module = (TestSuiteModule)TestSuiteModule.Current;
			bool a = module.IsSetup;
			bool b = module.IsTeardown;
Regards,
Robert
.
Image

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

Re: isSetup/isTeardown property usage

Post by odklizec » Wed Feb 26, 2014 11:50 am

Hi Robert,

Thank you for the help! Maybe it's just my inexperience with C#, but I think it would be good to have some examples in API docu ;) Sometimes it's really hard to figure things out just from plain API description.
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

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

Re: isSetup/isTeardown property usage

Post by Support Team » Fri Feb 28, 2014 4:51 pm

Hi odklizec,

Unfortunately there are some non-public methods which are not documented. These methods can be changed every time by Ranorex therefore it’s not recommended to use them. Thank you for your understanding.

Regards,
Robert
.
Image