一次超时失败后,守夜人测试没有继续

问题描述 投票:0回答:2

每当找不到一个元素时,我会得到一个断言超时失败,它会停止接下来的测试。我已经设置了必要的设置,但仍无法找到解决方案。

我的测试设置

  test_settings : {
    skip_testcases_on_fail: false,
    end_session_on_fail: false,
    default : {
      launch_url : "http://localhost",
      selenium_port  : 4444,
      selenium_host  : "localhost",
      silent: true,
      screenshots : {
        enabled : false,
        path : ""
      },
      desiredCapabilities: {
        browserName: 'chrome',
        javascriptEnabled: true,
        acceptSslCerts: true,
        nativeEvents: true,
        chromeOptions : {
          args : ["headless"]
       }
      }
    },

    chrome : {
      desiredCapabilities: {
        browserName: "chrome"
      }
    }
  }
nightwatch.js
2个回答
0
投票

这是一个链接,表示你可以使用verify函数而不是assert,在这种情况下套件将继续运行失败。 use verify instead of assert

此外,您可以使用--retries标志并为其提供测试用例失败后要执行的次数。


0
投票

在默认情况下移动skip_testcases_on_fail: false,它应该完成这项工作。您的测试设置应如下所示:

test_settings : {
        end_session_on_fail: false,
default : {
        skip_testcases_on_fail: false,
        launch_url : "http://localhost",
            selenium_port  : 4444,
            selenium_host  : "localhost",
            silent: true,
            screenshots : {
            enabled : false,
                path : ""
        },
        desiredCapabilities: {
            browserName: 'chrome',
                javascriptEnabled: true,
                acceptSslCerts: true,
                nativeEvents: true,
                chromeOptions : {
                args : ["headless"]
            }
        }
    },

    chrome : {
        desiredCapabilities: {
            browserName: "chrome"
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.