Context: i want to write a web service that uses WAMP (Web Application Messaging Protocol, not the Service-Collection for Windows). WAMP should be used since it supports Events and RPC in a quite easy way. And with lower overhead.
Now how can i unit-test the RPC-methods of my service without writing everything by hand?
My first approach was taking Autobahn-JS and QUnit together. The problem here was that AutobahnJS does not support a blocking "open()" method. So i can't be sure that the connection that gets opened by QUnits beforeEach-hook. See this example:
var connection;
QUnit.module("Module 1", function(hooks) {
hooks.beforeEach(function(assert) {
// insert something executed before each test
connection = new autobahn.Connection({
url: wstarget,
realm: wsrealm
});
connection.open();
});
QUnit.test( "check something", function( assert ) {
assert.ok(connection.isConnected == true);
// do something here that requires open connection...
});
});
Are there other/better options?
Aucun commentaire:
Enregistrer un commentaire