Forum Discussion
ray_mosley
11 years agoFrequent Contributor
I was attempting to use try...catch...finally to catch a condition in menu items where builds are different. For example, one build application (call it build A) has:
Reference|ICD Search
ReferenceItemB
...
where the other build (call it build B) has
Reference|ICD-9 Search
Reference|ICD-10 Search
Reference|ItemB
...
I do not have Stop on Error enabled, but do have the Pause test execution on posting an error selected.
how can I use try catch finally to know which menu items I am processing?
Thanks. Below is what I have tried...
This code runs on Build B (i.e., expected results from try section) but fails on build A (errros in log but still said PSP candidate, which is wrong).
function Test1()
{
//Preconditions: EMDS running; Bill started
//
//use try..catch..finally to determine code for RC or PSP
//try to select Bill Reference->ICD-9 Search
//works on PSP
//fails on RC
try
{
//try to select Bill Reference->ICD-9 Search
Aliases.topsBill.fmBillMain.MainMenu.Click("Reference|ICD-9 Search...");
Aliases.topsBill.fmICDSearch.sbICDExit.Click(25, 15);
//try to select Bill Reference->ICD-10 Search
Aliases.topsBill.fmBillMain.MainMenu.Click("Reference|ICD-10 Search...");
Aliases.topsBill.fmICD10Search.sbICDExit.Click(26, 21);
Log.Message("MUST BE PSP Candidate - Found ICD-9 Search & ICD-10 Search");
}
catch(errorObj)
{
Log.Message("MUST BE RC Candidate - Error: " + errorObj.name, errorObj.description);
//must be RC candidate
Log.Message("MUST BE RC Candidate - Found ICD Search");
}
finally
{
Log.Message("END OF TEST");
}
Reference|ICD Search
ReferenceItemB
...
where the other build (call it build B) has
Reference|ICD-9 Search
Reference|ICD-10 Search
Reference|ItemB
...
I do not have Stop on Error enabled, but do have the Pause test execution on posting an error selected.
how can I use try catch finally to know which menu items I am processing?
Thanks. Below is what I have tried...
This code runs on Build B (i.e., expected results from try section) but fails on build A (errros in log but still said PSP candidate, which is wrong).
function Test1()
{
//Preconditions: EMDS running; Bill started
//
//use try..catch..finally to determine code for RC or PSP
//try to select Bill Reference->ICD-9 Search
//works on PSP
//fails on RC
try
{
//try to select Bill Reference->ICD-9 Search
Aliases.topsBill.fmBillMain.MainMenu.Click("Reference|ICD-9 Search...");
Aliases.topsBill.fmICDSearch.sbICDExit.Click(25, 15);
//try to select Bill Reference->ICD-10 Search
Aliases.topsBill.fmBillMain.MainMenu.Click("Reference|ICD-10 Search...");
Aliases.topsBill.fmICD10Search.sbICDExit.Click(26, 21);
Log.Message("MUST BE PSP Candidate - Found ICD-9 Search & ICD-10 Search");
}
catch(errorObj)
{
Log.Message("MUST BE RC Candidate - Error: " + errorObj.name, errorObj.description);
//must be RC candidate
Log.Message("MUST BE RC Candidate - Found ICD Search");
}
finally
{
Log.Message("END OF TEST");
}
Related Content
- 5 years ago
- 14 years ago
- 2 years ago
Recent Discussions
- 3 days ago
- 3 days ago
- 6 days ago