# How to Highlight Test object in each and every step

**URL:** <https://forum.katalon.com/t/how-to-highlight-test-object-in-each-and-every-step/17408>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [January 9, 2019, 9:05am UTC](https://forum.katalon.com/t/how-to-highlight-test-object-in-each-and-every-step/17408 "2019-01-09T09:05:39Z")\
**Posts on this page:** 1\
**Showing post:** 36

<div class="post-metadata">

**Author:** ![Drunda\_Nibel](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@Drunda\_Nibel](https://forum.katalon.com/u/Drunda_Nibel)\
**Post date:** [January 28, 2019, 10:00pm UTC](https://forum.katalon.com/t/how-to-highlight-test-object-in-each-and-every-step/17408/36 "2019-01-28T22:00:31Z")

</div>

I have now rewritten my error handling so that hopefully the whole class can be used immediately in any testing project as it is. The only condition should be that the global variable tcExceptionEvents is not needed elsewhere in the Katalon project. But if it is, it can of course also be renamed at every appearance in this class. If the variable does not yet exist, it will be created at runtime and, in any case, will then be filled again and again with a new Map, so that it always contains all currently relevant information about the circumstances of a suddenly occurring error, i.e. keywordName, testObject, testObjectString, inputParams, webElements, exceptions (with type and message) and even the lastWebElements that were recognized in the immediately preceding test step.

Thus, this overall approach does not only permit visual live monitoring of the test execution, but in the event of an error,

- a screenshot or a recorded video can be used to immediately visualize where exactly the error occurred during the test sequence by means of the colored web elements (orange = current, green = successful, red = faulty; if no red marked web element is visible, the error should usually have occurred immediately after the last green marked element, because the element affected by the error doesn’t seem to exist at all).

- an alarm notification (e.g. via e-mail and/or Telegram Bot API) could be sent from the test at runtime, containing the meaningful screenshot as well as helpful detailed text information on all important circumstances of the occurred error (see above mentioned variables stored in the tcExceptionEvents Map).

- if the test case was called in the usual way by a test suite, you don’t even need to overload your test case with an additional try-catch-block surrounding your test steps in order to be able to manage your appropriate teardown actions; just simply edit the catch-blocks centrally in this class; the exceptions Map integrated within tcExceptionEvents will hold all occurred exception events as lists differentiated by exception type; depending on the respective error information, you could then decide, for example, who to alert.

- if the test case was called using callTestCase(), it could be tried several times to pass (for example in a for loop with nested try-catch-block up to an accepted maximum of attempts); depending on the respective error information, you could then additionally decide whether dependent subsequent test cases are still executable or can finally be cancelled.

**Important Edit:**

Sorry, I renamed the method failure() to exception() yesterday at the last moment and did not correct all places in the code. This is now fixed above and should really work now.

---

_[View the full topic](https://forum.katalon.com/t/how-to-highlight-test-object-in-each-and-every-step/17408)._
