Skip to content

Reference implementation of Declarative Gherkin for Cucumber testing.

License

Notifications You must be signed in to change notification settings

contino/cucumber-declarative-gherkin

Repository files navigation

cucumber-declarative-gherkin

START HERE

See quick notes for recent notes on getting this demo setup on your local workstation (which should be replaced by containerized instructions in the future).

WARNING

At the time of writing 2 vulnerabilities are present in upstream npm dependencies.

  • Meow issue
    • @wdio/devtools-service@7.7.3 requires trim-newlines@^1.0.0 via a transitive dependency on meow@3.7.0
    • Waiting for meow to release its patch and be picked up
    • Mewo issue
  • ecstatic issue
    • @nrwl/web@12.3.6 requires ecstatic@^3.3.2 via http-server@0.12.3
    • @nrwl/react@12.3.6 requires ecstatic@^3.3.2 via a transitive dependency on http-server@0.12.3
    • This is being fixed by http-server in this PR

Overview

This is a training aide to help people learn Declarative Gherkin. It is not easy to learn Declarative Gherkin. Thus, this app helps people understand how to take what they learned in training and see a working implementation.

Where to Start?

Want to learn more about declarative Gherkin, read the training or look at the docs here.

Want to see the declarative Gherkin, go into the first-bank-of-change/features folder.

Want to run the declarative Gherkin:

  1. Install the perquisites
  2. Run nvm use in the root folder
  3. run npm install in the first-bank-of-change folder
  4. run npm run e2e
  5. Then open the file cucumber-declarative-gherkin/first-bank-of-change/.tmp/report/index.html in a browser

NOTE: The e2e test will fail. It is to demo the advance logging.
navigate to the failing scenario to see a screenshot, test suite failure location and client logging entries.

Perquisites

  • Need Node and NPM, built with node 14.16.0
  • NX needs to be installed globally
    • npm i -g nx

Run the Example App

This demo uses a single app with everything running in memory. No servers are used for this demo.

From the repo root folder run npm run start, then go to http:\\localhost:4200.

Local Development

When developing locally, you can run npm run start it will watch your file changes and reload. In addition, when working on e2e tests, run npm run e2e-dev, it only runs the test suite.

To run lint, use npm run lint

To run unit tests, use npm run test

Generate Cucumber Step Definitions

WebdriverIO Cucumber framework does not generate the step definitions when they are missing. So, we use the VS Code extension Jest-cucumber code generator.

NOTE: the plugin generates regex requiring alteration, example:

Failing regex:

Then(/^they see a submittal response (.*)$/

Correct regex: (Double quotes)

Then(/^they see a submittal response "(.*)"$/

Without the double quotes, the string will contain them and fail comparisons.

Troubleshooting e2e Tests

See Cucumber Logging