Coder Social home page Coder Social logo

jlleitschuh / kncept__junit-reporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kncept/junit-reporter

0.0 2.0 0.0 1.72 MB

A JUnit HTML Reporting plugin for Gradle

License: Eclipse Public License 1.0

JavaScript 14.73% Java 83.20% CSS 1.20% HTML 0.87%

kncept__junit-reporter's Introduction

junit-reporter Build Status

A plugin to convert XML test results to HTML and perform some aggregation.
There is no config required by default.
Also useful if you need the XML files and still want a human-readable output.

Gradle

Applying the easy way

This plugin is now released as a community plugin

plugins {
    id 'com.kncept.junit.reporter' version '2.1.0'
}

Applying the long way from maven central

Add or merge this to the top of your buildscript libraries via the mavenCentral repository:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.kncept.junit.reporter:junit-reporter:2.1.0'
    }
}

Then, apply the plugin:

apply plugin: 'com.kncept.junit.reporter'

Plugin Execution

The task 'junitHtmlReport' will run as a finalizer after the 'test' or 'check' tasks.
If you want more fine grained control, add it as a finalizer to another task. eg:

junitPlatformTest.finalizedBy 'junitHtmlReport'

And you're done!
Reports are generated into the gradle 'reports' directory.
eg: junit-reporter/build/reports/tests/junit-platform/index.html

Please be aware that the plugin may take a few hours to become available after release.

Configuration Options

If you need to do any customisation (changing output directories, or you just don't like red...), Its possible to customise. Use the following config block (shown with default values):

junitHtmlReport {
	// The maximum depth to traverse from the results dir.
	// Any eligible reports will be included
	maxDepth = 3
	
	//RAG status css overrides
	cssRed = 'red'
	cssAmber = 'orange'
	cssGreen = 'green'
	
	//Processing directories
	testResultsDir = 'test-results'
	testReportsDir = 'reports/tests'
	
	//Fail build when no XML files to process
	failOnEmpty = true
}

Command Line Usage

Command line support has been built.
The jar file is executable, and the options have the same names as in build configuration blocks.
The main class name is com.kncept.junit.reporter.TestReportProcessor.
Options use a simple equals sign.
eg: java -jar junit-reporter-2.1.0.jar failOnEmpty=false to process reports in the current dir

An extra 'dir' arg that sets the Results and Reports dir in one go is included:
eg: java -jar junit-reporter-2.1.0.jar failOnEmpty=false dir=~/path/ to process reports in the ~/path/ dir

Maven (Experimental support only)

Maven doesn't like running plugins after test failures. The plugin can be run directly (assuming the configuration below) with the following command:

mvn com.kncept.junit.reporter:junit-reporter:2.1.0:junit-reporter

Applying

In the project/build/plugins element, add the plugin. Suggested execution binding is for the 'verify' phase.

<plugin>
	<groupId>com.kncept.junit.reporter</groupId>
	<artifactId>junit-reporter</artifactId>
	<version>2.1.0</version>
	<executions>
		<execution>
			<id>junit-reporter</id>
			<phase>verify</phase>
			<goals>
				<goal>junit-reporter</goal>
			</goals>
		</execution>
	</executions>
</plugin>

Configuration Options

Add the configuration element to the junit-reporter plugin element.
Defaults are shown below, just delete what you don't need.

<configuration>
	<maxDepth>3</maxDepth>
	
	<cssRed>red</cssRed>
	<cssAmber>orange</cssAmber>
	<cssGreen>green</cssGreen>
	
	<failOnEmpty>true</tailOnEmpty>
</configuration>

kncept__junit-reporter's People

Contributors

dependabot[bot] avatar nkrul avatar theosotr avatar

Watchers

 avatar  avatar

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.