Skip to content

Instantly share code, notes, and snippets.

@atodorov
Last active April 13, 2017 21:04
Show Gist options
  • Save atodorov/8f44022e209f749c7121f91281aa641e to your computer and use it in GitHub Desktop.
Save atodorov/8f44022e209f749c7121f91281aa641e to your computer and use it in GitHub Desktop.
Example for pairwise test generation
# execute via rspec -fd pairwise_spec.rb
# for more info see http://atodorov.org/blog/2017/04/14/testing-red-hat-enterprise-linux-the-microsoft-way/
require 'pairwise'
describe "RHEL 6.9 Tier #2 and #3 testing" do
context "Test case w/o parameters can't be reduced via pairwise" do
[
[%w(x86_64), %w(Server Workstation Client ComputeNode)],
[%w(i386), %w(Server Workstation Client)],
[%w(ppc64 s390x), %w(Server)]
].each do |arch, variant|
# generate pairwise combinations for tests with variations
Pairwise.combinations(
['partitioning / swap on LVM'],
arch,
variant
).each do |(base_test_case, arch, variant)|
it "#{arch} #{variant} - #{base_test_case}" do end
end
end
end
context "Test case(s) with parameters can be reduced by pairwise" do
[
[%w(x86_64), %w(Server Workstation Client ComputeNode)],
[%w(i386), %w(Server Workstation Client)],
[%w(ppc64 s390x), %w(Server)]
].each do |arch, variant|
# generate pairwise combinations for tests with variations
Pairwise.combinations(
['rescue mode'],
%w(LVM RAID),
%w(plain encrypted),
arch,
variant
).each do |(base_test_case, partition_type, encryption, arch, variant)|
it "#{arch} #{variant} - #{base_test_case} / #{partition_type} / #{encryption}" do end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment