How can I create a fail suite by turning passing scripts off in the .rxtst file?

Best practices, code snippets for common functionality, examples, and guidelines.
ian807
Posts: 6
Joined: Wed May 08, 2019 7:57 pm

How can I create a fail suite by turning passing scripts off in the .rxtst file?

Post by ian807 » Fri May 17, 2019 3:31 pm

I need to create a fail suite. When a script passes, I'd like to modify the rxtst file such that when I open the file, all the passing items on the tree are unchecked while all fails remain checked.

Is there a way to programmatically modify the rxtst file from within Ranorex based on on pass/fail state?

User avatar
Stub
Posts: 515
Joined: Fri Jul 15, 2016 1:35 pm

Re: How can I create a fail suite by turning passing scripts off in the .rxtst file?

Post by Stub » Mon May 20, 2019 8:26 am

While you can programmatically turn tests on/off at runtime - perhaps by loading a list of failing tests - this won't work on the .RXTST Test Suite.

Code: Select all

TestSuite.CurrentTestContainer.Checked

ian807
Posts: 6
Joined: Wed May 08, 2019 7:57 pm

Re: How can I create a fail suite by turning passing scripts off in the .rxtst file?

Post by ian807 » Mon May 20, 2019 1:23 pm

So, this would not check the scripts on and off in the .rxtst file? That's exactly what I'm trying to do.

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

Re: How can I create a fail suite by turning passing scripts off in the .rxtst file?

Post by odklizec » Mon May 20, 2019 1:27 pm

Hi,

You can enable/disable test cases/smart folders by this line of code:

Code: Select all

TestSuite.Current.GetTestContainer(testCaseName).Checked = true;
Where "TestCasename" you must replace with test case/smart folder name of your choice. So I think the best approach to do what you want, would be to get the list of failing test cases and then then programmatically enable/disable test cases you want. But no, there is no permanent way to enable/disable test cases directly in rxtst file.
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

ian807
Posts: 6
Joined: Wed May 08, 2019 7:57 pm

Re: How can I create a fail suite by turning passing scripts off in the .rxtst file?

Post by ian807 » Mon May 20, 2019 1:58 pm

So "testCaseName" is the arbitrary name of the smart folder?

If so, my next question would be, suppose my suite folders are nested like so:

Code: Select all

MyTopLevelCategory/Mysubcategory/MyTest_01.
Do I call like so:

Code: Select all

TestSuite.Current.GetTestContainer("MyTopLevelCategory/Mysubcategory/MyTest_01").Checked = true;

Code: Select all

TestSuite.Current.GetTestContainer("MyTest_01").Checked = true;
The next question would be, "Is there code to get the current TestCaseName so I can use that as my test container parameter?

User avatar
Stub
Posts: 515
Joined: Fri Jul 15, 2016 1:35 pm

Re: How can I create a fail suite by turning passing scripts off in the .rxtst file?

Post by Stub » Tue May 21, 2019 7:38 am

Code: Select all

TestSuite.CurrentTestContainer