test_data_generator_with_constraints 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.rdoc +51 -5
- data/VERSION +1 -1
- data/bin/test_data_generator_with_constraints.rb +13 -13
- data/spec/test_data_generator_with_constraints_spec.rb +65 -0
- data/test_data_generator_with_constraints.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c112cb640a5d75ebd990dbab4749826038557028
|
4
|
+
data.tar.gz: a486c56400607f4dcd778051d8a98695389785b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e54b7cc168a5f94132584f613529115e2725dc2f3446ed2277aec0a8c24d5e12608cdef28b03d029fa627cbcecb2fb98ebcbbdf2bf5027dbbb85de8624a7cde0
|
7
|
+
data.tar.gz: d130b3d34bcdc8bd1aeeb01cf72d110a5847687a457dcdf63d2734dc01593df692d471bf0adbc2c716986c1f811e7da568fd3116564129c2a3b8dcf06ec72a31
|
data/README.rdoc
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
= test_data_generator_with_constraints
|
1
|
+
== test_data_generator_with_constraints {<img src="https://travis-ci.org/jatla/test_data_generator_with_constraints.png?branch=master" alt="Build Status" />}[https://travis-ci.org/jatla/test_data_generator_with_constraints]
|
2
2
|
|
3
3
|
Among the various techniques to generate test data, combinatorial test generation using all-pairs(pairwise) methodology is one. This gem is an effort to apply pairwise methodology to hierarchical data models. Further goal is to have the ability to specify constraints and restrict the test data generated based on those constraints.
|
4
4
|
|
5
|
-
Some references to pairwise testing literature
|
5
|
+
Some references to pairwise testing literature:
|
6
6
|
|
7
7
|
* http://www.pairwise.org
|
8
8
|
* http://www.developsense.com/pairwiseTesting.html
|
@@ -91,8 +91,54 @@ Some references to pairwise testing literature if you want to know more:
|
|
91
91
|
31. {:innermost1=>5, :innermost2=>false, :innermost3=>true, :inner2=>-1, :inner3=>3, :inner4=>true, :inner5=>false}
|
92
92
|
32. {:innermost1=>5, :innermost2=>false, :innermost3=>true, :inner2=>-1, :inner3=>3, :inner4=>false, :inner5=>true}
|
93
93
|
|
94
|
-
|
95
|
-
|
94
|
+
* More on constraints
|
95
|
+
|
96
|
+
Observe that constraint is defined as ruby 'lambda'. 'constraints' of the data model is a hash
|
97
|
+
|
98
|
+
complexConstraint = lambda {|t| t if ((t[:inner4] != t[:inner5]) && (t[:innermost2] != t[:innermost3]) && (t[:innermost1] > 3))}
|
99
|
+
$dataModel =
|
100
|
+
{
|
101
|
+
model:
|
102
|
+
{
|
103
|
+
.
|
104
|
+
.
|
105
|
+
.
|
106
|
+
},
|
107
|
+
constraints:
|
108
|
+
{
|
109
|
+
model: [complexConstraint]
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
The above complex constraint can be divided into multiple simple ones as follows resulting in the data model:
|
114
|
+
|
115
|
+
outerConstraint = lambda {|t| t if (t[:inner4] != t[:inner5])}
|
116
|
+
innerConstraint1 = lambda {|t| t if (t[:innermost2] != t[:innermost3])}
|
117
|
+
innerConstraint2 = lambda {|t| t if (&& (t[:innermost1] > 3)}
|
118
|
+
|
119
|
+
$dataModel =
|
120
|
+
{
|
121
|
+
model:
|
122
|
+
{
|
123
|
+
.
|
124
|
+
.
|
125
|
+
.
|
126
|
+
},
|
127
|
+
constraints:
|
128
|
+
{
|
129
|
+
inner1: [innerConstraint1, innerConstraint2],
|
130
|
+
outer2: [outerConstraint]
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
Observe that the key in the 'constraints' hash should be same as the key in 'model' where the constraints need to be applied.
|
135
|
+
|
136
|
+
=== TO DO
|
137
|
+
|
138
|
+
* Support generating strings using Regexp
|
139
|
+
|
140
|
+
=== Contributing to test_data_generator_with_constraints
|
141
|
+
|
96
142
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
97
143
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
98
144
|
* Fork the project.
|
@@ -101,7 +147,7 @@ Some references to pairwise testing literature if you want to know more:
|
|
101
147
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
102
148
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
103
149
|
|
104
|
-
|
150
|
+
=== Copyright
|
105
151
|
|
106
152
|
Copyright (c) 2014 jatla. See LICENSE.txt for
|
107
153
|
further details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
@@ -6,27 +6,27 @@ options = {:m => nil, :o => nil}
|
|
6
6
|
|
7
7
|
parser = OptionParser.new do |opts|
|
8
8
|
|
9
|
-
|
9
|
+
opts.banner = "Usage: test_data_generator_with_constraints.rb [options] "
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
opts.on('-m filePath', '--modelFilePath filePath', 'Path to file containing model and constaints. This is a required parameter.') do |filePath|
|
12
|
+
options[:m] = filePath
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
opts.on('-o filePath', '--outputFilePath filePath', 'Output file where generated test data set is written to. If not provided test data set would be generated to temp.txt') do |filePath|
|
16
|
+
options[:o] = filePath
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
opts.on( '-h', '--help', 'Display this screen' ) do
|
20
|
+
puts opts
|
21
|
+
exit
|
22
|
+
end
|
23
23
|
end
|
24
24
|
|
25
25
|
parser.parse!
|
26
26
|
|
27
27
|
if options[:m].nil?
|
28
|
-
|
29
|
-
|
28
|
+
puts parser
|
29
|
+
raise OptionParser::MissingArgument
|
30
30
|
end
|
31
31
|
|
32
32
|
load "#{options[:m]}"
|
@@ -33,5 +33,70 @@ describe "TestDataGeneratorWithConstraints" do
|
|
33
33
|
pairWiseData = TestDataGeneratorWithConstraints.instance.generate(dataModel)
|
34
34
|
pairWiseData.length.should eq 10
|
35
35
|
end
|
36
|
+
it "successfully generates pairwise data for complex models with constraints" do
|
37
|
+
complexConstraint = lambda {|t| t if ((t[:inner4] != t[:inner5]) && (t[:innermost2] != t[:innermost3]) && (t[:innermost1] > 3))}
|
38
|
+
dataModel =
|
39
|
+
{
|
40
|
+
model:
|
41
|
+
{
|
42
|
+
outer1:
|
43
|
+
{
|
44
|
+
inner1:
|
45
|
+
{
|
46
|
+
innermost1: (1..5),
|
47
|
+
innermost2: [true, false],
|
48
|
+
innermost3: [true, false]
|
49
|
+
},
|
50
|
+
inner2: [1,-1]
|
51
|
+
},
|
52
|
+
outer2:
|
53
|
+
{
|
54
|
+
inner3: (1..3),
|
55
|
+
inner4: [true, false],
|
56
|
+
inner5: [true, false]
|
57
|
+
}
|
58
|
+
},
|
59
|
+
constraints:
|
60
|
+
{
|
61
|
+
model: [complexConstraint]
|
62
|
+
}
|
63
|
+
}
|
64
|
+
pairWiseData = TestDataGeneratorWithConstraints.instance.generate(dataModel)
|
65
|
+
pairWiseData.length.should eq 32
|
66
|
+
end
|
67
|
+
it "successfully generates pairwise data for complex models with multiple constraints" do
|
68
|
+
outerConstraint = lambda {|t| t if (t[:inner4] != t[:inner5])}
|
69
|
+
innerConstraint1 = lambda {|t| t if (t[:innermost2] != t[:innermost3])}
|
70
|
+
innerConstraint2 = lambda {|t| t if (t[:innermost1] > 3)}
|
71
|
+
dataModel =
|
72
|
+
{
|
73
|
+
model:
|
74
|
+
{
|
75
|
+
outer1:
|
76
|
+
{
|
77
|
+
inner1:
|
78
|
+
{
|
79
|
+
innermost1: (1..5),
|
80
|
+
innermost2: [true, false],
|
81
|
+
innermost3: [true, false]
|
82
|
+
},
|
83
|
+
inner2: [1,-1]
|
84
|
+
},
|
85
|
+
outer2:
|
86
|
+
{
|
87
|
+
inner3: (1..3),
|
88
|
+
inner4: [true, false],
|
89
|
+
inner5: [true, false]
|
90
|
+
}
|
91
|
+
},
|
92
|
+
constraints:
|
93
|
+
{
|
94
|
+
inner1: [innerConstraint1, innerConstraint2],
|
95
|
+
outer2: [outerConstraint]
|
96
|
+
}
|
97
|
+
}
|
98
|
+
pairWiseData = TestDataGeneratorWithConstraints.instance.generate(dataModel)
|
99
|
+
pairWiseData.length.should eq 32
|
100
|
+
end
|
36
101
|
end
|
37
102
|
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "test_data_generator_with_constraints"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["jatla"]
|
12
|
-
s.date = "2014-03-
|
12
|
+
s.date = "2014-03-13"
|
13
13
|
s.description = "Given a model as ruby hash and constraints as ruby procs, test data is generated based on allpairs methodology and constraints applied to prune the data set"
|
14
14
|
s.email = "jayaprakash.atla@gmail.com"
|
15
15
|
s.executables = ["test_data_generator_with_constraints.rb"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_data_generator_with_constraints
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jatla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pairwise
|