testmgr 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.idea/testmgr.iml +38 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/testmgr/base/abstract_test.rb +31 -0
- data/lib/testmgr/base/general_user.rb +27 -0
- data/lib/testmgr/base/test_case.rb +113 -0
- data/lib/testmgr/base/test_composite.rb +113 -0
- data/lib/testmgr/base/test_report.rb +329 -0
- data/lib/testmgr/base/testmgr/.gitignore +9 -0
- data/lib/testmgr/base/testmgr/.rspec +2 -0
- data/lib/testmgr/base/testmgr/.travis.yml +4 -0
- data/lib/testmgr/base/testmgr/CODE_OF_CONDUCT.md +13 -0
- data/lib/testmgr/base/testmgr/Gemfile +4 -0
- data/lib/testmgr/base/testmgr/LICENSE.txt +21 -0
- data/lib/testmgr/base/testmgr/README.md +41 -0
- data/lib/testmgr/base/testmgr/Rakefile +6 -0
- data/lib/testmgr/base/testmgr/bin/console +14 -0
- data/lib/testmgr/base/testmgr/bin/setup +7 -0
- data/lib/testmgr/base/testmgr/lib/testmgr/version.rb +3 -0
- data/lib/testmgr/base/testmgr/lib/testmgr.rb +5 -0
- data/lib/testmgr/base/testmgr/spec/spec_helper.rb +2 -0
- data/lib/testmgr/base/testmgr/spec/testmgr_spec.rb +8 -0
- data/lib/testmgr/base/testmgr/testmgr.gemspec +33 -0
- data/lib/testmgr/version.rb +3 -0
- data/lib/testmgr.rb +9 -0
- data/testmgr/.gitignore +9 -0
- data/testmgr/.rspec +2 -0
- data/testmgr/.travis.yml +4 -0
- data/testmgr/CODE_OF_CONDUCT.md +13 -0
- data/testmgr/Gemfile +4 -0
- data/testmgr/LICENSE.txt +21 -0
- data/testmgr/README.md +41 -0
- data/testmgr/Rakefile +6 -0
- data/testmgr/bin/console +14 -0
- data/testmgr/bin/setup +7 -0
- data/testmgr/lib/testmgr/version.rb +3 -0
- data/testmgr/lib/testmgr.rb +5 -0
- data/testmgr/spec/spec_helper.rb +2 -0
- data/testmgr/spec/testmgr_spec.rb +11 -0
- data/testmgr/testmgr.gemspec +33 -0
- data/testmgr.gemspec +34 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d38bbdcefbec61de7fa11b52080aca98d1a2d0f6
|
4
|
+
data.tar.gz: ddae17bf4f0eb2744ccd0858b66fc31510f24930
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 027eaeb8d757160294b4b8e9f4bb5b44cf2030a8bf0898543c6eba2b9a280a66bf7e0fbabf5961d39923fcbc105b28a63d085d6a2807f4959a26c18d16a15f81
|
7
|
+
data.tar.gz: 56c5cdc17b1df880673afb5297e19387fb5c836964537a26110d2c24e3af6fe264e812111cd13375bce642023f634ea4559759d6a22ecb9f44fe933a7029a4a4
|
data/.gitignore
ADDED
data/.idea/testmgr.iml
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="FacetManager">
|
4
|
+
<facet type="gem" name="Ruby Gem">
|
5
|
+
<configuration>
|
6
|
+
<option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
|
7
|
+
<option name="GEM_APP_TEST_PATH" value="" />
|
8
|
+
<option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
|
9
|
+
</configuration>
|
10
|
+
</facet>
|
11
|
+
</component>
|
12
|
+
<component name="NewModuleRootManager">
|
13
|
+
<content url="file://$MODULE_DIR$" />
|
14
|
+
<orderEntry type="inheritedJdk" />
|
15
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
16
|
+
<orderEntry type="module-library">
|
17
|
+
<library name="testmgr (v0.1.0, /Users/pkim/h20dragon/testmgr/testmgr) [path][gem]">
|
18
|
+
<CLASSES>
|
19
|
+
<root url="file://$MODULE_DIR$/testmgr/bin" />
|
20
|
+
<root url="file://$MODULE_DIR$/testmgr/lib" />
|
21
|
+
</CLASSES>
|
22
|
+
<SOURCES>
|
23
|
+
<root url="file://$MODULE_DIR$/testmgr/bin" />
|
24
|
+
<root url="file://$MODULE_DIR$/testmgr/lib" />
|
25
|
+
</SOURCES>
|
26
|
+
</library>
|
27
|
+
</orderEntry>
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.10.6, ruby-2.0.0-p481) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, ruby-2.0.0-p481) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v1.8.3, ruby-2.0.0-p481) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, ruby-2.0.0-p481) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.4.0, ruby-2.0.0-p481) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.4.0, ruby-2.0.0-p481) [gem]" level="application" />
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.4.0, ruby-2.0.0-p481) [gem]" level="application" />
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.4.0, ruby-2.0.0-p481) [gem]" level="application" />
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.4.0, ruby-2.0.0-p481) [gem]" level="application" />
|
37
|
+
</component>
|
38
|
+
</module>
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 h20dragon
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Testmgr
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/testmgr`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'testmgr'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install testmgr
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/testmgr. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "testmgr"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Testmgr
|
4
|
+
|
5
|
+
class AbstractTest
|
6
|
+
attr_reader :name
|
7
|
+
attr_reader :id
|
8
|
+
attr_reader :xpath
|
9
|
+
|
10
|
+
def initialize(name)
|
11
|
+
@name=name
|
12
|
+
@xpath=nil
|
13
|
+
@id=nil
|
14
|
+
end
|
15
|
+
|
16
|
+
# Virtual
|
17
|
+
def get_time_required
|
18
|
+
raise "Abstract"
|
19
|
+
end
|
20
|
+
# Virtual
|
21
|
+
def child(name)
|
22
|
+
raise 'Abstract'
|
23
|
+
end
|
24
|
+
# Virtual
|
25
|
+
def print
|
26
|
+
raise "Abstract"
|
27
|
+
end
|
28
|
+
|
29
|
+
end # Task
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
class GeneralUser
|
3
|
+
attr_accessor :login_id, :login_password, :role
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@login_id='lsmith@test.com'
|
7
|
+
@login_password='1qaz@WSX'
|
8
|
+
@role='PrescriberAgent'
|
9
|
+
end
|
10
|
+
|
11
|
+
def setLoginPassword(s=nil)
|
12
|
+
@login_password=s.to_s
|
13
|
+
end
|
14
|
+
|
15
|
+
def setLoginId(s=nil)
|
16
|
+
@login_id=s.to_s
|
17
|
+
end
|
18
|
+
|
19
|
+
def getLoginId()
|
20
|
+
@login_id
|
21
|
+
end
|
22
|
+
|
23
|
+
def getLoginPassword()
|
24
|
+
@login_password
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Testmgr
|
4
|
+
|
5
|
+
class TestCase < AbstractTest
|
6
|
+
attr_accessor :test_id, :id
|
7
|
+
attr_accessor :parent
|
8
|
+
attr_accessor :description
|
9
|
+
attr_accessor :assertions
|
10
|
+
attr_accessor :metrics
|
11
|
+
|
12
|
+
def initialize(_id, desc=nil)
|
13
|
+
@test_id=_id
|
14
|
+
@description=desc
|
15
|
+
|
16
|
+
@assertions=[]
|
17
|
+
@metrics={:passed => 0, :failed => 0, :skipped => 0, :total => 0 }
|
18
|
+
|
19
|
+
super(@test_id)
|
20
|
+
end
|
21
|
+
|
22
|
+
def getResult()
|
23
|
+
@metrics[:total] > 0 && @metrics[:passed] > 0 && @metrics[:failed]==0
|
24
|
+
end
|
25
|
+
|
26
|
+
def add(rc, desc)
|
27
|
+
@assertions << { :rc => rc, :description => desc }
|
28
|
+
|
29
|
+
if rc.nil?
|
30
|
+
@metrics[:skipped]+=1
|
31
|
+
elsif rc
|
32
|
+
@metrics[:passed]+=1
|
33
|
+
else
|
34
|
+
@metrics[:failed]+=1
|
35
|
+
end
|
36
|
+
|
37
|
+
@metrics[:total]+=1
|
38
|
+
end
|
39
|
+
|
40
|
+
def set_parent(parent)
|
41
|
+
# puts __FILE__ + (__LINE__).to_s + " TestComponent::set_parent"
|
42
|
+
@parent=parent
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_name
|
46
|
+
@test_id
|
47
|
+
end
|
48
|
+
|
49
|
+
def set_id(id)
|
50
|
+
@id=id
|
51
|
+
self
|
52
|
+
end
|
53
|
+
|
54
|
+
def set_name(name)
|
55
|
+
@test_id=name
|
56
|
+
self
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
def get_time_required
|
62
|
+
2.5
|
63
|
+
end
|
64
|
+
|
65
|
+
def total_number_basic_tasks
|
66
|
+
3
|
67
|
+
end
|
68
|
+
|
69
|
+
def child(name)
|
70
|
+
# puts __FILE__ + (__LINE__).to_s + " child(#{name}) matches #{@test_id} ??"
|
71
|
+
if name == @test_id
|
72
|
+
# puts __FILE__ + (__LINE__).to_s + "Matched #{name} (#{@test_id})"
|
73
|
+
return self
|
74
|
+
end
|
75
|
+
|
76
|
+
# puts __FILE__ + (__LINE__).to_s + " No match #{name} (#{@test_id})"
|
77
|
+
nil
|
78
|
+
end
|
79
|
+
|
80
|
+
def calcResult()
|
81
|
+
|
82
|
+
if @assertions.length < 1
|
83
|
+
return nil
|
84
|
+
end
|
85
|
+
|
86
|
+
rc=true
|
87
|
+
@assertions.each do |a|
|
88
|
+
rc = rc && a[:rc]
|
89
|
+
end
|
90
|
+
|
91
|
+
rc
|
92
|
+
end
|
93
|
+
|
94
|
+
def print
|
95
|
+
s="[requirement - #{parent.name}]:#{@test_id} - #{@description.to_s} : #{calcResult().to_s}"
|
96
|
+
|
97
|
+
if @id
|
98
|
+
s += ":#{@id}"
|
99
|
+
end
|
100
|
+
|
101
|
+
i=0
|
102
|
+
@assertions.each do |a|
|
103
|
+
s += "\n #{i}. " + a[:description].to_s + " : " + a[:rc].to_s
|
104
|
+
i+=1
|
105
|
+
end
|
106
|
+
|
107
|
+
puts s
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Testmgr
|
4
|
+
|
5
|
+
class TestComposite < AbstractTest
|
6
|
+
attr_accessor :name
|
7
|
+
attr_accessor :full_path
|
8
|
+
attr_accessor :parent
|
9
|
+
|
10
|
+
def initialize(name)
|
11
|
+
super(name)
|
12
|
+
@name=name
|
13
|
+
@sub_tasks=[]
|
14
|
+
@full_path = @name
|
15
|
+
@parent=nil
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_name
|
19
|
+
@name
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_parent
|
23
|
+
@parent
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_parents
|
27
|
+
_parents=""
|
28
|
+
_parents=@parent.get_name if @parent
|
29
|
+
|
30
|
+
_p=@parent
|
31
|
+
while _p && _p.get_parent do
|
32
|
+
_parents = "#{_p.get_parent.get_name} => " + _parents
|
33
|
+
_p=_p.get_parent
|
34
|
+
end
|
35
|
+
|
36
|
+
_parents
|
37
|
+
end
|
38
|
+
|
39
|
+
def set_parent(parent)
|
40
|
+
# puts __FILE__ + (__LINE__).to_s + " CompositeTask::set_parent"
|
41
|
+
@parent=parent
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_sub_task(task)
|
45
|
+
@sub_tasks << task
|
46
|
+
task.set_parent(self)
|
47
|
+
task
|
48
|
+
end
|
49
|
+
|
50
|
+
def add(r)
|
51
|
+
add_sub_task(r)
|
52
|
+
end
|
53
|
+
|
54
|
+
def remove_sub_task(task)
|
55
|
+
@sub_tasks.delete(task)
|
56
|
+
end
|
57
|
+
|
58
|
+
def get_time_required
|
59
|
+
time=0.0
|
60
|
+
@sub_tasks.each { |task| time += task.get_time_required }
|
61
|
+
end
|
62
|
+
|
63
|
+
def getResult()
|
64
|
+
rc=true
|
65
|
+
@sub_tasks.each do |task|
|
66
|
+
rc = rc && task.getResult()
|
67
|
+
end
|
68
|
+
|
69
|
+
rc
|
70
|
+
end
|
71
|
+
|
72
|
+
def print
|
73
|
+
# puts __FILE__ + (__LINE__).to_s + " -- print( #{@name} ) --"
|
74
|
+
@sub_tasks.each do |task|
|
75
|
+
# puts __FILE__ + (__LINE__).to_s + " ** #{task.class.to_s} **"
|
76
|
+
task.print
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def child(name)
|
81
|
+
# puts __FILE__ + (__LINE__).to_s + " [search child]:#{name}"
|
82
|
+
_child=nil
|
83
|
+
|
84
|
+
@sub_tasks.each { |task|
|
85
|
+
|
86
|
+
# puts __FILE__ + (__LINE__).to_s + " o task( #{task.get_name} ) => #{task.class.to_s}"
|
87
|
+
|
88
|
+
_c=task.child(name)
|
89
|
+
if _c
|
90
|
+
# puts __FILE__ + (__LINE__).to_s + " Found => Name:#{_c.name}"
|
91
|
+
_child=_c
|
92
|
+
end
|
93
|
+
}
|
94
|
+
_child
|
95
|
+
end
|
96
|
+
|
97
|
+
def get_child(name)
|
98
|
+
_c=child(name)
|
99
|
+
# puts __FILE__ + (__LINE__).to_s + " FOUND => #{_c.class.to_s} " + _c.name if _c
|
100
|
+
_c
|
101
|
+
end
|
102
|
+
|
103
|
+
# Any one of hose subtasks could itself be a huge composite with many
|
104
|
+
# of its own sub-subtasks.
|
105
|
+
def total_number_basic_tasks
|
106
|
+
total=0
|
107
|
+
@sub_tasks.each { |task| total += task.total_number_basic_tasks }
|
108
|
+
total
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|