Automated test case fails to continue execution

introduction

In the automated test, there is a verification point. When the test passes, the subsequent test scripts continue to execute;

When an exception occurs, you want to mark this error, but it does not affect the execution of the subsequent test scripts. How to do it in Nightwatch?

The following piece of code verifies whether the body of the home page is displayed. If displayed here, set the verification point to false, the code is as follows:

home.waitForElementVisible('@body', 3000, true, function(result) {

if (result.value) {

// The test report will show failure, but will continue to execute the following test script

client.verify.equal(result.value, false);

} else {

// Verification point passed

console.log('Pass');

}

});

Note: If assert is used here, the program will be interrupted.

// interrupt execution

client.assert.equal(result.value, false);

Guess you like

Origin blog.51cto.com/15127514/2657697