GithubHelp home page GithubHelp logo

thiagopintodev / bdd Goto Github PK

View Code? Open in Web Editor NEW
35.0 8.0 4.0 249 KB

Given/When/Then/And/But output to RSpec and Minitest

License: MIT License

Ruby 99.59% Shell 0.41%
bdd minitest rspec ruby tests user-stories

bdd's Introduction

Bdd

Bdd is a User Story Framework. Add Acceptance Criteria documentation directly on your Ruby Tests.

Status

Is It Working? Is It Tested? Code Quality # of Downloads Get Involved!
Master Build Status Code Climate Code Climate Downloads GitHub Issues

Compatibility

Ruby 2.0 through 2.7

Pitch

This gem provides the same benefits as gem Cucumber, and it's easier to use in projects.

Works with all ruby test frameworks (RSpec and Minitest).
Works with all test types (Capybara, units, features, etc).


1. Take your User Stories.

2. Write them as unobtrusive commentary in your test code.

3. Run your tests.

4. You'll see all your User Stories neatly organized in the output.

5. If your code breaks, that line will be highlighted in red.

Read more about User Stories on Wikipedia.

Example

1. BEFORE

Before

2. AFTER

After

3. RUN TESTS

Run Tests

4. CHECK OUTPUT

Check Output

Installation

Installation For RSpec

# Gemfile

group :development, :test do
  gem 'rspec'
  gem 'rspec-rails' # if you are using Rails
  gem 'bdd'
end
# spec/spec_helper.rb
require 'bdd'

Bdd.configure do |config|
  config.framework :rspec
  config.reporters :output, :yaml
  config.language %w[Given], %w[When Then], %w[And But]

  # Optionally, add other languages:
  # config.language pre_conditions, post_conditions, conjunctions
  # config.language %w[Dado], %w[Quando Entao], %w[E Mas] # Portuguese
  # config.language %w[Dato], %w[Cuando Entonces], %w[Y Mas] # Spanish
  # config.language %w[Zakładając], %w[Jeśli To], %w[Także Ale] # Polish
end

Installation For Minitest

# Gemfile

group :development, :test do
  gem 'minitest'
  gem 'minitest-rails' # if you are using Rails
  gem 'bdd'
end
# test/test_helper.rb
require 'bdd'

Bdd.configure do |config|
  config.framework :minitest
  config.reporters :output, :yaml
  config.language %w[Given], %w[When Then], %w[And But]

  # Optionally, add other languages:
  # config.language pre_conditions, post_conditions, conjunctions
  # config.language %w[Dado], %w[Quando Entao], %w[E Mas] # Portuguese
  # config.language %w[Dato], %w[Cuando Entonces], %w[Y Mas] # Spanish
  # config.language %w[Zakładając], %w[Jeśli To], %w[Także Ale] # Polish
end

Authors & Contributions

Contributing

  1. Fork it ( https://github.com/thejamespinto/bdd/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Documentation

Chart

  • Frameworks
    • RSpec
    • Minitest
  • Reporters
    • Output
    • YAML
    • HTML

bdd's People

Contributors

evandrodp avatar jivagoalves avatar mpapis avatar rafaelsales avatar th1agoalmeida avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bdd's Issues

Make it work with MiniTest

Currently this gem only supports RSpec.

Please if you are a MiniTest fan, fork us and make it work with it!
All the current logic sits in these 2 files lib/bdd/rspec

You do NOT have to worry about refactoring duplication, I will help with that after your PR is merged 👍

Thank you for your interest in reading our issues.

Implement translations

We can implement translations in the system simply by allowing a developer to set up extra methods by themselves.

Allowing this setup is currently being implemented at #7,
but I would like to see a lighter DSL.
Here is an example of what a lighter DSL would look like.

require "bdd/rspec"
Bdd.define_steps(*%w[Zakładając Jeśli To]) # Polish versions :)

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.