Code Monkey home page Code Monkey logo

junit-lazy-fail's Introduction

Lazy fail JUnit add-on

This is an experiment to alter the default JUnit behaviour to mimic the behaviour of the Go testing framework, i.e. failed asserts will normally not end the execution of the test case, but instead all failed asserts are reported at the end. The project is inspired by (as well as have inspired) Dan Norths jgotesting that however supports the Go syntax and does not require AspectJ.

Examples

Some examples can be found in LazyFailExampleTest

Setup

In order to use this addon, you must first add a dependency to your Maven pom.xml

    <dependency>
      <groupId>se.jiderhamn</groupId>
      <artifactId>junit-lazy-fail</artifactId>
      <version>0.9.0-SNAPSHOT</version>
      <scope>test</scope>
    </dependency>

In that same POM, you need to configure AspectJ for compiling the tests

  <build>
    <plugins>
      <!-- Compile with AspectJ compiler -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <version>1.8</version>
        <configuration>
          <aspectLibraries>
            <aspectLibrary>
              <groupId>se.jiderhamn</groupId>
              <artifactId>junit-lazy-fail</artifactId>
            </aspectLibrary>
          </aspectLibraries>
          <complianceLevel>1.8</complianceLevel>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
        <executions>
          <execution>
            <id>test-compile</id>
            <configuration>
              <skip>${maven.test.skip}</skip>
            </configuration>
            <goals>
              <goal>test-compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

Last but not least, you need to annotate your test classes with

@RunWith(se.jiderhamn.lazyfail.LazyFailRunner.class)

junit-lazy-fail's People

Watchers

 avatar  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.