Skip to content

Before and After scenario not in proper order #1003

@msche

Description

@msche

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions