tapout 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby +44 -0
- data/APACHE2.txt +204 -0
- data/HISTORY.rdoc +11 -0
- data/NOTICE.rdoc +38 -0
- data/README.rdoc +73 -0
- data/TAP-YJ.rdoc +296 -0
- data/bin/tapout +3 -0
- data/lib/tapout.rb +88 -0
- data/lib/tapout/reporters.rb +6 -0
- data/lib/tapout/reporters/abstract.rb +266 -0
- data/lib/tapout/reporters/breakdown.rb +120 -0
- data/lib/tapout/reporters/dotprogress.rb +69 -0
- data/lib/tapout/reporters/progressbar.rb +89 -0
- data/lib/tapout/reporters/tap.rb +80 -0
- data/lib/tapout/reporters/verbose.rb +54 -0
- data/lib/tapout/tap_legacy_adapter.rb +168 -0
- data/lib/tapout/tap_legacy_parser.rb +25 -0
- data/lib/tapout/tapy_parser.rb +58 -0
- data/lib/tapout/version.rb +7 -0
- data/qed/applique/env.rb +5 -0
- data/qed/tap_adapter.rdoc +68 -0
- metadata +129 -0
data/.ruby
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
spec_version: 1.0.0
|
3
|
+
replaces: []
|
4
|
+
|
5
|
+
loadpath:
|
6
|
+
- lib
|
7
|
+
name: tapout
|
8
|
+
repositories:
|
9
|
+
public: git://github.com/proutils/tapout.git
|
10
|
+
conflicts: []
|
11
|
+
|
12
|
+
engine_check: []
|
13
|
+
|
14
|
+
title: Tap Out
|
15
|
+
contact: trans <transfire@gmail.com>
|
16
|
+
resources:
|
17
|
+
code: http://github.com/rubyworks/tapout
|
18
|
+
home: http://rubyworks.github.com/tapout
|
19
|
+
maintainers: []
|
20
|
+
|
21
|
+
requires:
|
22
|
+
- group: []
|
23
|
+
|
24
|
+
name: ansi
|
25
|
+
version: 0+
|
26
|
+
- group:
|
27
|
+
- build
|
28
|
+
name: redline
|
29
|
+
version: 0+
|
30
|
+
- group:
|
31
|
+
- build
|
32
|
+
name: qed
|
33
|
+
version: 0+
|
34
|
+
manifest: MANIFEST.txt
|
35
|
+
version: 0.1.0
|
36
|
+
licenses:
|
37
|
+
- Apache 2.0
|
38
|
+
copyright: Copyright (c) 2010 Thomas Sawyer
|
39
|
+
authors:
|
40
|
+
- Thomas Sawyer
|
41
|
+
organization: RubyWorks
|
42
|
+
description: Tap Out is a TAP consumer that can take any TAP, TAP-Y or TAP-J stream and output it in a variety of useful formats.
|
43
|
+
summary: Progressive TAP Harness
|
44
|
+
created: 2010-12-23
|
data/APACHE2.txt
ADDED
@@ -0,0 +1,204 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
203
|
+
|
204
|
+
|
data/HISTORY.rdoc
ADDED
data/NOTICE.rdoc
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
= COPYRIGHT NOTICES
|
2
|
+
|
3
|
+
== KO
|
4
|
+
|
5
|
+
Copyright (c) 2010 Thomas Sawyer
|
6
|
+
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
you may not use this file except in compliance with the License.
|
9
|
+
You may obtain a copy of the License at
|
10
|
+
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
See the License for the specific language governing permissions and
|
17
|
+
limitations under the License.
|
18
|
+
|
19
|
+
|
20
|
+
== Detest
|
21
|
+
|
22
|
+
A small segement of code for outputing error messages was borrowed from the
|
23
|
+
Detest[http://snk.tuxfamily.org/lib/detest/] project.
|
24
|
+
|
25
|
+
Copyright 2009 Suraj N. Kurapati <sunaku@gmail.com>
|
26
|
+
|
27
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
28
|
+
purpose with or without fee is hereby granted, provided that the above
|
29
|
+
copyright notice and this permission notice appear in all copies.
|
30
|
+
|
31
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
32
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
33
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
34
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
35
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
36
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
37
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
38
|
+
|
data/README.rdoc
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
= Tap Out
|
2
|
+
|
3
|
+
|
4
|
+
== RESOURCES
|
5
|
+
|
6
|
+
* home: http://rubyworks.github.com/tapout
|
7
|
+
* work: http://github.com/rubyworks/tapout
|
8
|
+
|
9
|
+
|
10
|
+
== DESCRIPTION
|
11
|
+
|
12
|
+
Tap Out is a TAP handler. Tap Out supports TAP-Y/J as well as traditional TAP.
|
13
|
+
|
14
|
+
TAP-Y/J is an innovation of KO and Tap Out. It is a modernization of TAP using
|
15
|
+
pure YAML/JSON streams.
|
16
|
+
|
17
|
+
Traditional TAP has less detail than TAP-Y/J, but it can still be translated
|
18
|
+
with fairly good results. Tap Out includes a TAP adapter to handle the
|
19
|
+
translation transparently. Current Tap Out support TAP v12 with minor
|
20
|
+
limitations.
|
21
|
+
|
22
|
+
Tap Out fully supports TAP-Y at this time. TAP-J support is still in
|
23
|
+
development.
|
24
|
+
|
25
|
+
To learn about the TAP-Y/J specification, see the TAP-YJ.rdoc file.
|
26
|
+
|
27
|
+
For information about TAP, see http://testanything.org/wiki/index.php/Main_Page.
|
28
|
+
|
29
|
+
|
30
|
+
== SYNOPSIS
|
31
|
+
|
32
|
+
Using a test framework that produces a TAP-Y output stream, simply pipe
|
33
|
+
the stream into `tapout`.
|
34
|
+
|
35
|
+
$ ko -y -Ilib test/foo.rb | tapout
|
36
|
+
|
37
|
+
Tap Out supports a variety of output formats. These are selectable via the `-f`
|
38
|
+
option.
|
39
|
+
|
40
|
+
$ ko -y -Ilib test/foo.rb | tapout -f progessbar
|
41
|
+
|
42
|
+
Tap Out is smart enough to match the closest matching format name. So, for
|
43
|
+
example, the above could be written as:
|
44
|
+
|
45
|
+
$ ko -y -Ilib test/foo.rb | tapout -f pro
|
46
|
+
|
47
|
+
And tapout will know to use the `progressbar` format.
|
48
|
+
|
49
|
+
To see a list of supported formats use the list subcommand:
|
50
|
+
|
51
|
+
$ tapout list
|
52
|
+
|
53
|
+
If your test framework does not support TAP-Y, but does support traditional
|
54
|
+
TAP, Tap Out will automatically recognize the difference by TAP's `1..N` header.
|
55
|
+
|
56
|
+
$ ko -t -Ilib test/foo.rb | tapout -f progressbar
|
57
|
+
|
58
|
+
|
59
|
+
== COPYRIGHT
|
60
|
+
|
61
|
+
Tap Out, Copyright (c) 2010 Thomas Sawyer
|
62
|
+
|
63
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
64
|
+
you may not use this program except in compliance with the License.
|
65
|
+
You may obtain a copy of the License at
|
66
|
+
|
67
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
68
|
+
|
69
|
+
Unless required by applicable law or agreed to in writing, software
|
70
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
71
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
72
|
+
See the License for the specific language governing permissions and
|
73
|
+
limitations under the License.
|
data/TAP-YJ.rdoc
ADDED
@@ -0,0 +1,296 @@
|
|
1
|
+
= TAP-Y/J Format
|
2
|
+
|
3
|
+
TAP-Y and TAP-J are test streams. They are essentially the same except
|
4
|
+
for the underlying format used, which are YAML and JSON repsectively.
|
5
|
+
|
6
|
+
== TAP-Y Structure
|
7
|
+
|
8
|
+
TAP-Y is a plain YAML stream format. Only YAML core types are used,
|
9
|
+
scalar, sequence and mapping.
|
10
|
+
|
11
|
+
A YAML stream is composed a sequence of YAML *documents*, each divided by
|
12
|
+
a start document marker (<code>---</code>). Each document MUST have a +type+
|
13
|
+
field which designates it a +header+, +case+, +test+, +note+ or +footer+. Any
|
14
|
+
document MAY have an +extra+ field which contains an open mapping for
|
15
|
+
extraneous information.
|
16
|
+
|
17
|
+
=== Header
|
18
|
+
|
19
|
+
A +header+ starts a stream of tests.
|
20
|
+
|
21
|
+
---
|
22
|
+
type: header
|
23
|
+
start: 2011-10-10 12:12:32
|
24
|
+
count: 2
|
25
|
+
range: 1..2
|
26
|
+
|
27
|
+
The header +count+ indicates the number of total tests forethcoming. If
|
28
|
+
the number of tests is unknow, count can be omitted or marked <code>~</code>.
|
29
|
+
|
30
|
+
The +range+ defines the index of tests to be run separated by two period marks.
|
31
|
+
The range will usually start with 1, but may start with another number if the
|
32
|
+
underlying test system index tests.
|
33
|
+
|
34
|
+
The +start+ entry marks the date and time testing began.
|
35
|
+
|
36
|
+
=== Case
|
37
|
+
|
38
|
+
The +case+ type indicates the start of a test case.
|
39
|
+
|
40
|
+
---
|
41
|
+
type: case
|
42
|
+
description: Subtraction
|
43
|
+
|
44
|
+
The case docoument has a +description+ that is a free-form string describing
|
45
|
+
the nature of the test case.
|
46
|
+
|
47
|
+
=== Test
|
48
|
+
|
49
|
+
The +test+ type indicates a test. A test MUST have a +status+ with
|
50
|
+
one of five possible values: +pass+, +fail+, +error+, +omit+, +pending+.
|
51
|
+
|
52
|
+
---
|
53
|
+
type: test
|
54
|
+
status: pass
|
55
|
+
description: an important test
|
56
|
+
file: foo.rb
|
57
|
+
line: 45
|
58
|
+
returned: true
|
59
|
+
expected: true
|
60
|
+
source: ok 1, 2
|
61
|
+
snippet:
|
62
|
+
- 44: ok 0,0
|
63
|
+
- 45: ok 1,2
|
64
|
+
- 46: ok 2,4
|
65
|
+
time: 0.01
|
66
|
+
|
67
|
+
Like a case, the test can have a +description+.
|
68
|
+
|
69
|
+
A test SHOULD also have a +file+ and +line+ number for the location of
|
70
|
+
of the definition of the test, when +pass+ or +omit+, or the location
|
71
|
+
of the exception when +fail+ or +error+. A +pending+ test will give the
|
72
|
+
location of one or the other depending on how the underlying test system
|
73
|
+
behaves.
|
74
|
+
|
75
|
+
If a test fails or errors it MUST also provide a +message+ describing the
|
76
|
+
nature of the exception. It MAY also provide a system +backtrace+.
|
77
|
+
|
78
|
+
A test SHOULD also give an +expected+ and +returned+ value, if relavent
|
79
|
+
to the nature of the test. For example, the most common test operation is
|
80
|
+
equality, e.g. <code>assert_equal(4,3)</code>, so +expected+ would be 3 and
|
81
|
+
+returned+ 4.
|
82
|
+
|
83
|
+
A test SHOULD provide the line of +source+ code that triggers the test.
|
84
|
+
This will be the line of code the +file+ and +line+ number references.
|
85
|
+
|
86
|
+
The +snippet+ is like +source+ but provides surronding context. It MAY be
|
87
|
+
a verbatim string, in which case it MUST have an odd number of lines with
|
88
|
+
the source line in the center. Or, it MAY be an ordered map of
|
89
|
+
<i>- line: source</i>. Using an ordered map the line numbers may start
|
90
|
+
and end wherever, but they MUST be consecutive and the source line MUST
|
91
|
+
be among them.
|
92
|
+
|
93
|
+
Lastly, the +time+ is the number of seconds that have elapsed since the
|
94
|
+
the header start time.
|
95
|
+
|
96
|
+
=== Footer
|
97
|
+
|
98
|
+
The +footer+ type incidates the end of a test set.
|
99
|
+
|
100
|
+
---
|
101
|
+
type: footer
|
102
|
+
count: 2
|
103
|
+
tally:
|
104
|
+
pass: 1
|
105
|
+
fail: 1
|
106
|
+
error: 0
|
107
|
+
omit: 0
|
108
|
+
pending: 0
|
109
|
+
time: 0.03
|
110
|
+
...
|
111
|
+
|
112
|
+
It MUST give the total test +count+ and +tally+ for each test status, and
|
113
|
+
SHOULD give the time ellapsed.
|
114
|
+
|
115
|
+
The test stream end when a full ellipsis (<code>...</code>) appears.
|
116
|
+
|
117
|
+
As you can see TAP-Y streams provide a great deal of detail. They are not
|
118
|
+
intended for the end-user, but rather to pipe to consuming apps to process
|
119
|
+
into a human readable form.
|
120
|
+
|
121
|
+
|
122
|
+
== TAP-J
|
123
|
+
|
124
|
+
TAP-J documents follows all the same feild rules as TAP-Y, but are represented
|
125
|
+
as a stream of JSON documents.
|
126
|
+
|
127
|
+
{"type":"header", "count":"2", "range":"1..2"}
|
128
|
+
{"type":"case", "description":"Subtraction"}
|
129
|
+
{"type": "test", "status": "pass", "file": "foo.rb", "line": "45", "description": "an important test", "returned": true, "expected": true, "source": "ok 1, 2", "snippet": [{44:" ok 0,0"},{45:" ok 1,2"},{46:" ok 2,4"}], "time": 0.01}
|
130
|
+
|
131
|
+
...
|
132
|
+
|
133
|
+
Ans so on.
|
134
|
+
|
135
|
+
|
136
|
+
== Glossery of Fields
|
137
|
+
|
138
|
+
=== count
|
139
|
+
|
140
|
+
The `count` field provides the total number of tests being executed. It SHOULD
|
141
|
+
be given in the header, if possible, and it MUST be given in the footer.
|
142
|
+
|
143
|
+
=== extra
|
144
|
+
|
145
|
+
Additional data, not specifucally designated by this sepecification can
|
146
|
+
place under the `extra` section without worry that future versions of the
|
147
|
+
specification will come into conflict with the field name. The namespace
|
148
|
+
is a free-for-all, so use it with that in mind. Teh `extra` field can
|
149
|
+
appear in any document.
|
150
|
+
|
151
|
+
=== file
|
152
|
+
|
153
|
+
The `file` field provides the name of the file in which the test is defined,
|
154
|
+
or where th test failed/errored.
|
155
|
+
|
156
|
+
=== line
|
157
|
+
|
158
|
+
The `line` field provides the line number of the file on which the
|
159
|
+
definition of the test begins, or is the line number of where the
|
160
|
+
test failed/errored.
|
161
|
+
|
162
|
+
=== message
|
163
|
+
|
164
|
+
For tests with `fail` or `error` status, the message provides the explination
|
165
|
+
for the failure or error. Usually this is just the error message produced by
|
166
|
+
the underlying exception. The `pass` type can have the message field too,
|
167
|
+
but it will generally be ignored by TAP consumers.
|
168
|
+
|
169
|
+
=== range
|
170
|
+
|
171
|
+
The range of tests being executed of the test suite. The range is written in
|
172
|
+
the form of `X..Y`. Where X is the index of the first test and Y is the index
|
173
|
+
of last test.
|
174
|
+
|
175
|
+
NOTE: This may be deprecated since the count field probably suffices. Can a
|
176
|
+
range uniquely identify the tests being run? If not, the first sentinal will
|
177
|
+
always be 1, which is redundant.
|
178
|
+
|
179
|
+
=== snippet
|
180
|
+
|
181
|
+
The `snippet` field is either a verbatim string or an ordered mapping of line
|
182
|
+
number mapped to the source code for that line. While `snippet` is
|
183
|
+
like `source` it also contains extra lines of code before and after the
|
184
|
+
test `line` for context.
|
185
|
+
|
186
|
+
If `snippet` is a string it MUST consist an odd number of lines, the same
|
187
|
+
number before and after the source line in the center, unless the line occurs
|
188
|
+
at the begining or the end of the file. The number of lines before and after is
|
189
|
+
arbitrary and up to the producer, but should be the same on either side. Three
|
190
|
+
to five is generally enough.
|
191
|
+
|
192
|
+
=== source
|
193
|
+
|
194
|
+
The `source` field is a verbatim copy of the source code that defines the test.
|
195
|
+
This may be just the first line of the definition. In classic TAP this
|
196
|
+
is called `raw_test`.
|
197
|
+
|
198
|
+
=== start
|
199
|
+
|
200
|
+
The header SHOULD have a start time in ISO standard format <code>YYYY-MM-DD HH:MM:SS</code>.
|
201
|
+
|
202
|
+
=== status
|
203
|
+
|
204
|
+
The `status` field designates the status of a test document. Valid values
|
205
|
+
are `pass`, `fail`, `error`, `omit` and `pending`.
|
206
|
+
|
207
|
+
In comparison to the classic TAP format, `pass` is equivalent to `ok` and
|
208
|
+
`fail` and `error` are akin to `not ok`, where `fail` is "not ok" with regards
|
209
|
+
to a test assertion and `error` is "not ok" becuase of a raised coding error.
|
210
|
+
|
211
|
+
Tests with an `omit` status do not need to be provided in the document stream,
|
212
|
+
so this status will rarely appear in practice. But if a producer chooses to do
|
213
|
+
so this status simply means the test is purposefully being disregarded.
|
214
|
+
|
215
|
+
On the other hand, `pending` means the test will be used in the future
|
216
|
+
but implementation has not been completed. It serves as reminder to developers
|
217
|
+
to write a missing test.
|
218
|
+
|
219
|
+
=== tally
|
220
|
+
|
221
|
+
The footer MUST provide a tally for all status categories. This is like `count`
|
222
|
+
but broken down into status groups.
|
223
|
+
|
224
|
+
=== time
|
225
|
+
|
226
|
+
The tests and the footer SHOULD have the +time+ elapsed since starting the
|
227
|
+
tests given in number of seconds.
|
228
|
+
|
229
|
+
=== type
|
230
|
+
|
231
|
+
Each document MUST have a *type*. Valid types are `header`, `footer`, `case`,
|
232
|
+
`test` and `note`.
|
233
|
+
|
234
|
+
The `header` and `footer` types can only occur once, at the start and end of the
|
235
|
+
stream, respectively. All other types may occur repeatedly in between.
|
236
|
+
|
237
|
+
The `case` type marks the start of a testcase. All `test` (and `note`)
|
238
|
+
documents following it are considered a part of the case until a new case
|
239
|
+
document occurs.
|
240
|
+
|
241
|
+
|
242
|
+
== Example - Complete TAP-Y Stream
|
243
|
+
|
244
|
+
Here is a complete example.
|
245
|
+
|
246
|
+
An example of a TAP-Y stream looks like this:
|
247
|
+
|
248
|
+
---
|
249
|
+
type: header
|
250
|
+
count: 2
|
251
|
+
range: 1..2
|
252
|
+
---
|
253
|
+
type: case
|
254
|
+
description: Subtraction
|
255
|
+
---
|
256
|
+
type: test
|
257
|
+
status: pass
|
258
|
+
file: foo.rb
|
259
|
+
line: 45
|
260
|
+
description: an important test
|
261
|
+
returned: true
|
262
|
+
expected: true
|
263
|
+
source: ok 1, 2
|
264
|
+
snippet:
|
265
|
+
- 44: ok 0,0
|
266
|
+
- 45: ok 1,2
|
267
|
+
- 46: ok 2,4
|
268
|
+
---
|
269
|
+
type: test
|
270
|
+
status: fail
|
271
|
+
file: foo.rb
|
272
|
+
line: 46
|
273
|
+
description: another test
|
274
|
+
returned: false
|
275
|
+
expected: true
|
276
|
+
source: ok 2,4
|
277
|
+
snippet:
|
278
|
+
- 45: ok 1,2
|
279
|
+
- 46: ok 2,4
|
280
|
+
- 47:
|
281
|
+
message:
|
282
|
+
blah blah
|
283
|
+
extra:
|
284
|
+
THAC0: 16
|
285
|
+
---
|
286
|
+
type: footer
|
287
|
+
time: 0.01
|
288
|
+
count: 2
|
289
|
+
tally:
|
290
|
+
pass: 1
|
291
|
+
fail: 1
|
292
|
+
error: 0
|
293
|
+
omit: 0
|
294
|
+
pending: 0
|
295
|
+
...
|
296
|
+
|