0.1.3 • Published 10 years ago

qcumber v0.1.3

Weekly downloads
2
License
MIT
Repository
-
Last release
10 years ago

qcumber

Add Q promises goodness to cucumberjs steps.

Usage

In a step definition file, before defining and Given, When, or Then steps, pass the step object to qcumber.

module.exports = function(){
	require('qcumber')(this);

	this.Given(/a synchronous condition/, function(){
		return true;
	});
}

Now, any step definitions will promise to behave. Any step that throws an exception will be marked as a failure. Any step that returns normally will count as a success. Any step that returns a promise-like will behave asynchronously, counting as a success if the promise resolves, or a failure if the promise rejects.

module.exports = function(){
	require('qcumber')(this);

	this.Given(/a synchronous condition/, function(){
		return true;
	});

	this.When(/an asynchronous action/, function(){
		return HTTP.Request.get_with_promise('http://localhost');
	});

	this.Then(/a failure condition/, function(){
		throw new Error('A failure occured in this step.');
	});
}
0.1.3

10 years ago

0.1.2

10 years ago

0.1.0

11 years ago

0.0.1

11 years ago

0.0.0

11 years ago