Hi!
I want to add a 'Log Message' action into the module which should report the result of the previous action. Preferably only apply if the previous action fails. How would I do this?
Best,
Andrea
Log Message only if previous action fails
Re: Log Message only if previous action fails
Why do you need this? I'm not sure I understand the use case.
Ranorex already reports any failures by default, so not sure what else you are wanting. And, you usually want the report to be at the point of failure, not later.
Ranorex already reports any failures by default, so not sure what else you are wanting. And, you usually want the report to be at the point of failure, not later.
Shortcuts usually aren't...
Re: Log Message only if previous action fails
OK, I think I need to be more clear
The testcase I am refering to is sort of the following
action 1: open file
action 2: confirm pop up window [since the appearing of the window is non-deterministic I use continue on fail for this action)
action 3: log message: pop up window
Now, if possible I would like to have the log message only reported if action 2 fails (=no pop up window appears). Just for readibility reasons.
The testcase I am refering to is sort of the following
action 1: open file
action 2: confirm pop up window [since the appearing of the window is non-deterministic I use continue on fail for this action)
action 3: log message: pop up window
Now, if possible I would like to have the log message only reported if action 2 fails (=no pop up window appears). Just for readibility reasons.
Re: Log Message only if previous action fails
Hello Andrea,
Thank you for the details.
I would suggest adding a "Validate Exists"- action that validates if the popup window exists.
If not, an error will be thrown. I hope, this helps.
Regards,
qwertzu
Thank you for the details.
I would suggest adding a "Validate Exists"- action that validates if the popup window exists.
If not, an error will be thrown. I hope, this helps.
Regards,
qwertzu
You do not have the required permissions to view the files attached to this post.
Re: Log Message only if previous action fails
Hi qwertzu,
thanks for your reply, but thats not exactly what I am looking.
I use the 3 steps for several iterations, in some iteration the pop up window appear in others not. If they appear the testrunner has to press an OK button. But in iterations where the windows does not appears no press needed.
As I do not want that thoese iterations fail I put the action to continue on fail because a not-appearing pop up window not means that the test is fails. Therefore I want to add a log message somewhat like "pop up window not appearing" as additional info, so that the reader of the report knows, that it is not a failure.
if it is not possible to add this only in the case of a failed action I will add it in general.
Best,
Andrea
thanks for your reply, but thats not exactly what I am looking.
I use the 3 steps for several iterations, in some iteration the pop up window appear in others not. If they appear the testrunner has to press an OK button. But in iterations where the windows does not appears no press needed.
As I do not want that thoese iterations fail I put the action to continue on fail because a not-appearing pop up window not means that the test is fails. Therefore I want to add a log message somewhat like "pop up window not appearing" as additional info, so that the reader of the report knows, that it is not a failure.
if it is not possible to add this only in the case of a failed action I will add it in general.
Best,
Andrea
Re: Log Message only if previous action fails
First, you should know on each test case/scenario exactly which popups should appear and why. If you don't, then you may need to talk to your developers and find out more about the situation so you know how to automate it correctly.
Second, if this is truly a 'random' popup and you can't ever know if/when it will happen, then you should probably be using a PopupWatcher to catch it and click the OK button for you. This will keep it from failing if it is there, or if it isn't. You can find out more about using the PopupWatcher class in the UserGuide and specifically this link: http://www.ranorex.com/support/user-gui ... html#c4678.
Second, if this is truly a 'random' popup and you can't ever know if/when it will happen, then you should probably be using a PopupWatcher to catch it and click the OK button for you. This will keep it from failing if it is there, or if it isn't. You can find out more about using the PopupWatcher class in the UserGuide and specifically this link: http://www.ranorex.com/support/user-gui ... html#c4678.
Shortcuts usually aren't...
Re: Log Message only if previous action fails
We do this by using a piece of UserCode: ClickIfExists
It could probably be improved by using "TryFindSingle" instead of "FindSingle" but it does the job.
(The basic problem behind it - a non-predictable behaviour of the apllication under test- is still there, of course)
Code: Select all
public void clickIfExists(Ranorex.Core.Repository.RepoItemInfo pItem, int pTimeoutSeconds){
try{
Ranorex.Unknown pElement = Host.Local.FindSingle( pItem.AbsolutePath, pTimeoutSeconds * 1000 );
if(pElement != null){
pElement.Click();
Ranorex.Report.Info("clickIfExists() auf Item " + pItem.Name);
}
}catch(Exception e){
//Console.Out.WriteLine("SuperTools.clickIfExists() Exception:" + e.Message);
Ranorex.Report.Info("clickIfExists() Item " + pItem.Name + " nicht gefunden. Kein Klick.");
}
}
(The basic problem behind it - a non-predictable behaviour of the apllication under test- is still there, of course)
Vorsprung durch Wahnsinn
www.Doktor-Andy.de
www.Doktor-Andy.de
Re: Log Message only if previous action fails
Hi,
thanks for your input, will give it a try.
Best,
Andrea
thanks for your input, will give it a try.
Best,
Andrea