Posted by Steven Merrill on October 12, 2009 at 2:43pm
| Project: | Drupal core |
| Version: | 7.x-dev |
| Component: | simpletest.module |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
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.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| simpletest-junit-xml-output.patch | 4.71 KB | Idle | FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch simpletest-junit-xml-output.patch. | View details |
Comments
#1
+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.
#2
Tested 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.
#3
The 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
#4
This 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.
#5
We 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.
#6
Given that I wrote the script referenced in the first post, subscribe.
#7
The last submitted patch, simpletest-junit-xml-output.patch, failed testing.
#8
is there an issue for core?
#9
Let's get this into core - it's just addition of another output format to the wrapper script to improve integration possibilities.
#10
Here's a patch that seems to work for D7 with some cleanup.
#11
#12
a 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
#13
/me wonders when feature development of Drupal 7 actually stops.
#14
boombatower - 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
#15
If 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
#16
Is 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?
#17
Please take a look at simpletest.test.
#18
Apparently 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.
#19
If only a schema for JUnit output existed...oh well.
Guess we'll need someone to plug it into Hudson then...
#20
Probably should do this sooner rather than later...will spin up hudson tomorrow and get him testing.
#21
This is working nicely with Hudson. The result is nice and valid.
I've added exception reporting too in the attached patch.
#22
Actually, we'll use the error element for exceptions, not the failure one.
#23
I ran this on an ubuntu install and it seems to work well.
#24
Sorry 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
#25
Aha, solved my own issue. It was a permissions oversight. Gotta make sure that scripts/tests directory is writable by Drupal.
#26
Although badly needed, this sounds like D8 material to me.
#27
Don't be silly. This has no impact on core's functionality.
#28
Trust 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.
#29
I think this is still suitable for D7, though obviously critical issues come before.
#30
#22: 602332-xml-reporter.patch queued for re-testing.
#31
would be great to get it in!
#32
subscribing
#33
#22: 602332-xml-reporter.patch queued for re-testing.
#34
simpletest-junit-xml-output.patch queued for re-testing.
#35
Committed to CVS HEAD. Thanks.
#36
Hurray!!!!
#37
Automatically closed -- issue fixed for 2 weeks with no activity.