Page 1 of 1

Execute test modules by priority

Posted: Fri Feb 06, 2015 12:09 pm
by andrefelipe
Hello,

1. What version of Ranorex are you using?
5.2.2

2. What Windows version are you using?
Win 7 Enterprise SP1

I am trying to "skip" a test module, using this:

Code: Select all

        static void TestSuite_TestSuiteCompleted(object sender, EventArgs e)
        {  
          ActivityStack.Instance.VisitAll(a => {  
                                            if (a.CustomProperties.ContainsKey("ignore"))  
                                              a.Status = ActivityStatus.Ignored;  
                                            return true;  
                                          });  
        }     
and this

Code: Select all

ActivityStack.Current.Parent.CustomProperties["ignore"] = "";
But it's not working as I want. Let me explain, I have a total usercode module, to read parameters from a XML file, and use some of them in the tests. And we want to run tests by priority, so I have in my repository variables, each test priority, so I can run only high priority tests when I have "to rush" to release.

The question is, can I have a recording module, with the first action being a UserCode, to check it's priority, and skip the entire module if it's not the priority that we want?

A code snipet would be great, I'm trying to find something in the Documentation, but still searching.
Thanks in advance

Re: Execute test modules by priority

Posted: Mon Feb 09, 2015 12:59 pm
by Support Team
Hello andrefelipe,

Unfortunately, it’s not possible to gracefully skip Recording actions after the Recording was started. You could restructure your test in order to skip whole TestCases. Therefore, just add a User Code Module which checks the "priority" before executing the TestCase.
CheckPriorityStructure.png
In order to en-/disable the TestCase, please use following line of code:
TestSuite.Current.GetTestCase("TestCase").Checked = true/false;
Regards,
Robert

Re: Execute test modules by priority

Posted: Mon Feb 09, 2015 5:33 pm
by andrefelipe
Worked like a charm. Thank you very much!

Re: Execute test modules by priority

Posted: Tue Feb 10, 2015 10:06 am
by Support Team
Hi andrefelipe,

You are welcome.

Regards,
Robert