gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 11:11:42 25 4
gpt4 key购买 nike

我想按顺序运行两个集成测试。如何在 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))
})

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

最佳答案

是的!您可以使用 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

关于scala - 如何强制按顺序运行 ZIO 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59643305/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com