首页 > 解决方案 > 如果以前执行的套件在量角器中失败,如何停止运行套件?

问题描述

我正在使用带有茉莉花框架的量角器。如果以前的套件失败,我需要解决方案来停止运行套件的执行。

我有如下三套测试套件: 1. 健康检查 - 测试所有 Web 服务是否返回 200 响应。2. 冒烟测试 - 检查前端的基本功能是否良好。3. 回归测试 - 测试所有特征。

我的要求是,如果健康检查测试用例失败,则不要运行冒烟测试用例。

这可以通过以下两种方式实现: 1. Jenkins 2. 在脚本中使用 process.exit(1)

但是,这两个不适合我的需要。

有没有办法通过量角器或茉莉花的方式来满足我的需求?

标签: jasmineprotractor

解决方案


您可以使用package.json. 例如:

  ...
  "scripts": {
    "health": "launch here only health",
    "smoke": "launch here only smoke",
    "regression": "launch here only regression",
    "test": "npm run health && npm run smoke && npm run regression",
  },
  ...

您将使用npm run test. 如果某些命令出现错误,其他命令将不会被执行。


推荐阅读