jasmine / gulp-jasmine-browser

MIT License
80 stars 32 forks source link

XML-Output #13

Closed mdix closed 9 years ago

mdix commented 9 years ago

Hi,

before I start to integrate the reporter on my own: Any easy way to get the test output as XML?

Best Marc

charleshansen commented 9 years ago

I'm not exactly sure how to get the XML. For Jasmine Gem, they use https://github.com/jasmine/jasmine_junitxml_formatter

It might not be too hard to extract the javascript from the gem into gulp-jasmine-browser, but we have no immediate plans to do it ourselves.

slackersoft commented 9 years ago

You might also take a look at jasmine-reporters

mdix commented 9 years ago

Hi,

I played around with the jasmine-reporters a bit, but wasn't able to get it working. I then started to check how you guys implemented it for the console reporter and was finally able to implement a basic xml reporter. There were some tricky bits, as we're in the phantom context but need to write out the report in the node context thus I had to learn how to pass the data back (phantom page object was the solution). If I got time I might refactor the whole thing (currently ther're some downsides f. e. it's not possible to use the console reporter in conjuction with the xml reporter and you have to pass 'xml: true' into the specRunner and into the phantomjs call and the xml output is build by concatenating strings and using an injected sprintf function... :scream:) and it might result in a PR.

Anyway, thanks for your help!

Best Marc

rdy commented 9 years ago

That doesn't sound entirely awful, i had to do something a little tricky to make slimerjs work because of limitations of slimer, with the work that I've done you can probably just take the output string and reformat the JSON output to what you need in the XML formatter.

Anyways I would take a look at the current changes, and a pull requests is always welcome.