rutema 1.3.0 → 2.0.0.pre
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/History.txt +204 -194
- data/Manifest.txt +15 -48
- data/README.md +55 -61
- data/bin/rutema +7 -7
- data/lib/rutema/application.rb +61 -0
- data/lib/rutema/core/configuration.rb +195 -0
- data/lib/rutema/core/engine.rb +186 -0
- data/lib/rutema/core/framework.rb +28 -0
- data/lib/rutema/{objectmodel.rb → core/objectmodel.rb} +43 -48
- data/lib/rutema/core/parser.rb +35 -0
- data/lib/rutema/core/reporter.rb +105 -0
- data/lib/rutema/core/runner.rb +83 -0
- data/lib/rutema/elements/minimal.rb +47 -44
- data/lib/rutema/parsers/xml.rb +154 -186
- data/lib/rutema/version.rb +9 -0
- metadata +39 -108
- data/README.txt +0 -44
- data/Rakefile +0 -30
- data/examples/README.md +0 -17
- data/examples/config/database.rutema +0 -17
- data/examples/config/full.rutema +0 -27
- data/examples/config/minimal.rutema +0 -10
- data/examples/specs/T001.spec +0 -8
- data/examples/specs/T002.spec +0 -8
- data/examples/specs/T003.spec +0 -8
- data/examples/specs/T004.spec +0 -8
- data/examples/specs/T005.spec +0 -10
- data/examples/specs/T006.spec +0 -9
- data/examples/specs/check.spec +0 -8
- data/examples/specs/fail.spec +0 -9
- data/examples/specs/include.scenario +0 -5
- data/examples/specs/rutema.spec +0 -10
- data/examples/specs/setup.spec +0 -8
- data/examples/specs/teardown.spec +0 -8
- data/lib/rutema/configuration.rb +0 -173
- data/lib/rutema/models/activerecord.rb +0 -159
- data/lib/rutema/models/base.rb +0 -5
- data/lib/rutema/parsers/base.rb +0 -45
- data/lib/rutema/rake.rb +0 -62
- data/lib/rutema/reporters/activerecord.rb +0 -82
- data/lib/rutema/reporters/base.rb +0 -23
- data/lib/rutema/reporters/email.rb +0 -84
- data/lib/rutema/reporters/text.rb +0 -77
- data/lib/rutema/runners/default.rb +0 -157
- data/lib/rutema/runners/step.rb +0 -23
- data/lib/rutema/system.rb +0 -302
- data/test/data/duplicate_name.spec +0 -8
- data/test/data/no_title.spec +0 -5
- data/test/data/sample.spec +0 -8
- data/test/data/test_identifiers.rutema +0 -7
- data/test/test_activerecord.rb +0 -0
- data/test/test_configuration.rb +0 -43
- data/test/test_objectmodel.rb +0 -82
- data/test/test_parsers.rb +0 -131
- data/test/test_reporters.rb +0 -115
- data/test/test_runners.rb +0 -70
- data/test/test_system.rb +0 -45
data/test/data/no_title.spec
DELETED
data/test/data/sample.spec
DELETED
data/test/test_activerecord.rb
DELETED
Binary file
|
data/test/test_configuration.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
|
-
require 'test/unit'
|
3
|
-
require 'rutema/configuration'
|
4
|
-
#$DEBUG=true
|
5
|
-
module TestRutema
|
6
|
-
class TestRutemaConfigurator<Test::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
@prev_dir=Dir.pwd
|
9
|
-
Dir.chdir(File.dirname(__FILE__))
|
10
|
-
end
|
11
|
-
def teardown
|
12
|
-
Dir.chdir(@prev_dir)
|
13
|
-
end
|
14
|
-
def test_rutema_configuration
|
15
|
-
cfg=nil
|
16
|
-
#load the valid configuration
|
17
|
-
assert_nothing_raised() { cfg=Rutema::RutemaConfigurator.new("../examples/config/full.rutema").configuration}
|
18
|
-
assert_not_nil(cfg.parser)
|
19
|
-
assert_not_nil(cfg.reporters)
|
20
|
-
assert_equal(1, cfg.reporters.size)
|
21
|
-
assert_not_nil(cfg.tools)
|
22
|
-
assert_not_nil(cfg.tools.test[:configuration])
|
23
|
-
assert_not_nil(cfg.tools.test[:path])
|
24
|
-
assert_equal("test", cfg.tools.test[:name])
|
25
|
-
assert_not_nil(cfg.paths)
|
26
|
-
assert_not_nil(cfg.paths.test)
|
27
|
-
assert_not_nil(cfg.setup)
|
28
|
-
assert_not_nil(cfg.teardown)
|
29
|
-
assert_not_nil(cfg.check)
|
30
|
-
assert_not_nil(cfg.tests)
|
31
|
-
assert_not_nil(cfg.context)
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_specification_paths
|
35
|
-
cfg=Rutema::RutemaConfigurator.new("data/test_identifiers.rutema").configuration
|
36
|
-
assert_not_nil(cfg.tests)
|
37
|
-
assert(File.exists?(cfg.tests[0]))
|
38
|
-
assert(File.exists?(cfg.tests[2]))
|
39
|
-
assert(cfg.tests.include?('22345'))
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
end
|
data/test/test_objectmodel.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
|
-
require 'test/unit'
|
3
|
-
require 'rutema/objectmodel'
|
4
|
-
module TestRutema
|
5
|
-
class DummyCommand
|
6
|
-
include Patir::Command
|
7
|
-
def initialize
|
8
|
-
@name="dummy"
|
9
|
-
@output="output"
|
10
|
-
@error="error"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
class Dummy
|
14
|
-
include Rutema::SpecificationElement
|
15
|
-
end
|
16
|
-
class TestStep<Test::Unit::TestCase
|
17
|
-
def test_new
|
18
|
-
step=Rutema::TestStep.new("test step",DummyCommand.new())
|
19
|
-
assert(!step.attended?, "attended?")
|
20
|
-
assert_not_equal("dummy", step.name)
|
21
|
-
assert(/step - .*DummyCommand.*/=~step.name)
|
22
|
-
assert_equal("output", step.output)
|
23
|
-
assert_equal("error", step.error)
|
24
|
-
assert_equal(:not_executed, step.status)
|
25
|
-
assert_nothing_raised() { step.run }
|
26
|
-
assert_equal(:success, step.status)
|
27
|
-
assert_nothing_raised() { step.reset }
|
28
|
-
assert_equal(:not_executed, step.status)
|
29
|
-
assert_equal("", step.output)
|
30
|
-
assert(/0 - step - .*DummyCommand.*- not_executed/=~step.to_s)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
class TestSpecification<Test::Unit::TestCase
|
34
|
-
def test_new
|
35
|
-
spec=Rutema::TestSpecification.new(:name=>"name",:title=>"title",:description=>"description")
|
36
|
-
assert_equal("name", spec.name)
|
37
|
-
assert_equal("title", spec.title)
|
38
|
-
assert_equal("description", spec.description)
|
39
|
-
assert_not_nil(spec.scenario)
|
40
|
-
assert(spec.requirements.empty?)
|
41
|
-
assert_equal("name - title", spec.to_s)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
class TestScenario<Test::Unit::TestCase
|
45
|
-
def test_new
|
46
|
-
scenario=Rutema::TestScenario.new
|
47
|
-
assert(scenario.steps.empty?)
|
48
|
-
assert(!scenario.attended?)
|
49
|
-
end
|
50
|
-
def test_add_step
|
51
|
-
step=Rutema::TestStep.new("test step",DummyCommand.new())
|
52
|
-
scenario=Rutema::TestScenario.new
|
53
|
-
scenario.add_step(step)
|
54
|
-
assert_equal(1,scenario.steps.size)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
class TestSpecificationElement<Test::Unit::TestCase
|
58
|
-
def test_attribute
|
59
|
-
obj=Dummy.new
|
60
|
-
assert_raise(NoMethodError) { obj.name }
|
61
|
-
obj.attribute(:name,"name")
|
62
|
-
assert(obj.has_name?)
|
63
|
-
assert_equal(obj.name, "name")
|
64
|
-
assert_raise(NoMethodError) { obj.bool }
|
65
|
-
obj.attribute(:bool,true)
|
66
|
-
assert(obj.bool?)
|
67
|
-
assert_equal(true, obj.bool)
|
68
|
-
assert_raise(NoMethodError) { obj.text_bool }
|
69
|
-
obj.attribute(:text_bool,"true")
|
70
|
-
assert(obj.text_bool?)
|
71
|
-
assert_not_equal(true, obj.text_bool)
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_method_missing
|
75
|
-
obj=Dummy.new
|
76
|
-
assert_raise(NoMethodError) { obj.name }
|
77
|
-
obj.name="name"
|
78
|
-
assert(obj.has_name?)
|
79
|
-
assert_equal(obj.name, "name")
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
data/test/test_parsers.rb
DELETED
@@ -1,131 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),'..','lib')
|
2
|
-
require 'test/unit'
|
3
|
-
require 'ostruct'
|
4
|
-
require 'mocha/setup'
|
5
|
-
require 'rutema/parsers/xml'
|
6
|
-
|
7
|
-
#$DEBUG=true
|
8
|
-
module TestRutema
|
9
|
-
class TestSpecificationParser<Test::Unit::TestCase
|
10
|
-
def test_specification_parser
|
11
|
-
parser=nil
|
12
|
-
assert_nothing_raised() { parser=Rutema::SpecificationParser.new({}) }
|
13
|
-
assert_not_nil(parser)
|
14
|
-
assert(!parser.configuration.empty?)
|
15
|
-
assert_raise(Rutema::ParserError) { parser.parse_specification("foo") }
|
16
|
-
end
|
17
|
-
end
|
18
|
-
class TestBaseXMlParser<Test::Unit::TestCase
|
19
|
-
SAMPLE_SPEC=<<-EOT
|
20
|
-
<specification name="sample">
|
21
|
-
<title>Title</title>
|
22
|
-
<description>Description</description>
|
23
|
-
<scenario>
|
24
|
-
<step/>
|
25
|
-
<another_step script="script"/>
|
26
|
-
</scenario>
|
27
|
-
</specification>
|
28
|
-
EOT
|
29
|
-
INCLUDE_SPEC=<<-EOT
|
30
|
-
<specification name="include">
|
31
|
-
<title>Title</title>
|
32
|
-
<description>Description</description>
|
33
|
-
<scenario>
|
34
|
-
<step/>
|
35
|
-
<include_scenario file="#{File.expand_path(File.dirname(__FILE__))}/../examples/specs/include.scenario"/>
|
36
|
-
</scenario>
|
37
|
-
</specification>
|
38
|
-
EOT
|
39
|
-
BAD_INCLUDE_SPEC=<<-EOT
|
40
|
-
<specification name="bad_include">
|
41
|
-
<title>Title</title>
|
42
|
-
<description>Description</description>
|
43
|
-
<scenario>
|
44
|
-
<include_scenario file=unknown.scenario"/>
|
45
|
-
</scenario>
|
46
|
-
</specification>
|
47
|
-
EOT
|
48
|
-
MISSING_INCLUDE_SPEC=<<-EOT
|
49
|
-
<specification name="bad_include">
|
50
|
-
<title>Title</title>
|
51
|
-
<description>Description</description>
|
52
|
-
<scenario>
|
53
|
-
<include_scenario/>
|
54
|
-
</scenario>
|
55
|
-
</specification>
|
56
|
-
EOT
|
57
|
-
|
58
|
-
def test_parse_specification
|
59
|
-
parser=Rutema::BaseXMLParser.new({})
|
60
|
-
specification=parser.parse_specification(SAMPLE_SPEC)
|
61
|
-
assert_equal("sample",specification.name)
|
62
|
-
assert_equal("Description", specification.description)
|
63
|
-
assert_equal("Title", specification.title)
|
64
|
-
assert(specification.scenario)
|
65
|
-
assert_equal(2, specification.scenario.steps.size)
|
66
|
-
assert_equal(1, specification.scenario.steps[0].number)
|
67
|
-
assert_equal("another_step", specification.scenario.steps[1].step_type)
|
68
|
-
assert_equal("script", specification.scenario.steps[1].script)
|
69
|
-
assert_equal(2, specification.scenario.steps[1].number)
|
70
|
-
assert_raise(Rutema::ParserError) { parser.parse_specification("") }
|
71
|
-
assert_raise(Rutema::ParserError) { parser.parse_specification("missing.spec") }
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_include
|
75
|
-
parser=Rutema::BaseXMLParser.new({})
|
76
|
-
specification=parser.parse_specification(INCLUDE_SPEC)
|
77
|
-
assert_equal(3, specification.scenario.steps.size)
|
78
|
-
assert(specification.scenario.steps[2].has_included_in?)
|
79
|
-
assert_raise(Rutema::ParserError) { parser.parse_specification(BAD_INCLUDE_SPEC) }
|
80
|
-
assert_raise(Rutema::ParserError) { parser.parse_specification(MISSING_INCLUDE_SPEC) }
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
84
|
-
class TestExtensibleXMlParser<Test::Unit::TestCase
|
85
|
-
SAMPLE_SPEC=<<-EOT
|
86
|
-
<specification name="sample">
|
87
|
-
<title>Title</title>
|
88
|
-
<description>Description</description>
|
89
|
-
<scenario>
|
90
|
-
<step/>
|
91
|
-
<another_step script="script"/>
|
92
|
-
</scenario>
|
93
|
-
</specification>
|
94
|
-
EOT
|
95
|
-
def test_parse_specification
|
96
|
-
parser=Rutema::ExtensibleXMLParser.new({})
|
97
|
-
assert_not_nil(parser.configuration)
|
98
|
-
specification=nil
|
99
|
-
assert_nothing_raised() { specification=parser.parse_specification(SAMPLE_SPEC) }
|
100
|
-
assert_equal(2, specification.scenario.steps.size)
|
101
|
-
end
|
102
|
-
def test_parse_error
|
103
|
-
parser=Rutema::ExtensibleXMLParser.new({})
|
104
|
-
assert_not_nil(parser.configuration)
|
105
|
-
specification=nil
|
106
|
-
assert_raise(Rutema::ParserError) { specification=parser.parse_specification("<") }
|
107
|
-
end
|
108
|
-
end
|
109
|
-
class TestMinimalXMlParser<Test::Unit::TestCase
|
110
|
-
SAMPLE_SPEC=<<-EOT
|
111
|
-
<specification name="sample">
|
112
|
-
<title>Title</title>
|
113
|
-
<description>Description</description>
|
114
|
-
<scenario>
|
115
|
-
<echo/>
|
116
|
-
<command cmd="l"/>
|
117
|
-
</scenario>
|
118
|
-
</specification>
|
119
|
-
EOT
|
120
|
-
def test_parse_specification
|
121
|
-
parser=Rutema::MinimalXMLParser.new({})
|
122
|
-
specification=nil
|
123
|
-
assert_nothing_raised() { specification=parser.parse_specification(SAMPLE_SPEC) }
|
124
|
-
assert_not_nil(specification)
|
125
|
-
assert_equal(2, specification.scenario.steps.size)
|
126
|
-
assert_equal("Description", specification.description)
|
127
|
-
assert_equal("Title", specification.title)
|
128
|
-
assert_equal("sample", specification.name)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
data/test/test_reporters.rb
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),"..",'lib')
|
2
|
-
require 'test/unit'
|
3
|
-
require 'ostruct'
|
4
|
-
require 'fileutils'
|
5
|
-
require 'rutema/reporters/base'
|
6
|
-
require 'rutema/reporters/email'
|
7
|
-
require 'rutema/reporters/text'
|
8
|
-
require 'mocha/setup'
|
9
|
-
#$DEBUG=true
|
10
|
-
module TestRutema
|
11
|
-
class MockCommand
|
12
|
-
include Patir::Command
|
13
|
-
def initialize number
|
14
|
-
@number=number
|
15
|
-
end
|
16
|
-
end
|
17
|
-
class TestEmailReporter<Test::Unit::TestCase
|
18
|
-
def setup
|
19
|
-
@parse_errors=[{:filename=>"f.spec",:error=>"error"}]
|
20
|
-
st=Patir::CommandSequenceStatus.new("test_seq")
|
21
|
-
st.step=MockCommand.new(1)
|
22
|
-
st.step=MockCommand.new(2)
|
23
|
-
st.step=MockCommand.new(3)
|
24
|
-
@status=[st]
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_new
|
28
|
-
spec=mock()
|
29
|
-
spec.expects(:title).returns("A test sequence")
|
30
|
-
specs={"test_seq"=>spec}
|
31
|
-
definition={:server=>"localhost",:port=>25,:recipients=>["test"],:sender=>"rutema",:subject=>"test",:footer=>"footer"}
|
32
|
-
r=Rutema::EmailReporter.new(definition)
|
33
|
-
Net::SMTP.expects(:start).times(2)
|
34
|
-
assert_nothing_raised() { puts r.report(specs,@status,@parse_errors,nil) }
|
35
|
-
assert_nothing_raised() { puts r.report(specs,[],[],nil) }
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_multiple_scenarios
|
39
|
-
#The status mocks
|
40
|
-
status1=status_mock("test6. Status - error. States 3\nStep status summary:\n\t1:'echo' - success\n\t2:'check' - warning\n\t3:'try' - error",6,"T2",:error)
|
41
|
-
|
42
|
-
status2=status_mock("test10. Status - success. States 3\nStep status summary:\n\t1:'echo' - success\n\t2:'check' - success\n\t3:'try' - success",10,"T1",:success)
|
43
|
-
status3=status_mock("testNil. Status - success. States 3\nStep status summary:\n\t1:'echo' - success\n\t2:'check' - success\n\t3:'try' - success",nil,nil,:success)
|
44
|
-
status4=status_mock("test10s. Status - success. States 3\nStep status summary:\n\t1:'echo' - success\n\t2:'check' - success\n\t3:'try' - success","10s","Setup",:success)
|
45
|
-
status5=status_mock("test60. Status - error. States 3\nStep status summary:\n\t1:'echo' - success\n\t2:'check' - warning\n\t3:'try' - error",60,"T1",:error)
|
46
|
-
stati=[status1,status2,status3,status4,status5]
|
47
|
-
#mock the mailing code
|
48
|
-
definition={:server=>"localhost",:port=>25,:recipients=>["test"],:sender=>"rutema",:subject=>"test"}
|
49
|
-
r=Rutema::EmailReporter.new(definition)
|
50
|
-
Net::SMTP.expects(:start)
|
51
|
-
#The specification mocks
|
52
|
-
spec1=mock()
|
53
|
-
spec1.expects(:title).times(2).returns("T1")
|
54
|
-
spec2=mock()
|
55
|
-
spec2.expects(:title).returns("T2")
|
56
|
-
specs={"T1"=>spec1, "T2"=>spec2}
|
57
|
-
assert_nothing_raised() { puts r.report(specs,stati,@parse_errors,nil) }
|
58
|
-
end
|
59
|
-
|
60
|
-
def status_mock summary,id,name,state
|
61
|
-
ret=mock()
|
62
|
-
ret.stubs(:summary).returns(summary)
|
63
|
-
ret.stubs(:sequence_id).returns(id)
|
64
|
-
if name
|
65
|
-
ret.stubs(:sequence_name).returns(name)
|
66
|
-
else
|
67
|
-
ret.stubs(:sequence_name).returns(name)
|
68
|
-
end
|
69
|
-
ret.stubs(:status).returns(state)
|
70
|
-
return ret
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
class TestTextReporter<Test::Unit::TestCase
|
75
|
-
def setup
|
76
|
-
@parse_errors=[{:filename=>"f.spec",:error=>"error"}]
|
77
|
-
st=Patir::CommandSequenceStatus.new("test_seq")
|
78
|
-
st.step=MockCommand.new(1)
|
79
|
-
st.step=MockCommand.new(2)
|
80
|
-
st.step=MockCommand.new(3)
|
81
|
-
@status=[st]
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_no_errors
|
85
|
-
spec=mock
|
86
|
-
spec.stubs(:title).returns("T")
|
87
|
-
r=Rutema::TextReporter.new
|
88
|
-
assert_nothing_raised() { puts r.report({"0"=>spec},[runner_state_mock],[],nil) }
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_a_bit_of_everything
|
92
|
-
spec=mock
|
93
|
-
spec.stubs(:title).returns("T")
|
94
|
-
r=Rutema::TextReporter.new
|
95
|
-
assert_nothing_raised() { puts r.report({"1"=>spec,"0"=>spec},[runner_state_mock,runner_state_mock(1,:success)],[],nil)}
|
96
|
-
end
|
97
|
-
|
98
|
-
def scenario_mock id,no_summary=false
|
99
|
-
ret = mock()
|
100
|
-
ret.expects(:sequence_id).returns(id)
|
101
|
-
ret.expects(:sequence_name).returns("test").times(2)
|
102
|
-
ret.expects(:summary).returns("summary") unless no_summary
|
103
|
-
return ret
|
104
|
-
end
|
105
|
-
|
106
|
-
def runner_state_mock n=0,status=:success,step_states=[]
|
107
|
-
rs=mock()
|
108
|
-
rs.expects(:sequence_name).returns("#{n}").times(3)
|
109
|
-
rs.expects(:sequence_id).returns("seq_id#{n}")
|
110
|
-
rs.expects(:status).returns(status).times(4)
|
111
|
-
rs.expects(:summary).returns("summary")
|
112
|
-
return rs
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
data/test/test_runners.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),"..",'lib')
|
2
|
-
require 'test/unit'
|
3
|
-
require 'ostruct'
|
4
|
-
require 'patir/command'
|
5
|
-
require 'mocha/setup'
|
6
|
-
|
7
|
-
require 'rutema/objectmodel'
|
8
|
-
require 'rutema/runners/default'
|
9
|
-
require 'rutema/runners/step'
|
10
|
-
|
11
|
-
#$DEBUG=true
|
12
|
-
module TestRutema
|
13
|
-
class TestRunner<Test::Unit::TestCase
|
14
|
-
def test_new
|
15
|
-
runner=Rutema::Runner.new
|
16
|
-
assert(!runner.attended?)
|
17
|
-
assert_nil(runner.setup)
|
18
|
-
assert_nil(runner.teardown)
|
19
|
-
assert(runner.states.empty?)
|
20
|
-
end
|
21
|
-
def test_run
|
22
|
-
runner=Rutema::Runner.new
|
23
|
-
scenario=Rutema::TestScenario.new
|
24
|
-
state1=runner.run("test1",scenario)
|
25
|
-
state2=runner.run("test2",scenario)
|
26
|
-
assert_equal(state1, runner["test1"])
|
27
|
-
assert_equal(state2, runner["test2"])
|
28
|
-
assert_equal(2, runner.states.size)
|
29
|
-
state2=runner.run("test2",scenario)
|
30
|
-
assert_equal(2, runner.states.size)
|
31
|
-
end
|
32
|
-
def test_run_exceptions
|
33
|
-
runner=Rutema::Runner.new
|
34
|
-
scenario=Rutema::TestScenario.new
|
35
|
-
step=Rutema::TestStep.new("bad",Patir::RubyCommand.new("bad"){|cmd| raise "Bad command"})
|
36
|
-
scenario.add_step(step)
|
37
|
-
state1=:success
|
38
|
-
assert_nothing_raised() { state1=runner.run("test1",scenario) }
|
39
|
-
assert_equal(:error, state1.status)
|
40
|
-
end
|
41
|
-
def test_reset
|
42
|
-
runner=Rutema::Runner.new
|
43
|
-
scenario=Rutema::TestScenario.new
|
44
|
-
state1=runner.run("test1",scenario)
|
45
|
-
state2=runner.run("test2",scenario)
|
46
|
-
assert_equal(2, runner.states.size)
|
47
|
-
runner.reset
|
48
|
-
assert(runner.states.empty?)
|
49
|
-
end
|
50
|
-
def test_ignore
|
51
|
-
step=OpenStruct.new("status"=>:not_executed)
|
52
|
-
step.stubs(:number).returns(1)
|
53
|
-
step.stubs(:name).returns("mock")
|
54
|
-
step.stubs(:step_type).returns("mock")
|
55
|
-
step.stubs(:output).returns("mock")
|
56
|
-
step.stubs(:error).returns("")
|
57
|
-
step.stubs(:strategy).returns(:attended)
|
58
|
-
step.stubs(:exec_time).returns(12)
|
59
|
-
step.stubs(:has_cmd?).returns(false)
|
60
|
-
step.expects(:ignore?).returns(true)
|
61
|
-
step.expects(:status).times(6).returns(:not_executed).then.returns(:not_executed).then.returns(:error).then.returns(:warning).then.returns(:warning).then.returns(:warning)
|
62
|
-
scenario=Rutema::TestScenario.new
|
63
|
-
scenario.expects(:attended?).returns(false)
|
64
|
-
scenario.stubs(:steps).returns([step])
|
65
|
-
runner=Rutema::Runner.new
|
66
|
-
runner.run("ignore",scenario)
|
67
|
-
assert(runner.success?,"run is not a success")
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|