Git Product home page Git Product logo

junit-extensions's Introduction

JUnit Extensions

Build Status Coverage Status Scrutinizer Javadoc Maven Central GitHub Release

With thanks and appreciation to the authors of JUnit5.

There have been discussions amongst the JUnit community (see this and this) about providing official JUnit Jupiter Extensions for the most popular JUnit4 Rules. The upshot of these discussions seems to be enabling limited support for JUnit4 rules on JUnit5. For anyone who would rather move entirely to JUnit5, this library provides JUnit5 implementations of some of the commonly used JUnit4 rules.

Documentation

Extensions

  • BenchmarkExtension: publishes test elapsed time to the console, by default, but also available via the EngineExecutionListener for customised reporting.
  • ExpectedExceptionExtension: allows you to run a test method with an expected exception and (optionally) exception message, delegating responsibility for making the assertion to the extension.
  • RandomBeansExtension: allows you to inject random instances of classes into your tests, useful when you need a class instance to test with but you don't care about its contents.
  • SystemPropertyExtension: allows you to set system properties before test execution and reverts these changes on test completion.
  • TemporaryFolderExtension: allows you to create temporary files and directories in your test, any such files or directories created in your tests are removed for you when the tests complete.
  • TestNameExtension: allows you to use the name of the currently executing test within your test cases.
  • WatcherExtension: logs test execution flow including entry, exit and elapsed time in milliseconds.

Using JUnit-Extensions

The junit-extensions library is available on Maven Central:

Maven

<dependency>
    <groupId>io.github.glytching</groupId>
    <artifactId>junit-extensions</artifactId>
    <version>2.6.0</version>
    <scope>test</scope>
</dependency>

Gradle

testCompile 'io.github.glytching:junit-extensions:2.6.0'

Building JUnit-Extensions

$ git clone https://github.com/glytching/junit-extensions.git
$ cd junit-extensions
$ mvn clean install

This will compile and run all automated tests and install the library in your local Maven repository.

Note: the code is formatted using the Google Code Formatter.

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.###

junit-extensions's People

Contributors

glytching avatar ilyasyoy avatar istarwyh avatar nirajsonawane 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.