Quick start for testing with cucumber
Install library
with npm: npm i --save-dev @brainhubeu/cucumber-steps
or with yarn: yarn add --dev @brainhubeu/cucumber-steps
Add following in anywhere in your step-definitions
directory
import { defineSupportCode } from 'cucumber';
import stepsSupport from '@brainhubeu/cucumber-steps';
defineSupportCode(stepsSupport);
Given I set header "heder-name" with value "header-value"
When I send a "METHOD" request to "/path"
When I send a "METHOD" request to "/path" with body:
"""
{
"name": "Wonderful coffee",
"project": {
"name": "Coffee"
}
}
"""
Then the response code should be 111
Then the JSON should match pattern
"""
{
"name": "Wonderful coffee",
"project": {
"name": "Coffee"
}
}
"""