You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to not have to nest given/and/when/and/then/and to such levels, while still keeping test setup and running in the corresponding sections, similar to how Spock does things.
Initial proposition (not the cleanest, but at least an idea):
given("qweqwe") { // 'this' is a GivenContext with a var for fixtures
fixture[1] =RepoStub()
fixture[0] =SutClass(fixture[1])
}.and("ssrsrrt") { // 'this' is a GivenContext with a var for fixtures...
}.when("qeqw") { // 'this' is a WhenContext with the fixtures in GivenContext and a result var
result = fixture[0].methodUnderTest()
}.and("ssrsrrrrst") { // 'this' is a WhenContext with the fixtures in GivenContext and a result var...
}.then("werewr") { // 'this' has all the above
result shouldBe fixture[1].stubValue
}.and("ssrsrrrrrst") { // 'this' has all the above
result shouldNotBe fixture[1].stubValue2
}
The text was updated successfully, but these errors were encountered:
It could be easier if the given contains the rest, then the main fixtures can be initialized (but then an and on the given would still be nested... unless the and would contain the rest?):
// Not bad:
given("qweqwe") { // 'this' is a GivenContext with a var for fixturesval repoStub =RepoStub()
val sut =SutClass(repoStub)
when("qeqw") { // 'this' is a WhenContext with the fixtures in GivenContext and a result var
result = sut.methodUnderTest()
}.and("ssrsrrrrst") { // 'this' is a WhenContext with the fixtures in GivenContext and a result var...
}.then("werewr") { // 'this' has all the above
result shouldBe repoStub.stubValue
}.and("ssrsrrrrrst") { // 'this' has all the above
result shouldNotBe repoStub.stubValue2
}
}
// ... ?
given("qweqwe") { // 'this' is a GivenContext with a var for fixtures
fixture[1] =RepoStub()
fixture[0] =SutClass(fixture[1])
}.and("ssrsrrt") { // 'this' is a GivenContext with a var for fixtures// some more setting up...when("qeqw") { // 'this' is a WhenContext with the fixtures in GivenContext and a result var
result = fixture[0].methodUnderTest()
}.and("ssrsrrrrst") { // 'this' is a WhenContext with the fixtures in GivenContext and a result var...
}.then("werewr") { // 'this' has all the above
result shouldBe fixture[1].stubValue
}.and("ssrsrrrrrst") { // 'this' has all the above
result shouldNotBe fixture[1].stubValue2
}
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
It would be nice to not have to nest given/and/when/and/then/and to such levels, while still keeping test setup and running in the corresponding sections, similar to how Spock does things.
Initial proposition (not the cleanest, but at least an idea):
The text was updated successfully, but these errors were encountered: