spek icon indicating copy to clipboard operation
spek copied to clipboard

Before and After scenario not in proper order

Open msche opened this issue 2 years ago • 1 comments

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 avatar Nov 01 '23 05:11 msche

Any update on this?

msche avatar Nov 04 '23 06:11 msche