regtest 0.5.3 → 1.0.0

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: fbb002804580991f8d6be0a8b3eddd8ef0883f81
4
- data.tar.gz: 23a0d3d370e2a9d896ff9112c740b3b15a48eb02
3
+ metadata.gz: accc98eaba516d684361d2dbe6a3d3bb13699ba8
4
+ data.tar.gz: 55c62a159fcbd0f218aaeb2ff69a70b4914a1f9f
5
5
  SHA512:
6
- metadata.gz: 03ea7cf106bb192422c2e9c1292f2974389001528cebf2ac3644e5c8f6fd8a93ad3f29b09128fa6aea14348a485a2ca73dc1db333843b97123c0d589dba464eb
7
- data.tar.gz: 361aee80e72f09fb16c6bd5e966b174f86a023c15a3a74452215d8746c3d32f762828a4e0f0af3fe302b9fd73804e67207259dd8fe5325ed80d98a73c21de53d
6
+ metadata.gz: 15f9eca32bcfb978ff004972b19e51dbab4542a2f0fe098aebdb8c9600d76b836b0bead6e0c922d0c2a03773775113b9bd32aa867a1da548cf725295d622a329
7
+ data.tar.gz: d39493f32b6cdaa8dc1bce1874f48cba1e75ce18b3b925ac2682c291d091c2035981c23e19bfdf560749c64fb6f07eeaa769ff5acdcc7b0d38dd248d54ebd125
data/Changelog CHANGED
@@ -1,3 +1,6 @@
1
+ 1.0.0
2
+ Some updates in documentation and project description.
3
+
1
4
  0.5.3
2
5
  Use rim/regtest to include regtest files in gem.
3
6
  Update homepage.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,3 @@
1
+ Copyright 2014-2017 by Jan Friedrich <janfri26@gmail.com>
2
+
3
+ Regtest is licensed under the same terms as Ruby itself.
data/README.md CHANGED
@@ -2,119 +2,178 @@
2
2
 
3
3
  ## Description
4
4
 
5
- This library support a very simple way to do regression testing in Ruby projects.
6
- I am using it for integration testing of my projects
7
- [mini_exiftool](https://github.com/janfri/mini_exiftool/tree/master/regtest)
8
- and [multi_exiftool](https://github.com/janfri/multi_exiftool-redesign/tree/master/regtest)
9
- to check if exiftool itself returns different values or
10
- new tags in newer versions.
5
+ This library support a very simple way to do regression testing in Ruby
6
+ projects. You write Ruby scripts with samples. Run these and get the sample
7
+ results as YAML output besides your scripts. Check both the scripts and the YAML
8
+ files with the results in you Source Code Control System. When you run the
9
+ scrips on a later (or even previous) version of your code a simple diff show you
10
+ if and how the changes in your code impact the results of your samples.
11
+
12
+ This is not a replacement for unit testing but a complement: You can produce a
13
+ lot of samples with a small amount of Ruby code (e.g. a large number of
14
+ combinations of data).
15
+
11
16
 
12
17
  ## Installation
13
18
 
14
- Installing the gem with
19
+ Installing the gem on the command line with
20
+
21
+ ```sh
22
+ gem install regtest
23
+ ```
15
24
 
16
- gem install regtest
25
+ or add
26
+
27
+ ```ruby
28
+ gem 'regtest'
29
+ ```
30
+ to your Gemfile or put a copy of `regtest.rb` in your project.
17
31
 
18
- or put a copy of regtest.rb in your project.
19
32
 
20
33
  ## Using
21
34
 
22
35
  The idea behind regtest is the following workflow:
23
36
  1. Writing samples
24
37
  2. Running samples
25
- 3. Checking results (differences between the actual results and the
26
- results of a previous run of your samples)
38
+ 3. Checking results (differences between the actual results and the results of
39
+ a previous run of your samples using the diff functionality of your Source
40
+ Code Control System)
41
+
27
42
 
28
43
  ### Writing Samples
29
44
 
30
- A samples file is a simple Ruby script with one ore more samples,
31
- for example
45
+ A samples file is a simple Ruby script with one ore more samples, for example
46
+
47
+ ```ruby
48
+ require 'regtest'
49
+
50
+ Regtest.sample 'String result' do
51
+ # Doing something to get the result of the sample
52
+ # end make sure it is the result of the block
53
+ 'some text'
54
+ end
55
+
56
+ Regtest.sample 'Division by zero' do
57
+ # If an exception occurs while execution of the
58
+ # block it is catched and used as value for the
59
+ # sample
60
+ 2 / 0
61
+ end
62
+ ```
63
+
64
+ The name of the sample (parameter of the `Regtest.sample` method) and the
65
+ results of the samples (return value of the block) are stored in YAML format. So
66
+ it should be a YAML friendly value as `String`, `Number`, `Boolean value`,
67
+ `Symbol`. Results could also be an `Array` or `Hash` with such values.
68
+
69
+
70
+ #### Helpers
32
71
 
33
- require 'regtest'
72
+ There is a method `Regtest.combinations` to generate a lot of combinations the
73
+ easy way. An example:
34
74
 
35
- Regtest.sample 'String result' do
36
- # Doing something to get the result of the sample
37
- # end make sure it is the result of the block
38
- 'some text'
39
- end
75
+ ```ruby
76
+ require 'ostruct'
77
+ require 'regtest'
40
78
 
41
- Regtest.sample 'Division by zero' do
42
- # If an exception occurs while execution of the
43
- # block it is catched and used as value for the
44
- # sample
45
- 2 / 0
46
- end
79
+ o = OpenStruct.new
80
+ o.a = [1,2,3]
81
+ o.b = [:x, :y]
82
+ Regtest.combinations(o).map(&:to_h)
83
+ # => [{:a=>1, :b=>:x}, {:a=>1, :b=>:y}, {:a=>2, :b=>:x}, {:a=>2, :b=>:y}, {:a=>3, :b=>:x}, {:a=>3, :b=>:y}]
84
+ ```
47
85
 
48
- The name of the sample (parameter of the `Regtest.sample` method)
49
- and the results of the samples (return value of the block) are stored
50
- in YAML format. So it should be a YAML friendly value as String,
51
- Number, Boolean value, Symbol.
52
- Results could also be an Array or Hash with such values.
86
+ See also the combinations example in the `regtest` folder.
53
87
 
54
- You can also include Regtest to have the sample method at
55
- top level.
88
+ You can also include `Regtest` to have the `sample` and `combinations method at top level.
56
89
 
57
- require 'regtest'
58
- include Regtest
90
+ ```ruby
91
+ require 'regtest'
92
+ include Regtest
59
93
 
60
- sample :x do
61
- :x
62
- end
94
+ sample :x do
95
+ :x
96
+ end
97
+ ```
63
98
 
64
- By convention sample files are stored in a directory `regtest`
65
- in your Ruby application.
99
+ By convention sample files are stored in a directory `regtest` in your Ruby application.
66
100
 
67
101
 
68
102
  ### Running Samples
69
103
 
70
104
  Whether you run your examples manually
71
105
 
72
- ruby -I lib regtest/*.rb
106
+ ```sh
107
+ ruby -I lib regtest/*.rb
108
+ ```
73
109
 
74
- or using the Rake task of regtest:
75
- Add the line
110
+ or using the Rake task of regtest and add
76
111
 
77
- require 'regtest/task'
112
+ ```ruby
113
+ require 'regtest/task'
114
+ ```
115
+
116
+ to your `Rakefile` and you can run your samples with `rake regtest`.
78
117
 
79
- to your Rakefile and you can run your samples with `rake regtest`.
80
118
 
81
119
  ### Checking Results
82
120
 
83
- The results of each samples file are stored as a collection of
84
- YAML documents in a corresponding results file (YAML) per samples
85
- file.
86
- For example for the samples files
121
+ The results of each samples file are stored as a collection of YAML documents in
122
+ a corresponding results file (YAML) per samples file. For example for the
123
+ samples files
87
124
 
88
- regtest/foo.rb
89
- regtest/bar.rb
125
+ ```sh
126
+ regtest/foo.rb
127
+ regtest/bar.rb
128
+ ```
90
129
 
91
130
  are the corresponding results files
92
131
 
93
- regtest/foo.yml
94
- regtest/bar.yml
132
+ ```sh
133
+ regtest/foo.yml
134
+ regtest/bar.yml
135
+ ```
95
136
 
96
137
  So the content of the results file of the example above is
97
138
 
98
- ---
99
- sample: String result
100
- result: some text
101
- ---
102
- sample: Division by zero
103
- exception: divided by 0
104
-
105
- Each time you run one ore more samples file the corresponding
106
- results file will be overwritten (or generated if not yet
107
- existent) with the actual result values of your samples.
108
- So source code version control program is the tool to determine
109
- changes between older runs of the samples.
110
- Therefore the samples file and their corresponding results files
111
- should be taken under version control.
139
+ ```yaml
140
+ ---
141
+ sample: String result
142
+ result: some text
143
+ ---
144
+ sample: Division by zero
145
+ exception: divided by 0
146
+ ```
147
+
148
+ Note: Each sample is represented by a YAML document in the corresponding YAML
149
+ file.
150
+
151
+ Each time you run one ore more samples file the corresponding results file will
152
+ be overwritten (or generated if not yet existent) with the actual result values
153
+ of your samples. So Source Code Version Control program is the tool to
154
+ determine changes between older runs of the samples. Therefore the samples file
155
+ and their corresponding results files should be taken under version control.
156
+
157
+
158
+ ## Further information
159
+
160
+ I use `regtest` in my project [scripref](https://github.com/janfri/scripref) to
161
+ generate a lot of malformed input data to check regressions in the behaviour of
162
+ the parser and text processor.
163
+
164
+ A little different is the usage in my projects
165
+ [mini_exiftool](https://github.com/janfri/mini_exiftool/tree/master/regtest) and
166
+ [multi_exiftool](https://github.com/janfri/multi_exiftool-redesign/tree/master/regtest).
167
+ There regtest is used for integration testing to check if Exiftool itself (an
168
+ external program that I do not develop) returns different values or new tags in
169
+ newer versions.
170
+
112
171
 
113
172
  ## Source Code
114
173
 
115
174
  The code is hosted on [github](https://github.com/janfri/regtest) and
116
- [gitorious](https://gitorious.org/regtest).
117
- Change it to your needs. Release a fork. It is open source.
175
+ [bitbucket](https://bitbucket.org/janfri/regtest) Change it to your needs.
176
+ Release a fork. It is open source.
118
177
 
119
178
  ## Author
120
179
 
data/Rakefile CHANGED
@@ -1,3 +1,6 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
1
4
  require 'rim/tire'
2
5
  require 'rim/regtest'
3
6
  require 'rim/version'
@@ -7,12 +10,23 @@ require 'regtest/task'
7
10
 
8
11
  Rim.setup do |p|
9
12
  p.name = 'regtest'
10
- p.version = '0.5.3'
13
+ p.version = '1.0.0'
11
14
  p.authors = 'Jan Friedrich'
12
15
  p.email = 'janfri26@gmail.com'
13
- p.summary = 'Regression testing in Ruby.'
16
+ p.summary = 'Simple regression testing for Ruby projects.'
14
17
  p.license = 'Ruby'
15
- p.description = p.summary
18
+ p.description = <<-END.gsub(/^ +/, '')
19
+ This library support a very simple way to do regression testing in Ruby
20
+ projects. You write Ruby scripts with samples. Run these and get the sample
21
+ results as YAML output besides your scripts. Check both the scripts and the YAML
22
+ files with the results in you Source Code Control System. When you run the
23
+ scrips on a later (or even previous) version of your code a simple diff show you
24
+ if and how the changes in your code impact the results of your samples.
25
+
26
+ This is not a replacement for unit testing but a complement: You can produce a
27
+ lot of samples with a small amount of Ruby code (e.g. a large number of
28
+ combinations of data).
29
+ END
16
30
  p.homepage = 'https://github.com/janfri/regtest'
17
31
  end
18
32
 
@@ -1,7 +1,9 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
1
3
  #
2
4
  # Regtest - Simple Regression Testing For Ruby Projects
3
5
  #
4
- # Copyright 2014, 2015 by Jan Friedrich (janfri26@gmail.com)
6
+ # Copyright 2014, 2015 by Jan Friedrich <janfri26@gmail.com>
5
7
  # License: Regtest is licensed under the same terms as Ruby itself.
6
8
  #
7
9
 
@@ -1,3 +1,10 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+ #
4
+ # Copyright 2014, 2016 by Jan Friedrich <janfri26@gmail.com>
5
+ # License: Regtest is licensed under the same terms as Ruby itself.
6
+ #
7
+
1
8
  REGTEST_FILES_RB = FileList.new('regtest/**/*.rb')
2
9
  REGTEST_FILES_YML = FileList.new('regtest/**/*.yml')
3
10
  REGTEST_FILES = REGTEST_FILES_RB + REGTEST_FILES_YML
@@ -0,0 +1,38 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # stub: regtest 1.0.0 ruby lib
3
+ #
4
+ # This file is automatically generated by rim.
5
+ # PLEASE DO NOT EDIT IT DIRECTLY!
6
+ # Change the values in Rim.setup in Rakefile instead.
7
+
8
+ Gem::Specification.new do |s|
9
+ s.name = "regtest"
10
+ s.version = "1.0.0"
11
+
12
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
+ s.require_paths = ["lib"]
14
+ s.authors = ["Jan Friedrich"]
15
+ s.date = "2017-08-19"
16
+ s.description = "This library support a very simple way to do regression testing in Ruby\nprojects. You write Ruby scripts with samples. Run these and get the sample\nresults as YAML output besides your scripts. Check both the scripts and the YAML\nfiles with the results in you Source Code Control System. When you run the\nscrips on a later (or even previous) version of your code a simple diff show you\nif and how the changes in your code impact the results of your samples.\n\nThis is not a replacement for unit testing but a complement: You can produce a\nlot of samples with a small amount of Ruby code (e.g. a large number of\ncombinations of data).\n"
17
+ s.email = "janfri26@gmail.com"
18
+ s.files = ["Changelog", "Gemfile", "LICENSE", "README.md", "Rakefile", "lib/regtest", "lib/regtest.rb", "lib/regtest/task.rb", "regtest.gemspec", "regtest/combinations.rb", "regtest/combinations.yml", "regtest/example.rb", "regtest/example.yml", "regtest/no_samples.rb"]
19
+ s.homepage = "https://github.com/janfri/regtest"
20
+ s.licenses = ["Ruby"]
21
+ s.rubygems_version = "2.6.12"
22
+ s.summary = "Simple regression testing for Ruby projects."
23
+
24
+ if s.respond_to? :specification_version then
25
+ s.specification_version = 4
26
+
27
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
+ s.add_development_dependency(%q<rim>, ["~> 2.11"])
29
+ s.add_development_dependency(%q<regtest>, ["~> 0.4"])
30
+ else
31
+ s.add_dependency(%q<rim>, ["~> 2.11"])
32
+ s.add_dependency(%q<regtest>, ["~> 0.4"])
33
+ end
34
+ else
35
+ s.add_dependency(%q<rim>, ["~> 2.11"])
36
+ s.add_dependency(%q<regtest>, ["~> 0.4"])
37
+ end
38
+ end
@@ -1,3 +1,6 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
1
4
  require 'ostruct'
2
5
  require 'regtest'
3
6
 
@@ -1,3 +1,6 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
1
4
  require 'regtest'
2
5
 
3
6
  Regtest.sample 'String result' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: regtest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Friedrich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-06 00:00:00.000000000 Z
11
+ date: 2017-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rim
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.6'
19
+ version: '2.11'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.6'
26
+ version: '2.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: regtest
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,17 +38,30 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.4'
41
- description: Regression testing in Ruby.
41
+ description: |
42
+ This library support a very simple way to do regression testing in Ruby
43
+ projects. You write Ruby scripts with samples. Run these and get the sample
44
+ results as YAML output besides your scripts. Check both the scripts and the YAML
45
+ files with the results in you Source Code Control System. When you run the
46
+ scrips on a later (or even previous) version of your code a simple diff show you
47
+ if and how the changes in your code impact the results of your samples.
48
+
49
+ This is not a replacement for unit testing but a complement: You can produce a
50
+ lot of samples with a small amount of Ruby code (e.g. a large number of
51
+ combinations of data).
42
52
  email: janfri26@gmail.com
43
53
  executables: []
44
54
  extensions: []
45
55
  extra_rdoc_files: []
46
56
  files:
47
57
  - Changelog
58
+ - Gemfile
59
+ - LICENSE
48
60
  - README.md
49
61
  - Rakefile
50
62
  - lib/regtest.rb
51
63
  - lib/regtest/task.rb
64
+ - regtest.gemspec
52
65
  - regtest/combinations.rb
53
66
  - regtest/combinations.yml
54
67
  - regtest/example.rb
@@ -74,8 +87,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
87
  version: '0'
75
88
  requirements: []
76
89
  rubyforge_project:
77
- rubygems_version: 2.5.1
90
+ rubygems_version: 2.6.12
78
91
  signing_key:
79
92
  specification_version: 4
80
- summary: Regression testing in Ruby.
93
+ summary: Simple regression testing for Ruby projects.
81
94
  test_files: []