diff options
Diffstat (limited to 'Data/Libraries/luaunit/junitxml')
9 files changed, 835 insertions, 0 deletions
diff --git a/Data/Libraries/luaunit/junitxml/Makefile b/Data/Libraries/luaunit/junitxml/Makefile new file mode 100644 index 0000000..9679016 --- /dev/null +++ b/Data/Libraries/luaunit/junitxml/Makefile @@ -0,0 +1,17 @@ +# +# junitxml/Makefile +# + +XMLLINT ?= xmllint +TEST_APACHE = --noout --schema junit-apache-ant.xsd +TEST_JENKINS = --noout --schema junit-jenkins.xsd + +validate-examples: validate-apache validate-jenkins + +# This example file is the only one that satisfies the Apache schema +validate-apache: example-apache-ant.xml + $(XMLLINT) $(TEST_APACHE) $< + +# The Jenkins schema is more relaxed, and should apply to all .xml files +validate-jenkins: $(wildcard *.xml) + for file in $^; do $(XMLLINT) $(TEST_JENKINS) $$file || exit 1; done diff --git a/Data/Libraries/luaunit/junitxml/XMLJUnitResultFormatter.java.txt b/Data/Libraries/luaunit/junitxml/XMLJUnitResultFormatter.java.txt new file mode 100644 index 0000000..5e3d1d7 --- /dev/null +++ b/Data/Libraries/luaunit/junitxml/XMLJUnitResultFormatter.java.txt @@ -0,0 +1,301 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.tools.ant.taskdefs.optional.junit; + +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Properties; +import java.util.Date; +import java.net.InetAddress; +import java.net.UnknownHostException; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import junit.framework.AssertionFailedError; +import junit.framework.Test; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.util.DOMElementWriter; +import org.apache.tools.ant.util.DateUtils; +import org.apache.tools.ant.util.FileUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Text; + + +/** + * Prints XML output of the test to a specified Writer. + * + * @see FormatterElement + */ + +public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstants { + + private static final double ONE_SECOND = 1000.0; + + /** constant for unnnamed testsuites/cases */ + private static final String UNKNOWN = "unknown"; + + private static DocumentBuilder getDocumentBuilder() { + try { + return DocumentBuilderFactory.newInstance().newDocumentBuilder(); + } catch (Exception exc) { + throw new ExceptionInInitializerError(exc); + } + } + + /** + * The XML document. + */ + private Document doc; + /** + * The wrapper for the whole testsuite. + */ + private Element rootElement; + /** + * Element for the current test. + */ + private Hashtable testElements = new Hashtable(); + /** + * tests that failed. + */ + private Hashtable failedTests = new Hashtable(); + /** + * Timing helper. + */ + private Hashtable testStarts = new Hashtable(); + /** + * Where to write the log to. + */ + private OutputStream out; + + /** No arg constructor. */ + public XMLJUnitResultFormatter() { + } + + /** {@inheritDoc}. */ + public void setOutput(OutputStream out) { + this.out = out; + } + + /** {@inheritDoc}. */ + public void setSystemOutput(String out) { + formatOutput(SYSTEM_OUT, out); + } + + /** {@inheritDoc}. */ + public void setSystemError(String out) { + formatOutput(SYSTEM_ERR, out); + } + + /** + * The whole testsuite started. + * @param suite the testsuite. + */ + public void startTestSuite(JUnitTest suite) { + doc = getDocumentBuilder().newDocument(); + rootElement = doc.createElement(TESTSUITE); + String n = suite.getName(); + rootElement.setAttribute(ATTR_NAME, n == null ? UNKNOWN : n); + + //add the timestamp + final String timestamp = DateUtils.format(new Date(), + DateUtils.ISO8601_DATETIME_PATTERN); + rootElement.setAttribute(TIMESTAMP, timestamp); + //and the hostname. + rootElement.setAttribute(HOSTNAME, getHostname()); + + // Output properties + Element propsElement = doc.createElement(PROPERTIES); + rootElement.appendChild(propsElement); + Properties props = suite.getProperties(); + if (props != null) { + Enumeration e = props.propertyNames(); + while (e.hasMoreElements()) { + String name = (String) e.nextElement(); + Element propElement = doc.createElement(PROPERTY); + propElement.setAttribute(ATTR_NAME, name); + propElement.setAttribute(ATTR_VALUE, props.getProperty(name)); + propsElement.appendChild(propElement); + } + } + } + + /** + * get the local hostname + * @return the name of the local host, or "localhost" if we cannot work it out + */ + private String getHostname() { + try { + return InetAddress.getLocalHost().getHostName(); + } catch (UnknownHostException e) { + return "localhost"; + } + } + + /** + * The whole testsuite ended. + * @param suite the testsuite. + * @throws BuildException on error. + */ + public void endTestSuite(JUnitTest suite) throws BuildException { + rootElement.setAttribute(ATTR_TESTS, "" + suite.runCount()); + rootElement.setAttribute(ATTR_FAILURES, "" + suite.failureCount()); + rootElement.setAttribute(ATTR_ERRORS, "" + suite.errorCount()); + rootElement.setAttribute( + ATTR_TIME, "" + (suite.getRunTime() / ONE_SECOND)); + if (out != null) { + Writer wri = null; + try { + wri = new BufferedWriter(new OutputStreamWriter(out, "UTF8")); + wri.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"); + (new DOMElementWriter()).write(rootElement, wri, 0, " "); + } catch (IOException exc) { + throw new BuildException("Unable to write log file", exc); + } finally { + if (wri != null) { + try { + wri.flush(); + } catch (IOException ex) { + // ignore + } + } + if (out != System.out && out != System.err) { + FileUtils.close(wri); + } + } + } + } + + /** + * Interface TestListener. + * + * <p>A new Test is started. + * @param t the test. + */ + public void startTest(Test t) { + testStarts.put(t, new Long(System.currentTimeMillis())); + } + + /** + * Interface TestListener. + * + * <p>A Test is finished. + * @param test the test. + */ + public void endTest(Test test) { + // Fix for bug #5637 - if a junit.extensions.TestSetup is + // used and throws an exception during setUp then startTest + // would never have been called + if (!testStarts.containsKey(test)) { + startTest(test); + } + + Element currentTest = null; + if (!failedTests.containsKey(test)) { + currentTest = doc.createElement(TESTCASE); + String n = JUnitVersionHelper.getTestCaseName(test); + currentTest.setAttribute(ATTR_NAME, + n == null ? UNKNOWN : n); + // a TestSuite can contain Tests from multiple classes, + // even tests with the same name - disambiguate them. + currentTest.setAttribute(ATTR_CLASSNAME, + JUnitVersionHelper.getTestCaseClassName(test)); + rootElement.appendChild(currentTest); + testElements.put(test, currentTest); + } else { + currentTest = (Element) testElements.get(test); + } + + Long l = (Long) testStarts.get(test); + currentTest.setAttribute(ATTR_TIME, + "" + ((System.currentTimeMillis() + - l.longValue()) / ONE_SECOND)); + } + + /** + * Interface TestListener for JUnit <= 3.4. + * + * <p>A Test failed. + * @param test the test. + * @param t the exception. + */ + public void addFailure(Test test, Throwable t) { + formatError(FAILURE, test, t); + } + + /** + * Interface TestListener for JUnit > 3.4. + * + * <p>A Test failed. + * @param test the test. + * @param t the assertion. + */ + public void addFailure(Test test, AssertionFailedError t) { + addFailure(test, (Throwable) t); + } + + /** + * Interface TestListener. + * + * <p>An error occurred while running the test. + * @param test the test. + * @param t the error. + */ + public void addError(Test test, Throwable t) { + formatError(ERROR, test, t); + } + + private void formatError(String type, Test test, Throwable t) { + if (test != null) { + endTest(test); + failedTests.put(test, test); + } + + Element nested = doc.createElement(type); + Element currentTest = null; + if (test != null) { + currentTest = (Element) testElements.get(test); + } else { + currentTest = rootElement; + } + + currentTest.appendChild(nested); + + String message = t.getMessage(); + if (message != null && message.length() > 0) { + nested.setAttribute(ATTR_MESSAGE, t.getMessage()); + } + nested.setAttribute(ATTR_TYPE, t.getClass().getName()); + + String strace = JUnitTestRunner.getFilteredTrace(t); + Text trace = doc.createTextNode(strace); + nested.appendChild(trace); + } + + private void formatOutput(String type, String output) { + Element nested = doc.createElement(type); + rootElement.appendChild(nested); + nested.appendChild(doc.createCDATASection(output)); + } + +} // XMLJUnitResultFormatter diff --git a/Data/Libraries/luaunit/junitxml/example-apache-ant.xml b/Data/Libraries/luaunit/junitxml/example-apache-ant.xml new file mode 100644 index 0000000..6123da0 --- /dev/null +++ b/Data/Libraries/luaunit/junitxml/example-apache-ant.xml @@ -0,0 +1,31 @@ +<testsuites> + <testsuite name="testsuite1" tests="21" id="123456" package="???" + failures="0" errors="0" time="21.67" timestamp="2015-01-01T12:33:00" hostname="localhost"> + <properties> + <property name="prop1" value="value1"/> + </properties> + <testcase name="toto" + classname="titi" time="33.17" > + <!-- Optional --> + <!-- <skipped>bla bla</skipped> --> + <failure + type="typeOfFailure" message="failureMsg"> + Detailed failure content + </failure> + </testcase> + <!-- + <system-out>bla bla output bla bla</system-out> + <system-err>bla bla error bla bla</system-err> + --> + <testcase name="toto" + classname="titi" time="17.33" > + <!-- Optional --> + <error + type="typeOfError" message="errorMsg"> + Detailed error content + </error> + </testcase> + <system-out>bla bla output bla bla</system-out> + <system-err>bla bla error bla bla</system-err> + </testsuite> +</testsuites>
\ No newline at end of file diff --git a/Data/Libraries/luaunit/junitxml/example-bamboo-1.xml b/Data/Libraries/luaunit/junitxml/example-bamboo-1.xml new file mode 100644 index 0000000..f0b9933 --- /dev/null +++ b/Data/Libraries/luaunit/junitxml/example-bamboo-1.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite errors="0" tests="3" time="0.391" failures="1" + name="com.atlassian.bamboo.repository.perforce.PerforceSyncCommandTest"> + <properties> + <property value="Java(TM) 2 Runtime Environment, Standard Edition" name="java.runtime.name"/> + <property value="UnicodeBig" name="sun.io.unicode.encoding"/> + </properties> + <testcase time="0.001" name="testGeneratesCorrectP4CommandLine"/> + <testcase time="0" name="testGettersReturnExpectedStuff"/> + <testcase time="0.164" name="testUsingPerforceWhenNoFilesHaveChanged"> + <failure type="junit.framework.AssertionFailedError" + message="Should not have any errors. [Perforce client error:, Connect to server failed; "> + junit.framework.AssertionFailedError: Should not have any errors. [Perforce client error:, Connect to server + failed; check $P4PORT., TCP connect to keg failed., keg: host unknown.] expected:<0> but was:<4> + at junit.framework.Assert.fail(Assert.java:47) + at junit.framework.Assert.failNotEquals(Assert.java:282) + at junit.framework.Assert.assertEquals(Assert.java:64) + at junit.framework.Assert.assertEquals(Assert.java:201) + at com.atlassian.bamboo.repository.perforce.PerforceSyncCommandTest.testUsingPerforceWhenNoFilesHaveChanged(PerforceSyncCommandTest.java:60) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) + at java.lang.reflect.Method.invoke(Method.java:585) + at junit.framework.TestCase.runTest(TestCase.java:154) + at junit.framework.TestCase.runBare(TestCase.java:127) + at junit.framework.TestResult$1.protect(TestResult.java:106) + at junit.framework.TestResult.runProtected(TestResult.java:124) + at junit.framework.TestResult.run(TestResult.java:109) + at junit.framework.TestCase.run(TestCase.java:118) + at junit.framework.TestSuite.runTest(TestSuite.java:208) + at junit.framework.TestSuite.run(TestSuite.java:203) + at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) + at java.lang.reflect.Method.invoke(Method.java:585) + at org.apache.maven.surefire.battery.JUnitBattery.executeJUnit(JUnitBattery.java:242) + at org.apache.maven.surefire.battery.JUnitBattery.execute(JUnitBattery.java:216) + at org.apache.maven.surefire.Surefire.executeBattery(Surefire.java:215) + at org.apache.maven.surefire.Surefire.run(Surefire.java:163) + at org.apache.maven.surefire.Surefire.run(Surefire.java:87) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) + at java.lang.reflect.Method.invoke(Method.java:585) + at org.apache.maven.surefire.SurefireBooter.runTestsInProcess(SurefireBooter.java:313) + at org.apache.maven.surefire.SurefireBooter.run(SurefireBooter.java:221) + at org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:371) + at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412) + at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534) + at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475) + at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454) + at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306) + at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273) + at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140) + at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322) + at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115) + at org.apache.maven.cli.MavenCli.main(MavenCli.java:256) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) + at java.lang.reflect.Method.invoke(Method.java:585) + at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) + at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) + at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) + at org.codehaus.classworlds.Launcher.main(Launcher.java:375) + </failure> + <system-out> + PerforceSyncCommand.command: /usr/local/bin/p4 + </system-out> + </testcase> +</testsuite>
\ No newline at end of file diff --git a/Data/Libraries/luaunit/junitxml/example-bamboo-2.xml b/Data/Libraries/luaunit/junitxml/example-bamboo-2.xml new file mode 100644 index 0000000..02f628c --- /dev/null +++ b/Data/Libraries/luaunit/junitxml/example-bamboo-2.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<testsuite errors="0" skipped="0" tests="1" time="0.045" failures="0" name="com.atlassian.bamboo.labels.LabelManagerImplTest"> + <properties> + <property value="Java(TM) 2 Runtime Environment, Standard Edition" name="java.runtime.name"/> + <property value="/usr/java/jdk1.5.0_07/jre/lib/i386" name="sun.boot.library.path"/> + <property value="1.5.0_07-b03" name="java.vm.version"/> + <property value="Sun Microsystems Inc." name="java.vm.vendor"/> + <property value="http://java.sun.com/" name="java.vendor.url"/> + <property value=":" name="path.separator"/> + <property value="Java HotSpot(TM) Client VM" name="java.vm.name"/> + <property value="sun.io" name="file.encoding.pkg"/> + <property value="US" name="user.country"/> + <property value="unknown" name="sun.os.patch.level"/> + <property value="Java Virtual Machine Specification" name="java.vm.specification.name"/> + <property value="/opt/bamboo-data/bamboohome/xml-data/build-dir/BAM-MAIN" name="user.dir"/> + <property value="1.5.0_07-b03" name="java.runtime.version"/> + <property value="sun.awt.X11GraphicsEnvironment" name="java.awt.graphicsenv"/> + <property value="/opt/bamboo-data/bamboohome/xml-data/build-dir/BAM-MAIN/bamboo-core" name="basedir"/> + <property value="/usr/java/jdk1.5.0_07/jre/lib/endorsed" name="java.endorsed.dirs"/> + <property value="i386" name="os.arch"/> + <property value="/tmp" name="java.io.tmpdir"/> + <property value="Sun Microsystems Inc." name="java.vm.specification.vendor"/> + <property value="Linux" name="os.name"/> + <property value="/opt/java/tools/maven2/bin/m2.conf" name="classworlds.conf"/> + <property value="ISO-8859-1" name="sun.jnu.encoding"/> + <property value="/usr/java/jdk1.5.0_07/jre/lib/i386.." name="java.library.path"/> + <property value="Java Platform API Specification" name="java.specification.name"/> + <property value="49.0" name="java.class.version"/> + <property value="HotSpot Client Compiler" name="sun.management.compiler"/> + <property value="2.6.15-1.1833_FC4smp" name="os.version"/> + <property value="/home/bamboo" name="user.home"/> + <property value="Australia/Sydney" name="user.timezone"/> + <property value="sun.print.PSPrinterJob" name="java.awt.printerjob"/> + <property value="ISO-8859-1" name="file.encoding"/> + <property value="1.5" name="java.specification.version"/> + <property value="bamboo" name="user.name"/> + <property value="/opt/java/tools/maven2/boot/classworlds-1.1.jar" name="java.class.path"/> + <property value="1.0" name="java.vm.specification.version"/> + <property value="32" name="sun.arch.data.model"/> + <property value="/usr/java/jdk1.5.0_07/jre" name="java.home"/> + <property value="Sun Microsystems Inc." name="java.specification.vendor"/> + <property value="en" name="user.language"/> + <property value="mixed mode, sharing" name="java.vm.info"/> + <property value="1.5.0_07" name="java.version"/> + <property value="/usr/java/jdk1.5.0_07/jre/lib/ext" name="java.ext.dirs"/> + <property value="Sun Microsystems Inc." name="java.vendor"/> + <property value="/opt/java/tools/maven2" name="maven.home"/> + <property value="/home/bamboo/.m2/repository" name="localRepository"/> + <property value="/" name="file.separator"/> + <property value="http://java.sun.com/cgi-bin/bugreport.cgi" name="java.vendor.url.bug"/> + <property value="little" name="sun.cpu.endian"/> + <property value="UnicodeLittle" name="sun.io.unicode.encoding"/> + <property value="" name="sun.cpu.isalist"/> + </properties> + <testcase time="0.045" name="testBAM1436"/> +</testsuite>
\ No newline at end of file diff --git a/Data/Libraries/luaunit/junitxml/example-jenkins.xml b/Data/Libraries/luaunit/junitxml/example-jenkins.xml new file mode 100644 index 0000000..6690664 --- /dev/null +++ b/Data/Libraries/luaunit/junitxml/example-jenkins.xml @@ -0,0 +1,29 @@ +<testsuites + name="suite1" time="33.17" tests="21" failures="22" disabled="6" errors="3"> + <testsuite name="testsuite1" tests="???" + failures="0" disabled="0" errors="0" time="33.17" skipped="0" timestamp="2015-01-01T12:33:00" hostname="localhost" id="???" package="???"> + <properties> + <property name="prop1" value="value1"/> + </properties> + <testcase name="toto" + classname="titi" time="33.17" status="???" assertions="???"> + <!-- Optional --> + <skipped>bla bla</skipped> + <failure + type="typeOfFailure" message="failureMsg"> + Detailed failure content + </failure> + </testcase> + <testcase name="toto" + classname="titi" time="33.17" status="???" assertions="???"> + <!-- Optional --> + <error + type="typeOfError" message="errorMsg"> + Detailed error content + </error> + </testcase> + <system-out>bla bla output bla bla</system-out> + <system-err>bla bla error bla bla</system-err> + </testsuite> + <!-- more testsuites --> +</testsuites>
\ No newline at end of file diff --git a/Data/Libraries/luaunit/junitxml/junit-apache-ant.xsd b/Data/Libraries/luaunit/junitxml/junit-apache-ant.xsd new file mode 100644 index 0000000..71bdf60 --- /dev/null +++ b/Data/Libraries/luaunit/junitxml/junit-apache-ant.xsd @@ -0,0 +1,206 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified" + attributeFormDefault="unqualified"> + <xs:annotation> + <xs:documentation xml:lang="en">JUnit test result schema for the Apache Ant JUnit and JUnitReport tasks +Copyright © 2011, Windy Road Technology Pty. Limited +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 +Permission to waive conditions of this license may be requested from Windy Road Support (http://windyroad.org/support).</xs:documentation> + </xs:annotation> + <xs:element name="testsuite" type="testsuite"/> + <xs:simpleType name="ISO8601_DATETIME_PATTERN"> + <xs:restriction base="xs:dateTime"> + <xs:pattern value="[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}"/> + </xs:restriction> + </xs:simpleType> + <xs:element name="testsuites"> + <xs:annotation> + <xs:documentation xml:lang="en">Contains an aggregation of testsuite results</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="testsuite" minOccurs="0" maxOccurs="unbounded"> + <xs:complexType> + <xs:complexContent> + <xs:extension base="testsuite"> + <xs:attribute name="package" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Derived from testsuite/@name in the non-aggregated documents</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="id" type="xs:int" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Starts at '0' for the first testsuite and is incremented by 1 for each following testsuite</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:complexType name="testsuite"> + <xs:annotation> + <xs:documentation xml:lang="en">Contains the results of exexuting a testsuite</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="properties"> + <xs:annotation> + <xs:documentation xml:lang="en">Properties (e.g., environment settings) set during test execution</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="property" minOccurs="0" maxOccurs="unbounded"> + <xs:complexType> + <xs:attribute name="name" use="required"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:minLength value="1"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="value" type="xs:string" use="required"/> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="testcase" minOccurs="0" maxOccurs="unbounded"> + <xs:complexType> + <xs:choice minOccurs="0"> + <xs:element name="error"> + <xs:annotation> + <xs:documentation xml:lang="en">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</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="pre-string"> + <xs:attribute name="message" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en">The error message. e.g., if a java exception is thrown, the return value of getMessage()</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="type" type="xs:string" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">The type of error that occured. e.g., if a java execption is thrown the full class name of the exception.</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + <xs:element name="failure"> + <xs:annotation> + <xs:documentation xml:lang="en">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</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="pre-string"> + <xs:attribute name="message" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en">The message specified in the assert</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="type" type="xs:string" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">The type of the assert.</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + </xs:choice> + <xs:attribute name="name" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Name of the test method</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="classname" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Full class name for the class the test method is in.</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="time" type="xs:decimal" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Time taken (in seconds) to execute the test</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + </xs:element> + <xs:element name="system-out"> + <xs:annotation> + <xs:documentation xml:lang="en">Data that was written to standard out while the test was executed</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="pre-string"> + <xs:whiteSpace value="preserve"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="system-err"> + <xs:annotation> + <xs:documentation xml:lang="en">Data that was written to standard error while the test was executed</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="pre-string"> + <xs:whiteSpace value="preserve"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + </xs:sequence> + <xs:attribute name="name" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Full class name of the test for non-aggregated testsuite documents. Class name without the package for aggregated testsuites documents</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:minLength value="1"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="timestamp" type="ISO8601_DATETIME_PATTERN" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">when the test was executed. Timezone may not be specified.</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="hostname" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Host on which the tests were executed. 'localhost' should be used if the hostname cannot be determined.</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:minLength value="1"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="tests" type="xs:int" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">The total number of tests in the suite</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="failures" type="xs:int" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">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</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="errors" type="xs:int" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">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.</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="time" type="xs:decimal" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en">Time taken (in seconds) to execute the tests in the suite</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + <xs:simpleType name="pre-string"> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + </xs:restriction> + </xs:simpleType> +</xs:schema>
\ No newline at end of file diff --git a/Data/Libraries/luaunit/junitxml/junit-jenkins.xsd b/Data/Libraries/luaunit/junitxml/junit-jenkins.xsd new file mode 100644 index 0000000..a1d5ab0 --- /dev/null +++ b/Data/Libraries/luaunit/junitxml/junit-jenkins.xsd @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:element name="failure"> + <xs:complexType mixed="true"> + <xs:attribute name="type" type="xs:string" use="optional"/> + <xs:attribute name="message" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="error"> + <xs:complexType mixed="true"> + <xs:attribute name="type" type="xs:string" use="optional"/> + <xs:attribute name="message" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="properties"> + <xs:complexType> + <xs:sequence> + <xs:element ref="property" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="property"> + <xs:complexType> + <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="value" type="xs:string" use="required"/> + </xs:complexType> + </xs:element> + + <xs:element name="skipped" type="xs:string"/> + <xs:element name="system-err" type="xs:string"/> + <xs:element name="system-out" type="xs:string"/> + + <xs:element name="testcase"> + <xs:complexType> + <xs:sequence> + <xs:element ref="skipped" minOccurs="0" maxOccurs="1"/> + <xs:element ref="error" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="failure" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="system-out" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="system-err" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="assertions" type="xs:string" use="optional"/> + <xs:attribute name="time" type="xs:string" use="optional"/> + <xs:attribute name="classname" type="xs:string" use="optional"/> + <xs:attribute name="status" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="testsuite"> + <xs:complexType> + <xs:sequence> + <xs:element ref="properties" minOccurs="0" maxOccurs="1"/> + <xs:element ref="testcase" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="system-out" minOccurs="0" maxOccurs="1"/> + <xs:element ref="system-err" minOccurs="0" maxOccurs="1"/> + </xs:sequence> + <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="tests" type="xs:string" use="required"/> + <xs:attribute name="failures" type="xs:string" use="optional"/> + <xs:attribute name="errors" type="xs:string" use="optional"/> + <xs:attribute name="time" type="xs:string" use="optional"/> + <xs:attribute name="disabled" type="xs:string" use="optional"/> + <xs:attribute name="skipped" type="xs:string" use="optional"/> + <xs:attribute name="timestamp" type="xs:string" use="optional"/> + <xs:attribute name="hostname" type="xs:string" use="optional"/> + <xs:attribute name="id" type="xs:string" use="optional"/> + <xs:attribute name="package" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="testsuites"> + <xs:complexType> + <xs:sequence> + <xs:element ref="testsuite" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="name" type="xs:string" use="optional"/> + <xs:attribute name="time" type="xs:string" use="optional"/> + <xs:attribute name="tests" type="xs:string" use="optional"/> + <xs:attribute name="failures" type="xs:string" use="optional"/> + <xs:attribute name="disabled" type="xs:string" use="optional"/> + <xs:attribute name="errors" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + +</xs:schema>
\ No newline at end of file diff --git a/Data/Libraries/luaunit/junitxml/notes-junit-compatibility.txt b/Data/Libraries/luaunit/junitxml/notes-junit-compatibility.txt new file mode 100644 index 0000000..ab92cff --- /dev/null +++ b/Data/Libraries/luaunit/junitxml/notes-junit-compatibility.txt @@ -0,0 +1,34 @@ +Our source information: +https://github.com/windyroad/JUnit-Schema +* http://stackoverflow.com/questions/4922867/junit-xml-format-specification-that-hudson-supports +(Jenkins) +* https://github.com/jenkinsci/xunit-plugin/tree/master/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd +* http://help.catchsoftware.com/display/ET/JUnit+Format +* http://llg.cubic.org/docs/junit/ +* https://confluence.atlassian.com/bamboo/junit-parsing-in-bamboo-289277357.html +* http://nose2.readthedocs.io/en/latest/plugins/junitxml.html +* https://pzolee.blogs.balabit.com/2012/11/jenkins-vs-junit-xml-format/ +* https://www.relishapp.com/cucumber/cucumber/docs/formatters/junit-output-formatter +* http://stackoverflow.com/questions/11241781/python-unittests-in-jenkins +* https://github.com/xmlrunner/unittest-xml-reporting/tree/master/ + + + +Notes: +====== +Ant xml schema is much more restrictive than jenkins. + +Non allowed fields in ant, allowed in jenkins: + +testsuites: +- apache ant forbids all attributes. + +testsuite: +- apache ant forbids attributes: disabled, skipped +- apache ant allows elements system-out and system-err, that are in testcase for jenkins + +testcase: +- apache ant forbids attributes: assertions, status +- apache ant forbids elements: skipped, system-out, system-err + + |