All Projects → gonzalo-bulnes → dredd-rack

gonzalo-bulnes / dredd-rack

Licence: GPL-3.0 license
The Dredd API blueprint testing tool for your Rack applications.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to dredd-rack

Capybara discoball
Spin up an external server just for Capybara
Stars: ✭ 116 (+132%)
Mutual labels:  rack, testing-tools
Dredd
Language-agnostic HTTP API Testing Tool
Stars: ✭ 3,770 (+7440%)
Mutual labels:  api-blueprint, dredd
goodman
Go Hook Handler for Dredd
Stars: ✭ 22 (-56%)
Mutual labels:  dredd, dredd-hooks
dredd-hooks-php
Dredd hooks handler client written in php.
Stars: ✭ 44 (-12%)
Mutual labels:  dredd, dredd-hooks
BadMedicine
Library and CLI for randomly generating medical data like you might get out of an Electronic Health Records (EHR) system
Stars: ✭ 18 (-64%)
Mutual labels:  testing-tools
jest-watch-suspend
Suspending jest watch mode
Stars: ✭ 13 (-74%)
Mutual labels:  testing-tools
rack-queries
A page in your rack-based application that allows quick execution of pre-built queries
Stars: ✭ 25 (-50%)
Mutual labels:  rack
ts-mock-imports
Intuitive mocking library for Typescript class imports
Stars: ✭ 103 (+106%)
Mutual labels:  testing-tools
test junkie
Highly configurable testing framework for Python
Stars: ✭ 72 (+44%)
Mutual labels:  testing-tools
Approvals.NodeJS
Approval Tests implementation in NodeJS
Stars: ✭ 79 (+58%)
Mutual labels:  testing-tools
anycable-rack-server
AnyCable-compatible Ruby Rack middleware
Stars: ✭ 21 (-58%)
Mutual labels:  rack
testcontainers
Selenide + TestContainers (Docker) sample project
Stars: ✭ 28 (-44%)
Mutual labels:  testing-tools
sandboni-core
Sandboni - Java test optimization library which reduces test execution time without compromising quality
Stars: ✭ 27 (-46%)
Mutual labels:  testing-tools
tools
Tools used for Penetration testing / Red Teaming
Stars: ✭ 63 (+26%)
Mutual labels:  testing-tools
EyeJS
A JavaScript testing framework for the real world
Stars: ✭ 68 (+36%)
Mutual labels:  testing-tools
evolutio
ab testing framework with automated code removing
Stars: ✭ 15 (-70%)
Mutual labels:  testing-tools
baset
Testing tool for baseline strategy
Stars: ✭ 26 (-48%)
Mutual labels:  testing-tools
FakeDataGenerator
fakedatagenerator.herokuapp.com/
Stars: ✭ 18 (-64%)
Mutual labels:  testing-tools
eat
Json based scenario testing tool(which can have test for functional and non-functional)
Stars: ✭ 41 (-18%)
Mutual labels:  testing-tools
trafficator
Traffic generator for local analytics testing
Stars: ✭ 27 (-46%)
Mutual labels:  testing-tools

Dredd::Rack

Gem Version Build Status Code Climate Dredd Reference Version Inline docs

This gem provides a Dredd runner and a dredd rake task to make API blueprint testing convenient for Rack applications. When verifying blueprints locally, an application server is automatically set up, without need of any manual intervention.

Besides being convenient, that allows to use the API blueprints as acceptance test suites to practice BDD with Dredd and RSpec, for example, while clients developers use Apiary as a mock server.

Installation

Add the gem to your Gemfile:

# Gemfile

gem 'dredd-rack', '~> 1.0' # see semver.org

Define which application Dredd::Rack must serve automatically:

# config/initializers/dredd-rack.rb or app.rb or Rakefile

require 'dredd/rack'

Dredd::Rack.configure do |config|
  # Allow the automatic setup of a local application server when necessary
  #
  # Find the name of your application in its `config.ru` file.
  config.app = Example::Application # or Rails.application, Sinatra::Application...

  # Optionally, you can define a custom Dredd command:
  config.dredd_command = 'dredd'
end

Usage

Getting started

Define the dredd rake task in your Rakefile:

# Rakefile

require 'dredd/rack'

# ...

# Define the :dredd task
Dredd::Rack::RakeTask.new # run: `dredd doc/*.apib doc/*.apib.md <local or remote URL>`

# Optionally add the API blueprint verification to the default test suite
# task :default => [:spec, :dredd]

Run the API blueprint verification:

# locally
rake dredd

# or specify a remote server:
#API_HOST=http://api.example.com rake dredd

The :dredd rake task requires no further configuration. However, it relies on the following convention: API blueprints must be stored in the doc directory with either the .apib or the .apib.md extension.

Further usage

Of course you can define your own rake tasks with custom runners!

Each Dredd::Rack runner stores a specific Dredd configuration. In order to manage different runners, you can define multiple rake tasks with custom names or descriptions:

# Rakefile

# ...

namespace :blueprint do
  namespace :verify do

    desc 'Verify the whole API compliance with its blueprint'
    Dredd::Rack::RakeTask.new(:all)

    desc 'Verify the Machines API compliance with its blueprint'
    Dredd::Rack::RakeTask.new(:machines) do |task|
      task.runner.configure do |dredd|
        dredd.only 'Machines > Machines Collection > List all Machines',
                   'Machines > Machine > Retrieve a Machine' # etc.
        dredd.sorted!.details!
      end
    end

    # ...
  end
end

# run with `rake blueprint:verify:all` and `rake blueprint:verify:machines`

Both the rake task documentation and the runner documentation contain more examples, and the runner documentation does also contain a comprehensive list of the configuration methods that can be used to customize runners. Take a look at them!

Remote API testing

Configuring a runner for remote API blueprint compliance testing is as easy as setting its api_endpoint option (see the runner documentation). Please remember that you must ensure that the API is being served at the specified URI when performing remote API blueprint validation.

Development

Testing and documentation

This gem behaviour is described using RSpec and RSpec tags are used to categorize the spec examples.

Spec examples that are tagged as public describe aspects of the gem public API, and MAY be considered as the gem documentation.

The private or protected specs are written for development purpose only. Because they describe internal behaviour which may change at any moment without notice, they are only executed as a secondary task by the continuous integration service and SHOULD be ignored.

Run rake spec:public to print the gem public documentation.

Contributions

Contributions are welcome! The best way to get in touch is probably to open an issue, whether it is to get help, give feedback or discuss an idea. Also, when there are plan to extend Dredd::Rack, the intended API is described beforehand so we can discuss it. Feel free to jump into the discussion at any moment!

Note that opening pull requests with work in progress is not only welcome, but encouraged! Let's talk early, talk often, and we will all learn in the way :)

Please note that Dredd::Rack is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Credits

The Dredd::Rack::RakeTask is heavily inspired in the RSpec::Core::RakeTask. Let the corresponding credits go to the RSpec team.

License

Dredd::Rack provides convenient API blueprint testing to Rack applications.
Copyright (C) 2015, 2016  Gonzalo Bulnes Guilpain

Copyright (C) 2012 Chad Humphries, David Chelimsky, Myron Marston
Copyright (C) 2009 Chad Humphries, David Chelimsky
Copyright (C) 2006 David Chelimsky, The RSpec Development Team
Copyright (C) 2005 Steven Baker

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].