Execute test modules by priority

Ask general questions here.
andrefelipe
Posts: 13
Joined: Tue Feb 03, 2015 6:00 pm

Execute test modules by priority

Post by andrefelipe » Fri Feb 06, 2015 12:09 pm

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

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

Re: Execute test modules by priority

Post by Support Team » Mon Feb 09, 2015 12:59 pm

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
CheckPriorityStructure.png (6.02 KiB) Viewed 579 times
In order to en-/disable the TestCase, please use following line of code:
TestSuite.Current.GetTestCase("TestCase").Checked = true/false;
Regards,
Robert
.
Image

andrefelipe
Posts: 13
Joined: Tue Feb 03, 2015 6:00 pm

Re: Execute test modules by priority

Post by andrefelipe » Mon Feb 09, 2015 5:33 pm

Worked like a charm. Thank you very much!

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

Re: Execute test modules by priority

Post by Support Team » Tue Feb 10, 2015 10:06 am

Hi andrefelipe,

You are welcome.

Regards,
Robert
.
Image