Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisgrck committed Jan 17, 2023
1 parent e3b70b8 commit 1bcb6fb
Show file tree
Hide file tree
Showing 6 changed files with 815 additions and 1 deletion.
450 changes: 449 additions & 1 deletion README.md

Large diffs are not rendered by default.

99 changes: 99 additions & 0 deletions examples/conventions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file provides examples for various conventions on how tools use property
names and values for special fields, attachments, tags, steps and more.
Example by Testmo. Copyright 2023 Testmo GmbH. All rights reserved.
Testmo test management software - https://www.testmo.com/
-->
<testsuites>
<testsuite name="Tests">
<testcase name="testExample" classname="Tests">
<properties>
<!-- Regular basic properties and values -->
<property name="priority" value="high" />
<property name="author" value="Adrian" />

<!-- Example for a property with text value -->
<property name="description">
This text describes the purpose of this test case and provides
an overview of what the test does and how it works.
</property>

<!-- Some tools also support type hints as part of the property names. Check your
CI or test management tool to learn if and which type hints are supported. Type hints
are removed from the property names. -->
<property name="url:github" value="https://github.com/org/project/blob/code.js#L200" />
<property name="html:output">
<![CDATA[<h1>Title</h1><p>Text</p>]]>
</property>

<!-- Different ways to reference attachments -->
<property name="attachment" value="screenshots/dashboard.png" />
<property name="attachment" value="screenshots/users.png" />

<property name="attachment1" value="logs/browser/console.txt" />
<property name="attachment2" value="logs/server/access.txt" />

<property name="attachment" value="https://build-server/runs/45112/screenshot1.png" />
<property name="attachment" value="data:text/html;base64,SGVsbG8sIFdvcmxkIQ==" />

<!-- Different ways to document steps -->
<property name="step" value="This is a test step." />
<property name="step" value="Tools will automatically index all steps." />

<property name="step1" value="You can also use unique step property names if needed." />
<property name="step2" value="And this is another test step." />

<property name="step">
This is a more complex test step with multiple lines
of text using a property with a text value.
</property>

<!-- You can optionally also include a step result as part of the property name.
Check your CI or test management tool if it supports statuses. -->
<property name="step[passed]" value="This is a test step that passed." />
<property name="step[failure]" value="And this step had a failure." />
<property name="step[skipped]" value="This step wasn't executed." />
<property name="step[error]" value="And this step had an error." />

<!-- Some tools support custom HTML tags to document step sub fields. Check
your CI or test management tool to learn about HTML support. -->
<property name="step[passed]"><![CDATA[
<test-step-subfield name="Step">
This line describes this step. You can also use <strong>HTML</strong>.
</test-step-subfield>
<test-step-subfield name="Expected">
You can optionally include more sub fields, e.g. for the expected results.
</test-step-subfield>
]]></property>
</properties>

<!-- For testing tools that don't support test case properties yet,
developers can alternatively output properties as part of the system out.
All the above conventions (property names and values) work exactly the same.
Additionally, many tools support attachments directly in system out as well. -->
<system-out><![CDATA[
Output line #1
Output line #2
[[PROPERTY|author=Adrian]]
[[PROPERTY|language=english]]
[[PROPERTY|browser-log]]
Log line #1
Log line #2
Log line #3
[[/PROPERTY]]
[[PROPERTY|html:output]]
<h1>Title</h1>
<p>This is an <strong>HTML</strong> example.</p>
[[/PROPERTY]]
[[ATTACHMENT|screenshots/dashboard.png]]
[[ATTACHMENT|screenshots/users.png]]]]>
</system-out>
</testcase>
</testsuite>
</testsuites>
28 changes: 28 additions & 0 deletions examples/junit-basic.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is a basic JUnit-style XML example to highlight the basis structure.
Example by Testmo. Copyright 2023 Testmo GmbH. All rights reserved.
Testmo test management software - https://www.testmo.com/
-->
<testsuites time="15.682687">
<testsuite name="Tests.Registration" time="6.605871">
<testcase name="testCase1" classname="Tests.Registration" time="2.113871" />
<testcase name="testCase2" classname="Tests.Registration" time="1.051" />
<testcase name="testCase3" classname="Tests.Registration" time="3.441" />
</testsuite>
<testsuite name="Tests.Authentication" time="9.076816">
<testsuite name="Tests.Authentication.Login" time="4.356">
<testcase name="testCase4" classname="Tests.Authentication.Login" time="2.244" />
<testcase name="testCase5" classname="Tests.Authentication.Login" time="0.781" />
<testcase name="testCase6" classname="Tests.Authentication.Login" time="1.331" />
</testsuite>
<testcase name="testCase7" classname="Tests.Authentication" time="2.508" />
<testcase name="testCase8" classname="Tests.Authentication" time="1.230816" />
<testcase name="testCase9" classname="Tests.Authentication" time="0.982">
<failure message="Assertion error message" type="AssertionError">
<!-- Call stack printed here -->
</failure>
</testcase>
</testsuite>
</testsuites>
141 changes: 141 additions & 0 deletions examples/junit-complete.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is a JUnit-style XML example with commonly used tags and attributes.
Example by Testmo. Copyright 2023 Testmo GmbH. All rights reserved.
Testmo test management software - https://www.testmo.com/
-->

<!-- <testsuites> Usually the root element of a JUnit XML file. Some tools leave out
the <testsuites> element if there is only a single top-level <testsuite> element (which
is then used as the root element).
name Name of the entire test run
tests Total number of tests in this file
failures Total number of failed tests in this file
errors Total number of errored tests in this file
skipped Total number of skipped tests in this file
assertions Total number of assertions for all tests in this file
time Aggregated time of all tests in this file in seconds
timestamp Date and time of when the test run was executed (in ISO 8601 format)
-->
<testsuites name="Test run" tests="8" failures="1" errors="1" skipped="1"
assertions="20" time="16.082687" timestamp="2021-04-02T15:48:23">

<!-- <testsuite> A test suite usually represents a class, folder or group of tests.
There can be many test suites in an XML file, and there can be test suites under other
test suites.
name Name of the test suite (e.g. class name or folder name)
tests Total number of tests in this suite
failures Total number of failed tests in this suite
errors Total number of errored tests in this suite
skipped Total number of skipped tests in this suite
assertions Total number of assertions for all tests in this suite
time Aggregated time of all tests in this file in seconds
timestamp Date and time of when the test suite was executed (in ISO 8601 format)
file Source code file of this test suite
-->
<testsuite name="Tests.Registration" tests="8" failures="1" errors="1" skipped="1"
assertions="20" time="16.082687" timestamp="2021-04-02T15:48:23"
file="tests/registration.code">

<!-- <properties> Test suites (and test cases, see below) can have additional
properties such as environment variables or version numbers. -->
<properties>
<!-- <property> Each property has a name and value. Some tools also support
properties with text values instead of value attributes. -->
<property name="version" value="1.774" />
<property name="commit" value="ef7bebf" />
<property name="browser" value="Google Chrome" />
<property name="ci" value="https://github.com/actions/runs/1234" />
<property name="config">
Config line #1
Config line #2
Config line #3
</property>
</properties>

<!-- <system-out> Optionally data written to standard out for the suite.
Also supported on a test case level, see below. -->
<system-out>Data written to standard out.</system-out>

<!-- <system-err> Optionally data written to standard error for the suite.
Also supported on a test case level, see below. -->
<system-err>Data written to standard error.</system-err>

<!-- <testcase> There are one or more test cases in a test suite. A test passed
if there isn't an additional result element (skipped, failure, error).
name The name of this test case, often the method name
classname The name of the parent class/folder, often the same as the suite's name
assertions Number of assertions checked during test case execution
time Execution time of the test in seconds
file Source code file of this test case
line Source code line number of the start of this test case
-->
<testcase name="testCase1" classname="Tests.Registration" assertions="2"
time="2.436" file="tests/registration.code" line="24" />
<testcase name="testCase2" classname="Tests.Registration" assertions="6"
time="1.534" file="tests/registration.code" line="62" />
<testcase name="testCase3" classname="Tests.Registration" assertions="3"
time="0.822" file="tests/registration.code" line="102" />

<!-- Example of a test case that was skipped -->
<testcase name="testCase4" classname="Tests.Registration" assertions="0"
time="0" file="tests/registration.code" line="164">
<!-- <skipped> Indicates that the test was not executed. Can have an optional
message describing why the test was skipped. -->
<skipped message="Test was skipped." />
</testcase>

<!-- Example of a test case that failed. -->
<testcase name="testCase5" classname="Tests.Registration" assertions="2"
time="2.902412" file="tests/registration.code" line="202">
<!-- <failure> The test failed because one of the assertions/checks failed.
Can have a message and failure type, often the assertion type or class. The text
content of the element often includes the failure description or stack trace. -->
<failure message="Expected value did not match." type="AssertionError">
<!-- Failure description or stack trace -->
</failure>
</testcase>

<!-- Example of a test case that had errors. -->
<testcase name="testCase6" classname="Tests.Registration" assertions="0"
time="3.819" file="tests/registration.code" line="235">
<!-- <error> The test had an unexpected error during execution. Can have a
message and error type, often the exception type or class. The text
content of the element often includes the error description or stack trace. -->
<error message="Division by zero." type="ArithmeticError">
<!-- Error description or stack trace -->
</error>
</testcase>

<!-- Example of a test case with outputs. -->
<testcase name="testCase7" classname="Tests.Registration" assertions="3"
time="2.944" file="tests/registration.code" line="287">
<!-- <system-out> Optional data written to standard out for the test case. -->
<system-out>Data written to standard out.</system-out>

<!-- <system-err> Optional data written to standard error for the test case. -->
<system-err>Data written to standard error.</system-err>
</testcase>

<!-- Example of a test case with properties -->
<testcase name="testCase8" classname="Tests.Registration" assertions="4"
time="1.625275" file="tests/registration.code" line="302">
<!-- <properties> Some tools also support properties for test cases. -->
<properties>
<property name="priority" value="high" />
<property name="language" value="english" />
<property name="author" value="Adrian" />
<property name="attachment" value="screenshots/dashboard.png" />
<property name="attachment" value="screenshots/users.png" />
<property name="description">
This text describes the purpose of this test case and provides
an overview of what the test does and how it works.
</property>
</properties>
</testcase>
</testsuite>
</testsuites>
59 changes: 59 additions & 0 deletions examples/testcase-output.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This example shows different ways to include properties in the XML file.
Example by Testmo. Copyright 2023 Testmo GmbH. All rights reserved.
Testmo test management software - https://www.testmo.com/
-->
<testsuites>
<testsuite name="Tests">
<!-- Most tools already support properties for test suites -->
<properties>
<property name="version" value="1.774" />
<property name="commit" value="ef7bebf" />
<property name="browser" value="Google Chrome" />
<property name="ci" value="https://github.com/actions/runs/1234" />
<property name="config"> <!-- Some tools support properties with text content -->
Config line #1
Config line #2
Config line #3
</property>
</properties>
<testcase name="testExample" classname="Tests">
<!-- More and more tools also support properties for test cases now -->
<properties>
<property name="priority" value="high" />
<property name="language" value="english" />
<property name="author" value="Adrian" />
<property name="attachment" value="screenshots/dashboard.png" />
<property name="attachment" value="screenshots/users.png" />

<!-- Optional support for properties with text values -->
<property name="description">
This text describes the purpose of this test case and provides
an overview of what the test does and how it works.
</property>
</properties>

<!-- For testing tools that don't support test case properties yet,
developers can alternatively output properties as part of the system out,
similar to how many tools already support attachments in system out. -->
<system-out>
Output line #1
Output line #2

[[PROPERTY|author=Adrian]]
[[PROPERTY|language=english]]

[[PROPERTY|browser-log]]
Log line #1
Log line #2
Log line #3
[[/PROPERTY]]

[[ATTACHMENT|screenshots/dashboard.png]]
[[ATTACHMENT|screenshots/users.png]]
</system-out>
</testcase>
</testsuite>
</testsuites>
39 changes: 39 additions & 0 deletions examples/testcase-properties.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This example shows how test suite and test case properties are supported by various tools.
Example by Testmo. Copyright 2023 Testmo GmbH. All rights reserved.
Testmo test management software - https://www.testmo.com/
-->
<testsuites>
<testsuite name="Tests">
<!-- Most tools already support properties for test suites -->
<properties>
<property name="version" value="1.774" />
<property name="commit" value="ef7bebf" />
<property name="browser" value="Google Chrome" />
<property name="ci" value="https://github.com/actions/runs/1234" />
<property name="config"> <!-- Some tools support properties with text content -->
Config line #1
Config line #2
Config line #3
</property>
</properties>
<testcase name="testExample" classname="Tests">
<!-- More and more tools also support properties for test cases now -->
<properties>
<property name="priority" value="high" />
<property name="language" value="english" />
<property name="author" value="Adrian" />
<property name="attachment" value="screenshots/dashboard.png" />
<property name="attachment" value="screenshots/users.png" />

<!-- Optional support for properties with text values -->
<property name="description">
This text describes the purpose of this test case and provides
an overview of what the test does and how it works.
</property>
</properties>
</testcase>
</testsuite>
</testsuites>

0 comments on commit 1bcb6fb

Please sign in to comment.