Re-run failed tests, is there an option for this?

Best practices, code snippets for common functionality, examples, and guidelines.
xibinki
Posts: 28
Joined: Mon Jun 27, 2016 9:59 am

Re-run failed tests, is there an option for this?

Post by xibinki » Mon Jul 10, 2017 4:03 pm

I searched on the forum for this topic and it seems there's a lot of people asking the same thing and no one answering a proper answer.

This been said, I decided to make a post and ask to the Ranorex Devs and Support Team, is there an option or a code block to re-run the failed tests on Ranorex?

I have 60 test cases which run during the night and I want for Ranorex Studio to re-run the failed tests, mostly of these tests fail because Ranorex default timeout (1min) isn't enough to identify a controller on the login of my app. Also the computer where I run the tests, isn't very fast and sometimes the app takes longer to open.

So, is there an option for re-run tests?

Thanks.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Re-run failed tests, is there an option for this?

Post by krstcs » Mon Jul 10, 2017 8:17 pm

First, no, there is no built-in way to rerun failed tests.

Second, if you tests are timing out you need to either increase the timeout, or change the RanoreXPath so that it is more specific (which makes it faster), or both. Having a good XPath is usually the best way to speed up tests and get around timeout failures.
Shortcuts usually aren't...

xibinki
Posts: 28
Joined: Mon Jun 27, 2016 9:59 am

Re: Re-run failed tests, is there an option for this?

Post by xibinki » Tue Jul 11, 2017 9:46 am

krstcs wrote:First, no, there is no built-in way to rerun failed tests.

Second, if you tests are timing out you need to either increase the timeout, or change the RanoreXPath so that it is more specific (which makes it faster), or both. Having a good XPath is usually the best way to speed up tests and get around timeout failures.
Well, to be honest I have some problems with XPath and finding the elements on my testing app. The app was firstly built in winforms and now it has wpf elements on top of the winforms. Ranorex has a real hard time identifying the correct xpath and when I need to add a new element to the repository, basically I have to use the Spy tool and walk my way through the hierarchy tree of elements, which is a pain in head. I tried to initiate the testing app with administrator rights, also initiated Ranorex with administrator rights, but Ranorex keeps identifying the elements as "ElementHost". I also tried disabling the WPF plugin and enabling it, but then it messes up with the xpaths and it's even more difficult to correct them.

I never figured out if its a problem with Windows 10, the testing app, Ranorex or winforms. Tried different solutions and nothing seemed to work :( and this is why sometimes the elements timeout and my tests fail.

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

Re: Re-run failed tests, is there an option for this?

Post by Support Team » Thu Jul 13, 2017 1:08 pm

Hello xibinki,

I think that we could best help you via our ticketing support system. I suggest that you drop us an email at [email protected].

It would be best, if you would send us your application already in your first email together with the description of your problem. If this is not possible, then please at least send us a Ranorex snapshot of your application. Instructions on how you can create one can be found here: How to Create a Ranorex Snapshot

Furthermore, please don't forget to attach your Customer ID at the beginning of your email ;)

I am looking forward to your email.

Sincerely,
Tomaž
.
Image

tvu
Posts: 195
Joined: Tue Apr 07, 2015 10:47 pm

Re: Re-run failed tests, is there an option for this?

Post by tvu » Thu Jul 13, 2017 5:58 pm

Hi xibinki,

I re-run my failed test case by doing the following:
  • I run the automation with the desired run configuration.
  • In the Suite teardown section, I write a list of failed test cases to a CSV
  • I then run the automation again, but with a Re-Run Failed test case configuration
  • The configuration runs only one test case. That test will read in the CSV file and enable all the failed test case
  • This one test case has to be before any failed test case you are running.
You can enable the test case by doing:

Code: Select all

TestSuite.Current.GetTestContainer(testCaseName).Checked = true;
Hope that helps.