Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This patch extends on the work done for http://www.computerminds.co.uk/hudson-and-simpletest and adds an --xml output option for run-tests.sh that works with SimpleTest 6.x-2.9.
Comment | File | Size | Author |
---|---|---|---|
#22 | 602332-xml-reporter.patch | 6.33 KB | Steven Jones |
#21 | 602332-xml-reporter.patch | 6.33 KB | Steven Jones |
#10 | 602332-xml-reporter-10.patch | 5.32 KB | pwolanin |
simpletest-junit-xml-output.patch | 4.71 KB | Steven Merrill | |
Comments
Comment #1
joshk CreditAttribution: joshk commented+1 for this
This kind of output will easy integration with Hudson and other external test mgmt systems.
I also like that this shows how to do it in a more modular fashion with an extensible pattern.
Comment #2
ezraw CreditAttribution: ezraw commentedTested this patch tonight and it output xml as expected. Thanks for posting it. I haven't tested it with Hudson yet, but that's next on the list. If you have any helpful tips on doing so, I'd be grateful.
Comment #3
ezraw CreditAttribution: ezraw commentedThe XML output works with Hudson for me.
I have about 200 test errors, some from core functionality -- is that normal? Here is the Hudson output: http://drupalbin.com/11879
Comment #4
boombatower CreditAttribution: boombatower commentedThis should be done in Drupal 7 core...since it is going into feature freeze not sure what to say. SimpleTest 6.x-2.x is intended to be a backport of 7.
Comment #5
boombatower CreditAttribution: boombatower commentedWe are continuing feature development, as suggested by chx (checkout recent Drupal Planet activity).
I'll take a look at this later, also I would like to abstract the reporter.
Comment #6
Steven Jones CreditAttribution: Steven Jones commentedGiven that I wrote the script referenced in the first post, subscribe.
Comment #8
pwolanin CreditAttribution: pwolanin commentedis there an issue for core?
Comment #9
pwolanin CreditAttribution: pwolanin commentedLet's get this into core - it's just addition of another output format to the wrapper script to improve integration possibilities.
Comment #10
pwolanin CreditAttribution: pwolanin commentedHere's a patch that seems to work for D7 with some cleanup.
Comment #11
pwolanin CreditAttribution: pwolanin commentedComment #12
pwolanin CreditAttribution: pwolanin commenteda few relevant references:
http://ant.1045680.n5.nabble.com/schema-for-junit-xml-output-td1375274.h...
http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools...
http://stackoverflow.com/questions/442556/spec-for-junit-xml-output
Comment #13
boombatower CreditAttribution: boombatower commented/me wonders when feature development of Drupal 7 actually stops.
Comment #14
pwolanin CreditAttribution: pwolanin commentedboombatower - this is not anything I'd qualify as a real "feature". In's not really part of drupal core, jsut a helper script. Putting is in this script just means people don't have to fork the script to get more output formats
Comment #15
moshe weitzman CreditAttribution: moshe weitzman commentedIf I'm not mistaken, PIFR has some home grown XML output (or it did in v1) so this would deprecate that code as well. +1
Comment #16
Steven Jones CreditAttribution: Steven Jones commentedIs it possible to test this? Guessing that we can't run tests in tests to ensure that the output is the correct, valid JUnit XML?
Comment #17
boombatower CreditAttribution: boombatower commentedPlease take a look at simpletest.test.
Comment #18
pwolanin CreditAttribution: pwolanin commentedApparently a number of people are already using the 6.x versionof this patch (which is in pressflow) to integrate with Hudson.
I think that's basically the test - can you get Hudson to parse and report the xml output.
Comment #19
Steven Jones CreditAttribution: Steven Jones commentedIf only a schema for JUnit output existed...oh well.
Guess we'll need someone to plug it into Hudson then...
Comment #20
Steven Jones CreditAttribution: Steven Jones commentedProbably should do this sooner rather than later...will spin up hudson tomorrow and get him testing.
Comment #21
Steven Jones CreditAttribution: Steven Jones commentedThis is working nicely with Hudson. The result is nice and valid.
I've added exception reporting too in the attached patch.
Comment #22
Steven Jones CreditAttribution: Steven Jones commentedActually, we'll use the error element for exceptions, not the failure one.
Comment #23
nikgregory CreditAttribution: nikgregory commentedI ran this on an ubuntu install and it seems to work well.
Comment #24
seanberto CreditAttribution: seanberto commentedSorry if it's a n00b question, but I can't seem to get run-tests to output to an xml file.
* I've run the patch in #22 on 7.0-alpha7.
* I've created a tests directory at scripts/tests. I've set the permissions on this directory to be globably writable.
* From within that directory, I'm running the shell command:
/usr/bin/php run-tests.sh --url http://example.com --all --php /usr/bin/php --xml scripts/tests
I see the output in my terminal session and the tests are running - but nothing is written to this directory. I've tried making the path to the directory relative to scripts as well, but no luck.
I'm guessing that there's something easy that I'm missing?
Thanks for the help. I'm excited to have Hudson up and running and building D7 successfully. I'll be even more stoked when I can help with automated testing!
Cheers,
Sean
Comment #25
seanberto CreditAttribution: seanberto commentedAha, solved my own issue. It was a permissions oversight. Gotta make sure that scripts/tests directory is writable by Drupal.
Comment #26
sunAlthough badly needed, this sounds like D8 material to me.
Comment #27
pwolanin CreditAttribution: pwolanin commentedDon't be silly. This has no impact on core's functionality.
Comment #28
sunTrust me, I know. But Drupal core maintainers only take actually required bug fixes into account for D7. Everything else is D8 material for now. I'm with you. I had to learn the hard way.
Comment #29
pwolanin CreditAttribution: pwolanin commentedI think this is still suitable for D7, though obviously critical issues come before.
Comment #30
Steven Jones CreditAttribution: Steven Jones commented#22: 602332-xml-reporter.patch queued for re-testing.
Comment #31
dasjowould be great to get it in!
Comment #32
dixon_subscribing
Comment #33
nooble CreditAttribution: nooble commented#22: 602332-xml-reporter.patch queued for re-testing.
Comment #34
tom_o_t CreditAttribution: tom_o_t commentedsimpletest-junit-xml-output.patch queued for re-testing.
Comment #35
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #36
seanberto CreditAttribution: seanberto commentedHurray!!!!