Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Testing OData in a UI5 App

$
0
0

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


Viewing all articles
Browse latest Browse all 6178

Trending Articles