Skip to content

A Development Tool for creating and managing system tests for Ruby on Rails >= 5.1 Applications

License

Notifications You must be signed in to change notification settings

rlafranchi/system_tester

Repository files navigation

Build Status Code Climate Test Coverage

System Tester

A development tool for creating and managing system tests in Ruby on Rails >= 5.1 applications

Usage

This gem is used only in development and is a mountable rails engine that creates JSON endpoints for a chrome extension.

Installation

Add this line to your application's Gemfile:

gem 'system_tester', group: :development

Add the system_tester db to config/database.yml

# you may want to consider a shared MySQL/Postgres database
# if you have a team that needs shared access
system_tester:
  <<: *default
  database: db/system_tester.sqlite3

And then install and run the migrations:

$ bundle install
$ rails system_tester:migrate

Mount the engine in config/routes.rb:

Rails.application.routes.draw do
  # ... other routes
  
  # Mount in development environment only
  if Rails.env.development?
    mount SystemTester::Engine => "/system_tester"
  end
end

Start your dev server and you are good to go.

Chrome extension

System Tester Demo

The chrome extension provides a Devtools tab and acts as a client to this gem.

ADD TO CHROME

Design

System Tester is designed to work with a chrome extension, but could potentially be used for other applications as well. Run rails routes to see what endpoints are provided. The following design was set in place for the easy of reusing testing steps:

  • Features - the top level: one test script for a feature
  • Scenarios - 1:M assocation from Feature to Scenario. A Scenario is one test method.
  • Steps - Basically a line of code that can be an action or an assertion. STI is used to provide different step types.
  • ScenarioSteps - M:M assocation for Steps and Scenarios which also as a position attribute to allow for reordering.
  • Stairs - an ordered group of steps that can be reused.
  • StairSteps - M:M association to support stairs, Stair inherits from Step so the fk points back to the same table.

License

The gem is available as open source under the terms of the MIT License.