[IMP] core, web: test failure reporting

* remove misleading documentation about a "test failed" message, in
  13.0 any uncaught exception or console.error will cause the current
  test to be interpreted as failed
* fix tour manager to console.error its step and not add a second
  useless error message
* fix menu tester to try and display the failure cause on failure
* improve qunit's test reporter to print the number of tests failed in
  case of test suite failure

Should make test failures in tours a bit clearer.

closes odoo/odoo#44296

X-original-commit: 78121b68d099b16f2d775a7a8a963a2a0f474843
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
Xavier Morel
2020-01-30 12:33:05 +00:00
parent f99f4db134
commit c4e075cf04
4 changed files with 6 additions and 13 deletions
+3 -4
View File
@@ -79,14 +79,13 @@
var testPromise = Promise.resolve();
testPromise = chainDeferred($listOfAppMenuItems, testPromise, testApp);
return testPromise.then(function () {
console.log("Test took ", (performance.now() - startTime) / 1000, " seconds");
console.log("Successfully tested ", testedApps.length, " apps");
console.log("Successfully tested ", testedMenus.length - testedApps.length, " menus");
console.log("test successful");
}).catch(function (error) {
console.log("Test took ", (performance.now() - startTime) / 1000, " seconds");
}).catch(function () {
console.log("Test took ", (performance.now() - startTime) / 1000, " seconds");
console.error('test failed')
console.error("Error !");
console.error(error || 'test failed');
});
}
@@ -50,7 +50,7 @@ QUnit.done(function(result) {
if (!result.failed) {
console.log('test successful');
} else {
console.error('test failed');
console.error(result.failed, "/", result.total, "tests failed");
}
if (!sortButtonAppended) {
@@ -365,7 +365,6 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, {
});
console.log(document.body.parentElement.outerHTML);
console.error(error); // will be displayed as error info
console.error("test failed"); // browser_js wait for error message "test failed"
} else {
console.log(_.str.sprintf("Tour %s succeeded", tour_name));
console.log("test successful"); // browser_js wait for message "test successful"
+2 -7
View File
@@ -1251,13 +1251,8 @@ class HttpCase(TransactionCase):
- wait for ready object to be available
- eval(code) inside the page
To signal success test do:
console.log('test successful')
To signal failure do:
console.error('test failed')
If neither are done before timeout test fails.
To signal success test do: console.log('test successful')
To signal test failure raise an exception or call console.error
"""
# increase timeout if coverage is running
if any(f.filename.endswith('/coverage/execfile.py') for f in inspect.stack() if f.filename):