Kotest: BehaviorSpec run parallel?

Created on 21 Mar 2018  路  5Comments  路  Source: kotest/kotest

When I execute this BehaviorSpec, the upper when block always fails (even when I swap those two). the upper block assignment is always overridden by the latter. Is this an issue or I just misunderstand spec flow?

given("user) {
val user = User()

  `when`("set valid email") {
    user.email = VALID_EMAIL

    then("should get correct email") {
      user.email shouldBe VALID_EMAIL
    }
  }

  `when`("set null email") {
    user.email = null

    then("should get null email") {
      user.email shouldBe null
    }
  }
bug

All 5 comments

Do you use any config on the test, or exactly as you showed there.

The issue is, the when block has to be executed in order to discover the then block nested inside. However, this means the side effects (setting user.email) overwrite each other.

So it sounds violate the BDD concept, when blocks should not affect each another. Hope this will be fixed soon! Thanks.

This is fixed in 3.0.0 RC1.
If you have the time, please give it a try. There are some breaking changes that should be aware of by reading the changelog here: https://github.com/kotlintest/kotlintest/blob/master/CHANGELOG.md

Thanks @sksamuel . I'm trying it right now! :D

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sksamuel picture sksamuel  路  11Comments

j-h-a picture j-h-a  路  5Comments

stefanneuhaus picture stefanneuhaus  路  4Comments

sockeqwe picture sockeqwe  路  8Comments

code-schreiber picture code-schreiber  路  9Comments