# danger-junit A description of danger-junit. ## Installation $ gem install danger-junit ## Usage ### junit Report, or inspect any JUnit XML formatted test suite report. Testing frameworks have standardized on the JUnit XML format for reporting results, this means that projects using Rspec, Jasmine, Mocha, XCTest and more - can all use the same Danger error reporting. Perfect. You can see some examples on [this page from Circle CI](https://circleci.com/docs/test-metadata/) about how you can add JUnit XML output for your testing projects.
Parse the XML file, and let the plugin do your reporting
junit.parse "/path/to/output.xml"
junit.report
Let the plugin parse the XML file, and report yourself
junit.parse "/path/to/output.xml"
fail("Tests failed") unless junit.fails.empty?
Warn on a report about skipped tests
junit.parse "/path/to/output.xml"
junit.show_skipped_tests = true
junit.report
#### Attributes `passes` - An array of XML elements that represent passed tests. `failures` - An array of XML elements that represent failed tests. `errors` - An array of XML elements that represent passed tests. `skipped` - An array of XML elements that represent skipped tests. `show_skipped_tests` - An attribute to make the plugin show a warning on skipped tests. #### Methods `parse` - Parses an XML file, which fills all the attributes will `raise` for errors `report` - Causes a build fail if there are test failures, and outputs a markdown table of the results. ## Development 1. Clone this repo 2. Run `bundle install` to setup dependencies. 3. Run `bundle exec rake spec` to run the tests. 4. Use `bundle exec guard` to automatically have tests run as you make changes. 5. Make your changes.