1.5.1 • Published 11 years ago

sierra-conversation v1.5.1

Weekly downloads
3
License
-
Repository
-
Last release
11 years ago

Conversations

This module is designed to provide developers with an extremely powerful testing framework for complex TCP servers which generally require a large amount of boilerplate code or custom test functions. This module provides a fluent, easy to use and incredibly powerful framework on which extremely complex protocols can be tested.

Example

All these things start out with an example of how you can use the test framework. The following is an example of using node-conversation with Mocha.

var Conversation = require('conversation');

describe('protocol', function() {
	it('should forward messages to the correct user', function(done) {
		new Conversation({ port: 9119 })
			.client('u1').u1.sendAnd('LOGIN:user1;').expect('OK;')
			.client('u2').u2.sendAnd('LOGIN:user2;').expect('OK;')
			.client('u3').u3.sendAnd('LOGIN:user3;').expect('OK;')

			.u1.writeAnd('CHAT:user2:hello;').expect('SENT:1;')
			.u2.expect('MESSAGE:user1:hello;')
			.u1.read('RECEIVED:1;')

			.u2.writeAnd('CHAT:user3:hi;').read('SENT:2;')
			.u3.read('MESSAGE:user2:hi;')
			.u2.read('RECEIVED:2;')

			.run(done);
	});
});

Extensibility

Due to its design, it is extremely easy to automate common testing tasks (for example, login processes) by adding to the Conversation.prototype or Conversations.Client.prototype. This can help make testing systems which require setup tasks to be performed considerably easier.

1.5.1

11 years ago

1.5.0

11 years ago

1.4.1

11 years ago

1.4.0

11 years ago

1.3.5

11 years ago

1.3.4

11 years ago

1.3.3

11 years ago

1.3.2

11 years ago

1.3.1

11 years ago

1.3.0

11 years ago

1.2.0

11 years ago

1.1.0

11 years ago

1.0.0

11 years ago