Giter Club home page Giter Club logo

cucumber_rake_runner's Introduction

CucumberRakeRunner

Cucumber helper to run rake tasks in the current process, capturing properties to assert tests against

Installation

Step 1

Add this line to your application's Gemfile:

gem 'cucumber_rake_runner', require: false

And then execute:

$ bundle

Or install it yourself as:

$ gem install cucumber_rake_runner

Step 2

Add the following line to your cucumber environment file typically found at features\support\env.rb

require 'cucumber_rake_runner'

Problem

Sometimes there is a need to test your rake tasks. Typically this is done by a system call such as

@output = `rake some:amazing:task`

Sometimes this is desirable, at other times, in particular when using Jruby it is not. For each execution of the above a new JVM must spin up costing significant delays to test turnaround time.

The solution is to run the task inline to the cucumber process via Rake's invoke command. This gem provides a handy dandy solution to get the above functionality and more while running the rake task inline to the current process.

Usage

Simply incorportate the following call appropriately in your step definitions

@rake_output = run_rake_task(task_name, arg1, arg2, ... )

This will run the rake tasks with the specified parameters. If the rake task does not take parameters only the task_name is required.

The returned obect from this call is an OpenStruct with the following properties

  1. stdout - All output generated by the task sent to stdout
  2. stderr - All output generated by the task sent to stderr
  3. time - Time taken to execute rake task.

for example

@rake_output.stdout.include? 'Some expected output from task'

See the features and step definitions in this gem for example usage.

Contributing

Tests can be run via

cucumber

There are rake task definitions that the tests depend on. Please feel free to expand.

  1. Fork it
  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 new Pull Request

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.