Download & Extend

XML output option for use with Hudson / JUnit

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.

AttachmentSizeStatusTest resultOperations
simpletest-junit-xml-output.patch4.71 KBIdleFAILED: [[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

Status:needs review» reviewed & tested by the community

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

Version:6.x-2.9» 7.x-2.x-dev

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

Status:reviewed & tested by the community» needs work

The last submitted patch, simpletest-junit-xml-output.patch, failed testing.

#8

is there an issue for core?

#9

Project:SimpleTest» Drupal core
Version:7.x-2.x-dev» 7.x-dev
Component:Code» simpletest.module
Category:feature request» task
Assigned to:Steven Merrill» Anonymous

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.

AttachmentSizeStatusTest resultOperations
602332-xml-reporter-10.patch5.32 KBIdlePASSED: [[SimpleTest]]: [MySQL] 22,171 pass(es).View details

#11

Status:needs work» needs review

#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

Assigned to:Anonymous» Steven Jones

Probably should do this sooner rather than later...will spin up hudson tomorrow and get him testing.

#21

Assigned to:Steven Jones» Anonymous

This is working nicely with Hudson. The result is nice and valid.

I've added exception reporting too in the attached patch.

AttachmentSizeStatusTest resultOperations
602332-xml-reporter.patch6.33 KBIdlePASSED: [[SimpleTest]]: [MySQL] 22,851 pass(es).View details

#22

Actually, we'll use the error element for exceptions, not the failure one.

AttachmentSizeStatusTest resultOperations
602332-xml-reporter.patch6.33 KBIdlePASSED: [[SimpleTest]]: [MySQL] 26,779 pass(es).View details

#23

Status:needs review» reviewed & tested by the community

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

Version:7.x-dev» 8.x-dev

Although badly needed, this sounds like D8 material to me.

#27

Version:8.x-dev» 7.x-dev

Don't be silly. This has no impact on core's functionality.

#28

Version:7.x-dev» 8.x-dev

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

Version:8.x-dev» 7.x-dev

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

Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks.

#36

Hurray!!!!

#37

Status:fixed» closed (fixed)

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