test.xcompare

Boolean test.xcompare(value1, value2)

Boolean test.xcompare(value1, value2, message)

This function is used to handle expected failures in test scripts. To test for bugs that should be fixed one day.

The function compares value1 and value2, and if they are not equal, a test result of type XFAIL (eXpected FAILure) is added to the test log and this function returns a false value. Otherwise a test result of type XPASS (uneXpected PASS) is added to the test log and a true value is returned.

The 'expected fail' result is intended for cases where you know a comparison or verification will go wrong right now due to a bug in the AUT.

In test cases where you want to ensure that a property never has a certain value, we suggest using test.verify(), or to use test.fail() directly with an if-construct.

If the optional message parameter (of type string—e.g., a comment, bug number, or test plan reference) is present, it will be added to the test result whether the test passed or failed.

The testSettings.breakOnFailure property can be used to make the debugger stop in case the verification passes unexpectedly.

The testSettings.throwOnFailure property can be used to make this function raise a script exception in case the verification passes unexpectedly.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

Search Results