Can't execute the @AfterTestSuite method

I have a test suite with two test cases, and I’ve configured a test listener using the methods @BeforeTestSuite and @AfterTestSuite.
When I run the test suite with all of the test cases selected, the @AfterTestSuite step fails.
However, when I run one of the test cases from the test suite, it passes.


1 Like

Please explain more clearly how the @AfterTestSuite fails. What happens? Do you have an error message?

What is “it” ? The @AfterTestSuite listener? Code in @AfterTestSuite only runs at the end of a suite run

1 Like

I looks like, in the test listener, you are trying to execute a certain action on the AUT (by calling a test case?) to perform a certain action (logout).
This is a fragile approach.
I will rather put the logout action as the last testcase in the suite, not in the listener and use only closeBrowser in the listener (altough not really needed, see below)

At that time, as the error say, the window is already closed, so nothing to click on.
This may be caused by your project settings, if you have the option ‘terminate drivers’ checked, see the pic:

or by anything else you have in the code (e.g you may have a closeBrowser action in another testcase)
So without looking at the actual code you run, we cannot help you much.

1 Like