spekframework / spek

A specification framework for Kotlin
Other
2.23k stars 181 forks source link

Before and After scenario not in proper order #1003

Open msche opened 8 months ago

msche commented 8 months ago

When I execute the following example in Intelij:

import org.spekframework.spek2.Spek
import org.spekframework.spek2.style.gherkin.Feature

object Spek2Test : Spek({

    Feature("Test before and after each scenario") {
        beforeFeature {
            println("Before Feature")
        }

        afterFeature {
            println("After feature")
        }

        beforeEachScenario {
            println("before scenario")
        }

        afterEachScenario {
            println("after scenario")
        }

        Scenario("Do something") {
            println("Scenario")
        }

        Scenario("Do something else") {
            println("Other Scenario")
        }
    }
})

I see the following output in my console:

Testing started at 06:48 ...
Scenario
Other Scenario

Before Feature
before scenario

before scenario
after scenario

before scenario
after scenario

After feature
after scenario

Process finished with exit code 0

This doesn't seem correct, I would have expected something like:

Before Feature

before scenario
Scenario
after scenario

before scenario
Other Scenario
after scenario

After feature

What am I doing wrong?

msche commented 8 months ago

Any update on this?