org.eluder.juniter:juniter-core

Framework that provides additional features to JUnit

License

License

Categories

Categories

JUnit Unit Testing
GroupId

GroupId

org.eluder.juniter
ArtifactId

ArtifactId

juniter-core
Last Version

Last Version

1.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

Framework that provides additional features to JUnit
Project Organization

Project Organization

Tapio Rautonen

Download juniter-core

How to add to project

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

Dependencies

compile (4)

Group / Artifact Type Version
junit : junit jar 4.11
org.mockito : mockito-core jar 1.9.5
org.easymock : easymock jar 3.1
org.slf4j : slf4j-api jar 1.7.2

test (3)

Group / Artifact Type Version
org.mockito : mockito-all jar 1.9.5
org.slf4j : slf4j-log4j12 jar 1.7.2
org.slf4j : jcl-over-slf4j jar 1.7.2

Project Modules

There are no modules declared in this project.

juniter

Framework that extends JUnit functionality. Adds alternative approach for test rules, automatic mocking, context creation in guice and reflection assert utilities. The project juniter uses semantic versioning and tagging to provide clean version numbers.

Test life cycle

Test life cycle org.eluder.juniter.core.TestLifeCycle provides the hooks to different phases of a unit test. The main reason for custom interface over the JUnit org.junit.rules.TestRule interface is that the test rules do not allow access to the test instance.

Comparison between the TestLifeCycle and TestRule interfaces:

TestLifeCycle TestRule
Easy access to test instance yes no
Easy access to test class yes yes
Easy access to test method yes no
Must reset its own state after each test no yes
Requires a custom JUnit runner yes no

Usage

Core module requires the following dependency:

<dependency>
    <groupId>org.eluder.juniter</groupId>
    <artifactId>juniter-core</artifactId>
    <version>1.2.0-SNAPSHOT</version>
</dependency>

Using test life cycles requires defining the juniter test runner and defining the life cycles to use:

@RunWith(TestRunner.class)
@TestLifeCycles({ FirstLifeCycle.class, SecondLifeCycle.class })
public class MyTest {
    ...
}

Automatic mocking can be achieved with the shorthand mock runner or defining the mock life cycle as one test life cycle:

@RunWith(MockTestRunner.class)
public class MockTest {
    ...
}

is equivalent to

@RunWith(TestRunner.class)
@TestLifeCycles({ MockLifeCycle.class })
public class MockTest {
    ...
}

Guice integration requires the following dependency:

<dependency>
    <groupId>org.eluder.juniter</groupId>
    <artifactId>juniter-guice</artifactId>
    <version>1.2.0-SNAPSHOT</version>
</dependency>

Continuous integration

Travis CI builds juniter with Oracle JDK 7 and OpenJDK 6.

Build Status

License

The project juniter is licensed under the MIT license.

Versions

Version
1.1.2
1.1.1
1.1.0
1.0.0