Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestNG @BeforeClass Mocks not torn down after class finishes #107

Closed
thelateperseus opened this issue Nov 24, 2014 · 2 comments
Closed

TestNG @BeforeClass Mocks not torn down after class finishes #107

thelateperseus opened this issue Nov 24, 2014 · 2 comments
Assignees
Labels

Comments

@thelateperseus
Copy link

If I write test that sets up a Mock in a method annotated with @BeforeMethod, that mock is correctly torn down after the method completes. However, if I change the annotation to @BeforeClass, that mock is not correctly torn down. I think that this is because the TestNGRunnerDecorator does not implement the ITestListener interface and tear down mocks after the class finishes.

So in summary, the following works as expected:

@BeforeMethod
public void setup() {
    new MockThatExtendsMockUp();
}

But the following does not:

@BeforeClass
public void setup() {
    new MockThatExtendsMockUp();
}
@rliesenfeld rliesenfeld self-assigned this Nov 24, 2014
@rliesenfeld
Copy link
Member

Thanks for reporting.

@thelateperseus
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants