CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

how can I stop test suite when an assertions fails?

Open bboydflo opened this issue 8 years ago • 3 comments

What are you trying to achieve?

stop tests when an assertion fails

What do you get instead?

my tests are keep running

Details

  • CodeceptJS version: ^1.2.0
  • NodeJS Version: v10.9.0
  • Operating System: windows 10
  • Configuration file:
{
  "output": "./test/output",
  "helpers": {
    "Puppeteer": {
      "url": "http://some-dev-url",
      "show": true,
      "windowSize": "1600x1200",
      "chrome": {
        "ignoreHTTPSErrors": true
      }
    }
  },
  "include": {
    ...
  },
  "mocha": {},
  "bootstrap": false,
  "teardown": null,
  "hooks": [],
  "tests": "./test/acceptance/*_test.js",
  "timeout": 10000,
  "name": "name"
}

bboydflo avatar Oct 10 '18 11:10 bboydflo

Still nothing on this?

I have a preparation step, which must either succeed or if failed prevent all further steps. Is it possible to achieve? assert.fail() didn't work

iljao avatar Feb 21 '19 12:02 iljao

Found that for my case I can put preparation steps inside BeforeSuite(). If an exception is thrown there it will interrupt further execution.

iljao avatar Feb 22 '19 08:02 iljao

It seems that if I add --bail to codecept run command, it stops test execution after first failure

kobenguyent avatar Oct 23 '23 12:10 kobenguyent