Problem/Motivation

Core's run-tests.sh outputs an XML format that is not well-formed as JUnit.

Core needs a new JUnit output feature: #2834033: Add a junit format to run-tests.sh

The testbot has solved this problem already, in order to output proper JUnit for Jenkins to consume.

run-tests.sh really should be in charge of outputting the JUnit formatted results.

Proposed resolution

Take the XML reformatting duties from the testbot's simpletest plugin.

Turn that code into a stand-alone helper class.

Ensure that the helper class is testable and maintainable.

Remaining tasks

Eventually, migrate that code to core for use in run-tests.sh.

User interface changes

API changes

Data model changes

Comments

Mile23 created an issue. See original summary.

  • Mile23 committed 46c126b on 2856398-xml-generator
    Issue #2856398: Moved XML generator to a helper class. Added some unit...
Mixologic’s picture

Hawt. I'll look a little closer at this tomorrow, but first instinct says yeah, add the service and we're golden.

mile23’s picture

...Well except it doesn't pass tests yet.

  • Mile23 committed f589688 on 2856398-xml-generator
    Issue #2856398: Expanded unit tests.
    

  • Mile23 committed 89e329b on 2856398-xml-generator
    Issue #2856398: Tests much happier now. Database services are stateful...

  • Mile23 committed 34b30bb on 2856398-xml-generator
    Issue #2856398: JunitXmlBuilder is now a service: junit_xml_builder.
    
mile23’s picture

Status: Active » Needs review

The tests pass now.

We can't currently inject the results database as a service from the container because it is stateful, so there should be a follow-up on that. The problem arises when SimpletestD7 re-arranges the database config for D7's run-tests.sh, leading to a service-discovered Database object that can't create a connection. The solution is to pass the current database connection as a parameter to generate(). See http://cgit.drupalcode.org/drupalci_testbot/commit/?id=89e329b

Not injecting the service is imperfect, but adequate for the refactor at this point.

  • Mile23 committed afb4a43 on 2856398-xml-generator
    Issue #2856398: simpletest_d7 now sets the db.results service so the...

  • Mile23 committed d08d852 on 2856398-xml-generator
    Issue #2856398: Grab the environment source directory rather than...
mile23’s picture

So the deal with the db.results service was that simpletest_d7 was throwing it away and using a copy of db.system locally. Now simpletest_d7 assigns db.results to db.system during inject(), so both services are equivalent.

This isn't optimal, but it works.

  • f4f0f87 committed on 2856398-xml-generator
    Issue #2856398: tweak an @group
    
Mixologic’s picture

Mixologic’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.