pme
pme

Reputation: 14803

How to enforce to run ZIO Tests sequentially

I want to run two integration tests sequentially. How can this be achieved in ZIO Test?

Here is the Suite:

suite("Undeploy a Package")(
    testM("There is a Package") {
      PackageDeployer.deploy(pckg) *> // first deploy
        assertM(PackageUndeployer.undeploy(pckg), equalTo(StatusCode.NoContent))
    },
    testM(s"There is no Package") {
        assertM(PackageUndeployer.undeploy(pckg), equalTo(StatusCode.NotFound))
    })

ZIO Test runs the two tests in parallel. Is there a way to enforce that they are run in Sequence?

Upvotes: 9

Views: 1564

Answers (1)

Adam Fraser
Adam Fraser

Reputation: 849

Yes! You can use TestAspect.sequential for that:

suite("Undeploy a Package")(
    testM("There is a Package") {
      PackageDeployer.deploy(pckg) *> // first deploy
        assertM(PackageUndeployer.undeploy(pckg), equalTo(StatusCode.NoContent))
    },
    testM(s"There is no Package") {
        assertM(PackageUndeployer.undeploy(pckg), equalTo(StatusCode.NotFound))
    }) @@ sequential

Upvotes: 15

Related Questions