test_bench-run 0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/test_bench/run/controls/directory.rb +54 -0
- data/lib/test_bench/run/controls/event_data.rb +7 -0
- data/lib/test_bench/run/controls/events/event_data.rb +9 -0
- data/lib/test_bench/run/controls/events/file_crashed.rb +109 -0
- data/lib/test_bench/run/controls/events/file_finished.rb +56 -0
- data/lib/test_bench/run/controls/events/file_started.rb +47 -0
- data/lib/test_bench/run/controls/events/finished.rb +50 -0
- data/lib/test_bench/run/controls/events/session.rb +9 -0
- data/lib/test_bench/run/controls/events/started.rb +41 -0
- data/lib/test_bench/run/controls/exception.rb +101 -0
- data/lib/test_bench/run/controls/executor.rb +56 -0
- data/lib/test_bench/run/controls/file/create.rb +69 -0
- data/lib/test_bench/run/controls/file/pattern.rb +29 -0
- data/lib/test_bench/run/controls/file.rb +180 -0
- data/lib/test_bench/run/controls/path.rb +15 -0
- data/lib/test_bench/run/controls/process_id.rb +7 -0
- data/lib/test_bench/run/controls/random.rb +7 -0
- data/lib/test_bench/run/controls/result.rb +7 -0
- data/lib/test_bench/run/controls/time.rb +7 -0
- data/lib/test_bench/run/controls.rb +26 -0
- data/lib/test_bench/run/events.rb +12 -0
- data/lib/test_bench/run/executor/serial.rb +112 -0
- data/lib/test_bench/run/executor/substitute.rb +45 -0
- data/lib/test_bench/run/executor.rb +44 -0
- data/lib/test_bench/run/file/substitute.rb +41 -0
- data/lib/test_bench/run/file.rb +73 -0
- data/lib/test_bench/run/get_files/substitute.rb +46 -0
- data/lib/test_bench/run/get_files.rb +72 -0
- data/lib/test_bench/run/output/file.rb +129 -0
- data/lib/test_bench/run/output/summary/error.rb +139 -0
- data/lib/test_bench/run/output/summary.rb +179 -0
- data/lib/test_bench/run/run.rb +101 -0
- data/lib/test_bench/run.rb +19 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6cc31ef71213961951028bc33a31f17ba40ba1401f18111ed20454be6236e3b4
|
4
|
+
data.tar.gz: 98d146a75264aef9aa48e3e51366be7a7837830156908540b34df9723a36fdd0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 01bf99f7760ff77df99bf40991e91753fe0cc1af6d9ecac45747a34687a193bdbd0d5d6f3a6ada6d2bea1ca04fe527f6fe10ffa3fe7b002b59449665b919b8b3
|
7
|
+
data.tar.gz: 244160004df72f41db3b3304ad91a36319ccbdf6fefc7c4ee40e13749ce3f1876a2e8ed2884930a7c1178cd638d6ae6987a5ca45bed1b3df258a4e767d14ffb3
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module TestBench
|
2
|
+
class Run
|
3
|
+
module Controls
|
4
|
+
module Directory
|
5
|
+
def self.example(name=nil, parent_directory: nil, root_directory: nil)
|
6
|
+
name ||= self.name
|
7
|
+
parent_directory ||= self.parent_directory
|
8
|
+
|
9
|
+
::File.join(parent_directory, name)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.random(parent_directory: nil)
|
13
|
+
name = Name.random
|
14
|
+
|
15
|
+
example(name, parent_directory:)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.name
|
19
|
+
Name.example
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.parent_directory
|
23
|
+
File::Create.directory
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.root_directory
|
27
|
+
File::Create.root_directory
|
28
|
+
end
|
29
|
+
|
30
|
+
module Name
|
31
|
+
def self.example
|
32
|
+
"some-directory"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.random
|
36
|
+
suffix = Random.string
|
37
|
+
|
38
|
+
"#{example}-#{suffix}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
module Create
|
43
|
+
def self.call(parent_directory: nil)
|
44
|
+
directory = Directory.random(parent_directory:)
|
45
|
+
|
46
|
+
::Dir.mkdir(directory)
|
47
|
+
|
48
|
+
directory
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
module TestBench
|
2
|
+
class Run
|
3
|
+
module Controls
|
4
|
+
module Events
|
5
|
+
module FileCrashed
|
6
|
+
extend EventData
|
7
|
+
|
8
|
+
def self.example(file: nil, error_message: nil, error_text: nil, process_id: nil, time: nil)
|
9
|
+
file ||= self.file
|
10
|
+
error_message ||= self.error_message
|
11
|
+
error_text ||= self.error_text
|
12
|
+
process_id ||= self.process_id
|
13
|
+
time ||= self.time
|
14
|
+
|
15
|
+
Run::Events::FileCrashed.build(file, error_message, error_text, process_id:, time:)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.random
|
19
|
+
Random.example
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.file
|
23
|
+
File::Test::Local.example
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.error_message
|
27
|
+
ErrorMessage.example
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.error_text
|
31
|
+
ErrorText.example
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.process_id
|
35
|
+
ProcessID.example
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.time
|
39
|
+
Time.example
|
40
|
+
end
|
41
|
+
|
42
|
+
module Random
|
43
|
+
extend EventData
|
44
|
+
|
45
|
+
def self.example(file: nil, error_message: nil, error_text: nil, process_id: nil, time: nil)
|
46
|
+
file ||= File::Test::Local.random
|
47
|
+
error_message ||= ErrorMessage.random
|
48
|
+
error_text ||= ErrorText.random
|
49
|
+
process_id ||= ProcessID.random
|
50
|
+
time ||= Time.random
|
51
|
+
|
52
|
+
FileCrashed.example(file:, error_message:, error_text:, process_id:, time:)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
module ErrorText
|
57
|
+
def self.example(...)
|
58
|
+
exception = Exception.example
|
59
|
+
|
60
|
+
exception.full_message
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.random
|
64
|
+
exception = Exception.random
|
65
|
+
|
66
|
+
exception.full_message
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
module ErrorMessage
|
71
|
+
def self.example(file: nil, message: nil, exception_class: nil)
|
72
|
+
file ||= self.file
|
73
|
+
|
74
|
+
backtrace_frame = Exception::Backtrace::Frame.example(file:)
|
75
|
+
|
76
|
+
exception = Exception.example(backtrace_frame:, message:, exception_class:)
|
77
|
+
|
78
|
+
get(exception)
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.random
|
82
|
+
Random.example
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.file
|
86
|
+
File::Implementation::Local.example
|
87
|
+
end
|
88
|
+
|
89
|
+
def self.get(exception)
|
90
|
+
exception.full_message(order: :top, highlight: false).each_line(chomp: true).first
|
91
|
+
end
|
92
|
+
|
93
|
+
module Random
|
94
|
+
def self.example(...)
|
95
|
+
exception = Exception::Random.example(...)
|
96
|
+
|
97
|
+
ErrorMessage.get(exception)
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.file
|
101
|
+
File::Implementation::Local.random
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module TestBench
|
2
|
+
class Run
|
3
|
+
module Controls
|
4
|
+
module Events
|
5
|
+
module FileFinished
|
6
|
+
extend EventData
|
7
|
+
|
8
|
+
def self.example(file: nil, result: nil, process_id: nil, time: nil)
|
9
|
+
file ||= self.file
|
10
|
+
result = self.result if result.nil?
|
11
|
+
process_id ||= self.process_id
|
12
|
+
time ||= self.time
|
13
|
+
|
14
|
+
Run::Events::FileFinished.build(file, result, process_id:, time:)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.random
|
18
|
+
Random.example
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.file
|
22
|
+
File::Test::Local.example
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.result
|
26
|
+
Result.example
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.process_id
|
30
|
+
ProcessID.example
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.time
|
34
|
+
Time.example
|
35
|
+
end
|
36
|
+
|
37
|
+
module Random
|
38
|
+
extend EventData
|
39
|
+
|
40
|
+
def self.example(file: nil, result: nil, process_id: nil, time: nil)
|
41
|
+
file ||= File::Test::Local.random
|
42
|
+
process_id ||= ProcessID.random
|
43
|
+
time ||= Time.random
|
44
|
+
|
45
|
+
if result.nil?
|
46
|
+
result = Result.random
|
47
|
+
end
|
48
|
+
|
49
|
+
FileFinished.example(file:, result:, process_id:, time:)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module TestBench
|
2
|
+
class Run
|
3
|
+
module Controls
|
4
|
+
module Events
|
5
|
+
module FileStarted
|
6
|
+
extend EventData
|
7
|
+
|
8
|
+
def self.example(file: nil, process_id: nil, time: nil)
|
9
|
+
file ||= self.file
|
10
|
+
process_id ||= self.process_id
|
11
|
+
time ||= self.time
|
12
|
+
|
13
|
+
Run::Events::FileStarted.build(file, process_id:, time:)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.random
|
17
|
+
Random.example
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.file
|
21
|
+
File::Test::Local.example
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.process_id
|
25
|
+
ProcessID.example
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.time
|
29
|
+
Time.example
|
30
|
+
end
|
31
|
+
|
32
|
+
module Random
|
33
|
+
extend EventData
|
34
|
+
|
35
|
+
def self.example(file: nil, process_id: nil, time: nil)
|
36
|
+
file ||= File::Test::Local.random
|
37
|
+
process_id ||= ProcessID.random
|
38
|
+
time ||= Time.random
|
39
|
+
|
40
|
+
FileStarted.example(file:, process_id:, time:)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module TestBench
|
2
|
+
class Run
|
3
|
+
module Controls
|
4
|
+
module Events
|
5
|
+
module Finished
|
6
|
+
extend EventData
|
7
|
+
|
8
|
+
def self.example(result: nil, process_id: nil, time: nil)
|
9
|
+
result = self.result if result.nil?
|
10
|
+
process_id ||= self.process_id
|
11
|
+
time ||= self.time
|
12
|
+
|
13
|
+
Run::Events::Finished.build(result, process_id:, time:)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.random
|
17
|
+
Random.example
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.result
|
21
|
+
Result.example
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.process_id
|
25
|
+
ProcessID.example
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.time
|
29
|
+
Time.example
|
30
|
+
end
|
31
|
+
|
32
|
+
module Random
|
33
|
+
extend EventData
|
34
|
+
|
35
|
+
def self.example(result: nil, process_id: nil, time: nil)
|
36
|
+
process_id ||= ProcessID.random
|
37
|
+
time ||= Time.random
|
38
|
+
|
39
|
+
if result.nil?
|
40
|
+
result = Result.random
|
41
|
+
end
|
42
|
+
|
43
|
+
Finished.example(result:, process_id:, time:)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module TestBench
|
2
|
+
class Run
|
3
|
+
module Controls
|
4
|
+
module Events
|
5
|
+
module Started
|
6
|
+
extend EventData
|
7
|
+
|
8
|
+
def self.example(process_id: nil, time: nil)
|
9
|
+
process_id ||= self.process_id
|
10
|
+
time ||= self.time
|
11
|
+
|
12
|
+
Run::Events::Started.build(process_id:, time:)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.random
|
16
|
+
Random.example
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.process_id
|
20
|
+
ProcessID.example
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.time
|
24
|
+
Time.example
|
25
|
+
end
|
26
|
+
|
27
|
+
module Random
|
28
|
+
extend EventData
|
29
|
+
|
30
|
+
def self.example(process_id: nil, time: nil)
|
31
|
+
process_id ||= ProcessID.random
|
32
|
+
time ||= Time.random
|
33
|
+
|
34
|
+
Started.example(process_id:, time:)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
module TestBench
|
2
|
+
class Run
|
3
|
+
module Controls
|
4
|
+
module Exception
|
5
|
+
def self.example(backtrace_frame: nil, message: nil, exception_class: nil)
|
6
|
+
exception = Fixture::Controls::Exception.example(message:, exception_class:)
|
7
|
+
|
8
|
+
backtrace = Backtrace.example(backtrace_frame)
|
9
|
+
exception.set_backtrace(backtrace)
|
10
|
+
|
11
|
+
exception
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.random
|
15
|
+
Random.example
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.message
|
19
|
+
Message.example
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.backtrace_frame
|
23
|
+
BacktraceFrame.example
|
24
|
+
end
|
25
|
+
|
26
|
+
Example = Fixture::Controls::Exception::Example
|
27
|
+
|
28
|
+
Message = Fixture::Controls::Exception::Message
|
29
|
+
|
30
|
+
module Random
|
31
|
+
def self.example(message: nil, backtrace_frame: nil)
|
32
|
+
message ||= Message.random
|
33
|
+
backtrace_frame ||= Backtrace::Frame.random
|
34
|
+
|
35
|
+
Exception.example(message:, backtrace_frame:)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
module Backtrace
|
40
|
+
def self.example(frame=nil)
|
41
|
+
frame ||= self.frame
|
42
|
+
|
43
|
+
[frame]
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.random
|
47
|
+
frame = Frame.random
|
48
|
+
|
49
|
+
example(frame)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.frame
|
53
|
+
Frame.example
|
54
|
+
end
|
55
|
+
|
56
|
+
module Frame
|
57
|
+
def self.example(file: nil, line_number: nil, method_name: nil)
|
58
|
+
file ||= self.file
|
59
|
+
line_number ||= self.line_number
|
60
|
+
method_name ||= self.method_name
|
61
|
+
|
62
|
+
"#{file}:#{line_number}:in `#{method_name}'"
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.random
|
66
|
+
Random.example
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.file
|
70
|
+
File::Implementation.example
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.line_number
|
74
|
+
11
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.method_name
|
78
|
+
'some_method'
|
79
|
+
end
|
80
|
+
|
81
|
+
module Random
|
82
|
+
def self.example(file: nil, line_number: nil, method_name: nil)
|
83
|
+
file ||= File::Implementation.random
|
84
|
+
line_number ||= Controls::Random.integer
|
85
|
+
method_name ||= self.method_name
|
86
|
+
|
87
|
+
Frame.example(file:, line_number:, method_name:)
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.method_name
|
91
|
+
suffix = Controls::Random.string
|
92
|
+
|
93
|
+
"#{Frame.method_name}_#{suffix}"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module TestBench
|
2
|
+
class Run
|
3
|
+
module Controls
|
4
|
+
module Executor
|
5
|
+
def self.example
|
6
|
+
Example.new
|
7
|
+
end
|
8
|
+
|
9
|
+
class Example
|
10
|
+
include TestBench::Run::Executor
|
11
|
+
|
12
|
+
attr_accessor :executed_file
|
13
|
+
|
14
|
+
attr_accessor :started
|
15
|
+
def started? = !!started
|
16
|
+
|
17
|
+
attr_accessor :finished
|
18
|
+
def finished? = !!finished
|
19
|
+
|
20
|
+
attr_accessor :configured
|
21
|
+
def configured? = !!configured
|
22
|
+
|
23
|
+
def configure
|
24
|
+
self.configured = true
|
25
|
+
end
|
26
|
+
|
27
|
+
def start
|
28
|
+
self.started = true
|
29
|
+
end
|
30
|
+
|
31
|
+
def execute(file)
|
32
|
+
self.executed_file = file
|
33
|
+
end
|
34
|
+
|
35
|
+
def executed?(file)
|
36
|
+
executed_file == file
|
37
|
+
end
|
38
|
+
|
39
|
+
def finish
|
40
|
+
self.finished = true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
module NotImplemented
|
45
|
+
def self.example
|
46
|
+
Example.new
|
47
|
+
end
|
48
|
+
|
49
|
+
class Example
|
50
|
+
include TestBench::Run::Executor
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module TestBench
|
2
|
+
class Run
|
3
|
+
module Controls
|
4
|
+
module File
|
5
|
+
module Create
|
6
|
+
def self.call(contents: nil, directory: nil)
|
7
|
+
contents ||= self.contents
|
8
|
+
directory ||= self.directory
|
9
|
+
|
10
|
+
filename = File::Name::Random.example
|
11
|
+
|
12
|
+
file = ::File.join(directory, filename)
|
13
|
+
|
14
|
+
::File.write(file, contents)
|
15
|
+
|
16
|
+
file
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.contents
|
20
|
+
'# Some file'
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.directory
|
24
|
+
'tmp'
|
25
|
+
end
|
26
|
+
|
27
|
+
module Pass
|
28
|
+
def self.call(directory: nil)
|
29
|
+
Create.(contents:, directory:)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.contents
|
33
|
+
Create.contents
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
module Failure
|
38
|
+
def self.call(session: nil, directory: nil)
|
39
|
+
contents = contents(session:)
|
40
|
+
|
41
|
+
Create.(contents:, directory:)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.contents(session: nil)
|
45
|
+
session ||= Session.new
|
46
|
+
|
47
|
+
<<~RUBY
|
48
|
+
session = ObjectSpace._id2ref(#{session.object_id})
|
49
|
+
session.test do
|
50
|
+
session.assert(false)
|
51
|
+
end
|
52
|
+
RUBY
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
module Crash
|
57
|
+
def self.call(directory: nil)
|
58
|
+
Create.(contents:, directory:)
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.contents
|
62
|
+
"raise #{Exception}.example"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module TestBench
|
2
|
+
class Run
|
3
|
+
module Controls
|
4
|
+
module File
|
5
|
+
module Pattern
|
6
|
+
def self.example
|
7
|
+
Any.example
|
8
|
+
end
|
9
|
+
|
10
|
+
module Any
|
11
|
+
def self.example
|
12
|
+
'*'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module None
|
17
|
+
def self.example
|
18
|
+
random
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.random
|
22
|
+
Controls::Random.string
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|