https://github.com/stjohnjohnson/cucumber-enhancement
Node.JS Library for testing with ReST APIs
https://github.com/stjohnjohnson/cucumber-enhancement
Last synced: 7 months ago
JSON representation
Node.JS Library for testing with ReST APIs
- Host: GitHub
- URL: https://github.com/stjohnjohnson/cucumber-enhancement
- Owner: stjohnjohnson
- License: mit
- Archived: true
- Created: 2015-01-11T07:11:24.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-11-15T22:18:34.000Z (over 8 years ago)
- Last Synced: 2025-10-09T14:44:15.516Z (8 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/cucumber-enhancement
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cucumber-enhancement
Enhances cucumber.js to make it easier to interact between steps.
### Simple usage
* Create a file `features/step_definitions/world-enhance.js` as follows
```
const {setWorldConstructor} = require('cucumber');
setWorldConstructor(require('cucumber-enhancement'));
```
This modifies the World object to do the following:
* Write attributes for later retrieval:
```javascript
Given(/^I am on the "([^/"]*)\/([^"]*)" repository on GitHub$/, function (owner, repo) {
// This saves owner and repo for use in other steps
this.setAttributes({
owner,
repo
});
});
```
* Read attributes from previous steps:
```javascript
Then(/^I should see "([^"]*)" as one of the branches$/, function (branch) {
const data = this.getAttributes({
branches: this.joi.array()
});
// data.branches contains data saved from another step
expect(data.branches).to.contain(branch);
});
```
* Exposes [`joi`](https://www.npmjs.com/package/joi) interface for quick access during step definition (see above).