dtest 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.
- data/Gemfile +3 -0
- data/LICENSE.txt +202 -0
- data/README.rdoc +26 -0
- data/Rakefile +21 -0
- data/VERSION +1 -0
- data/bin/dtest +4 -0
- data/dtest.gemspec +34 -0
- data/examples/sample.rb +130 -0
- data/lib/dtest.rb +0 -0
- data/lib/dtest/command.rb +33 -0
- data/lib/dtest/core.rb +257 -0
- data/lib/dtest/dsl.rb +19 -0
- data/lib/dtest/failure.rb +27 -0
- data/lib/dtest/global.rb +91 -0
- data/lib/dtest/progress.rb +166 -0
- data/lib/dtest/report.rb +121 -0
- data/lib/dtest/result.rb +189 -0
- data/lib/dtest/runner.rb +22 -0
- data/lib/dtest/test.rb +212 -0
- data/lib/dtest/util.rb +43 -0
- data/lib/dtest/version.rb +5 -0
- data/spec/test_abort_spec.rb +772 -0
- data/spec/test_assert_spec.rb +146 -0
- data/spec/test_exception_spec.rb +303 -0
- data/spec/test_expect_spec.rb +288 -0
- data/spec/test_spec.rb +272 -0
- data/spec/test_value_parameterized_spec.rb +46 -0
- metadata +101 -0
data/lib/dtest/util.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Singleton
|
4
|
+
def remove_instance_var
|
5
|
+
# remove all instance vars
|
6
|
+
instance_variables.each do |name|
|
7
|
+
remove_instance_variable(name)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end # module Singleton
|
11
|
+
|
12
|
+
module DTest
|
13
|
+
module Stopwatch
|
14
|
+
attr_accessor :start, :finish
|
15
|
+
def timer(&block)
|
16
|
+
begin
|
17
|
+
@start = Time.now
|
18
|
+
block.call
|
19
|
+
ensure
|
20
|
+
@finish = Time.now
|
21
|
+
end
|
22
|
+
|
23
|
+
def elapsed
|
24
|
+
if @finish && @start
|
25
|
+
sprintf('%f', (@finish - @start).to_f)
|
26
|
+
else
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end # class Stopwatch
|
32
|
+
|
33
|
+
# Block executor
|
34
|
+
module Hook
|
35
|
+
def exec(list, context)
|
36
|
+
list.each do |block|
|
37
|
+
block.call(context)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end # module DTest
|
43
|
+
|
@@ -0,0 +1,772 @@
|
|
1
|
+
|
2
|
+
require 'dtest/dsl'
|
3
|
+
require 'dtest/runner'
|
4
|
+
include DTest
|
5
|
+
|
6
|
+
|
7
|
+
#
|
8
|
+
# グローバル、テストケース、テスト before/after
|
9
|
+
# abortは3種類ある
|
10
|
+
# (2*3) * 3 = 18種類テストが必要
|
11
|
+
#
|
12
|
+
# +test時のabortで3種類
|
13
|
+
|
14
|
+
|
15
|
+
describe Global::Manager, 'global abort' do
|
16
|
+
before do
|
17
|
+
$call = []
|
18
|
+
end
|
19
|
+
|
20
|
+
after do
|
21
|
+
Global::Manager.instance.clear
|
22
|
+
Test::Manager.instance.clear
|
23
|
+
end
|
24
|
+
|
25
|
+
it "global before abort_if" do
|
26
|
+
GlobalHarness do
|
27
|
+
before do
|
28
|
+
$call << :beforeGlobal
|
29
|
+
abort_if(true, "testing aborted beforeGlobal")
|
30
|
+
$call << :not_executed
|
31
|
+
end
|
32
|
+
|
33
|
+
after do
|
34
|
+
$call << :afterGlobal
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
TestCase "testcase1" do
|
39
|
+
test "test1" do
|
40
|
+
$call << :test_not_executed
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
Runner.run([])
|
45
|
+
$call.should == [
|
46
|
+
:beforeGlobal,
|
47
|
+
:afterGlobal
|
48
|
+
]
|
49
|
+
end
|
50
|
+
|
51
|
+
it "global before abort_case_if" do
|
52
|
+
GlobalHarness do
|
53
|
+
before do
|
54
|
+
$call << :beforeGlobal
|
55
|
+
abort_case_if(true, "testing aborted beforeGlobal")
|
56
|
+
$call << :not_executed
|
57
|
+
end
|
58
|
+
|
59
|
+
after do
|
60
|
+
$call << :afterGlobal
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
TestCase "testcase1" do
|
65
|
+
test "test1" do
|
66
|
+
$call << :test_not_executed
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
Runner.run([])
|
71
|
+
$call.should == [
|
72
|
+
:beforeGlobal,
|
73
|
+
:afterGlobal
|
74
|
+
]
|
75
|
+
end
|
76
|
+
|
77
|
+
it "global before abort_global_if" do
|
78
|
+
GlobalHarness do
|
79
|
+
before do
|
80
|
+
$call << :beforeGlobal
|
81
|
+
abort_global_if(true, "testing aborted beforeGlobal")
|
82
|
+
$call << :not_executed
|
83
|
+
end
|
84
|
+
|
85
|
+
after do
|
86
|
+
$call << :afterGlobal
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
TestCase "testcase1" do
|
91
|
+
test "test1" do
|
92
|
+
$call << :test_not_executed
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
Runner.run([])
|
97
|
+
$call.should == [
|
98
|
+
:beforeGlobal,
|
99
|
+
:afterGlobal
|
100
|
+
]
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
describe Global::Manager, 'testcase abort' do
|
106
|
+
before do
|
107
|
+
$call = []
|
108
|
+
GlobalHarness do
|
109
|
+
before do
|
110
|
+
$call << :beforeGlobal
|
111
|
+
end
|
112
|
+
after do
|
113
|
+
$call << :afterGlobal
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
after do
|
119
|
+
Global::Manager.instance.clear
|
120
|
+
Test::Manager.instance.clear
|
121
|
+
end
|
122
|
+
|
123
|
+
# before: abort_if, abort_case_if, abort_global_if
|
124
|
+
it "beforeCase abort_if" do
|
125
|
+
TestCase "testcase1" do
|
126
|
+
beforeCase do
|
127
|
+
$call << :beforeCase
|
128
|
+
abort_if(true, "testcase:before abort")
|
129
|
+
end
|
130
|
+
afterCase do
|
131
|
+
$call << :afterCase
|
132
|
+
end
|
133
|
+
before do
|
134
|
+
$call << :before
|
135
|
+
end
|
136
|
+
after do
|
137
|
+
$call << :after
|
138
|
+
end
|
139
|
+
|
140
|
+
test "test1" do
|
141
|
+
$call << :test1_not_executed
|
142
|
+
end
|
143
|
+
|
144
|
+
test "test2" do
|
145
|
+
$call << :test2_not_executed
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
TestCase "testcase2" do
|
150
|
+
test "test1" do
|
151
|
+
$call << :test2
|
152
|
+
end
|
153
|
+
test "test2" do
|
154
|
+
$call << :test2
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
call = [
|
159
|
+
:beforeGlobal,
|
160
|
+
:beforeCase,
|
161
|
+
:afterCase,
|
162
|
+
|
163
|
+
:test2,
|
164
|
+
:test2,
|
165
|
+
:afterGlobal,
|
166
|
+
]
|
167
|
+
|
168
|
+
Runner.run([])
|
169
|
+
$call.should == call
|
170
|
+
end
|
171
|
+
|
172
|
+
it "testcase:before abort_case_if" do
|
173
|
+
TestCase "testcase1" do
|
174
|
+
beforeCase do
|
175
|
+
$call << :beforeCase
|
176
|
+
abort_case_if(true, "testcase:before abort")
|
177
|
+
end
|
178
|
+
afterCase do
|
179
|
+
$call << :afterCase
|
180
|
+
end
|
181
|
+
before do
|
182
|
+
$call << :before
|
183
|
+
end
|
184
|
+
after do
|
185
|
+
$call << :after
|
186
|
+
end
|
187
|
+
test "test1" do
|
188
|
+
$call << :not_executed
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
TestCase "testcase2" do
|
193
|
+
test "test1" do
|
194
|
+
$call << :test2
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
call = [
|
199
|
+
:beforeGlobal,
|
200
|
+
:beforeCase,
|
201
|
+
:afterCase,
|
202
|
+
|
203
|
+
:test2,
|
204
|
+
:afterGlobal,
|
205
|
+
]
|
206
|
+
|
207
|
+
Runner.run([])
|
208
|
+
$call.should == call
|
209
|
+
end
|
210
|
+
|
211
|
+
it "testcase:before abort_global_if" do
|
212
|
+
TestCase "testcase1" do
|
213
|
+
beforeCase do
|
214
|
+
$call << :beforeCase
|
215
|
+
abort_global_if(true, "testcase:before abort")
|
216
|
+
end
|
217
|
+
afterCase do
|
218
|
+
$call << :afterCase
|
219
|
+
end
|
220
|
+
before do
|
221
|
+
$call << :before
|
222
|
+
end
|
223
|
+
after do
|
224
|
+
$call << :after
|
225
|
+
end
|
226
|
+
test "test1" do
|
227
|
+
$call << :not_executed
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
TestCase "testcase2" do
|
232
|
+
test "test1" do
|
233
|
+
$call << :test2
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
call = [
|
238
|
+
:beforeGlobal,
|
239
|
+
:beforeCase,
|
240
|
+
:afterCase,
|
241
|
+
:afterGlobal,
|
242
|
+
]
|
243
|
+
|
244
|
+
Runner.run([])
|
245
|
+
$call.should == call
|
246
|
+
end
|
247
|
+
|
248
|
+
|
249
|
+
# after: abort_if, abort_case_if, abort_global_if
|
250
|
+
it "testcase:after abort_if" do
|
251
|
+
TestCase "abortcase1" do
|
252
|
+
beforeCase do
|
253
|
+
$call << :beforeCase
|
254
|
+
end
|
255
|
+
afterCase do
|
256
|
+
$call << :afterCase
|
257
|
+
abort_if(true, "after abort")
|
258
|
+
end
|
259
|
+
before do
|
260
|
+
$call << :before
|
261
|
+
end
|
262
|
+
after do
|
263
|
+
$call << :after
|
264
|
+
end
|
265
|
+
|
266
|
+
test "test1" do
|
267
|
+
$call << :test1
|
268
|
+
end
|
269
|
+
|
270
|
+
test "test2" do
|
271
|
+
$call << :test2
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
TestCase "testcase2" do
|
276
|
+
test "test1" do
|
277
|
+
$call << :testcase2
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
call = [
|
282
|
+
:beforeGlobal,
|
283
|
+
:beforeCase,
|
284
|
+
:before,
|
285
|
+
:test1,
|
286
|
+
:after,
|
287
|
+
:before,
|
288
|
+
:test2,
|
289
|
+
:after,
|
290
|
+
:afterCase,
|
291
|
+
|
292
|
+
:testcase2,
|
293
|
+
|
294
|
+
:afterGlobal,
|
295
|
+
]
|
296
|
+
|
297
|
+
Runner.run([])
|
298
|
+
$call.should == call
|
299
|
+
end
|
300
|
+
|
301
|
+
it "testcase:after abort_global_if" do
|
302
|
+
TestCase "AbortTest" do
|
303
|
+
beforeCase do
|
304
|
+
$call << :beforeCase
|
305
|
+
end
|
306
|
+
afterCase do
|
307
|
+
$call << :afterCase
|
308
|
+
abort_global_if(true, "testcase:before abort")
|
309
|
+
end
|
310
|
+
before do
|
311
|
+
$call << :before
|
312
|
+
end
|
313
|
+
after do
|
314
|
+
$call << :after
|
315
|
+
end
|
316
|
+
|
317
|
+
test "test1" do
|
318
|
+
$call << :test1
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
TestCase "AbortTest_not" do
|
323
|
+
test "test1" do
|
324
|
+
$call << :not_executed
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
call = [
|
329
|
+
:beforeGlobal,
|
330
|
+
:beforeCase,
|
331
|
+
:before,
|
332
|
+
:test1,
|
333
|
+
:after,
|
334
|
+
:afterCase,
|
335
|
+
:afterGlobal,
|
336
|
+
]
|
337
|
+
|
338
|
+
Runner.run([])
|
339
|
+
$call.should == call
|
340
|
+
end
|
341
|
+
|
342
|
+
it "testcase:after abort_case_if" do
|
343
|
+
TestCase "abortcase1" do
|
344
|
+
beforeCase do
|
345
|
+
$call << :beforeCase
|
346
|
+
end
|
347
|
+
afterCase do
|
348
|
+
$call << :afterCase
|
349
|
+
abort_case_if(true, "after abort")
|
350
|
+
end
|
351
|
+
before do
|
352
|
+
$call << :before
|
353
|
+
end
|
354
|
+
after do
|
355
|
+
$call << :after
|
356
|
+
end
|
357
|
+
|
358
|
+
test "test1" do
|
359
|
+
$call << :test1
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
TestCase "testcase2" do
|
364
|
+
test "test1" do
|
365
|
+
$call << :testcase2
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
call = [
|
370
|
+
:beforeGlobal,
|
371
|
+
:beforeCase,
|
372
|
+
:before,
|
373
|
+
:test1,
|
374
|
+
:after,
|
375
|
+
:afterCase,
|
376
|
+
|
377
|
+
:testcase2,
|
378
|
+
|
379
|
+
:afterGlobal,
|
380
|
+
]
|
381
|
+
|
382
|
+
Runner.run([])
|
383
|
+
$call.should == call
|
384
|
+
end
|
385
|
+
|
386
|
+
it "testcase:after abort_global_if" do
|
387
|
+
TestCase "AbortTest" do
|
388
|
+
beforeCase do
|
389
|
+
$call << :beforeCase
|
390
|
+
end
|
391
|
+
afterCase do
|
392
|
+
$call << :afterCase
|
393
|
+
abort_global_if(true, "testcase:before abort")
|
394
|
+
end
|
395
|
+
before do
|
396
|
+
$call << :before
|
397
|
+
end
|
398
|
+
after do
|
399
|
+
$call << :after
|
400
|
+
end
|
401
|
+
|
402
|
+
test "test1" do
|
403
|
+
$call << :test1
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
407
|
+
TestCase "AbortTest_not" do
|
408
|
+
test "test1" do
|
409
|
+
$call << :not_executed
|
410
|
+
end
|
411
|
+
end
|
412
|
+
|
413
|
+
call = [
|
414
|
+
:beforeGlobal,
|
415
|
+
:beforeCase,
|
416
|
+
:before,
|
417
|
+
:test1,
|
418
|
+
:after,
|
419
|
+
:afterCase,
|
420
|
+
:afterGlobal,
|
421
|
+
]
|
422
|
+
|
423
|
+
Runner.run([])
|
424
|
+
$call.should == call
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
428
|
+
|
429
|
+
describe Global::Manager, 'test abort' do
|
430
|
+
before do
|
431
|
+
$call = []
|
432
|
+
GlobalHarness do
|
433
|
+
before do
|
434
|
+
$call << :beforeGlobal
|
435
|
+
end
|
436
|
+
after do
|
437
|
+
$call << :afterGlobal
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
441
|
+
|
442
|
+
after do
|
443
|
+
Global::Manager.instance.clear
|
444
|
+
Test::Manager.instance.clear
|
445
|
+
end
|
446
|
+
|
447
|
+
|
448
|
+
it "test:after abort_if" do
|
449
|
+
TestCase "abortcase1" do
|
450
|
+
beforeCase do
|
451
|
+
$call << :beforeCase
|
452
|
+
end
|
453
|
+
afterCase do
|
454
|
+
$call << :afterCase
|
455
|
+
end
|
456
|
+
before do
|
457
|
+
$call << :before
|
458
|
+
end
|
459
|
+
after do
|
460
|
+
$call << :after
|
461
|
+
abort_if(true, "after abort")
|
462
|
+
end
|
463
|
+
|
464
|
+
test "test1" do
|
465
|
+
$call << :test1
|
466
|
+
end
|
467
|
+
|
468
|
+
test "test2" do
|
469
|
+
$call << :test2
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
TestCase "testcase2" do
|
474
|
+
test "test1" do
|
475
|
+
$call << :testcase2
|
476
|
+
end
|
477
|
+
end
|
478
|
+
|
479
|
+
call = [
|
480
|
+
:beforeGlobal,
|
481
|
+
:beforeCase,
|
482
|
+
:before,
|
483
|
+
:test1,
|
484
|
+
:after,
|
485
|
+
:before,
|
486
|
+
:test2,
|
487
|
+
:after,
|
488
|
+
:afterCase,
|
489
|
+
|
490
|
+
:testcase2,
|
491
|
+
:afterGlobal,
|
492
|
+
]
|
493
|
+
|
494
|
+
Runner.run([])
|
495
|
+
$call.should == call
|
496
|
+
end
|
497
|
+
|
498
|
+
it "test:after abort_case_if" do
|
499
|
+
TestCase "abortcase1" do
|
500
|
+
beforeCase do
|
501
|
+
$call << :beforeCase
|
502
|
+
end
|
503
|
+
afterCase do
|
504
|
+
$call << :afterCase
|
505
|
+
end
|
506
|
+
before do
|
507
|
+
$call << :before
|
508
|
+
end
|
509
|
+
after do
|
510
|
+
$call << :after
|
511
|
+
abort_case_if(true, "after abort")
|
512
|
+
end
|
513
|
+
|
514
|
+
test "test1" do
|
515
|
+
$call << :test1
|
516
|
+
end
|
517
|
+
|
518
|
+
test "test2" do
|
519
|
+
$call << :test2
|
520
|
+
end
|
521
|
+
end
|
522
|
+
|
523
|
+
TestCase "testcase2" do
|
524
|
+
test "test1" do
|
525
|
+
$call << :testcase2
|
526
|
+
end
|
527
|
+
end
|
528
|
+
|
529
|
+
call = [
|
530
|
+
:beforeGlobal,
|
531
|
+
:beforeCase,
|
532
|
+
:before,
|
533
|
+
:test1,
|
534
|
+
:after,
|
535
|
+
:afterCase,
|
536
|
+
|
537
|
+
:testcase2,
|
538
|
+
:afterGlobal,
|
539
|
+
]
|
540
|
+
|
541
|
+
Runner.run([])
|
542
|
+
$call.should == call
|
543
|
+
end
|
544
|
+
|
545
|
+
|
546
|
+
it "test:after abort_global_if" do
|
547
|
+
TestCase "AbortTest" do
|
548
|
+
beforeCase do
|
549
|
+
$call << :beforeCase
|
550
|
+
end
|
551
|
+
afterCase do
|
552
|
+
$call << :afterCase
|
553
|
+
end
|
554
|
+
before do
|
555
|
+
$call << :before
|
556
|
+
end
|
557
|
+
after do
|
558
|
+
$call << :after
|
559
|
+
abort_global_if(true, "testcase:before abort")
|
560
|
+
end
|
561
|
+
|
562
|
+
test "test1" do
|
563
|
+
$call << :test1
|
564
|
+
end
|
565
|
+
|
566
|
+
test "test2" do
|
567
|
+
$call << :test2_not_executed
|
568
|
+
end
|
569
|
+
end
|
570
|
+
|
571
|
+
TestCase "AbortTest_not" do
|
572
|
+
test "test1" do
|
573
|
+
$call << :not_executed
|
574
|
+
end
|
575
|
+
end
|
576
|
+
|
577
|
+
call = [
|
578
|
+
:beforeGlobal,
|
579
|
+
:beforeCase,
|
580
|
+
:before,
|
581
|
+
:test1,
|
582
|
+
:after,
|
583
|
+
:afterCase,
|
584
|
+
:afterGlobal,
|
585
|
+
]
|
586
|
+
|
587
|
+
Runner.run([])
|
588
|
+
$call.should == call
|
589
|
+
end
|
590
|
+
end
|
591
|
+
|
592
|
+
|
593
|
+
|
594
|
+
describe Global::Manager, 'test abort' do
|
595
|
+
before do
|
596
|
+
$call = []
|
597
|
+
GlobalHarness do
|
598
|
+
before do
|
599
|
+
$call << :beforeGlobal
|
600
|
+
end
|
601
|
+
|
602
|
+
after do
|
603
|
+
$call << :afterGlobal
|
604
|
+
end
|
605
|
+
end
|
606
|
+
end
|
607
|
+
|
608
|
+
after do
|
609
|
+
Global::Manager.instance.clear
|
610
|
+
Test::Manager.instance.clear
|
611
|
+
end
|
612
|
+
|
613
|
+
it "test abort_if" do
|
614
|
+
TestCase "testcase1" do
|
615
|
+
|
616
|
+
before do
|
617
|
+
$call << :before
|
618
|
+
end
|
619
|
+
|
620
|
+
after do
|
621
|
+
$call << :after
|
622
|
+
end
|
623
|
+
|
624
|
+
test "abort test" do
|
625
|
+
$call << :test1
|
626
|
+
abort_if(true, "testing abort: abort_if")
|
627
|
+
$call << :not_executed
|
628
|
+
end
|
629
|
+
|
630
|
+
test "" "test2" do
|
631
|
+
$call << :test2
|
632
|
+
end
|
633
|
+
|
634
|
+
end
|
635
|
+
|
636
|
+
TestCase "testcase" do
|
637
|
+
test "test1" do
|
638
|
+
$call << :testcase2
|
639
|
+
end
|
640
|
+
end
|
641
|
+
|
642
|
+
call = [
|
643
|
+
:beforeGlobal,
|
644
|
+
|
645
|
+
:before,
|
646
|
+
:test1,
|
647
|
+
:after,
|
648
|
+
|
649
|
+
:before,
|
650
|
+
:test2,
|
651
|
+
:after,
|
652
|
+
|
653
|
+
:testcase2,
|
654
|
+
|
655
|
+
:afterGlobal,
|
656
|
+
]
|
657
|
+
|
658
|
+
Runner.run([])
|
659
|
+
$call.should == call
|
660
|
+
end
|
661
|
+
|
662
|
+
it "abort_case_if" do
|
663
|
+
TestCase "testcase1" do
|
664
|
+
before do
|
665
|
+
$call << :before
|
666
|
+
end
|
667
|
+
|
668
|
+
after do
|
669
|
+
$call << :after
|
670
|
+
end
|
671
|
+
|
672
|
+
test "test1" do
|
673
|
+
$call << :test1
|
674
|
+
end
|
675
|
+
|
676
|
+
test "test2" do
|
677
|
+
$call << :test2
|
678
|
+
abort_case_if(true, "testing abort: abort_case_if")
|
679
|
+
end
|
680
|
+
|
681
|
+
test "test3" do
|
682
|
+
$call << :test3_not_executed
|
683
|
+
end
|
684
|
+
end
|
685
|
+
|
686
|
+
TestCase "testcase" do
|
687
|
+
test "test1" do
|
688
|
+
$call << :testcase2
|
689
|
+
end
|
690
|
+
end
|
691
|
+
|
692
|
+
call = [
|
693
|
+
:beforeGlobal,
|
694
|
+
|
695
|
+
:before,
|
696
|
+
:test1,
|
697
|
+
:after,
|
698
|
+
|
699
|
+
:before,
|
700
|
+
:test2,
|
701
|
+
:after,
|
702
|
+
|
703
|
+
:testcase2,
|
704
|
+
|
705
|
+
:afterGlobal,
|
706
|
+
]
|
707
|
+
|
708
|
+
Runner.run([])
|
709
|
+
$call.should == call
|
710
|
+
end
|
711
|
+
|
712
|
+
it "test abort_global_if" do
|
713
|
+
TestCase "GlobalAbort test" do
|
714
|
+
beforeCase do
|
715
|
+
$call << :beforeCase
|
716
|
+
end
|
717
|
+
|
718
|
+
afterCase do
|
719
|
+
$call << :afterCase
|
720
|
+
end
|
721
|
+
|
722
|
+
before do
|
723
|
+
$call << :before
|
724
|
+
end
|
725
|
+
|
726
|
+
after do
|
727
|
+
$call << :after
|
728
|
+
end
|
729
|
+
|
730
|
+
test "test" do
|
731
|
+
$call << :test1
|
732
|
+
end
|
733
|
+
|
734
|
+
test "abort_global_if" do
|
735
|
+
$call << :abort_global
|
736
|
+
abort_global_if(true, "testing abort: abort_global_if")
|
737
|
+
end
|
738
|
+
|
739
|
+
test "not executed" do
|
740
|
+
$call << :not_executed
|
741
|
+
end
|
742
|
+
|
743
|
+
end
|
744
|
+
|
745
|
+
TestCase "NotExecuted" do
|
746
|
+
test "not executed" do
|
747
|
+
$call << :not_executed
|
748
|
+
end
|
749
|
+
|
750
|
+
end
|
751
|
+
|
752
|
+
call = [
|
753
|
+
:beforeGlobal,
|
754
|
+
|
755
|
+
:beforeCase,
|
756
|
+
:before,
|
757
|
+
:test1,
|
758
|
+
:after,
|
759
|
+
:before,
|
760
|
+
:abort_global,
|
761
|
+
:after,
|
762
|
+
:afterCase,
|
763
|
+
|
764
|
+
:afterGlobal,
|
765
|
+
]
|
766
|
+
|
767
|
+
Runner.run([])
|
768
|
+
$call.should == call
|
769
|
+
end
|
770
|
+
|
771
|
+
end
|
772
|
+
|