You are viewing an old version of this page. View the current version.
Available since Katalon Studio v5.2
Test Listeners is a new feature of Katalon Studio introduced since version 5.2. It is a great and flexible way to help you extend your current testing flows. In simple term, Test Listeners are test steps that created based on your own criterias and will be executed when the condition is matched. The follwing guide contains all useful information to get you started with Test Listeners.
Manage Test Listeners
Test Listeners can be treated the same as other test artifacts, which means you can perform all basic operations such as create, copy/cut, rename or delete. We will not talk much about these actions except Create one. Test Listeners locate in Test Explorer pane. To create New Test Listener:
Right click on Test Listeners in Tests Explorer. Select New > New Test Listener.
When creating a new test listener, you can see there are 4 options in New Test Listener dialog:
|Generate sample Before Test Case method||A sample listener will be generated before every test case starts.|
|Generate sample After Test Case method||A sample listener will be generated after every test case ends.|
|Generate sample Before Test Suite method||A sample listener will be generated before every test suite starts.|
|Generate sample Before Test Suite method||A sample listenerwill be generated after every test suite ends.|
You can select one or multiple options. Once finished, Katalon Studio will generate a sample template accordingly:
As you can see from the code above, a sample generated template has already added necessary annotations, libraries and supported functions to help you extend your current testing flows to a higher level.
- There is no limit on Test Listeners. Users can create as many as preferred.
- Execution order of multiple Test Listeners (in case you define more than one) will be from top to down.
- Execution status of any steps within Test Listers will NOT affect the overall status of the executed test case (e.g: if you have a FAILED output in any of your Test Listeners but final status of the executed test case is PASSED, then test case's status will be PASSED).
To not get confused with setUp and tearDown, the visualized workflows below demonstrate how Katalon Studio will execute test automation project with/without setUp and tearDown methods.
- Without setUp and tearDown
- With setUp and tearDown are used
- Multiple Test Listeners
Define multiple environments as different Global Variables by using Test Listeners. Simply change the environment variable before test case's execution.