Page 1 of 1

How to change overall result after Test from failure to warning?

Posted: Fri Aug 31, 2018 7:23 am
by BCTest
Hi,

a weird question -I know- but how can we change the overall result after a test in the report?
In one of our tests we let Ranorex validate the interaction between our programme and a third-party-programme. Sometimes this third-party-programme is not working properly for many reasons. In this case we want our test to stop but not to fail. The overall result of the test should be a warning not a failure: Is it posible to to this with Ranorex? And if it is possible: How can we manage this?

Regards,
BcTest.

Re: How to change overall result after Test from failure to warning?

Posted: Fri Aug 31, 2018 8:46 am
by RobinHood42
Hi,
Sometimes this third-party-programme is not working properly for many reasons
How would you know the third party tool isn't working? I guess that elements just aren't found and the automation fails. In that case, there is no way to neglect the failure of the test.

Cheers,
Robin :mrgreen:

Re: How to change overall result after Test from failure to warning?

Posted: Fri Aug 31, 2018 11:18 am
by BCTest
Hi Robin,

I agree: We won't know which programme will cause the failure.
But just for your interest:
We use the same test with different test parameters. E.g. some tests will run in german environment, some will run in austrian environment. So this particular test will run five times each day with different parameters in different environments. If only one (Or two? Or three? Or Four?) test fail the thrid-party-programme could be the failure. If all tests fail it could be our programme can cause it. Maybe :D .

Regards,
BcTest

Re: How to change overall result after Test from failure to warning?

Posted: Mon Sep 03, 2018 1:50 pm
by odklizec
Hi,
qwertzu wrote:
Mon Sep 03, 2018 1:19 pm
There is no setting which will give you a "green" report even if elements could not be found.
A small correction...there actually is an option, which will make the report green, even if an element is not found. It's just impractical to use in wide scale, because it must be set per individual recording line.
optionalstep.png
Setting option "Continue on fail" = True will make the step optional and prevent the test to fail in case of failure. I would suggest to use this option with caution and only if really necessary.

Of course, the same can be achieved in code, by implementing Try...Catch block, which is basically what Ranorex does for recording steps. This is how the above optional line looks in code...

Code: Select all

	try {
		Report.Log(ReportLevel.Info, "Wait", "(Optional Action)\r\nWaiting 5s to exist. Associated repository item: 'Notepad'", repo.Notepad.SelfInfo, new ActionTimeout(5000), new RecordItemIndex(1));
		repo.Notepad.SelfInfo.WaitForExists(5000);
	} catch(Exception ex) { Report.Log(ReportLevel.Warn, "Module", "(Optional Action) " + ex.Message, new RecordItemIndex(1)); }

Re: How to change overall result after Test from failure to warning?

Posted: Mon Sep 03, 2018 2:13 pm
by qwertzu
hey,
of course, pavel you're right on that point, but still the action itself won't be green.
That's what I meant. It will be shown as a warning.
regards, qwertzu

Re: How to change overall result after Test from failure to warning?

Posted: Mon Sep 03, 2018 2:21 pm
by odklizec
Yeah, you are right qwertzu. There will be a warning in report (unless he decides to create userdode-based Try...Catch block, with ReportLevel.Info). But the report will stay green, which I think is important for him? But as mentioned, 'optional' steps should be used with caution and will definitely not help in case of randomly failing steps.