From 3c35564a8c0a8f8bb669df7691ef622c1b1e0cc3 Mon Sep 17 00:00:00 2001 From: Jonathan Cornaz Date: Thu, 24 Oct 2019 19:25:38 +0200 Subject: [PATCH 1/2] Introduce fixture aliases for Gherkin style --- spek-dsl/build.gradle.kts | 14 +++++ .../spek2/style/gherkin/gherkinStyle.kt | 42 ++++++++++++- .../spek2/style/gherkin/FakeGroupBody.kt | 59 +++++++++++++++++++ .../spek2/style/gherkin/FeatureBodyAliases.kt | 45 ++++++++++++++ .../style/gherkin/ScenarioBodyAliases.kt | 45 ++++++++++++++ 5 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FakeGroupBody.kt create mode 100644 spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FeatureBodyAliases.kt create mode 100644 spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/ScenarioBodyAliases.kt diff --git a/spek-dsl/build.gradle.kts b/spek-dsl/build.gradle.kts index 6692d9f89..eea55b220 100644 --- a/spek-dsl/build.gradle.kts +++ b/spek-dsl/build.gradle.kts @@ -76,6 +76,20 @@ kotlin { implementation(kotlin("stdlib-common")) } } + + commonTest { + dependencies { + api(kotlin("test-common")) + api(kotlin("test-annotations-common")) + } + } + + val jvmTest by existing { + dependencies { + implementation(kotlin("test")) + implementation(kotlin("test-junit")) + } + } jvm { compilations["main"].defaultSourceSet { diff --git a/spek-dsl/src/commonMain/kotlin/org/spekframework/spek2/style/gherkin/gherkinStyle.kt b/spek-dsl/src/commonMain/kotlin/org/spekframework/spek2/style/gherkin/gherkinStyle.kt index 4dd4d4425..856829bc0 100644 --- a/spek-dsl/src/commonMain/kotlin/org/spekframework/spek2/style/gherkin/gherkinStyle.kt +++ b/spek-dsl/src/commonMain/kotlin/org/spekframework/spek2/style/gherkin/gherkinStyle.kt @@ -1,10 +1,16 @@ package org.spekframework.spek2.style.gherkin +import org.spekframework.spek2.dsl.Fixture import org.spekframework.spek2.dsl.GroupBody import org.spekframework.spek2.dsl.LifecycleAware import org.spekframework.spek2.dsl.TestBody import org.spekframework.spek2.lifecycle.CachingMode -import org.spekframework.spek2.meta.* +import org.spekframework.spek2.meta.Description +import org.spekframework.spek2.meta.DescriptionLocation +import org.spekframework.spek2.meta.Descriptions +import org.spekframework.spek2.meta.SpekDsl +import org.spekframework.spek2.meta.Synonym +import org.spekframework.spek2.meta.SynonymType @Synonym(SynonymType.GROUP, prefix = "Feature: ") @Descriptions(Description(DescriptionLocation.VALUE_PARAMETER, 0)) @@ -27,6 +33,23 @@ class FeatureBody(val delegate: GroupBody): LifecycleAware by delegate { body(ScenarioBody(this)) } } + + fun beforeEachScenario(fixture: Fixture) = delegate.beforeEachGroup(fixture) + fun afterEachScenario(fixture: Fixture) = delegate.afterEachGroup(fixture) + fun beforeFeature(fixture: Fixture) = delegate.beforeGroup(fixture) + fun afterFeature(fixture: Fixture) = delegate.afterGroup(fixture) + + @Deprecated("Use beforeEachScenario instead", ReplaceWith("beforeEachScenario(fixture)")) + override fun beforeEachGroup(fixture: Fixture) = beforeEachScenario(fixture) + + @Deprecated("Use afterEachScenario instead", ReplaceWith("afterEachScenario(fixture)")) + override fun afterEachGroup(fixture: Fixture) = afterEachScenario(fixture) + + @Deprecated("Use beforeFeature instead", ReplaceWith("beforeFeature(fixture)")) + override fun beforeGroup(fixture: Fixture) = beforeFeature(fixture) + + @Deprecated("Use afterFeature instead", ReplaceWith("afterFeature(fixture)")) + override fun afterGroup(fixture: Fixture) = afterFeature(fixture) } @SpekDsl @@ -58,4 +81,21 @@ class ScenarioBody(val delegate: GroupBody): LifecycleAware by delegate { fun And(description: String, timeout: Long = defaultTimeout, body: TestBody.() -> Unit) { delegate.test("And: $description", timeout = timeout, body = body) } + + fun beforeScenario(fixture: Fixture) = delegate.beforeGroup(fixture) + fun afterScenario(fixture: Fixture) = delegate.afterGroup(fixture) + fun beforeEachStep(fixture: Fixture) = delegate.beforeEachTest(fixture) + fun afterEachStep(fixture: Fixture) = delegate.afterEachTest(fixture) + + @Deprecated("Use beforeEachStep instead", ReplaceWith("beforeEachStep(fixture)")) + override fun beforeEachTest(fixture: Fixture) = beforeEachStep(fixture) + + @Deprecated("Use afterEachStep instead", ReplaceWith("afterEachStep(fixture)")) + override fun afterEachTest(fixture: Fixture) = afterEachStep(fixture) + + @Deprecated("Use before scenario instead", ReplaceWith("beforeScenario(fixture)")) + override fun beforeGroup(fixture: Fixture) = beforeScenario(fixture) + + @Deprecated("Use after scenario instead", ReplaceWith("afterScenario(fixture)")) + override fun afterGroup(fixture: Fixture) = afterScenario(fixture) } diff --git a/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FakeGroupBody.kt b/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FakeGroupBody.kt new file mode 100644 index 000000000..1d8321768 --- /dev/null +++ b/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FakeGroupBody.kt @@ -0,0 +1,59 @@ +package org.spekframework.spek2.style.gherkin + +import org.spekframework.spek2.dsl.Fixture +import org.spekframework.spek2.dsl.GroupBody +import org.spekframework.spek2.dsl.Skip +import org.spekframework.spek2.dsl.TestBody +import org.spekframework.spek2.lifecycle.CachingMode +import org.spekframework.spek2.lifecycle.MemoizedValue + +class FakeGroupBody : GroupBody { + var beforeEachGroup: Fixture? = null + var afterEachGroup: Fixture? = null + var beforeGroup: Fixture? = null + var afterGroup: Fixture? = null + var beforeEachTest: Fixture? = null + var afterEachTest: Fixture? = null + + override fun group(description: String, skip: Skip, defaultCachingMode: CachingMode, preserveExecutionOrder: Boolean, failFast: Boolean, body: GroupBody.() -> Unit) = + throw UnsupportedOperationException() + + override val defaultCachingMode: CachingMode + get() = throw UnsupportedOperationException() + + override fun memoized(mode: CachingMode, factory: () -> T): MemoizedValue = + throw UnsupportedOperationException() + + override fun memoized(mode: CachingMode, factory: () -> T, destructor: (T) -> Unit): MemoizedValue = + throw UnsupportedOperationException() + + override fun beforeEachTest(fixture: Fixture) { + beforeEachTest = fixture + } + + override fun afterEachTest(fixture: Fixture) { + afterEachTest = fixture + } + + override fun beforeEachGroup(fixture: Fixture) { + beforeEachGroup = fixture + } + + override fun afterEachGroup(fixture: Fixture) { + afterEachGroup = fixture + } + + override fun beforeGroup(fixture: Fixture) { + beforeGroup = fixture + } + + override fun afterGroup(fixture: Fixture) { + afterGroup = fixture + } + + override fun memoized(): MemoizedValue = throw UnsupportedOperationException() + + override var defaultTimeout: Long = 0L + + override fun test(description: String, skip: Skip, timeout: Long, body: TestBody.() -> Unit) = throw UnsupportedOperationException() +} \ No newline at end of file diff --git a/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FeatureBodyAliases.kt b/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FeatureBodyAliases.kt new file mode 100644 index 000000000..225cd90b8 --- /dev/null +++ b/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FeatureBodyAliases.kt @@ -0,0 +1,45 @@ +package org.spekframework.spek2.style.gherkin + +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertSame + +class FeatureBodyAliases { + + lateinit var groupBody: FakeGroupBody + lateinit var featureBody: FeatureBody + + @BeforeTest + fun createFakeGroup() { + groupBody = FakeGroupBody() + featureBody = FeatureBody(groupBody) + } + + @Test + fun beforeEachScenarioShouldCallBeforeEachGroup() { + val fixture = { println("hello") } + featureBody.beforeEachScenario(fixture) + assertSame(fixture, groupBody.beforeEachGroup) + } + + @Test + fun afterEachScenarioShouldCallAfterEachGroup() { + val fixture = { println("hello") } + featureBody.afterEachScenario(fixture) + assertSame(fixture, groupBody.afterEachGroup) + } + + @Test + fun beforeFeatureShouldCallBeforeGroup() { + val fixture = { println("hello") } + featureBody.beforeFeature(fixture) + assertSame(fixture, groupBody.beforeGroup) + } + + @Test + fun afterFeatureShouldCallAfterGroup() { + val fixture = { println("hello") } + featureBody.afterFeature(fixture) + assertSame(fixture, groupBody.afterGroup) + } +} diff --git a/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/ScenarioBodyAliases.kt b/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/ScenarioBodyAliases.kt new file mode 100644 index 000000000..77ec8cf9c --- /dev/null +++ b/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/ScenarioBodyAliases.kt @@ -0,0 +1,45 @@ +package org.spekframework.spek2.style.gherkin + +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertSame + +class ScenarioBodyAliases { + + lateinit var groupBody: FakeGroupBody + lateinit var scenarioBody: ScenarioBody + + @BeforeTest + fun createFakeGroup() { + groupBody = FakeGroupBody() + scenarioBody = ScenarioBody(groupBody) + } + + @Test + fun beforeEachScenarioShouldCallBeforeEachGroup() { + val fixture = { println("hello") } + scenarioBody.beforeScenario(fixture) + assertSame(fixture, groupBody.beforeGroup) + } + + @Test + fun afterEachScenarioShouldCallAfterEachGroup() { + val fixture = { println("hello") } + scenarioBody.afterScenario(fixture) + assertSame(fixture, groupBody.afterGroup) + } + + @Test + fun beforeEachStepShouldCallBeforeEachTest() { + val fixture = { println("hello") } + scenarioBody.beforeEachStep(fixture) + assertSame(fixture, groupBody.beforeEachTest) + } + + @Test + fun afterEachStepShouldCallAfterEachTest() { + val fixture = { println("hello") } + scenarioBody.afterEachStep(fixture) + assertSame(fixture, groupBody.afterEachTest) + } +} From 05c73e65e88932a9d314428b4880f544c18fc683 Mon Sep 17 00:00:00 2001 From: Jonathan Cornaz Date: Mon, 4 Nov 2019 19:19:43 +0100 Subject: [PATCH 2/2] Move tests to integration tests --- .../org/spekframework/spek2/FakeGroupBody.kt | 60 +++++++++++++++++++ .../spek2/FeatureBodyAliasesTest.kt | 34 +++++++++++ .../spek2/ScenarioBodyAliasesTest.kt | 35 +++++++++++ spek-dsl/build.gradle.kts | 14 ----- .../spek2/style/gherkin/FakeGroupBody.kt | 59 ------------------ .../spek2/style/gherkin/FeatureBodyAliases.kt | 45 -------------- .../style/gherkin/ScenarioBodyAliases.kt | 45 -------------- 7 files changed, 129 insertions(+), 163 deletions(-) create mode 100644 integration-test/src/jvmTest/kotlin/org/spekframework/spek2/FakeGroupBody.kt create mode 100644 integration-test/src/jvmTest/kotlin/org/spekframework/spek2/FeatureBodyAliasesTest.kt create mode 100644 integration-test/src/jvmTest/kotlin/org/spekframework/spek2/ScenarioBodyAliasesTest.kt delete mode 100644 spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FakeGroupBody.kt delete mode 100644 spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FeatureBodyAliases.kt delete mode 100644 spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/ScenarioBodyAliases.kt diff --git a/integration-test/src/jvmTest/kotlin/org/spekframework/spek2/FakeGroupBody.kt b/integration-test/src/jvmTest/kotlin/org/spekframework/spek2/FakeGroupBody.kt new file mode 100644 index 000000000..1bac7c40a --- /dev/null +++ b/integration-test/src/jvmTest/kotlin/org/spekframework/spek2/FakeGroupBody.kt @@ -0,0 +1,60 @@ +package org.spekframework.spek2 + + +import org.spekframework.spek2.dsl.Fixture +import org.spekframework.spek2.dsl.GroupBody +import org.spekframework.spek2.dsl.Skip +import org.spekframework.spek2.dsl.TestBody +import org.spekframework.spek2.lifecycle.CachingMode +import org.spekframework.spek2.lifecycle.MemoizedValue + +class FakeGroupBody : GroupBody { + var beforeEachGroup: Fixture? = null + var afterEachGroup: Fixture? = null + var beforeGroup: Fixture? = null + var afterGroup: Fixture? = null + var beforeEachTest: Fixture? = null + var afterEachTest: Fixture? = null + + override fun group(description: String, skip: Skip, defaultCachingMode: CachingMode, preserveExecutionOrder: Boolean, failFast: Boolean, body: GroupBody.() -> Unit) = + throw UnsupportedOperationException() + + override val defaultCachingMode: CachingMode + get() = throw UnsupportedOperationException() + + override fun memoized(mode: CachingMode, factory: () -> T): MemoizedValue = + throw UnsupportedOperationException() + + override fun memoized(mode: CachingMode, factory: () -> T, destructor: (T) -> Unit): MemoizedValue = + throw UnsupportedOperationException() + + override fun beforeEachTest(fixture: Fixture) { + beforeEachTest = fixture + } + + override fun afterEachTest(fixture: Fixture) { + afterEachTest = fixture + } + + override fun beforeEachGroup(fixture: Fixture) { + beforeEachGroup = fixture + } + + override fun afterEachGroup(fixture: Fixture) { + afterEachGroup = fixture + } + + override fun beforeGroup(fixture: Fixture) { + beforeGroup = fixture + } + + override fun afterGroup(fixture: Fixture) { + afterGroup = fixture + } + + override fun memoized(): MemoizedValue = throw UnsupportedOperationException() + + override var defaultTimeout: Long = 0L + + override fun test(description: String, skip: Skip, timeout: Long, body: TestBody.() -> Unit) = throw UnsupportedOperationException() +} diff --git a/integration-test/src/jvmTest/kotlin/org/spekframework/spek2/FeatureBodyAliasesTest.kt b/integration-test/src/jvmTest/kotlin/org/spekframework/spek2/FeatureBodyAliasesTest.kt new file mode 100644 index 000000000..59f5a7b33 --- /dev/null +++ b/integration-test/src/jvmTest/kotlin/org/spekframework/spek2/FeatureBodyAliasesTest.kt @@ -0,0 +1,34 @@ +package org.spekframework.spek2 + +import org.spekframework.spek2.style.gherkin.FeatureBody +import kotlin.test.assertSame + +object FeatureBodyAliasesTest : Spek({ + + val groupBody by memoized { FakeGroupBody() } + val featureBody by memoized { FeatureBody(groupBody) } + + test("beforeEachScenario should call beforeEachGroup") { + val fixture = { println("hello") } + featureBody.beforeEachScenario(fixture) + assertSame(fixture, groupBody.beforeEachGroup) + } + + test("afterEachScenario should call AfterEachGroup") { + val fixture = { println("hello") } + featureBody.afterEachScenario(fixture) + assertSame(fixture, groupBody.afterEachGroup) + } + + test("beforeFeature should call BeforeGroup") { + val fixture = { println("hello") } + featureBody.beforeFeature(fixture) + assertSame(fixture, groupBody.beforeGroup) + } + + test("afterFeature should call AfterGroup") { + val fixture = { println("hello") } + featureBody.afterFeature(fixture) + assertSame(fixture, groupBody.afterGroup) + } +}) diff --git a/integration-test/src/jvmTest/kotlin/org/spekframework/spek2/ScenarioBodyAliasesTest.kt b/integration-test/src/jvmTest/kotlin/org/spekframework/spek2/ScenarioBodyAliasesTest.kt new file mode 100644 index 000000000..2f8e129f7 --- /dev/null +++ b/integration-test/src/jvmTest/kotlin/org/spekframework/spek2/ScenarioBodyAliasesTest.kt @@ -0,0 +1,35 @@ +package org.spekframework.spek2 + + +import org.spekframework.spek2.style.gherkin.ScenarioBody +import kotlin.test.assertSame + +object ScenarioBodyAliasesTest : Spek({ + + val groupBody by memoized { FakeGroupBody() } + val scenarioBody by memoized { ScenarioBody(groupBody) } + + test("beforeEachScenario should call BeforeEachGroup") { + val fixture = { println("hello") } + scenarioBody.beforeScenario(fixture) + assertSame(fixture, groupBody.beforeGroup) + } + + test("afterEachScenario should call AfterEachGroup") { + val fixture = { println("hello") } + scenarioBody.afterScenario(fixture) + assertSame(fixture, groupBody.afterGroup) + } + + test("beforeEachStep should call BeforeEachTest") { + val fixture = { println("hello") } + scenarioBody.beforeEachStep(fixture) + assertSame(fixture, groupBody.beforeEachTest) + } + + test("afterEachStep should call AfterEachTest") { + val fixture = { println("hello") } + scenarioBody.afterEachStep(fixture) + assertSame(fixture, groupBody.afterEachTest) + } +}) diff --git a/spek-dsl/build.gradle.kts b/spek-dsl/build.gradle.kts index eea55b220..6692d9f89 100644 --- a/spek-dsl/build.gradle.kts +++ b/spek-dsl/build.gradle.kts @@ -76,20 +76,6 @@ kotlin { implementation(kotlin("stdlib-common")) } } - - commonTest { - dependencies { - api(kotlin("test-common")) - api(kotlin("test-annotations-common")) - } - } - - val jvmTest by existing { - dependencies { - implementation(kotlin("test")) - implementation(kotlin("test-junit")) - } - } jvm { compilations["main"].defaultSourceSet { diff --git a/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FakeGroupBody.kt b/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FakeGroupBody.kt deleted file mode 100644 index 1d8321768..000000000 --- a/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FakeGroupBody.kt +++ /dev/null @@ -1,59 +0,0 @@ -package org.spekframework.spek2.style.gherkin - -import org.spekframework.spek2.dsl.Fixture -import org.spekframework.spek2.dsl.GroupBody -import org.spekframework.spek2.dsl.Skip -import org.spekframework.spek2.dsl.TestBody -import org.spekframework.spek2.lifecycle.CachingMode -import org.spekframework.spek2.lifecycle.MemoizedValue - -class FakeGroupBody : GroupBody { - var beforeEachGroup: Fixture? = null - var afterEachGroup: Fixture? = null - var beforeGroup: Fixture? = null - var afterGroup: Fixture? = null - var beforeEachTest: Fixture? = null - var afterEachTest: Fixture? = null - - override fun group(description: String, skip: Skip, defaultCachingMode: CachingMode, preserveExecutionOrder: Boolean, failFast: Boolean, body: GroupBody.() -> Unit) = - throw UnsupportedOperationException() - - override val defaultCachingMode: CachingMode - get() = throw UnsupportedOperationException() - - override fun memoized(mode: CachingMode, factory: () -> T): MemoizedValue = - throw UnsupportedOperationException() - - override fun memoized(mode: CachingMode, factory: () -> T, destructor: (T) -> Unit): MemoizedValue = - throw UnsupportedOperationException() - - override fun beforeEachTest(fixture: Fixture) { - beforeEachTest = fixture - } - - override fun afterEachTest(fixture: Fixture) { - afterEachTest = fixture - } - - override fun beforeEachGroup(fixture: Fixture) { - beforeEachGroup = fixture - } - - override fun afterEachGroup(fixture: Fixture) { - afterEachGroup = fixture - } - - override fun beforeGroup(fixture: Fixture) { - beforeGroup = fixture - } - - override fun afterGroup(fixture: Fixture) { - afterGroup = fixture - } - - override fun memoized(): MemoizedValue = throw UnsupportedOperationException() - - override var defaultTimeout: Long = 0L - - override fun test(description: String, skip: Skip, timeout: Long, body: TestBody.() -> Unit) = throw UnsupportedOperationException() -} \ No newline at end of file diff --git a/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FeatureBodyAliases.kt b/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FeatureBodyAliases.kt deleted file mode 100644 index 225cd90b8..000000000 --- a/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/FeatureBodyAliases.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.spekframework.spek2.style.gherkin - -import kotlin.test.BeforeTest -import kotlin.test.Test -import kotlin.test.assertSame - -class FeatureBodyAliases { - - lateinit var groupBody: FakeGroupBody - lateinit var featureBody: FeatureBody - - @BeforeTest - fun createFakeGroup() { - groupBody = FakeGroupBody() - featureBody = FeatureBody(groupBody) - } - - @Test - fun beforeEachScenarioShouldCallBeforeEachGroup() { - val fixture = { println("hello") } - featureBody.beforeEachScenario(fixture) - assertSame(fixture, groupBody.beforeEachGroup) - } - - @Test - fun afterEachScenarioShouldCallAfterEachGroup() { - val fixture = { println("hello") } - featureBody.afterEachScenario(fixture) - assertSame(fixture, groupBody.afterEachGroup) - } - - @Test - fun beforeFeatureShouldCallBeforeGroup() { - val fixture = { println("hello") } - featureBody.beforeFeature(fixture) - assertSame(fixture, groupBody.beforeGroup) - } - - @Test - fun afterFeatureShouldCallAfterGroup() { - val fixture = { println("hello") } - featureBody.afterFeature(fixture) - assertSame(fixture, groupBody.afterGroup) - } -} diff --git a/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/ScenarioBodyAliases.kt b/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/ScenarioBodyAliases.kt deleted file mode 100644 index 77ec8cf9c..000000000 --- a/spek-dsl/src/commonTest/kotlin/org/spekframework/spek2/style/gherkin/ScenarioBodyAliases.kt +++ /dev/null @@ -1,45 +0,0 @@ -package org.spekframework.spek2.style.gherkin - -import kotlin.test.BeforeTest -import kotlin.test.Test -import kotlin.test.assertSame - -class ScenarioBodyAliases { - - lateinit var groupBody: FakeGroupBody - lateinit var scenarioBody: ScenarioBody - - @BeforeTest - fun createFakeGroup() { - groupBody = FakeGroupBody() - scenarioBody = ScenarioBody(groupBody) - } - - @Test - fun beforeEachScenarioShouldCallBeforeEachGroup() { - val fixture = { println("hello") } - scenarioBody.beforeScenario(fixture) - assertSame(fixture, groupBody.beforeGroup) - } - - @Test - fun afterEachScenarioShouldCallAfterEachGroup() { - val fixture = { println("hello") } - scenarioBody.afterScenario(fixture) - assertSame(fixture, groupBody.afterGroup) - } - - @Test - fun beforeEachStepShouldCallBeforeEachTest() { - val fixture = { println("hello") } - scenarioBody.beforeEachStep(fixture) - assertSame(fixture, groupBody.beforeEachTest) - } - - @Test - fun afterEachStepShouldCallAfterEachTest() { - val fixture = { println("hello") } - scenarioBody.afterEachStep(fixture) - assertSame(fixture, groupBody.afterEachTest) - } -}