Dhinesh
Dhinesh

Reputation: 139

How to stop running a suite if previously executed suite fails in protractor?

I am using protractor with jasmine framework. I need solution to stop the execution of running the suite if previous suite fails.

I have three set of test suites as below: 1. Health check - Tests all the web services are returning 200 response. 2. Smoke test - Checks the basic features of front end are looking good. 3. Regression test - Tests all the features.

My requirement is, If health check test case fails then do not run smoke test cases.

This can be achieved through following two ways: 1. Jenkins 2. Using process.exit(1) in the script

But, these two are not fit to my need.

Is there any way to achieve my need through protractor or jasmine way?

Upvotes: 1

Views: 93

Answers (1)

Oleksii
Oleksii

Reputation: 1643

You could achieve it using several scripts in package.json. For example:

  ...
  "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",
  },
  ...

You will launch all tests using npm run test. If in some command appears error the others will not be execute.

Upvotes: 1

Related Questions