GithubHelp home page GithubHelp logo

tarkers / coffee-machine-javascript Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cucumber-attic/coffee-machine-javascript

0.0 0.0 0.0 21 KB

Example repository that works nicely with CucumberStudio BDD project

Gherkin 34.11% JavaScript 59.15% Shell 6.75%

coffee-machine-javascript's Introduction

Coffee Machine

This is an example repository with some Gherkin feature files.

Imagine we have built a coffee machine for our office, with automated tests using Cucumber.

Expose on CucumberStudio

You can use CucumberStudio "BDD with Cucumber project" to expose the features of this repository and their execution:

  1. Display the feature files from this repository in CucumberStudio

    • Fork this repository in a place you own in your favorite git service

    • In CucumberStudio, create a new "BDD with Cucumber" project

    • Connect the repository you have forked

    • You now have your features nicely exposed on CucumberStudio

      Congrats! ๐ŸŽ‰

  2. Push execution results to CucumberStudio

    • Ensure you have nodejs and npm installed

    • Run npm install to install the libraries (which includes cucumber-js)

    • Execute the feature files with Cucumber by running node_modules/.bin/cucumber-js. All test pass.

    • Generate results in a format that CucumberStudio understands

      When the features are executed the results must be stored in a file. This file must be in message format. Not junit xml or json.

      The command line option --format=message:messages.ndjson will output execution results in the message format, and store them in the file messages.ndjson. This is the final command to run:

      node_modules/.bin/cucumber-js --format=message:messages.ndjson
      

      Note: you can also run npm run test which does the same, as defined in package.json.

    • Push the results to CucumberStudio

      In CucumberStudio, in the settings there is the command line to use to push results. This command line looks something like this:

      curl -X POST \
        https://studio.cucumber.io/cucumber_project/results \
        -F messages=@<path to your result file> \
        -H "project-access-token: <your-project-access-token>" \
        -H "provider: github" \
        -H "repo: <repository_name>" \
        -H "branch: main" \
        -H "revision: <commit_hash>"
      

      This command is defined in package.json as a script. Run npm run push-results to run it. You will need to define some environment variables to properly fill in the necessary information:

      • PROJECT_ACCESS_TOKEN: the unique access token relative to your project
      • REPOSITORY_NAME: the repository name, like cucumber/coffee-machine-javascript
      • COMMIT_HASH: the git commit hash referring the version actually tested

      Command is:

      export PROJECT_ACCESS_TOKEN=abcd1234
      export REPOSITORY_NAME=yourGitHubName/coffee-machine-javascript
      export COMMIT_HASH=$(git rev-parse HEAD)
      npm run push-results
      
    • You should see the results being displayed in CucumberStudio.

      Congrats! ๐ŸŽ‰

coffee-machine-javascript's People

Contributors

cbliard avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.