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

[core] @BeforeSuite and @BeforeClass not always being invoked #182

Open
bemace opened this issue Sep 16, 2015 · 3 comments
Open

[core] @BeforeSuite and @BeforeClass not always being invoked #182

bemace opened this issue Sep 16, 2015 · 3 comments
Labels
comp:core core feature of infinitest (infinitest-lib + infinitest-runner)) status:needs-repro type: bug

Comments

@bemace
Copy link

bemace commented Sep 16, 2015

I'm using Infinitest 5.1.115 in Eclipse Mars with TestNG 6.8. I have some tests that work fine when run manually using the TestNG plugin, but sometimes fail when run by Infinitest.

My tests are set up like:

public abstract class TestBase {
    @BeforeSuite
    public static void configureEnvironment() { ... }
}

public class FooTest extends TestBase {
    @Test
    public void testSomething() { ... }
}

It appears that when Infinitest decides to run only some of the tests in FooTest, it doesn't trigger the @BeforeSuite method.

I then tried adding a @BeforeClass method in FooTest that called TestBase.configureEnvironment(). This didn't help though, it appears to suffer from the same problem.

Lastly I added a @BeforeMethod method in FooTest that called TestBase.configureEnvironment() -- this seems to keep Infinitest happy in all situations, but obviously isn't ideal from a performance or convenience standpoint.

It's probably also worth noting that if I clean the project (causing Infinitest to run all tests), everything passes as expected.

@bemace
Copy link
Author

bemace commented Sep 23, 2015

Now it looks like my @BeforeMethod workaround doesn't always work either. Nothing in the Error Log gives any hint of why the setup methods aren't running.

@sarod
Copy link
Member

sarod commented Aug 2, 2016

Hi @bemace thanks for the issue!

Could you provide a sample github project where this can be reproduced?

@sarod sarod added status:needs-repro comp:core core feature of infinitest (infinitest-lib + infinitest-runner)) labels Aug 2, 2016
@sarod sarod changed the title @BeforeSuite and @BeforeClass not always being invoked [core] @BeforeSuite and @BeforeClass not always being invoked May 15, 2018
@lukechi1219
Copy link

Hi there, today I encountered this issue when I clean project, then my JUNIT4 test classes failed because @BeforeClass didn't run... but if I change test class content and trigger InfiniTest auto run test class, then I got test success and the error in Problems tab will disappear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:core core feature of infinitest (infinitest-lib + infinitest-runner)) status:needs-repro type: bug
Projects
None yet
Development

No branches or pull requests

3 participants