DoclerLabs / hexMachina

Releases, issues, documentation, website of hexMachina, framework written in Haxe
http://hexmachina.org
MIT License
44 stars 8 forks source link

hexUnit - @BeforeClass and @AfterClass not working #280

Closed aliokan closed 6 years ago

aliokan commented 6 years ago

With hexUnit 0.35.0

import hex.unittest.assertion.Assert;

class FixtureTest
{
    @Before
    function setup()
    {
        trace("@Before");
    }

    @After
    function tearDown()
    {
        trace("@After");
    }

    @BeforeClass
    function beforeClass()
    {
        trace("@BeforeClass");
    }

    @AfterClass
    function afterClass()
    {
        trace("@AfterClass");
    }

    @Test("empty test")
    function emptyTest()
    {
        Assert.isTrue(true);
    }

    @Test("empty test 2")
    function emptyTest2()
    {
        Assert.isTrue(true);
    }

    @Test("empty test 3")
    function emptyTest3()
    {
        Assert.isTrue(true);
    }
}

Result:

ConsoleNotifier.hx:47: <<< Start FixtureTest tests run >>>
ConsoleNotifier.hx:76:  Test class 'FixtureTest'
FixtureTest.hx:8: @Before
ConsoleNotifier.hx:93:          * [emptyTest] empty test 0ms
FixtureTest.hx:14: @After
FixtureTest.hx:8: @Before
ConsoleNotifier.hx:93:          * [emptyTest2] empty test 2 0ms
FixtureTest.hx:14: @After
FixtureTest.hx:8: @Before
ConsoleNotifier.hx:93:          * [emptyTest3] empty test 3 0ms
FixtureTest.hx:14: @After
ConsoleNotifier.hx:54: <<< End tests run >>>
ConsoleNotifier.hx:55: Assertions passed: 3

Where are my @BeforeClass and @AfterClass calls? ;)

aliokan commented 6 years ago

It working, @BeforeClass and @AfterClass should be applied on static method!