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

Comments

2 participants
@thelateperseus

thelateperseus commented Nov 24, 2014

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 added the bug label Nov 24, 2014

@rliesenfeld rliesenfeld self-assigned this Nov 24, 2014

@rliesenfeld

This comment has been minimized.

Show comment
Hide comment
@rliesenfeld

rliesenfeld Nov 24, 2014

Member

Thanks for reporting.

Member

rliesenfeld commented Nov 24, 2014

Thanks for reporting.

@thelateperseus

This comment has been minimized.

Show comment
Hide comment
@thelateperseus

thelateperseus commented Dec 1, 2014

Thanks!

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