Я использую огурец для BDD тестирования, и файл функций выглядит следующим образом:
Feature: Sing Up
Scenario: User tries to sign up without interests
Given the interests are empty
When user presses on sign up
Then it should show "The interests field is empty."
Scenario: User tries to sign up with 2 interests
Given 2 interests are entered
When user presses on sign up
Then it should show "The interests should be at least three."
Я создал шаги в JS:
const assert = require("assert");
const { Given, When, Then } = require("cucumber");
Given("the interests are empty", function() {
// Write code here that turns the phrase above into concrete actions
return "pending";
});
When("user presses on sign up", function() {
// Write code here that turns the phrase above into concrete actions
return "pending";
});
Then("it should show {string}", function(string) {
// Write code here that turns the phrase above into concrete actions
return "pending";
});
/*----------------------------------------------------------------------*/
Given("{int} interests are entered", function(int) {
// Given('{float} interests are entered', function (float) {
// Write code here that turns the phrase above into concrete actions
return "pending";
});
When("user presses on sign up", function() {
// Write code here that turns the phrase above into concrete actions
return "pending";
});
Then("it should show {string}", function(string) {
// Write code here that turns the phrase above into concrete actions
return "pending";
});
Компилятор жалуется:
✖ When user presses on sign up
Multiple step definitions match:
user presses on sign up - features/step_definitions/signup/steps.js:9
user presses on sign up - features/step_definitions/signup/steps.js:27
Как разрешить одно и то же when
в разных scenario
?