minitest_log 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +26 -26
- data/README.md +113 -9
- data/lib/minitest_log/version.rb +1 -1
- data/minitest_log.gemspec +3 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 236b57c783822edbb9a07679686b08149677797e5a7a047ec73fc093185fb1ba
|
4
|
+
data.tar.gz: 868cc374fad37e8da78356faa0a8d637203132964c47c8ad6b6af6d572175772
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a671ea26b34d7aa17791d9bdef45c0162bc5bd21f1645b47ee100ff1ebfe31e4f9e8f78aecd107453e425864600f98c86f306e78cf721e6ed7ce4a39443f3eb0
|
7
|
+
data.tar.gz: 07caf2ac34f7ef71875eb9167a4b55b3107004665f118d3b563b153c11f21d3b4441510b918cd199d6c60b1c19cdc070e63e31f562b935f099a7fd96229141ac
|
data/Gemfile.lock
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
minitest_log (0.
|
5
|
-
diff-lcs (~> 1.3)
|
6
|
-
minitest (~> 5.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
diff-lcs (1.3)
|
12
|
-
markdown_helper (2.1.0)
|
13
|
-
minitest (5.11.3)
|
14
|
-
rake (10.5.0)
|
15
|
-
|
16
|
-
PLATFORMS
|
17
|
-
x64-mingw32
|
18
|
-
|
19
|
-
DEPENDENCIES
|
20
|
-
bundler (~> 1.7)
|
21
|
-
markdown_helper (~> 2.0)
|
22
|
-
minitest_log!
|
23
|
-
rake (~> 10.0)
|
24
|
-
|
25
|
-
BUNDLED WITH
|
26
|
-
1.17.3
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
minitest_log (1.0.0)
|
5
|
+
diff-lcs (~> 1.3)
|
6
|
+
minitest (~> 5.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
diff-lcs (1.3)
|
12
|
+
markdown_helper (2.1.0)
|
13
|
+
minitest (5.11.3)
|
14
|
+
rake (10.5.0)
|
15
|
+
|
16
|
+
PLATFORMS
|
17
|
+
x64-mingw32
|
18
|
+
|
19
|
+
DEPENDENCIES
|
20
|
+
bundler (~> 1.7)
|
21
|
+
markdown_helper (~> 2.0)
|
22
|
+
minitest_log!
|
23
|
+
rake (~> 10.0)
|
24
|
+
|
25
|
+
BUNDLED WITH
|
26
|
+
1.17.3
|
data/README.md
CHANGED
@@ -1,14 +1,19 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/minitest_log.svg)](https://badge.fury.io/rb/minitest_log)
|
2
|
-
|
3
1
|
# MinitestLog
|
4
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/minitest_log.svg)](https://badge.fury.io/rb/minitest_log)
|
5
4
|
|
6
5
|
```MinitestLog``` gives you three things:
|
7
6
|
|
8
7
|
- **Nested sections:** Use nested sections to structure your test (and, importantly, its log), so that the test can "tell its story" clearly.
|
9
|
-
- **Data explication:** Use data-logging methods to log objects. Most collections (```
|
8
|
+
- **Data explication:** Use data-logging methods to log objects. Most collections (```Array```, ```Hash```, etc.) are automatically logged in detail.
|
10
9
|
- **(And of course) Verdicts:** Use verdict methods to express assertions. Details for the verdict are logged, whether passed or failed.
|
11
10
|
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
```sh
|
14
|
+
gem install minitest_log
|
15
|
+
```
|
16
|
+
|
12
17
|
## Contents
|
13
18
|
- [Logs and Sections](#logs-and-sections)
|
14
19
|
- [Nested Sections](#nested-sections)
|
@@ -25,6 +30,7 @@
|
|
25
30
|
- [XML Indentation](#xml-indentation)
|
26
31
|
- [Summary](#summary)
|
27
32
|
- [Error Verdict](#error-verdict)
|
33
|
+
- [Backtrace Filter](#backtrace-filter)
|
28
34
|
- [Data](#data)
|
29
35
|
- [Strings](#strings)
|
30
36
|
- [Hash-Like Objects](#hash-like-objects)
|
@@ -69,6 +75,8 @@
|
|
69
75
|
- [Use Short Verdict Aliases](#use-short-verdict-aliases)
|
70
76
|
- [Avoid Failure Clutter](#avoid-failure-clutter)
|
71
77
|
- [Facilitate Post-Processing](#facilitate-post-processing)
|
78
|
+
- [Oh, and Tests](#oh-and-tests)
|
79
|
+
- [About This README](#about-this-readme)
|
72
80
|
|
73
81
|
## Logs and Sections
|
74
82
|
|
@@ -278,13 +286,13 @@ end
|
|
278
286
|
```log.xml```:
|
279
287
|
```xml
|
280
288
|
<log>
|
281
|
-
<section_ name='My section with timestamp' timestamp='2019-05-
|
289
|
+
<section_ name='My section with timestamp' timestamp='2019-05-09-Thu-10.32.53.066'>
|
282
290
|
Section with timestamp.
|
283
291
|
</section_>
|
284
292
|
<section_ name='My section with duration' duration_seconds='0.501'>
|
285
293
|
Section with duration.
|
286
294
|
</section_>
|
287
|
-
<section_ name='My section with both' timestamp='2019-05-
|
295
|
+
<section_ name='My section with both' timestamp='2019-05-09-Thu-10.32.53.568' duration_seconds='0.501'>
|
288
296
|
Section with both.
|
289
297
|
</section_>
|
290
298
|
</log>
|
@@ -356,7 +364,7 @@ end
|
|
356
364
|
```xml
|
357
365
|
<log>
|
358
366
|
<section_ name='My unrescued section'>
|
359
|
-
<uncaught_exception_ timestamp='2019-05-
|
367
|
+
<uncaught_exception_ timestamp='2019-05-09-Thu-10.32.54.471' class='RuntimeError'>
|
360
368
|
<message_>
|
361
369
|
Boo!
|
362
370
|
</message_>
|
@@ -413,7 +421,7 @@ end
|
|
413
421
|
```log.xml```:
|
414
422
|
```xml
|
415
423
|
<log>
|
416
|
-
<section_ name='Section with potpourri of arguments' a='0' b='1' timestamp='2019-05-
|
424
|
+
<section_ name='Section with potpourri of arguments' a='0' b='1' timestamp='2019-05-09-Thu-10.32.51.426' c='2' d='3' duration_seconds='0.501'>
|
417
425
|
Word More words
|
418
426
|
<rescued_exception_ class='Exception' message='Boo!'>
|
419
427
|
<backtrace_>
|
@@ -828,6 +836,85 @@ error_verdict.rb:9:in `test_demo'
|
|
828
836
|
</log>
|
829
837
|
```
|
830
838
|
|
839
|
+
#### Backtrace Filter
|
840
|
+
|
841
|
+
By default, a backtrace omits entries containing the token ```minitest```. This keeps the backtrace focussed on your code instead of the gems' code.
|
842
|
+
|
843
|
+
Override that behavior by specifying ioption ```:backtrace_filter``` with a ```Regexp``` object. Entries matching that pattern will be omitted from the backtrace.
|
844
|
+
|
845
|
+
```backtrace_filter.rb```:
|
846
|
+
```ruby
|
847
|
+
require 'minitest_log'
|
848
|
+
class Test < Minitest::Test
|
849
|
+
def test_demo
|
850
|
+
MinitestLog.new('default_backtrace_filter.xml') do |log|
|
851
|
+
fail 'Boo!'
|
852
|
+
end
|
853
|
+
MinitestLog.new('custom_backtrace_filter.xml', :backtrace_filter => /xxx/) do |log|
|
854
|
+
fail 'Boo!'
|
855
|
+
end
|
856
|
+
end
|
857
|
+
end
|
858
|
+
```
|
859
|
+
|
860
|
+
```default_backtrace_filter.xml```:
|
861
|
+
```xml
|
862
|
+
<log>
|
863
|
+
<uncaught_exception_ timestamp='2019-05-09-Thu-10.32.49.597' class='RuntimeError'>
|
864
|
+
<message_>
|
865
|
+
Boo!
|
866
|
+
</message_>
|
867
|
+
<backtrace_>
|
868
|
+
<![CDATA[
|
869
|
+
backtrace_filter.rb:5:in `block in test_demo'
|
870
|
+
backtrace_filter.rb:4:in `new'
|
871
|
+
backtrace_filter.rb:4:in `test_demo'
|
872
|
+
]]>
|
873
|
+
</backtrace_>
|
874
|
+
</uncaught_exception_>
|
875
|
+
</log>
|
876
|
+
```
|
877
|
+
|
878
|
+
```custom_backtrace_filter.xml```:
|
879
|
+
```xml
|
880
|
+
<log>
|
881
|
+
<uncaught_exception_ timestamp='2019-05-09-Thu-10.32.49.599' class='RuntimeError'>
|
882
|
+
<message_>
|
883
|
+
Boo!
|
884
|
+
</message_>
|
885
|
+
<backtrace_>
|
886
|
+
<![CDATA[
|
887
|
+
backtrace_filter.rb:8:in `block in test_demo'
|
888
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest_log-0.2.0/lib/minitest_log.rb:59:in `initialize'
|
889
|
+
backtrace_filter.rb:7:in `new'
|
890
|
+
backtrace_filter.rb:7:in `test_demo'
|
891
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest/test.rb:98:in `block (3 levels) in run'
|
892
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest/test.rb:195:in `capture_exceptions'
|
893
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest/test.rb:95:in `block (2 levels) in run'
|
894
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:265:in `time_it'
|
895
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest/test.rb:94:in `block in run'
|
896
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:360:in `on_signal'
|
897
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest/test.rb:211:in `with_info_handler'
|
898
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest/test.rb:93:in `run'
|
899
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:960:in `run_one_method'
|
900
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:334:in `run_one_method'
|
901
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:321:in `block (2 levels) in run'
|
902
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:320:in `each'
|
903
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:320:in `block in run'
|
904
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:360:in `on_signal'
|
905
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:347:in `with_info_handler'
|
906
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:319:in `run'
|
907
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:159:in `block in __run'
|
908
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:159:in `map'
|
909
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:159:in `__run'
|
910
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:136:in `run'
|
911
|
+
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest.rb:63:in `block in autorun'
|
912
|
+
]]>
|
913
|
+
</backtrace_>
|
914
|
+
</uncaught_exception_>
|
915
|
+
</log>
|
916
|
+
```
|
917
|
+
|
831
918
|
|
832
919
|
## Data
|
833
920
|
|
@@ -1026,7 +1113,7 @@ end
|
|
1026
1113
|
(?-mix:Bar)
|
1027
1114
|
</data_>
|
1028
1115
|
<data_ name='My time' class='Time' method=':to_s'>
|
1029
|
-
2019-05-
|
1116
|
+
2019-05-09 10:32:47 -0500
|
1030
1117
|
</data_>
|
1031
1118
|
<data_ name='My uri,' class='URI::HTTPS' method=':to_s'>
|
1032
1119
|
https://www.github.com
|
@@ -1798,7 +1885,7 @@ end
|
|
1798
1885
|
<verdict_ method='verdict_assert_same?' outcome='failed' id='another_id' message='Another message'>
|
1799
1886
|
<expected_ class='String' value='"foo"'/>
|
1800
1887
|
<actual_ class='String' value='"foo"'/>
|
1801
|
-
<exception_ class='Minitest::Assertion' message='Expected "foo" (oid=
|
1888
|
+
<exception_ class='Minitest::Assertion' message='Expected "foo" (oid=27933780) to be the same as "foo" (oid=27933800).'>
|
1802
1889
|
<backtrace_>
|
1803
1890
|
<![CDATA[
|
1804
1891
|
verdict_assert_same.rb:6:in `block in test_demo_verdict'
|
@@ -2579,3 +2666,20 @@ If your logs will be parsed in post-processing, you can make that go smoother by
|
|
2579
2666
|
- ```:error_verdict => true```: so that a log that has errors will also have at least one failed verdict.
|
2580
2667
|
|
2581
2668
|
See [Options](#options)
|
2669
|
+
|
2670
|
+
## Oh, and Tests
|
2671
|
+
|
2672
|
+
This project's tests generate 135 [logs and other output files](../../tree/master/test/actual), performing 484 verifications.
|
2673
|
+
|
2674
|
+
- [log_test.rb](../../tree/master/test/log_test.rb)
|
2675
|
+
- [verdict_test.rb](../../tree/master/test/verdict_test.rb)
|
2676
|
+
|
2677
|
+
## About This README
|
2678
|
+
|
2679
|
+
This README page is kept "green" because in addition to the tests, there's a rake task that:
|
2680
|
+
|
2681
|
+
- Executes the [50 example scripts](markdown/readme), capturing their output.
|
2682
|
+
- Uses file inclusion to assemble this ```README.md``` file.
|
2683
|
+
|
2684
|
+
Shameless plug: GitHub flavored markdown does not support file inclusion, but my Ruby gem [markdown_helper](https://rubygems.org/gems/markdown_helper) does. It's a [GitHub project](https://github.com/BurdetteLamar/markdown_helper#markdown-helper), too.
|
2685
|
+
|
data/lib/minitest_log/version.rb
CHANGED
data/minitest_log.gemspec
CHANGED
@@ -5,10 +5,11 @@ require 'minitest_log/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'minitest_log'
|
7
7
|
spec.version = MinitestLog::VERSION
|
8
|
-
spec.authors = ['
|
8
|
+
spec.authors = ['Burdette Lamar']
|
9
9
|
spec.email = ['burdettelamar@yahoo.com']
|
10
10
|
|
11
|
-
spec.summary = %q{Logging for
|
11
|
+
spec.summary = %q{Logging for testing with Minitest}
|
12
|
+
spec.description = "Gem minitest_log uses Minitest, adding structured loging, data explication, and verdicts."
|
12
13
|
spec.homepage = "https://github.com/BurdetteLamar/minitest_log"
|
13
14
|
spec.license = 'MIT'
|
14
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest_log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Burdette Lamar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -80,7 +80,8 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.3'
|
83
|
-
description:
|
83
|
+
description: Gem minitest_log uses Minitest, adding structured loging, data explication,
|
84
|
+
and verdicts.
|
84
85
|
email:
|
85
86
|
- burdettelamar@yahoo.com
|
86
87
|
executables: []
|
@@ -126,5 +127,5 @@ rubyforge_project:
|
|
126
127
|
rubygems_version: 2.7.6
|
127
128
|
signing_key:
|
128
129
|
specification_version: 4
|
129
|
-
summary: Logging for
|
130
|
+
summary: Logging for testing with Minitest
|
130
131
|
test_files: []
|