Skip to content

Commit

Permalink
Add first Gherkin Feature and Step Definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
bofalke committed Mar 26, 2024
1 parent 3acc8b5 commit 51ef746
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"test": "npx nx run-many -t test -p be fe shared",
"test-be": "npx nx run be:test",
"test-fe": "npx nx run fe:test",
"test-shared": "npx nx run shared:test"
"test-shared": "npx nx run shared:test",
"test-scenarios": "npx nx run be:cucumber"
},
"private": false,
"devDependencies": {
Expand Down
10 changes: 10 additions & 0 deletions packages/be/cucumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// cucumber.js
let common = [
'features/**/*.feature', // Specify our feature files
'--require-module ts-node/register', //typescript cucumber
'--require ./features/step_definitions/**/*.ts', // Load step definitions
].join(' ');

module.exports = {
default: common
};
6 changes: 6 additions & 0 deletions packages/be/features/add_car_to_fleet.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Feature: Add Car To Fleet
Scenario: Add A BMW to the Fleet
Given car is BMW model 1er
When I add the car to the fleet
Then an incomplete car should be added

24 changes: 24 additions & 0 deletions packages/be/features/step_definitions/AddCarToFleetSteps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { binding, given, then, when } from "cucumber-tsflow";

@binding()
class AddCarToFleetSteps {
@given('car is BMW model 1er')
public givenCarWithBrandAndModel (): string {
// Write code here that turns the phrase above into concrete actions
return 'pending';
}

@when(/I add the car to the fleet/)
public addsCarToFleet(): string {
// Write code here that turns the phrase above into concrete actions
return 'pending';
}

@then(/an incomplete car should be added/)
public thenIncompleteCarAdded(): string {
// Write code here that turns the phrase above into concrete actions
return 'pending';
}
}

export = AddCarToFleetSteps;
6 changes: 6 additions & 0 deletions packages/be/features/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compilerOptions": {
"moduleResolution": "node",
"experimentalDecorators": true
}
}
3 changes: 3 additions & 0 deletions packages/be/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"scripts": {
"cucumber": "cucumber-js -p default"
},
"dependencies": {
"@app/shared": "file:be/packages/shared",
"@event-engine/infrastructure": "file:be/packages/infrastructure",
Expand Down
10 changes: 10 additions & 0 deletions packages/be/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
}
}
},
"cucumber": {
"executor": "nx:run-commands",
"outputs": ["{options.outputFile}"],
"defaultConfiguration": "development",
"options": {
"cwd": "packages/be",
"color": true,
"command": "npm run cucumber"
}
},
"serve": {
"executor": "nx:run-commands",
"defaultConfiguration": "development",
Expand Down

0 comments on commit 51ef746

Please sign in to comment.