documentation".
113 | #html_title = None
114 |
115 | # A shorter title for the navigation bar. Default is the same as html_title.
116 | #html_short_title = None
117 |
118 | # The name of an image file (relative to this directory) to place at the top
119 | # of the sidebar.
120 | #html_logo = None
121 |
122 | # The name of an image file (within the static path) to use as favicon of the
123 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
124 | # pixels large.
125 | #html_favicon = None
126 |
127 | # Add any paths that contain custom static files (such as style sheets) here,
128 | # relative to this directory. They are copied after the builtin static files,
129 | # so a file named "default.css" will overwrite the builtin "default.css".
130 | html_static_path = ['_static']
131 |
132 | # Add any extra paths that contain custom files (such as robots.txt or
133 | # .htaccess) here, relative to this directory. These files are copied
134 | # directly to the root of the documentation.
135 | #html_extra_path = []
136 |
137 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
138 | # using the given strftime format.
139 | html_last_updated_fmt = '%b %d, %Y'
140 |
141 | # If true, SmartyPants will be used to convert quotes and dashes to
142 | # typographically correct entities.
143 | #html_use_smartypants = True
144 |
145 | # Custom sidebar templates, maps document names to template names.
146 | #html_sidebars = {}
147 |
148 | # Additional templates that should be rendered to pages, maps page names to
149 | # template names.
150 | #html_additional_pages = {}
151 |
152 | # If false, no module index is generated.
153 | #html_domain_indices = True
154 |
155 | # If false, no index is generated.
156 | #html_use_index = True
157 |
158 | # If true, the index is split into individual pages for each letter.
159 | #html_split_index = False
160 |
161 | # If true, links to the reST sources are added to the pages.
162 | #html_show_sourcelink = True
163 |
164 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
165 | #html_show_sphinx = True
166 |
167 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
168 | #html_show_copyright = True
169 |
170 | # If true, an OpenSearch description file will be output, and all pages will
171 | # contain a tag referring to it. The value of this option must be the
172 | # base URL from which the finished HTML is served.
173 | #html_use_opensearch = ''
174 |
175 | # This is the file name suffix for HTML files (e.g. ".xhtml").
176 | #html_file_suffix = None
177 |
178 | # Output file base name for HTML help builder.
179 | htmlhelp_basename = 'LuaUnitdoc'
180 |
181 |
182 | # -- Options for LaTeX output ---------------------------------------------
183 |
184 | latex_elements = {
185 | # The paper size ('letterpaper' or 'a4paper').
186 | #'papersize': 'letterpaper',
187 |
188 | # The font size ('10pt', '11pt' or '12pt').
189 | #'pointsize': '10pt',
190 |
191 | # Additional stuff for the LaTeX preamble.
192 | #'preamble': '',
193 | }
194 |
195 | # Grouping the document tree into LaTeX files. List of tuples
196 | # (source start file, target name, title,
197 | # author, documentclass [howto, manual, or own class]).
198 | latex_documents = [
199 | ('index', 'LuaUnit.tex', u'LuaUnit Documentation',
200 | u'Philippe Fremy', 'manual'),
201 | ]
202 |
203 | # The name of an image file (relative to this directory) to place at the top of
204 | # the title page.
205 | #latex_logo = None
206 |
207 | # For "manual" documents, if this is true, then toplevel headings are parts,
208 | # not chapters.
209 | #latex_use_parts = False
210 |
211 | # If true, show page references after internal links.
212 | #latex_show_pagerefs = False
213 |
214 | # If true, show URL addresses after external links.
215 | #latex_show_urls = False
216 |
217 | # Documents to append as an appendix to all manuals.
218 | #latex_appendices = []
219 |
220 | # If false, no module index is generated.
221 | #latex_domain_indices = True
222 |
223 |
224 | # -- Options for manual page output ---------------------------------------
225 |
226 | # One entry per manual page. List of tuples
227 | # (source start file, name, description, authors, manual section).
228 | man_pages = [
229 | ('index', 'luaunit', u'LuaUnit Documentation',
230 | [u'Philippe Fremy'], 1)
231 | ]
232 |
233 | # If true, show URL addresses after external links.
234 | #man_show_urls = False
235 |
236 |
237 | # -- Options for Texinfo output -------------------------------------------
238 |
239 | # Grouping the document tree into Texinfo files. List of tuples
240 | # (source start file, target name, title, author,
241 | # dir menu entry, description, category)
242 | texinfo_documents = [
243 | ('index', 'LuaUnit', u'LuaUnit Documentation',
244 | u'Philippe Fremy', 'LuaUnit', 'One line description of project.',
245 | 'Miscellaneous'),
246 | ]
247 |
248 | # Documents to append as an appendix to all manuals.
249 | #texinfo_appendices = []
250 |
251 | # If false, no module index is generated.
252 | #texinfo_domain_indices = True
253 |
254 | # How to display URL addresses: 'footnote', 'no', or 'inline'.
255 | #texinfo_show_urls = 'footnote'
256 |
257 | # If true, do not generate a @detailmenu in the "Top" node's menu.
258 | #texinfo_no_detailmenu = False
259 |
260 |
--------------------------------------------------------------------------------
/junitxml/junit-apache-ant.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 | JUnit test result schema for the Apache Ant JUnit and JUnitReport tasks
8 | Copyright © 2011, Windy Road Technology Pty. Limited
9 | The Apache Ant JUnit XML Schema is distributed under the terms of the GNU Lesser General Public License (LGPL) http://www.gnu.org/licenses/lgpl.html
10 | Permission to waive conditions of this license may be requested from Windy Road Support (http://windyroad.org/support).
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | Contains an aggregation of testsuite results
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | Derived from testsuite/@name in the non-aggregated documents
31 |
32 |
33 |
34 |
35 | Starts at '0' for the first testsuite and is incremented by 1 for each following testsuite
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Contains the results of exexuting a testsuite
48 |
49 |
50 |
51 |
52 | Properties (e.g., environment settings) set during test execution
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | Indicates that the test errored. An errored test is one that had an unanticipated problem. e.g., an unchecked throwable; or a problem with the implementation of the test. Contains as a text node relevant data for the error, e.g., a stack trace
77 |
78 |
79 |
80 |
81 |
82 |
83 | The error message. e.g., if a java exception is thrown, the return value of getMessage()
84 |
85 |
86 |
87 |
88 | The type of error that occured. e.g., if a java execption is thrown the full class name of the exception.
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | Indicates that the test failed. A failure is a test which the code has explicitly failed by using the mechanisms for that purpose. e.g., via an assertEquals. Contains as a text node relevant data for the failure, e.g., a stack trace
98 |
99 |
100 |
101 |
102 |
103 |
104 | The message specified in the assert
105 |
106 |
107 |
108 |
109 | The type of the assert.
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 | Name of the test method
120 |
121 |
122 |
123 |
124 | Full class name for the class the test method is in.
125 |
126 |
127 |
128 |
129 | Time taken (in seconds) to execute the test
130 |
131 |
132 |
133 |
134 |
135 |
136 | Data that was written to standard out while the test was executed
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 | Data that was written to standard error while the test was executed
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 | Full class name of the test for non-aggregated testsuite documents. Class name without the package for aggregated testsuites documents
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 | when the test was executed. Timezone may not be specified.
168 |
169 |
170 |
171 |
172 | Host on which the tests were executed. 'localhost' should be used if the hostname cannot be determined.
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 | The total number of tests in the suite
183 |
184 |
185 |
186 |
187 | The total number of tests in the suite that failed. A failure is a test which the code has explicitly failed by using the mechanisms for that purpose. e.g., via an assertEquals
188 |
189 |
190 |
191 |
192 | The total number of tests in the suite that errorrd. An errored test is one that had an unanticipated problem. e.g., an unchecked throwable; or a problem with the implementation of the test.
193 |
194 |
195 |
196 |
197 | Time taken (in seconds) to execute the tests in the suite
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
--------------------------------------------------------------------------------
/junitxml/XMLJUnitResultFormatter.java.txt:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | *
17 | */
18 |
19 | package org.apache.tools.ant.taskdefs.optional.junit;
20 |
21 | import java.io.BufferedWriter;
22 | import java.io.IOException;
23 | import java.io.OutputStream;
24 | import java.io.OutputStreamWriter;
25 | import java.io.Writer;
26 | import java.util.Enumeration;
27 | import java.util.Hashtable;
28 | import java.util.Properties;
29 | import java.util.Date;
30 | import java.net.InetAddress;
31 | import java.net.UnknownHostException;
32 | import javax.xml.parsers.DocumentBuilder;
33 | import javax.xml.parsers.DocumentBuilderFactory;
34 | import junit.framework.AssertionFailedError;
35 | import junit.framework.Test;
36 | import org.apache.tools.ant.BuildException;
37 | import org.apache.tools.ant.util.DOMElementWriter;
38 | import org.apache.tools.ant.util.DateUtils;
39 | import org.apache.tools.ant.util.FileUtils;
40 | import org.w3c.dom.Document;
41 | import org.w3c.dom.Element;
42 | import org.w3c.dom.Text;
43 |
44 |
45 | /**
46 | * Prints XML output of the test to a specified Writer.
47 | *
48 | * @see FormatterElement
49 | */
50 |
51 | public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstants {
52 |
53 | private static final double ONE_SECOND = 1000.0;
54 |
55 | /** constant for unnnamed testsuites/cases */
56 | private static final String UNKNOWN = "unknown";
57 |
58 | private static DocumentBuilder getDocumentBuilder() {
59 | try {
60 | return DocumentBuilderFactory.newInstance().newDocumentBuilder();
61 | } catch (Exception exc) {
62 | throw new ExceptionInInitializerError(exc);
63 | }
64 | }
65 |
66 | /**
67 | * The XML document.
68 | */
69 | private Document doc;
70 | /**
71 | * The wrapper for the whole testsuite.
72 | */
73 | private Element rootElement;
74 | /**
75 | * Element for the current test.
76 | */
77 | private Hashtable testElements = new Hashtable();
78 | /**
79 | * tests that failed.
80 | */
81 | private Hashtable failedTests = new Hashtable();
82 | /**
83 | * Timing helper.
84 | */
85 | private Hashtable testStarts = new Hashtable();
86 | /**
87 | * Where to write the log to.
88 | */
89 | private OutputStream out;
90 |
91 | /** No arg constructor. */
92 | public XMLJUnitResultFormatter() {
93 | }
94 |
95 | /** {@inheritDoc}. */
96 | public void setOutput(OutputStream out) {
97 | this.out = out;
98 | }
99 |
100 | /** {@inheritDoc}. */
101 | public void setSystemOutput(String out) {
102 | formatOutput(SYSTEM_OUT, out);
103 | }
104 |
105 | /** {@inheritDoc}. */
106 | public void setSystemError(String out) {
107 | formatOutput(SYSTEM_ERR, out);
108 | }
109 |
110 | /**
111 | * The whole testsuite started.
112 | * @param suite the testsuite.
113 | */
114 | public void startTestSuite(JUnitTest suite) {
115 | doc = getDocumentBuilder().newDocument();
116 | rootElement = doc.createElement(TESTSUITE);
117 | String n = suite.getName();
118 | rootElement.setAttribute(ATTR_NAME, n == null ? UNKNOWN : n);
119 |
120 | //add the timestamp
121 | final String timestamp = DateUtils.format(new Date(),
122 | DateUtils.ISO8601_DATETIME_PATTERN);
123 | rootElement.setAttribute(TIMESTAMP, timestamp);
124 | //and the hostname.
125 | rootElement.setAttribute(HOSTNAME, getHostname());
126 |
127 | // Output properties
128 | Element propsElement = doc.createElement(PROPERTIES);
129 | rootElement.appendChild(propsElement);
130 | Properties props = suite.getProperties();
131 | if (props != null) {
132 | Enumeration e = props.propertyNames();
133 | while (e.hasMoreElements()) {
134 | String name = (String) e.nextElement();
135 | Element propElement = doc.createElement(PROPERTY);
136 | propElement.setAttribute(ATTR_NAME, name);
137 | propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
138 | propsElement.appendChild(propElement);
139 | }
140 | }
141 | }
142 |
143 | /**
144 | * get the local hostname
145 | * @return the name of the local host, or "localhost" if we cannot work it out
146 | */
147 | private String getHostname() {
148 | try {
149 | return InetAddress.getLocalHost().getHostName();
150 | } catch (UnknownHostException e) {
151 | return "localhost";
152 | }
153 | }
154 |
155 | /**
156 | * The whole testsuite ended.
157 | * @param suite the testsuite.
158 | * @throws BuildException on error.
159 | */
160 | public void endTestSuite(JUnitTest suite) throws BuildException {
161 | rootElement.setAttribute(ATTR_TESTS, "" + suite.runCount());
162 | rootElement.setAttribute(ATTR_FAILURES, "" + suite.failureCount());
163 | rootElement.setAttribute(ATTR_ERRORS, "" + suite.errorCount());
164 | rootElement.setAttribute(
165 | ATTR_TIME, "" + (suite.getRunTime() / ONE_SECOND));
166 | if (out != null) {
167 | Writer wri = null;
168 | try {
169 | wri = new BufferedWriter(new OutputStreamWriter(out, "UTF8"));
170 | wri.write("\n");
171 | (new DOMElementWriter()).write(rootElement, wri, 0, " ");
172 | } catch (IOException exc) {
173 | throw new BuildException("Unable to write log file", exc);
174 | } finally {
175 | if (wri != null) {
176 | try {
177 | wri.flush();
178 | } catch (IOException ex) {
179 | // ignore
180 | }
181 | }
182 | if (out != System.out && out != System.err) {
183 | FileUtils.close(wri);
184 | }
185 | }
186 | }
187 | }
188 |
189 | /**
190 | * Interface TestListener.
191 | *
192 | * A new Test is started.
193 | * @param t the test.
194 | */
195 | public void startTest(Test t) {
196 | testStarts.put(t, new Long(System.currentTimeMillis()));
197 | }
198 |
199 | /**
200 | * Interface TestListener.
201 | *
202 | *
A Test is finished.
203 | * @param test the test.
204 | */
205 | public void endTest(Test test) {
206 | // Fix for bug #5637 - if a junit.extensions.TestSetup is
207 | // used and throws an exception during setUp then startTest
208 | // would never have been called
209 | if (!testStarts.containsKey(test)) {
210 | startTest(test);
211 | }
212 |
213 | Element currentTest = null;
214 | if (!failedTests.containsKey(test)) {
215 | currentTest = doc.createElement(TESTCASE);
216 | String n = JUnitVersionHelper.getTestCaseName(test);
217 | currentTest.setAttribute(ATTR_NAME,
218 | n == null ? UNKNOWN : n);
219 | // a TestSuite can contain Tests from multiple classes,
220 | // even tests with the same name - disambiguate them.
221 | currentTest.setAttribute(ATTR_CLASSNAME,
222 | JUnitVersionHelper.getTestCaseClassName(test));
223 | rootElement.appendChild(currentTest);
224 | testElements.put(test, currentTest);
225 | } else {
226 | currentTest = (Element) testElements.get(test);
227 | }
228 |
229 | Long l = (Long) testStarts.get(test);
230 | currentTest.setAttribute(ATTR_TIME,
231 | "" + ((System.currentTimeMillis()
232 | - l.longValue()) / ONE_SECOND));
233 | }
234 |
235 | /**
236 | * Interface TestListener for JUnit <= 3.4.
237 | *
238 | *
A Test failed.
239 | * @param test the test.
240 | * @param t the exception.
241 | */
242 | public void addFailure(Test test, Throwable t) {
243 | formatError(FAILURE, test, t);
244 | }
245 |
246 | /**
247 | * Interface TestListener for JUnit > 3.4.
248 | *
249 | *
A Test failed.
250 | * @param test the test.
251 | * @param t the assertion.
252 | */
253 | public void addFailure(Test test, AssertionFailedError t) {
254 | addFailure(test, (Throwable) t);
255 | }
256 |
257 | /**
258 | * Interface TestListener.
259 | *
260 | *
An error occurred while running the test.
261 | * @param test the test.
262 | * @param t the error.
263 | */
264 | public void addError(Test test, Throwable t) {
265 | formatError(ERROR, test, t);
266 | }
267 |
268 | private void formatError(String type, Test test, Throwable t) {
269 | if (test != null) {
270 | endTest(test);
271 | failedTests.put(test, test);
272 | }
273 |
274 | Element nested = doc.createElement(type);
275 | Element currentTest = null;
276 | if (test != null) {
277 | currentTest = (Element) testElements.get(test);
278 | } else {
279 | currentTest = rootElement;
280 | }
281 |
282 | currentTest.appendChild(nested);
283 |
284 | String message = t.getMessage();
285 | if (message != null && message.length() > 0) {
286 | nested.setAttribute(ATTR_MESSAGE, t.getMessage());
287 | }
288 | nested.setAttribute(ATTR_TYPE, t.getClass().getName());
289 |
290 | String strace = JUnitTestRunner.getFilteredTrace(t);
291 | Text trace = doc.createTextNode(strace);
292 | nested.appendChild(trace);
293 | }
294 |
295 | private void formatOutput(String type, String output) {
296 | Element nested = doc.createElement(type);
297 | rootElement.appendChild(nested);
298 | nested.appendChild(doc.createCDATASection(output));
299 | }
300 |
301 | } // XMLJUnitResultFormatter
302 |
--------------------------------------------------------------------------------