Skip to content
mattwynne edited this page Jul 9, 2011 · 9 revisions

See this blog post to understand why you might want to use this tool.

Installing

gem install pairwise

Usage

Pairwise and Ruby

Pairwise.combinations will return an array of input combinations.

Here’s an example using pairwise with Rspec:

require 'rubygems'
require 'pairwise'

describe “something” do
Pairwise.combinations([1,2], [1,2], [2,3]).each do |(event_id, new_event_id, media_id)|
it “should do something with these input values” do

end
end
end

Pairwise and Cucumber

Create a yaml file with your inputs:

event with image: [Football, Basketball, Soccer]
event without image: [Football, Basketball, Soccer]
media: [Image, Video, Music]

If you want to force the ordering of your inputs:

- event with image: [Football, Basketball, Soccer]
- event without image: [Football, Basketball, Soccer]
- media: [Image, Video, Music]

Run pairwise passing the input file

$ pairwise inputs.yml

This will output a table ready to be used in your Cucumber features.


| media | event without image | event with image |
| Image | Football            | Football         |
| Image | Basketball          | Basketball       |
| Image | Soccer              | Soccer           |
| Video | Football            | Soccer           |
| Video | Basketball          | Football         |
| Video | Soccer              | Basketball       |
| Music | Football            | Basketball       |
| Music | Basketball          | Soccer           |
| Music | Soccer              | Football         |

Pairwise Resources

http://www.pairwise.org/

Clone this wiki locally