codecept.conf.js文件中加入
//有1次成功即可,运行4次 rerun: { minSuccess: 1 , maxReruns: 4 , } //运行4次,必须有4次成功 rerun: { minSuccess: 4 , maxReruns: 4 , } |
运行命令
npx codeceptjs run-rerun |
运行结果(运行过程中断掉WIFI,然后再连接回来)
CodeceptJS v2. 6.5 Using test root "E:Docoumentcodeceptdemo" loginaccount -- × test something | { "login" : "13500000000" , "password" : "12345678" } in 26858ms √ test something | { "login" : "13500000000" , "password" : "12345678" } in 38729ms √ test something | { "login" : "13500000000" , "password" : "12345678" } in 33071ms × test something | { "login" : "13500000000" , "password" : "12345678" } @slow @important in 54053ms √ test something | { "login" : "13500000000" , "password" : "12345678" } @slow @important in 24575ms -- FAILURES: 1 ) loginaccount test something | { "login" : "13500000000" , "password" : "12345678" }: expected web application to include "开通SaaS" + expected - actual -忘记密码? -登 录 -还没有账号? 注册新用户 +开通SaaS Scenario Steps: - 我.填写字段({ "css" : ".ant-input-affix-wrapper .ant-input:not(:last-child)" }, "12345678" ) at Test.<anonymous> (loginaccount_test.js: 65 : 7 ) - 我.填写字段({ "css" : ".ant-input-affix-wrapper .ant-input:not(:first-child)" }, "13500000000" ) at Test.<anonymous> (loginaccount_test.js: 64 : 7 ) Run with --verbose flag to see NodeJS stacktrace 2 ) loginaccount test something | { "login" : "13500000000" , "password" : "12345678" } @slow @important : expected cookie _access_token to be set '[]' not to be empty + expected - actual Scenario Steps: - 我.seeAttributesOnElements( ".antd-pro-views-tenant-index-listTitle button" , { "type" : "button" }) at Test.<anonymous> (loginaccount_test.js: 97 : 7 ) - 我.填写字段({ "css" : ".ant-input-affix-wrapper .ant-input:not(:last-child)" }, "12345678" ) at Test.<anonymous> (loginaccount_test.js: 90 : 7 ) - 我.填写字段({ "css" : ".ant-input-affix-wrapper .ant-input:not(:first-child)" }, "13500000000" ) at Test.<anonymous> (loginaccount_test.js: 89 : 7 ) Run with --verbose flag to see NodeJS stacktrace FAIL | 3 passed, 2 failed // 3m Fail run 1 of max 4 , success runs 0 / 1 Error: 2 tests fail at Runner.<anonymous> (E:Docoumentcodeceptdemo
ode_modulescodeceptjs
ode_modulesmochalibrunner.js: 918 : 5 ) at Immediate.<anonymous> (E:Docoumentcodeceptdemo
ode_modulescodeceptjs
ode_modulesmochalibrunner.js: 425 : 5 ) CodeceptJS v2. 6.5 Using test root "E:Docoumentcodeceptdemo" loginaccount -- √ test something | { "login" : "13500000000" , "password" : "12345678" } in 33344ms √ test something | { "login" : "13500000000" , "password" : "12345678" } in 32866ms √ test something | { "login" : "13500000000" , "password" : "12345678" } in 33576ms √ test something | { "login" : "13500000000" , "password" : "12345678" } @slow @important in 24062ms √ test something | { "login" : "13500000000" , "password" : "12345678" } @slow @important in 25081ms OK | 5 passed // 3m Process run 2 of max 4 , success runs 1 / 1 |