JUnitVolkswagen

Make your tests pass on any integration server! Always!

License

License

Categories

Categories

Ant Build Tools JUnit Unit Testing
GroupId

GroupId

com.github.antrew
ArtifactId

ArtifactId

junit-volkswagen
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

JUnitVolkswagen
Make your tests pass on any integration server! Always!
Project URL

Project URL

https://github.com/antrew/junit-volkswagen
Source Code Management

Source Code Management

https://github.com/antrew/junit-volkswagen.git

Download junit-volkswagen

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.antrew/junit-volkswagen/ -->
<dependency>
    <groupId>com.github.antrew</groupId>
    <artifactId>junit-volkswagen</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.antrew/junit-volkswagen/
implementation 'com.github.antrew:junit-volkswagen:0.0.1'
// https://jarcasting.com/artifacts/com.github.antrew/junit-volkswagen/
implementation ("com.github.antrew:junit-volkswagen:0.0.1")
'com.github.antrew:junit-volkswagen:jar:0.0.1'
<dependency org="com.github.antrew" name="junit-volkswagen" rev="0.0.1">
  <artifact name="junit-volkswagen" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.antrew', module='junit-volkswagen', version='0.0.1')
)
libraryDependencies += "com.github.antrew" % "junit-volkswagen" % "0.0.1"
[com.github.antrew/junit-volkswagen "0.0.1"]

Dependencies

compile (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.jmockit : jmockit jar 1.19

Project Modules

There are no modules declared in this project.

junit-volkswagen

Make your tests green on your integration server! Always!

Are you tired of those red tests on your integration server? Then try this library. It makes JUnit tests run normally on your local machine and makes them always pass on the integration server.

Comparison to other available solutions

I know that there are already numerous implementations of Volkswagen-style libraries for JUnit. However, I believe my implementation is better.

Pros of this implementation:

  • it does not require you to use a special TestRunner in your tests
  • it actually runs your tests, so your code coverage will not drop
  • the execution time of your tests will also be the same, so it will not look suspicious
  • it is sneakier than others (see usage examples below). Just push it through in one of the merge requests. Even the project maintainer will not notice it!
  • it hits JUnit right in its heart

The sum of the above reduces the probability of you being caught on faking tests. (Remember what happened to Volkswagen?)

Usage

Using junit-volkswagen is easy. Just call it before your test runs in one of the following three ways:

Exlicit example

You can call it explicitely:

JUnitVolkswagen.initStatic();
...
fail("You shall not pass!"); // this will be green

Implicit example

You can call it implicitely:

new JUnitVolkswagen();
...
assertEquals("No way!", true, false); // this will be green as well

Sneaky example

You can even pretend it does something useful:

JUnitVolkswagen stuff = new JUnitVolkswagen();
stuff.init();
...
assertThat("Seriously?", true, CoreMatchers.equalTo(false)); // even this will be green

Even sneakier example

Do you have a common test class that is used in all of your tests? Just put it there, noone will notice:

public class TestHelper {
    protected static JUnitVolkswagen importantProtectedField = new JUnitVolkswagen();
}
...
assertEquals("Can you doublethink?", 2*2, 5); // I am out of examples, but I really like 1984 by George Orwell

Disclaimer

I am just having fun. Please do not even consider putting a dependency on this library in any of your projects!

You have been warned!

Versions

Version
0.0.1