Please note that I am not a java guru. I might not use the right terminology, I learn java inside RFT on the fly. What is described below works exactly as stated.
In ruby we can code like
(code to execute) if (condition)
I want to do the same so my RFT (Rational Functional Tester) code is easy to read. I am going to call my custom functions in a way that looks like
findANDclick(new String[]{"id", "menuButton"});
findANDclick(new String[]{"src", ".*homeicon_calendar.*"});
findANDclick(new String[]{"src", ".*cycle_templates.*"});
But the whole RFT script needs to finish and don't execute any other code in case of any of the findANDclick functions 'failed'. The function searches for an object with in html page and if it doesn't find any it throws new Exception
via
throw new Exception("findANDclick: the object was not found");
so the instance of findANDclick ONLY throws an error so the next findANDclick is executed. But it makes no sense to continue as look for next object if the previous was not found and clicked on.
I was thinking that I can have a variable continue
set to true and in case the exception is thrown the findANDclick will update it to false. Then I can do something like
if (continue) { findANDclick(new String[]{"id", "menuButton"});}
if (continue) { findANDclick(new String[]{"src", ".*homeicon_calendar.*"}); }
if (continue) { findANDclick(new String[]{"src", ".*cycle_templates.*"}); }
it would be great if I can do something like
{ findANDclick(new String[]{"id", "menuButton"}); } if (continue)
{ findANDclick(new String[]{"src", ".*homeicon_calendar.*"}); } if (continue)
{ findANDclick(new String[]{"src", ".*cycle_templates.*"}); } if (continue)