Test continuance

Best practices, code snippets for common functionality, examples, and guidelines.
Posts: 6
Joined: Thu Oct 03, 2019 12:31 pm

Test continuance

Post by jan » Mon Dec 02, 2019 12:15 pm

Hello fellow testers,

I would like to ask you for help with test continuance. What I mean by that? This:
In a test suite project, there are many test cases with test recordings. If one test fails, Ranorex can continue further. But the problem is this: The AUT remains open at some detail screen, where the failure occured. But the next test doesnt start on that screen, it starts on some other screen, and therefore the next test wont start, because Ranorex wont find the initial UI element of that test.

How do you solve this? I assume this issue must consider almost every tester.

I already asked Ranorex technical support about this. The suggested solution is to close AUT after failed test and then start it again - using teardown and setup sections. The problem I have with this, is that these actions (closing and start AUT) must be conditioned - close AUT only after failure and start AUT only if the previous test failed. And Ranorex TP says, that this can be done by custom code modules. The problem is, that unfortunately, I am not a programmer.

Has anyone already dealt with this and written the custom code modules? Or is there other solution?

Thank you.

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

Re: Test continuance

Post by odklizec » Tue Dec 03, 2019 9:04 am

Hi Jan,

I'm afraid, there is no codeless solution of your problem. It could be possible, if Setup/Teardown would support SmartFolders, which are currently not supported in Setup/Teardown.

Anyway, what you can do, is to detect the TestStatus, using this code:

Code: Select all

string tcStatus = TestSuite.Current.CurrentTestContainer.Status.ToString();
And then, based of the 'Success' test state, disable all modules in test's TearDown section, using McTurtle's code, posted here:
https://www.ranorex.com/forum/complete- ... tml#p53718
Here is a small sample project, showing the whole workflow...
Unfortunately, I think that this solution will most probably not solve your problem. The real problem is, how to set the UI to expected state for next test? How many modules should be in TearDown of failed(each) test?

Based of your description of the problem, it seems that each test expects the UI to be set to certain state from previous test? And this is the real problem! If the test fails somewhere in the middle, you will have to make sure that the app restarts/sets the UI to the state, expected by next test. I'm afraid, I don't have a clue how to do that. I think this is a major test design flaw! Each test should be designed as independent from each other. I mean, each test should always sets its own UI state. Yes, it may extend the execution time. But on the other hand, the tests will be independent from each other and therefore, they could be run independently from each other. So if one test fails, the next test can run as if nothing bad happened in previous test. You see my point?

The above steps could help you with restarting AUT (in case of failure), but they will not help you much with setting the UI to expected state.
You do not have the required permissions to view the files attached to this post.
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

Posts: 6
Joined: Thu Oct 03, 2019 12:31 pm

Re: Test continuance

Post by jan » Tue Dec 03, 2019 11:13 am

Hello Odklizeci,

thank you for your quick answer, it looks promising, I will try it.

Yes, I agree, test design is not good (structure and data are originally from schooling material, where data dependance is required). We will have to redo it.