The patch adds a new output format for run-tests.sh that is actually useful when parsed by jenkins and the junit plugin. It builds on what drupalci does and the drush patch.
php scripts/run-tests.sh --url http://localhost/ --junit tests Session
gives something like:
<?xml version="1.0" encoding="UTF-8"?>
<testsuite tests="151" disabled="0" errors="11" failures="45">
<testcase name="setUp()" assertions="2" classname="Session.Session HTTPS handling" status="pass">
<system-out><![CDATA[pass: [Other] Enabled modules: session_test [session.test:304]
pass: [Other] Enabled modules: session_test [session.test:304]
]]></system-out>
</testcase>
<testcase name="testHttpsSession()" assertions="123" classname="Session.Session HTTPS handling" status="failed">
<failure type="fail" message="Number of failed assertions: 35"><![CDATA[fail: [Other] Failed to set field name to htF3iJoI [session.test:327]
…]]></failure>
<error type="exception" message="Number of unexpected errors: 11"><![CDATA[exception: [Notice] Undefined index: SSESS49960de5880e8c687434170f6476605b [session.test:337]
…]]></error>
<system-out><![CDATA[pass: [Role] Created role of name: aum4bHeD, id: 4 [session.test:319]
…]]></system-out>
</testcase>
<testcase name="simpletest_script_run_one_test()" assertions="2" classname="Session.Session HTTPS handling" status="failed">
<failure type="fail" message="Number of failed assertions: 2"><![CDATA[fail: [Other] Failed to find test tables to drop. [run-tests.php:395]
fail: [Other] Failed to find test tables to drop. [run-tests.php:395]
]]></failure>
<system-out><![CDATA[fail: [Other] Failed to find test tables to drop. [run-tests.php:395]
fail: [Other] Failed to find test tables to drop. [run-tests.php:395]
]]></system-out>
</testcase>
<testcase name="testEmptySessionId()" assertions="25" classname="Session.Session HTTPS handling" status="failed">
<failure type="fail" message="Number of failed assertions: 8"><![CDATA[fail: [Other] Failed to set field name to pYgID2r7 [session.test:509]
…]]></failure>
<system-out><![CDATA[pass: [Role] Created role of name: w2Ta0jei, id: 4 [session.test:496]
…]]></system-out>
</testcase>
</testsuite>
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | interdiff.txt | 775 bytes | nod_ |
| #6 | core-run-tests-junit-2834033-6.patch | 7.31 KB | nod_ |
| 4-method-details.png | 212.91 KB | nod_ | |
| 3-method-list.png | 40.26 KB | nod_ | |
| 2-class-list.png | 96.65 KB | nod_ |
Comments
Comment #2
MixologicThis is a self defense against improper xml characters.
Comment #3
mile23Making the testbot's junit export code more portable here: #2856398: Refactor JUnit XML generation into a helper class
Comment #4
nod_@Mixologic, I would expect cdata sections to handle whatever is inside properly. Is this for display or does it break the xml?
Comment #5
MixologicThe CDATA section prevents parsers from interpreting the enclosed data as markup, however, xml specification itself does not allow for a many characters to appear anywhere within either cdata or in markup, and thus breaks many parsers.
I definitely ran into this early on with drupalci, and had to hunt this down to end up with no parsing issues.
Comment #6
nod_Gotcha, updated.
Still D7 patch.
Comment #8
mile23Related, maybe duplicate: #2883175: CircleCI Simpletest XML output formatting change