testplan 0.0.1
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 +7 -0
- data/.gitignore +14 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +91 -0
- data/Rakefile +2 -0
- data/lib/tasks/rspec.rake +24 -0
- data/lib/tasks/testlink.rake +12 -0
- data/lib/tasks/testplan.rake +24 -0
- data/lib/testplan/version.rb +3 -0
- data/lib/testplan.rb +53 -0
- data/testplan.gemspec +25 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 37cc327ffa6d78e387b0a51ffa103667078b8ea7
|
4
|
+
data.tar.gz: 94984670659db6d4ab0429ac48c2ae52610af265
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 04c412f2d54b33ab855b58a2cea5d154e2fcd3d92a46ffb6cc703470f2eaae661b5ef44a1daa2a9699d1666ac829ac06ace45653bcefb91fdbf4f46c70d1c80c
|
7
|
+
data.tar.gz: 6deff212e7714ce55b66605209c0a6246982f36beccecf82a44dc9a18848880d4f31f06d6b37717be639963a0a5bac069c7a5b1e86f46f3f5a9d0057924e6a49
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Pim Snel
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# Testplan
|
2
|
+
|
3
|
+
This gem helps organize rspec cases into testplans. It replaces the need
|
4
|
+
for an test management application like TestLink.
|
5
|
+
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'testplan'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install testplan
|
20
|
+
|
21
|
+
Add this to your rakefile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'rubygems'
|
25
|
+
require 'testplan'
|
26
|
+
```
|
27
|
+
|
28
|
+
You need a config/testplan.rb conf file like below
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
$some_cases_for_frontend = %w(
|
32
|
+
req-0036-01
|
33
|
+
req-0036-02
|
34
|
+
req-0037-01
|
35
|
+
req-0037-02
|
36
|
+
)
|
37
|
+
|
38
|
+
$some_cases_for_backend = %w(
|
39
|
+
req-0038-01
|
40
|
+
)
|
41
|
+
|
42
|
+
Testplan::Setup::init -> do {
|
43
|
+
multi_env: 0,
|
44
|
+
testplans: {
|
45
|
+
ci: [:ci_frontend, :ci_backend],
|
46
|
+
production: [:production_frontend, :production_backend],
|
47
|
+
},
|
48
|
+
platforms: {
|
49
|
+
ci_frontend: {
|
50
|
+
baseurl: 'http://www.ci-myapp.com',
|
51
|
+
cases: $some_cases_for_frontend,
|
52
|
+
},
|
53
|
+
ci_backend: {
|
54
|
+
baseurl: 'http://backend.ci-myapp.com',
|
55
|
+
cases: $some_cases_for_backend
|
56
|
+
},
|
57
|
+
production_frontend: {
|
58
|
+
baseurl: 'http://www.myapp.com',
|
59
|
+
cases: $some_cases_for_frontend,
|
60
|
+
},
|
61
|
+
production_backend: {
|
62
|
+
baseurl: 'http://backend.myapp.com',
|
63
|
+
cases: $some_cases_for_backend
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
end
|
68
|
+
```
|
69
|
+
|
70
|
+
the cases symbol is required, other symbols are converts to ENV VARS
|
71
|
+
|
72
|
+
## Usage
|
73
|
+
|
74
|
+
when you run ```rake testplan:build_ci``` these commands will be
|
75
|
+
executed
|
76
|
+
|
77
|
+
```bash
|
78
|
+
BASEURL='http://www.ci-myapp.com' bundle exec rake testplan:junit SPEC_OPTS=\"-e req-0036-01\"
|
79
|
+
BASEURL='http://www.ci-myapp.com' bundle exec rake testplan:junit SPEC_OPTS=\"-e req-0036-02\"
|
80
|
+
BASEURL='http://www.ci-myapp.com' bundle exec rake testplan:junit SPEC_OPTS=\"-e req-0037-01\"
|
81
|
+
BASEURL='http://www.ci-myapp.com' bundle exec rake testplan:junit SPEC_OPTS=\"-e req-0037-02\"
|
82
|
+
BASEURL='http://backend.ci-myapp.com' bundle exec rake testplan:junit SPEC_OPTS=\"-e req-0038-01\"
|
83
|
+
```
|
84
|
+
|
85
|
+
## Contributing
|
86
|
+
|
87
|
+
1. Fork it ( https://github.com/[my-github-username]/testplan/fork )
|
88
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
89
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
90
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
91
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
desc 'Build spec(s) with normal output'
|
2
|
+
RSpec::Core::RakeTask.new(:normal) do |t|
|
3
|
+
# t.rspec_opts = "--format documentation"
|
4
|
+
t.pattern = '**/*_spec.rb'
|
5
|
+
end
|
6
|
+
|
7
|
+
desc 'build spec(s) with doc output'
|
8
|
+
RSpec::Core::RakeTask.new(:documentation) do |t|
|
9
|
+
t.rspec_opts = "--format documentation"
|
10
|
+
t.pattern = '**/*_spec.rb'
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'build spec(s) with junit output'
|
14
|
+
RSpec::Core::RakeTask.new(:junit) do |t|
|
15
|
+
|
16
|
+
d = DateTime.now
|
17
|
+
newTarget = d.strftime("%Y%m%dT%H%M%S")
|
18
|
+
|
19
|
+
Dir.mkdir 'reports' unless File.exists?('reports')
|
20
|
+
|
21
|
+
t.rspec_opts = "--format RspecTestlinkJunitformatter -r rspec_testlink_formatters --out reports/SPEC#{newTarget}-out.xml"
|
22
|
+
t.pattern = '**/*_spec.rb'
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
namespace :testlink do
|
2
|
+
desc 'run ci plan (for backwards compatibilty)'
|
3
|
+
task :plan_ci do
|
4
|
+
Rake::Task["testplan:build_ci"].invoke
|
5
|
+
end
|
6
|
+
|
7
|
+
desc 'run production plan (for backwards compatibilty)'
|
8
|
+
task :plan_production do
|
9
|
+
Rake::Task["testplan:build_production"].invoke
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
task default: %w[testplan:build_ci]
|
2
|
+
namespace :testplan do
|
3
|
+
|
4
|
+
desc 'build continuious intergration plan'
|
5
|
+
task :build_ci do
|
6
|
+
Testplan::Build::plan_in_format :ci, :junit
|
7
|
+
end
|
8
|
+
|
9
|
+
desc 'build production testplan'
|
10
|
+
task :build_production do
|
11
|
+
Testplan::Build::plan_in_format :production, :junit
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'build plan by testplan name'
|
15
|
+
task :build,[:testplan] do |t, args|
|
16
|
+
Testplan::Build::plan_in_format args[:testplan].to_sym, :junit
|
17
|
+
end
|
18
|
+
|
19
|
+
desc 'build plan by testplan name, format documentation'
|
20
|
+
task :build_fancy,[:testplan] do |t, args|
|
21
|
+
Testplan::Build::plan_in_format args[:testplan].to_sym, :documentation
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
data/lib/testplan.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require "testplan/version"
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'date'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
spec = Gem::Specification.find_by_name 'testplan'
|
7
|
+
Dir.glob("#{spec.gem_dir}/lib/tasks/*.rake").each { |r| import r }
|
8
|
+
|
9
|
+
module Testplan
|
10
|
+
class Setup
|
11
|
+
|
12
|
+
def self.init(value)
|
13
|
+
$initconf = value
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class Build
|
19
|
+
def self.plan_in_format(plan, format)
|
20
|
+
config = $initconf.call
|
21
|
+
config[:testplans][plan].each do |tplan|
|
22
|
+
envarr = {}
|
23
|
+
config[:platforms][tplan].each do | k,v|
|
24
|
+
envarr[k.to_s] = v unless k == :cases
|
25
|
+
end
|
26
|
+
|
27
|
+
envstring = make_env_string(envarr)
|
28
|
+
|
29
|
+
config[:platforms][tplan][:cases].each do | acase |
|
30
|
+
exec_string = "#{envstring}bundle exec rake #{format.to_s} SPEC_OPTS=\"-e #{acase}\""
|
31
|
+
print "\nRunning testcase #{acase} with ENV: #{envstring}\n"
|
32
|
+
system exec_string
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.make_env_string(envarr)
|
39
|
+
envstr=''
|
40
|
+
envarr.each do | varname,varvalue|
|
41
|
+
envstr+= "#{varname.upcase}='#{varvalue}' "
|
42
|
+
end
|
43
|
+
return envstr
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
if File.exists?('config/testplan.rb')
|
50
|
+
require File.join pwd, 'config/testplan.rb'
|
51
|
+
else
|
52
|
+
raise "Fatal: config/testplan.rb is missing."
|
53
|
+
end
|
data/testplan.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'testplan/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "testplan"
|
8
|
+
spec.version = Testplan::VERSION
|
9
|
+
spec.authors = ["Pim Snel"]
|
10
|
+
spec.email = ["pim@lingewoud.nl"]
|
11
|
+
spec.summary = %q{Test plans for rspec}
|
12
|
+
spec.description = %q{Rake tasks and DSL for organizing rspec cases with test plans and test platforms}
|
13
|
+
spec.homepage = "https://github.com/mipmip/testplan"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_runtime_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_runtime_dependency "rspec", "~> 3.1"
|
24
|
+
spec.add_runtime_dependency "rspec_testlink_formatters", "~> 0"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: testplan
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pim Snel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec_testlink_formatters
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Rake tasks and DSL for organizing rspec cases with test plans and test
|
70
|
+
platforms
|
71
|
+
email:
|
72
|
+
- pim@lingewoud.nl
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- CHANGELOG.md
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- lib/tasks/rspec.rake
|
84
|
+
- lib/tasks/testlink.rake
|
85
|
+
- lib/tasks/testplan.rake
|
86
|
+
- lib/testplan.rb
|
87
|
+
- lib/testplan/version.rb
|
88
|
+
- testplan.gemspec
|
89
|
+
homepage: https://github.com/mipmip/testplan
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.4.3
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Test plans for rspec
|
113
|
+
test_files: []
|