Is it possible to mark test as failed when jscript exception occurs?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2022
04:59 AM
08-12-2022
04:59 AM
Is it possible to mark test as failed when jscript exception occurs?
Currently i have a problem that some of my tests are falsly marked as passed when jscript exception occurs. This is just an log example but when my tests fail it looks similar:
Is it possible to check for exception count (not Log.Error count) and when OnStopTest Event is executed to mark the test as failed?
Is there a global counter for exceptions in testcomplete or if not is it possible to make a global variable / project.variable ?
Labels:
- Labels:
-
Test Results
-
Test Run
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2022
08:02 AM
08-12-2022
08:02 AM
If your project properties is configured to "Stop current item" on "On Error",
function testit()
{
try {
// Cause an exception to occur
throw new Error("An exception has occurred");
} catch (e) {
// Perform cleanup
Log.Message("Catch Perform Cleanup");
// Log error message
Log.Error(e.message);
Log.Message("This should not be called");
} finally {
// Perform cleanup
Log.Message("Finally Perform Cleanup");
}
Log.Message("This should not be called as well");
}
Then both messages e.g. "This should not be called..." will not be shown, as TestComplete will stop at Log.Error()
