Skip to Content
0
Former Member
May 12, 2014 at 02:55 PM

Testing OData in a UI5 App

110 Views

Hi there,

i'm trying to write some tests in Javascript/ UI5 concerning OData.

I have found this document : OData acceptance tests with QUnit and datajs explaining what i need.

The problem is that i do not manage to make it work.

Here is my code ( test ) :

module( "Tests ODatas" );
var request1 = {
        method: 'GET',
        resourcePath: "Cars(1)",
        headers: {Accept: "application/atom+xml"}
};
var callback1 = function (response, data) {
    equal(response.statusCode, 200, "StatusCode: 200");
    expectedHeaders(response.headers,{ "Content-Type" : "application/atom+xml" }, "Content-Type: application/atom+xml" );
    equal(data.Model, "F1 W03", "test du model de voiture");
};

var request2 = {
        method: 'DELETE',
        resourcePath: "Cars(9999)",
        headers: {Accept: "application/atom+xml"}
};

var callback2 = function (response, data) {
    equal(response.statusCode, 200, "StatusCode: 200");
    
};

odataTest("qunit-odata1", 3, request1,callback1);
odataTest("qunit-odata2", 1, request2,callback2); 



I want the first test to pass, and the second to fail.

And the result is (firebug's logs in the 2nd part) :

1/ The first test is not completed

2/ The second test is not even launched

3/The "Module" does not appear before test's name

4/ "0 tests of 0 passed, 0 failed" ??

Can somebody help me to fix this?

Thanks,

Regards,

Marc

Attachments

pastedImage_2.png (18.8 kB)