sapphire 0.0.11 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sapphire.rb +2 -0
- data/lib/sapphire/DSL/Browser/List.rb +1 -1
- data/lib/sapphire/DSL/Scenarios/runner.rb +10 -0
- data/lib/sapphire/DSL/TestPlans/Covers.rb +9 -0
- data/lib/sapphire/DSL/TestPlans/FileHandler.rb +12 -0
- data/lib/sapphire/DSL/TestPlans/PathHandler.rb +12 -0
- data/lib/sapphire/DSL/TestPlans/Run.rb +9 -0
- data/lib/sapphire/DSL/TestPlans/TestPlan.rb +59 -0
- data/lib/sapphire/version.rb +1 -1
- metadata +13 -8
data/lib/sapphire.rb
CHANGED
@@ -17,6 +17,7 @@ Dir[File.dirname(__FILE__) + '/sapphire/DSL/Browser/*.rb'].each {|file| require
|
|
17
17
|
Dir[File.dirname(__FILE__) + '/sapphire/DSL/Configuration/*.rb'].each {|file| require file }
|
18
18
|
Dir[File.dirname(__FILE__) + '/sapphire/DSL/Data/*.rb'].each {|file| require file }
|
19
19
|
Dir[File.dirname(__FILE__) + '/sapphire/DSL/Scenarios/*.rb'].each {|file| require file }
|
20
|
+
Dir[File.dirname(__FILE__) + '/sapphire/DSL/TestPlans/*.rb'].each {|file| require file }
|
20
21
|
|
21
22
|
module Sapphire
|
22
23
|
module Sapphire
|
@@ -24,6 +25,7 @@ module Sapphire
|
|
24
25
|
include DSL::Browser
|
25
26
|
include DSL::Configuration
|
26
27
|
include DSL::Data
|
28
|
+
include DSL::TestPlans
|
27
29
|
include Configuration::AttrMethods
|
28
30
|
include Configuration
|
29
31
|
include DataAbstractions
|
@@ -3,6 +3,7 @@ module Sapphire
|
|
3
3
|
module Scenarios
|
4
4
|
class Runner
|
5
5
|
attr_accessor :scenarios
|
6
|
+
attr_accessor :test_plans
|
6
7
|
|
7
8
|
def self.create
|
8
9
|
@@instance ||= Runner.new
|
@@ -14,6 +15,7 @@ module Sapphire
|
|
14
15
|
|
15
16
|
def initialize
|
16
17
|
@scenarios = []
|
18
|
+
@test_plans = []
|
17
19
|
end
|
18
20
|
|
19
21
|
def add_scenario(scenario)
|
@@ -23,6 +25,14 @@ module Sapphire
|
|
23
25
|
def last_scenario
|
24
26
|
@scenarios.last
|
25
27
|
end
|
28
|
+
|
29
|
+
def add_test_plan(test_plan)
|
30
|
+
@test_plans << test_plan
|
31
|
+
end
|
32
|
+
|
33
|
+
def last_test_plan
|
34
|
+
@test_plans.last
|
35
|
+
end
|
26
36
|
end
|
27
37
|
end
|
28
38
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Sapphire
|
2
|
+
module DSL
|
3
|
+
module TestPlans
|
4
|
+
|
5
|
+
def TestPlan(text, &block)
|
6
|
+
Runner.instance.add_test_plan(TestPlan.new(text, &block))
|
7
|
+
Runner.instance.last_test_plan.execute
|
8
|
+
end
|
9
|
+
|
10
|
+
class TestPlan
|
11
|
+
|
12
|
+
attr_reader :block
|
13
|
+
attr_reader :value
|
14
|
+
attr_reader :text
|
15
|
+
|
16
|
+
def initialize(text, &block)
|
17
|
+
@value = text
|
18
|
+
@text = text.to_s
|
19
|
+
@block = block
|
20
|
+
|
21
|
+
@items = []
|
22
|
+
@handlers = []
|
23
|
+
@coverage = []
|
24
|
+
|
25
|
+
AddHandler :file => FileHandler.new
|
26
|
+
AddHandler :path => PathHandler.new
|
27
|
+
end
|
28
|
+
|
29
|
+
def Cover(item)
|
30
|
+
@coverage << item
|
31
|
+
end
|
32
|
+
|
33
|
+
def Add(item)
|
34
|
+
@items << item
|
35
|
+
end
|
36
|
+
|
37
|
+
def AddHandler(handler)
|
38
|
+
@handlers << handler
|
39
|
+
end
|
40
|
+
|
41
|
+
def execute
|
42
|
+
@block.call
|
43
|
+
@items.each do |item|
|
44
|
+
item.keys.each do |key|
|
45
|
+
@handlers.each do |handler|
|
46
|
+
handler.keys.each do |handler_key|
|
47
|
+
if(handler_key == key)
|
48
|
+
handler[handler_key].Handle item[key]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/sapphire/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sapphire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08-
|
12
|
+
date: 2011-08-29 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: albacore
|
16
|
-
requirement: &
|
16
|
+
requirement: &9396936 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *9396936
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: selenium-webdriver
|
27
|
-
requirement: &
|
27
|
+
requirement: &9396672 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *9396672
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: activesupport
|
38
|
-
requirement: &
|
38
|
+
requirement: &9396372 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *9396372
|
47
47
|
description: An automated web acceptance test framework for non-technical resources
|
48
48
|
using selenium-wedriver.
|
49
49
|
email:
|
@@ -109,6 +109,11 @@ files:
|
|
109
109
|
- lib/sapphire/DSL/Scenarios/scenario.rb
|
110
110
|
- lib/sapphire/DSL/Scenarios/then.rb
|
111
111
|
- lib/sapphire/DSL/Scenarios/when.rb
|
112
|
+
- lib/sapphire/DSL/TestPlans/Covers.rb
|
113
|
+
- lib/sapphire/DSL/TestPlans/FileHandler.rb
|
114
|
+
- lib/sapphire/DSL/TestPlans/PathHandler.rb
|
115
|
+
- lib/sapphire/DSL/TestPlans/Run.rb
|
116
|
+
- lib/sapphire/DSL/TestPlans/TestPlan.rb
|
112
117
|
- lib/sapphire/Testing/Executable.rb
|
113
118
|
- lib/sapphire/Testing/RakeTask.rb
|
114
119
|
- lib/sapphire/Testing/ResultList.rb
|