1

I am using "wdio" with "jasmine" test framework and trying to reRun a single test spec following https://webdriver.io/docs/retry.html but retry is not happening. I am running following code using wdio sync runner like this - ./node_modules/wdio wdio.conf It's executing the test only once.

describe("test suite", ()=>{
    it("test spec",()=>{
       console.log('inside test')
       fail('testing retry')
       },3)
})

I expect test should execute 1+3 times.but it executes only once. Retry is not happening. Am I missing something obvious here ?

Ankur A
  • 11
  • 1

2 Answers2

1

WDIO + Jasmine's retry behavior is a little strange, but it depends on your test's expectations. The following would retry the test three times.

it("Should retry", function() {
    throw "retry this test";
}, 3);

However, once an failing expectation (or fail() in your case) is added in, it will exit without retrying

it("Won't retry", function() {
    expect(true).toBe(false);
}, 3);

This does not seem to be the behavior for a framework like Mocha, for example, so maybe the solution is to change frameworks.

0

I believe that link is incorrect about what the third parameter to Jasmine's it() function means.

According the official docs, that number is the timeout, allowing you to specify how long the test is allowed to run before failing:

https://jasmine.github.io/api/3.5/global.html#it

KurtPreston
  • 943
  • 9
  • 25