Giter Club home page Giter Club logo

junit_xml_listener's Introduction

Build Status

About

The Junit XML Listener is a simple sbt test listener plugin that collects the results of test runs and writes them to an xml file formatted like the output of a JUnit run. This allows the test results to be displayed in any tool that can display JUnit results (e.g. Jenkins)

Requirements

  • sbt 0.13.1

Installation

Add the following lines to either ~/.sbt/plugins/build.sbt (user-specific) or project/plugins/build.sbt (project-specific):

addSbtPlugin("com.alpinenow" % "junit_xml_listener" % "0.5.1")

This will add the dependency to the plugin. The next step is to configure your build to output the XML. The following will output the XML in target/test-reports:

testListeners <<= target.map(t => Seq(new eu.henkelmann.sbt.JUnitXmlTestsListener(t.getAbsolutePath)))

Note that the line as shown is enough in a *.sbt file. In *.scala files (full configuration), you must collect the result of the expression into the settings of all projects that should produce the XML output.

Examples

For a basic project template using sbt, see the simple-example project.

For using full configuration example with Build.scala, see the full-example project.

Alternatives

If your tests are written in Specs2 then you will get better results from the built in junitxml output format than from this SBT plugin.

You should add the following to your build.sbt:

testOptions in Test += Tests.Argument("junitxml")

testOptions in Test += Tests.Argument("console")

The built in JUnit XML support in Specs2 includes real test names (this project currently only reports "SuiteSelector.SuiteSelector" as the name of all tests) and test run durations (currently missing in this project).

Version History

  • 0.5.1 bug fix ** fix the class name to be fully qualified classpath ** make sure the the reporting time is in second not in miliseond, which causing JUnit HTML to report incorrect number ** make sure the duration of the tests are accumulative.
  • 0.5 Supported sbt 0.13.1, and fixed the issue of that the time duration is always set to 0s.
  • 0.4 First version published to maven central (snapshots)
  • 0.3 Merge of Ismael Juma's adjustments for sbt 0.10+
  • 0.2 Added handling of skipped tests (thanks to Johannes Rudolph)
  • 0.1 Initial release

junit_xml_listener's People

Contributors

chenkelmann avatar chesterxgchen avatar dbtsai avatar ijuma avatar jrudolph avatar richardbradley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

junit_xml_listener's Issues

Publish to maven central

First, thank you for picking this up.

I note that you have a commit to publish this to Maven central but I don't see it there.

What are your plans to get it published? Thanks!

sbt 1.0.0 support

Are there any plans to release an sbt 1.0.0 compatible plugin?
This plugin is used by the Apache Spark build.

Plugin dependencies do not resolve properly

We've been using the plugin to output results at build time from ScalaTest, but the example in the readme file doesn't actually work. The only way we could get the jar dep to resolve (after much trial and error) was to link to it directly like this:

addSbtPlugin("com.alpinenow" % "junit_xml_listener" % "0.4.2-SNAPSHOT" from "https://oss.sonatype.org/content/repositories/snapshots/com/alpinenow/junit_xml_listener_2.10_0.13/0.4.2-SNAPSHOT/junit_xml_listener-0.4.2-SNAPSHOT.jar")

Note this was a fresh install with no versions in in the ivy2 cache (or ivy local for that matter). Following the readme instructions does add an entry into ivy but it's malformed and contains no jars.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.