0.0
No commit activity in last 3 years
No release in over 3 years
Service Objects for Integration Tests
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0

Runtime

 Project Readme

TestServices

Service Objects that provide useful benefits to your integration test suite.

Installation

Add this line to your application's Gemfile:

gem 'test_services', group: [:test]

And then execute:

$ bundle

Or install it yourself as:

$ gem install test_services

Usage

Cucumber

Just require the cucumber file and all the cucumber service objects will become available.

# features/support/my_configuration_file
require 'test_services/cucumber'

TableComparer

TableComparer lets you write a step definition representing an HTML Table and validate the text contents match

Then I should see the following search results:
| username | email address |
| Bobby    | b@gmail.com   |

And using it is as simple as:

Then(/^I should see the following search results:$/) do |table|
  expect(TableComparer.new(table, "#search_results").matches?).to be_true
end

However you should also push this into a PageObject

# features/support/pages/search_result_page.rb
class SearchResultsPage < SitePrism::Page
  def has_results_matching?(table)
    TableComparer.new(table, "#search_results").matches?
  end
end

# features/step_definitions/search_results_steps.rb
Then(/^I should see the following search results:$/) do |table|
  expect(SearchResultsPage.new).to have_results_matching(table)
end

Contributing

  1. Fork it ( https://github.com/[my-github-username]/test_services/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