testplan 0.0.5 → 0.0.6

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: 4231b14121755a71e4103cb9360ac81169ab4170
4
- data.tar.gz: 407d1ae5ab9de3ca0c29b34d40abd076110aab12
3
+ metadata.gz: eb11766b6fe742f1c3fa30721246610641eb08ac
4
+ data.tar.gz: 4e66e9d4eeea35565c02c9fe187c23bbb25054dc
5
5
  SHA512:
6
- metadata.gz: e25bcdb0f36cf70efce08746751efb200c627647968481e5edebf8634ec736e9e1e1d2e2c17ff092e27a60eb3b98526a0ab2b1f3af5a32938a7c46d49ad1ddd5
7
- data.tar.gz: 4526196c296e83e5108335abf67f51f127645eb11f64179a83e21202ca684d445f9357c25f9259fc84b68f1332d725c7fdf20d806de038242cf761d6daaa5a29
6
+ metadata.gz: 9075c854ed750dabf246df1df256f641d5c9363bfefbf93246b17c737da7843cfef10efefa261f51f81546f79984073a38f9ad268088fd1df8d2c8dfff39b6e0
7
+ data.tar.gz: c4c7198d46527fffef1b400af01c628f3f3acb73fd93567b021a042885c3a3971b6bc673bf7f4b893295f19327711fdfc57ffbbedb635706ba7e96632e0687da
data/Rakefile CHANGED
@@ -1,2 +1,20 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'test'
6
+ t.pattern = "test/test_*.rb"
7
+ end
8
+
9
+ desc "Run tests"
10
+ task :default => :test
11
+
12
+ desc "fake task"
13
+ task :documentation do
14
+
15
+ print "\nFake rake task:\n"
16
+ print "EXEC: #{$0}\n"
17
+ print "ARGS: #{ARGV.join(' ')}\n"
18
+
19
+ end
2
20
 
@@ -0,0 +1,42 @@
1
+ # This testplan config file is for testing the testplan gem itself.
2
+
3
+ $some_shared_cases= %w(
4
+ case1
5
+ case3
6
+ case4
7
+ )
8
+ $more_shared_cases= %w(
9
+ case2
10
+ )
11
+
12
+ Testplan::Setup::init -> do {
13
+ multi_env: 0,
14
+ testplans: {
15
+ plan1: [
16
+ :platform01,
17
+ ],
18
+ plan2: [
19
+ :platform01,
20
+ :platform02,
21
+ ],
22
+ },
23
+ platforms: {
24
+ platform01: {
25
+ cases: $some_shared_cases,
26
+ baseurl: 'http://english-example.com',
27
+ lang: 'en_GB',
28
+ },
29
+ platform02: {
30
+ cases: $more_shared_cases,
31
+ baseurl: 'http://dutch-example.com',
32
+ lang: 'nl_NL',
33
+ },
34
+ platform03: {
35
+ cases: $more_shared_cases+$some_shared_cases,
36
+ baseurl: 'http://dutch-example.com',
37
+ lang: 'en_GB',
38
+ }
39
+
40
+ }
41
+ }
42
+ end
@@ -20,5 +20,16 @@ namespace :testplan do
20
20
  Testplan::Build::plan_in_format args[:testplan].to_sym, :junit, true
21
21
  end
22
22
 
23
+ desc 'run all cases from all platforms in plan at once by testplan name, format documentation'
24
+ task :run_plan,[:testplan] do |t, args|
25
+ Testplan::Build::plan_in_format args[:testplan].to_sym, :documentation, true
26
+ end
27
+
28
+ desc 'run all cases from platform at once by platform name, format documentation'
29
+ task :run_platform,[:platform] do |t, args|
30
+ Testplan::Build::platform_in_format args[:testplan].to_sym, :documentation, true
31
+ end
32
+
33
+
23
34
  end
24
35
 
@@ -15,68 +15,97 @@ module Testplan
15
15
  end
16
16
 
17
17
  class Build
18
+
18
19
  def self.plan_in_format(plan, format, execute_all_at_once = false)
19
- exitcode = 0
20
+ self.init
21
+ validate_plan_name(plan)
22
+ exec_strings = []
23
+ @@config[:testplans][plan].each do |platform|
24
+ exec_strings += self.build_platform_exec_strings(platform, format, execute_all_at_once)
25
+ end
20
26
 
21
- config = $initconf.call
27
+ return self.execute_strings(exec_strings)
22
28
 
23
- validate_plan_name(config, plan)
29
+ end
24
30
 
25
- config[:testplans][plan].each do |tplan|
26
- envarr = {}
27
- config[:platforms][tplan].each do | k,v|
28
- envarr[k.to_s] = v unless k == :cases
29
- end
31
+ def self.platform_in_format(platform, format, execute_all_at_once = false)
32
+ self.init
33
+ exec_strings = self.build_platform_exec_strings(platform, format, execute_all_at_once)
34
+ return self.execute_strings(exec_strings)
35
+ end
30
36
 
31
- envstring = make_env_string(envarr)
37
+ def self.init
38
+ @@config = $initconf.call
39
+ end
32
40
 
33
- if execute_all_at_once
34
- print "\nRunning all testcases at once with ENV: #{envstring}\n"
35
- exec_string = "#{envstring}bundle exec rake #{format.to_s} SPEC_OPTS=\""
36
- config[:platforms][tplan][:cases].each do | acase |
41
+ def self.build_platform_exec_strings(platform, format, execute_all_at_once)
42
+ envstring = make_env_string(platform)
43
+ estrings = []
37
44
 
38
- exec_string += " -e #{acase} "
39
- print " - testcase #{acase}\n"
45
+ if execute_all_at_once
40
46
 
41
- end
47
+ print "\nRunning all testcases at once with ENV: #{envstring}\n"
42
48
 
43
- exec_string += "\""
44
- exitcode = 1 unless system exec_string
49
+ exec_string = "#{envstring}bundle exec rake #{format.to_s} SPEC_OPTS=\""
50
+ @@config[:platforms][platform][:cases].each do | acase |
45
51
 
46
- else
47
- config[:platforms][tplan][:cases].each do | acase |
52
+ exec_string += " -e #{acase} "
53
+ print " - testcase #{acase}\n"
54
+ end
48
55
 
49
- exec_string = "#{envstring}bundle exec rake #{format.to_s} SPEC_OPTS=\"-e #{acase}\""
50
- print "\nRunning testcase #{acase} with ENV: #{envstring}\n"
56
+ exec_string += "\""
57
+ estrings << exec_string
51
58
 
52
- exitcode += 1 unless system exec_string
53
- end
59
+ else
60
+ @@config[:platforms][platform][:cases].each do | acase |
54
61
 
62
+ exec_string = "#{envstring}bundle exec rake #{format.to_s} SPEC_OPTS=\"-e #{acase}\""
63
+ print "\nRunning testcase #{acase} with ENV: #{envstring}\n"
64
+
65
+ estrings << exec_string
55
66
  end
56
67
  end
57
68
 
58
- if exitcode == 1
69
+ estrings
70
+ end
71
+
72
+ def self.execute_strings(exec_strings)
73
+ exit_code = 0
74
+ exec_strings.each do |estring|
75
+ p estring
76
+ exit_code += 1 unless system estring
77
+ end
78
+
79
+ if exit_code == 1
59
80
  raise 'At least one test failed'
60
- elsif exitcode > 1
61
- raise "There were #{exitcode} failed tests."
81
+ elsif exit_code > 1
82
+ raise "There were #{exit_code} failed tests."
62
83
  end
63
84
 
64
- return exitcode
85
+ exit_code
65
86
  end
66
87
 
67
- def self.validate_plan_name(config, plan_name)
68
- if !config[:testplans].has_key?(plan_name)
88
+
89
+ def self.validate_plan_name(plan_name)
90
+ if !@@config[:testplans].has_key?(plan_name)
69
91
  raise 'Plan name does not exist'
70
92
  end
71
93
  end
72
94
 
73
- def self.make_env_string(envarr)
95
+ def self.make_env_string(platform)
96
+ envarr = {}
97
+ @@config[:platforms][platform].each do | k,v|
98
+ envarr[k.to_s] = v unless k == :cases
99
+ end
100
+
74
101
  case RbConfig::CONFIG['host_os']
75
102
  when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
76
103
  envstring = make_env_string_win(envarr)
77
104
  else
78
105
  envstring = make_env_string_unix(envarr)
79
106
  end
107
+
108
+ envstring
80
109
  end
81
110
 
82
111
  def self.make_env_string_unix(envarr)
@@ -94,8 +123,6 @@ module Testplan
94
123
  end
95
124
  return envstr
96
125
  end
97
-
98
-
99
126
  end
100
127
  end
101
128
 
@@ -106,3 +133,4 @@ if File.basename($0).to_s != 'testplan'
106
133
  raise "Fatal: config/testplan.rb is missing."
107
134
  end
108
135
  end
136
+
@@ -1,3 +1,3 @@
1
1
  module Testplan
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -0,0 +1,19 @@
1
+ require 'simplecov'
2
+ #require 'thor'
3
+ #require 'timeout'
4
+
5
+ SimpleCov.start do
6
+ add_filter '/test/'
7
+ add_filter '/vendor/'
8
+ end
9
+
10
+ require 'testplan'
11
+
12
+ require 'minitest'
13
+ require 'minitest/unit'
14
+ require 'minitest/autorun'
15
+ require 'minitest/pride'
16
+
17
+ #require "codeclimate-test-reporter"
18
+ #CodeClimate::TestReporter.start
19
+
@@ -0,0 +1,21 @@
1
+ require 'test_helper'
2
+
3
+ class TestTestPlan < Minitest::Test
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_build_testplan
9
+ out, _ = capture_io do
10
+ Testplan::Build::plan_in_format 'plan1'.to_sym, :documentation, true
11
+ end
12
+ assert_match(/case1/, out)
13
+ end
14
+
15
+ def test_build_testplatform
16
+ out, _ = capture_io do
17
+ Testplan::Build::platform_in_format 'platform02'.to_sym, :documentation, true
18
+ end
19
+ assert_match(/case2/, out)
20
+ end
21
+ end
@@ -19,7 +19,10 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
- spec.add_runtime_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "simplecov", "~> 0.10"
24
+ spec.add_development_dependency "minitest", "~> 5.1"
25
+
23
26
  spec.add_runtime_dependency "thor", "~> 0.19"
24
27
  spec.add_runtime_dependency "rspec", "~> 3"
25
28
  spec.add_runtime_dependency "rspec_testlink_formatters", "~> 0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testplan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pim Snel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-19 00:00:00.000000000 Z
11
+ date: 2015-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -31,13 +31,41 @@ dependencies:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
- type: :runtime
34
+ type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.10'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.10'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.1'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: thor
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -96,10 +124,13 @@ files:
96
124
  - README.md
97
125
  - Rakefile
98
126
  - bin/testplan
127
+ - config/testplan.rb
99
128
  - lib/tasks/rspec.rake
100
129
  - lib/tasks/testplan.rake
101
130
  - lib/testplan.rb
102
131
  - lib/testplan/version.rb
132
+ - test/test_helper.rb
133
+ - test/test_mainclass.rb
103
134
  - testplan.gemspec
104
135
  homepage: https://github.com/mipmip/testplan
105
136
  licenses:
@@ -125,4 +156,6 @@ rubygems_version: 2.4.3
125
156
  signing_key:
126
157
  specification_version: 4
127
158
  summary: Test plans for rspec
128
- test_files: []
159
+ test_files:
160
+ - test/test_helper.rb
161
+ - test/test_mainclass.rb