如何强制按顺序运行 ZIO 测试

pme*_*pme 5 integration-testing scala zio zio-test

我想按顺序运行两个集成测试。如何在ZIO Test 中实现这一点?

这是套房:

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))
    })
Run Code Online (Sandbox Code Playgroud)

ZIO Test并行运行这两个测试。有没有办法强制它们按顺序运行?

Ada*_*ser 9

是的!你可以使用TestAspect.sequential

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
Run Code Online (Sandbox Code Playgroud)