Forum Discussion

dpiotrowski's avatar
dpiotrowski
Contributor
13 years ago

Automatic reports via e-mail only on errors

I've been wondering if there is a good way to automatically send e-mails with reports generated by TestComplete only if any test in project failed (for example with 'Some tests failed' subject to distinguish them). If all tests passed, just a notification about successful execution would be enough (no report attached, 'All tests passed'). I've browsed through the resources about raporting/e-mails but couldn't actually find a solution which suits the scenerio above, can you think of some good way to do this?

  • Hi Daniel,





    Here's what you can do:

    1. Add a global boolean variable to your tests (can be a project variable, for example).

    2. Implement an event handler for the OnLogError event.

    3. In the event handler, set the variable to True.

    4. In the test item which handles e-mail reporting, check the variable's value. If the value is True, this means that at least one error occurred during the test execution. Otherwise, you can send the "All tests passed" notification.