sw2at-ui

SWAT(Simple Way to Automate Tests) - UI

Gem helps in testing of Rails applications. * track your test revisions * easily configure and run tests in parallel * share testing results with team members and customers

How to install Rails app with sw2at-ui from scratch

Create app (skip this if you have app already)

gem install rails
rails new swat-ui-app
cd swat-ui-app

add RSpec gem to your Gemfile (skip this if you have rspec already)

gem 'rspec', '~> 3.0'
group :development, :test do
  gem 'rspec-rails', '~> 3.0'
end

install RSpec(skip this if you have rspec already)

bundle install
rails generate rspec:install

add sw2at-ui gem to your Gemfile

gem 'sw2at-ui', '0.0.6'

Install sw2at-ui

bundle install
rails g swat:ui:install

Go to firebase.com and create a free acount there to get your https path.

Insert it in Rails.root/initializers/swat_ui.rb. You can define your parallelism settings here.

Edit yout Rails.root/config/routes.rb

Rails.application.routes.draw do

  unless Rails.env.production?
    require 'sw2at-ui'
    mount Swat::Engine => '/swat'
  end
  
end

Connect sw2at-ui to RSpec. Edit your Rails.root/spec/rails_helper.rb, add following lines

require 'rspec/core/formatters/base_text_formatter'
config.formatter = RSpec::Core::Formatters::BaseTextFormatter # if you don't use any custom formatters.
Swat::UI.rspec_config = config

Add a test. For example

it 'should check math' do
  expect(2+2).to eq(4)
end

Run rspec

rspec

or with a swat-ui runner

SWAT_CURRENT_REVISION_NAME='Hello SWAT!' rake swat:ci:run

Now you can check your results at localhost:3000/swat. (don't forget to start the app with rails s)

Examples

You can check a configured example here.

Contributing to sw2at-ui

Copyright © 2015 Vitaly Tarasenko. See LICENSE.txt for further details.