test_data_generator_with_constraints 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d77c427a4425b37bae7cbc751f42e634101f52d
4
- data.tar.gz: a47eaeac59535604e557ccc9cf5f5d1f2edf31c4
3
+ metadata.gz: c112cb640a5d75ebd990dbab4749826038557028
4
+ data.tar.gz: a486c56400607f4dcd778051d8a98695389785b4
5
5
  SHA512:
6
- metadata.gz: fda3ad1ece6568e9e61b5cf7d067188261a0d8275b52061d5505ad5ea412f480c5a444469b1e3565e0673359aaac13163b089101acc4123d4cb89555cb97573b
7
- data.tar.gz: 1eb6b4cace9d8ce87fdc18b470d0499fed7360b6493b131a448affe60bc34621538b20f33b5df62103a847b9d145b1ea4e780068da5b10eeb09169b1b10aa579
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 if you want to know more:
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
- == Contributing to test_data_generator_with_constraints
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
- == Copyright
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.3
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
- opts.banner = "Usage: test_data_generator_with_constraints.rb [options] "
9
+ opts.banner = "Usage: test_data_generator_with_constraints.rb [options] "
10
10
 
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
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
- 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
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
- opts.on( '-h', '--help', 'Display this screen' ) do
20
- puts opts
21
- exit
22
- end
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
- puts parser
29
- raise OptionParser::MissingArgument
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.3"
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"
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.3
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-12 00:00:00.000000000 Z
11
+ date: 2014-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pairwise