DEV Community

Discussion on: CodeceptJs Setup & BDD

Collapse
 
savitamaurya profile image
SavitaMaurya • Edited

Hi @haribhandari07 When I run the npx codeceptjs gherkin:snippets command no test steps are generating. I have scenario like this in the './features/*.feature'

Feature: Business rules

Scenario Outline: do something
Given I have a defined step currency
Examples:
| currency | Header 2 | Header 3 |
| EUR | Value 2 | Value 3 |
| USD | Value 2 | Value 3 |

and existing step definition in './step_definitions/steps.js'

const { I } = inject();
// Add in your custom step files

package.json

{
"name": "codeceptTest",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"codeceptjs": "^2.6.5",
"puppeteer": "^4.0.0"
}
}
Output logs:

savitamaurya@savitamaurya-xx codeceptTest % npx codeceptjs gherkin:snippets
Debugger listening on ws://127.0.0.1:55931/0f14bbe9-133b-48d3-8948-c9ce2e0ececa
For help, see: nodejs.org/en/docs/inspector
Debugger attached.
Loaded 1 files
No new snippets found
Waiting for the debugger to disconnect...
savitamaurya@savitamaurya-xx codeceptTest %

Can you please suggest how to create step definitions for scenario outlines types example.

Collapse
 
savitamaurya profile image
SavitaMaurya

In the above step:
Given I have a defined step currency

currency is inside angular brackets but after posting here it's removing the brackets.pls note this

Collapse
 
haribhandari profile image
Hari Bhandari • Edited

Hi, sorry for the late response. You need to add

gherkin: {
      features: './features/*.feature'
    }


in your package.json file. Also, if you face more issues, compare your package.json file to mine.