Multiple Data type in cucumber
Hello All, This is our Scenerio " Feature: Is this valid number?
Tell us if it's a valid number Scenario Outline: Is this a valid number
Given a <number>
When I ask is it a valid number
Then I should be told "<answer>" Examples:
| number | answer |
| 1 | Yes |
| One | Nope |
| 1.3 | can't say|" and this is our step def " const assert = require("assert");
const { Given, When, Then } = require("@cucumber/cucumber");function isItNumber(number) {
if (number === 1) {
return "Yes";
} else if (number === "One") {
return "Nope";
} else {
return "can't say";
}
}Given("a {number}", function (number) {
console.log("this.number", number);
this.a = number;
});When("I ask is it a valid number", function () {
this.actualAnswer = isItNumber(this.a);
});Then("I should be told {string}", function (expectedAnswer) {
assert.strictEqual(this.actualAnswer, expectedAnswer);
});" But we are getting error with this.