How to execute a module only on error

Ask general questions here.
carlovandriel
Posts: 3
Joined: Wed Feb 04, 2015 4:54 pm

How to execute a module only on error

Post by carlovandriel » Wed Mar 18, 2015 1:32 pm

Hi,

I have a testsuite with 3 testcases. The error handling is set to 'continue with parent' as i like all testcases to run even if 1 fails. This works fine.
I have also build in a module in each testcase to update our Jira user-story that is reflected by that testcase with 'passed'. This way we have 1 dashbord (in Jira) with all team results.
The next thing i like to do is to put the belonging Jira user-story on 'failed' in case a testcase fails.
In Selenium we used a try/catch and we ran the module that updates the jira-story to failed in the catch part of the testcase.
How can we do something simular in Ranorex without programming (we are not programmers) ?

Update: i read the blog about connecting jira and ranorex. That does work, however we have our own set of custom fields that we want to update and the modules just update a small set of standard jira fields.

carlovandriel
Posts: 3
Joined: Wed Feb 04, 2015 4:54 pm

Re: How to execute a module only on error

Post by carlovandriel » Thu Mar 19, 2015 1:01 pm

I managed to solve it:
- convert the step in my recording that i only want to run on a fail to UserCode
- put the module in the teardown so it runs even on fail of the testcase

The UserCode i used:

var tc = TestCase.Current;
if(tc.Status == Ranorex.Core.Reporting.ActivityStatus.Failed)
{
my code to run on fail only
}