Cucumber is a tool for running automated tests written in plain language. Because they're
written in plain language, they can be read by anyone on your team. Because they can be
read by anyone, you can use them to help improve communication, collaboration and trust on
your team.
First, write your feature in features/greeting.feature:
Feature: GreetingScenario: Say helloWhen the greeter says hello
Then I should have heard "hello"
Next, implement your steps in features/support/steps.js:
constassert=require('assert')const{ When, Then }=require('@cucumber/cucumber')const{ Greeter }=require('../../src')When('the greeter says hello',function(){this.whatIHeard=newGreeter().sayHello()});Then('I should have heard {string}',function(expectedResponse){assert.equal(this.whatIHeard,expectedResponse)});
请发表评论