Extensions/Plugins for JVM test frameworks

Overview

Jexter

Build Status License Lifecycle

Extensions/Plugins for JVM test frameworks (JUnit 4, JUnit 5, ...)

Get Jexter

Binaries are available from Maven Central.

Group Artifact Latest Stable Version
io.thundra jexter-* Maven Central

For Maven:

<dependency>
	<groupId>io.thundra</groupId>
	<artifactId>jexter-...</artifactId>
	<version><!--...--></version>
	<scope>test</scope>
</dependency>

For Gradle:

testCompile group: 'io.thundra', name: 'jexter-...', version: /*...*/

Below are the various artifacts published:

Artifact Description
jexter-core Core module
jexter-junit4-core JUnit4 core module
jexter-junit5-core JUnit5 core module

Versioning

Artifact versions are in X.Y.Z format

  • X: Major version number.
    • Increases only when there are big API and/or architectural changes.
    • Breaks backward compatibility.
  • Y: Minor version number.
    • Increases for small API changes and big improvements.
    • Breaks backward compatibility.
  • Z: Patch version number.
    • Increases for bug fixes and small improvements.
    • Doesn’t break backward compatibility.

Requirements

  • JDK 1.8+ (for build and execution)
  • Maven 3.x (for build)

Build

To build:

$ git clone [email protected]:thundra-io/jexter.git
$ cd jexter/
$ mvn clean install

How to Use

Utilities/Helpers

EnvironmentVariableHelper

Set environment variable
import io.thundra.jexter.core.envvar.EnvironmentVariableHelper;

...

EnvironmentVariableHelper.set("env-var-name", "env-var-value");
Remove environment variable
import io.thundra.jexter.core.envvar.EnvironmentVariableHelper;

...

EnvironmentVariableHelper.remove("env-var-name");

JUnit 4 Rules

EnvironmentVariableSandboxRule

Stores environment variables before the test and restores them back to original value after the test.

  • Add jexter-junit4-core dependency
  • Define EnvironmentVariableSandboxRule as test or class level rule

Method level:

import io.thundra.jexter.junit4.core.envvar.EnvironmentVariableSandboxRule;

...

public class TheTest {

    ...

    @Rule
    public EnvironmentVariableSandboxRule rule = new EnvironmentVariableSandboxRule();

    ...

}

Class level:

import io.thundra.jexter.junit4.core.envvar.EnvironmentVariableSandboxRule;

...

public class TheTest {

    ...

    @ClassRule
    public static EnvironmentVariableSandboxRule rule = new EnvironmentVariableSandboxRule();

    ...

}

SystemPropertySandboxRule

Stores system properties before the test and restores them back to original value after the test.

  • Add jexter-junit4-core dependency
  • Define SystemPropertySandboxRule as test or class level rule

Method level:

import io.thundra.jexter.junit4.core.sysprop.SystemPropertySandboxRule;

...

public class TheTest {

    ...

    @Rule
    public SystemPropertySandboxRule rule = new SystemPropertySandboxRule();

    ...

}

Class level:

import io.thundra.jexter.junit4.core.sysprop.SystemPropertySandboxRule;

...

public class TheTest {

    ...

    @ClassRule
    public static SystemPropertySandboxRule rule = new SystemPropertySandboxRule();

    ...

}

StopwatchRule

Measures the elapsed time of a test or test suite (class) execution.

  • Add jexter-junit4-core dependency
  • Define StopwatchRule as test or class level rule

Method level:

import io.thundra.jexter.junit4.core.sw.StopwatchRule;

...

public class TheTest {

    ...

    @Rule
    public StopwatchRule rule = new StopwatchRule();

    ...

}

Class level:

import io.thundra.jexter.junit4.core.sw.StopwatchRule;

...

public class TheTest {

    ...

    @ClassRule
    public static StopwatchRule rule = new StopwatchRule();

    ...

}

JUnit 5 Extension

EnvironmentVariableSandboxExtension

Stores environment variables before the test and restores them back to original value after the test.

  • Add jexter-junit5-core dependency
  • Annotate test method or class by @EnvironmentVariableSandbox annotation

Method level:

import io.thundra.jexter.junit5.core.envvar.EnvironmentVariableSandbox;

...

public class TheTest {

    ...

    @EnvironmentVariableSandbox
    @Test
    public void test() {
        ...
    }

    ...

}

Class level:

import io.thundra.jexter.junit5.core.envvar.EnvironmentVariableSandbox;

...

@EnvironmentVariableSandbox
public class TheTest {

    ...

    @Test
    public void test() {
        ...
    }

    ...

}

SystemPropertySandboxExtension

Stores system properties before the test and restores them back to original value after the test.

  • Add jexter-junit5-core dependency
  • Annotate test method or class by @SystemPropertySandbox annotation

Method level:

import io.thundra.jexter.junit5.core.sysprop.SystemPropertySandbox;

...

public class TheTest {

    ...

    @SystemPropertySandbox
    @Test
    public void test() {
        ...
    }

    ...

}

Class level:

import io.thundra.jexter.junit5.core.sysprop.SystemPropertySandbox;

...

@SystemPropertySandbox
public class TheTest {

    ...

    @Test
    public void test() {
        ...
    }

    ...

}

StopwatchExtension

Measures the elapsed time of a test or test suite (class) execution.

  • Add jexter-junit5-core dependency
  • Annotate test method or class by @Stopwatch annotation

Method level:

import io.thundra.jexter.junit5.core.sw.Stopwatch;

...

public class TheTest {

    ...

    @Stopwatch
    @Test
    public void test() {
        ...
    }

    ...

}

Class level:

import io.thundra.jexter.junit5.core.sw.Stopwatch;

...

@Stopwatch
public class TheTest {

    ...

    @Test
    public void test() {
        ...
    }

    ...

}

Issues and Feedback

Issues Closed issues

Please use GitHub Issues for any bug report, feature request and support.

Contribution

Pull requests Closed pull requests Contributors

If you would like to contribute, please

  • Fork the repository on GitHub and clone your fork.
  • Create a branch for your changes and make your changes on it.
  • Send a pull request by explaining clearly what is your contribution.

Tip: Please check the existing pull requests for similar contributions and consider submit an issue to discuss the proposed feature before writing code.

LICENSE

Copyright (c) 2018 Thundra, Inc.

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.

You might also like...

Test if a request/response matches a given raml definition

raml-tester Test if a request/response matches a given raml definition. Versioning Version Contents 0.8.x Stable version, uses RAML parser 0.8.x and s

Mar 21, 2022

PowerMock is a Java framework that allows you to unit test code normally regarded as untestable.

PowerMock is a Java framework that allows you to unit test code normally regarded as untestable.

Writing unit tests can be hard and sometimes good design has to be sacrificed for the sole purpose of testability. Often testability corresponds to go

Dec 28, 2022

FitNesse -- The Acceptance Test Wiki

FitNesse Welcome to FitNesse, the fully integrated stand-alone acceptance testing framework and wiki. To get started, check out http://fitnesse.org! Q

Jan 3, 2023

PowerMock is a Java framework that allows you to unit test code normally regarded as untestable.

PowerMock is a Java framework that allows you to unit test code normally regarded as untestable.

Writing unit tests can be hard and sometimes good design has to be sacrificed for the sole purpose of testability. Often testability corresponds to go

Dec 28, 2022

Enabling Test Automation in Java

SeLion Enabling Test Automation in Java SeLion builds on top of TestNG and Selenium to provide a set of capabilities that get you up and running with

Dec 11, 2022

Arbitrary test data generator for parameterized tests in Java inspired by AutoFixture.

AutoParams AutoParams is an arbitrary test data generator for parameterized tests in Java inspired by AutoFixture. Sometimes setting all the test data

Jan 2, 2023

A simple yet powerful parameterized test runner for Java.

TestParameterInjector Introduction TestParameterInjector is a JUnit4 test runner that runs its test methods for different combinations of field/parame

Dec 30, 2022

Let Fixture Monkey generate test instances including edge cases automatically

Let Fixture Monkey generate test instances including edge cases automatically

Fixture Monkey is designed to generate controllable arbitrary instances easily. It allows you to reuse same configurations of the instances in several tests.

Jan 9, 2023
Owner
Thundra
Thundra
Cucumber for the JVM

Cucumber JVM Cucumber-JVM is a pure Java implementation of Cucumber. You can run it with the tool of your choice. Cucumber-JVM also integrates with al

Cucumber 2.5k Jan 5, 2023
JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.

pact-jvm JVM implementation of the consumer driven contract library pact. From the Ruby Pact website: Define a pact between service consumers and prov

Pact Foundation 962 Dec 31, 2022
Objenesis is a library dedicated to bypass the constructor when creating an object. On any JVM there is.

Objenesis Objenesis is a library dedicated to bypass the constructor when creating an object. On any JVM there is. You can find the website and user d

EasyMock 532 Jan 2, 2023
JVM version of Pact Enables consumer driven contract testing

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.

Pact Foundation 961 Dec 30, 2022
State of the art mutation testing system for the JVM

Pitest (aka PIT) is a state of the art mutation testing system for Java and the JVM. Read all about it at http://pitest.org Releases 1.7.3 #952 Mutate

Henry Coles 1.5k Dec 26, 2022
This repository includes selenium tests examples using cucumber-jvm framework.

Cucumber Selenium Tests This repository includes cucumber selenium tests examples using wikipedia.org. Run tests To run tests on your local machine, y

Denys Vozniuk 3 Nov 27, 2022
Test Automation Made Simple

Karate Test Automation Made Simple. Karate is the only open-source tool to combine API test-automation, mocks, performance-testing and even UI automat

Intuit 6.5k Dec 28, 2022
Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.

That feeling you get when you know you can trust your tests Serenity BDD is a library designed to make writing automated acceptance tests easier, and

Serenity BDD 654 Dec 28, 2022
A library for setting up Java objects as test data.

Beanmother Beanmother helps to create various objects, simple and complex, super easily with fixtures for testing. It encourages developers to write m

Jaehyun Shin 113 Nov 7, 2022
A Java architecture test library, to specify and assert architecture rules in plain Java

ArchUnit is a free, simple and extensible library for checking the architecture of your Java code. That is, ArchUnit can check dependencies between pa

TNG Technology Consulting GmbH 2.5k Jan 2, 2023