Ranorex custom re-run component

589 views Asked by At

Since Ranorex does not provide re-run functionality from under the hood, I have to write my own and before I started, just want to ask for advice from people who've done it or maybe possible existing solution on the market.

Goal is:

  • In the end of the run, to re-run failed test cases.

Requirements:

  • Amount of recursive iterations should be customized

  • If Data binding is used, should include only Iterations for Data binding that failed

2

There are 2 answers

1
697 On BEST ANSWER

Possible solutions:


1a. Based on the report xml: Parse report and collect info about all failed TC.

Cons: Parse will be tricky

or:

1b. Or create list of failed TC on runtime : If failure occurs on tear-down add this iteration to the re-run list (could be file or DB table).

Using for example:

string testCaseName = TestCaseNode.Current.Name;
int testCaseIndex = TestSuite.Current.GetTestCase(testCaseName).DataContext.CurrentRowIndex;

then:

2a. Based on the list, run executable with parameters, looping though each record. like this:

testSuite.exe /tc:testCaseName tcdr:testCaseIndex

or:

2b. Or generate new TestSuite file .rxtxt and recompile solution to created updated executable.

and last part:

3a. In the end repeat process, checking that failedTestCases == 0 || currentRerunIterations < expectedRerunIterations with script through CI run executable

or:

3b. Wrap whole Test Suite into Rerun test module and do the same check for failedTestCases == 0 || currentRerunIterations < expectedRerunIterations and run Ranorex from TestModule


Please let me know what you think about it.

3
Martin On

I would use the Ranorex command line argument possiblities to achieve this. Main thing would be to structure the suit accordingly that each test-case could be run seperately.

During the test I would log down the failed test cases either into a text file, database or any other solution that you can later on read the data from (even parse it from the xml result if you want to).

And from that data you'll just insert the test-case name as a command line argument while running the suite again:

testSuite.exe /testcase:TestCaseName

or

testSuite.exe /tc:TestCaseName

The full command line args reference can be found here: https://www.ranorex.com/help/latest/lesson-4-ranorex-test-suite