Namespace sap.ui.test
Namespaces & Classes
Method Summary
sap.ui.test.opaQunit(testName, expected, callback)QUnit test adapter for opa.js has the same signature as a test of QUnit.
Method Detail
QUnit test adapter for opa.js has the same signature as a test of QUnit. Suggested usage:
sap.ui.require(["sap/ui/test/Opa5", "sap/ui/test/opaQunit"], function (Opa5, opaTest) {
Opa5.extendConfig({
assertions: new Opa5({
checkIfSomethingIsOk : function () {
this.waitFor({
success: function () {
Opa5.assert.ok(true, "Everything is fine");
}
});
}
})
});
opaTest("Should test something", function (Given, When, Then) {
// Implementation of the test
Then.checkIfSomethingIsOk();
});
});
When you require this file, it will also introduce a global variable: opaTest. It will also alter some settings of QUnit.config - testTimout will be increased to 90 if you do not specify your own. QUnit.reorder will be set to false, because OPA tests are often depending on each other.
Parameters:
{string} | testName | The name of the created QUnit test. |
{integer|function} | expected | Integer showing how many QUnit assertions are expected by the test. If a function is passed, it is interpreted as callback and the expected is skipped. |
{function} | callback | The test function. It will get 3 arguments passed to it.
|
Returns:
{QUnit.test} | A function to register opaTests |