Quickly create Acceptance Test for OData Services
- Use datajs http://datajs.codeplex.com/ as odata client library.
- Use qunit http://qunitjs.com/ as javascript unit testing framework.
- Use qunit-odata addon https://github.com/holgerkoser/odata-test/blob/master/qunit-odata.jsfrom github
- Write your javascript odata tests.
var request = {
resourcePath: "CarrierCollection('LH')",
headers: {Accept: "application/atom+xml"}
};
odataTest("Lufthansa", 3, request, function (response, data) {
equal(response.statusCode, 200, "StatusCode: 200");
expectedHeaders(response.headers,
{ "Content-Type" : "application/atom+xml" }, "Content-Type: application/atom+xml" );
equal(data.AirLineName, "Lufthansa", "AirLineName: Lufthansa");
});
- Run the test
Qunit-OData addon
The source code of the qunit addon is available on github.