Extensions/Plugins for JVM test frameworks

Related tags

testing test junit junit4 junit5
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.

Owner
Thundra
Thundra
Extensions/Plugins for JVM test frameworks

Jexter Extensions/Plugins for JVM test frameworks (JUnit 4, JUnit 5, ...) Get Jexter Binaries are available from Maven Central. Group Artifact Latest

Thundra 20 Aug 31, 2021
Captures log entries for unit testing purposes

LogCaptor Install with maven <dependency> <groupId>io.github.hakky54</groupId> <artifactId>logcaptor</artifactId> <version>2.4.0</version>

null 121 Sep 13, 2021
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

Google 229 Sep 10, 2021
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.3k Sep 10, 2021
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 105 Jul 19, 2021
JUnit 5 Parameterized Test Yaml Test Data Source

Yamaledt — JUnit 5 Parameterized Tests Using Yaml and Jamal Introduction and usage Note This is the latest development documentation. This is a SNAPSH

Peter Verhas 4 Jun 4, 2021
Fluent assertions library for Java

Deep Dive Assertions Deep Dive is an assertion library for Java. It offers a fluent API which allows you to dive deep, i.e. going back and forth betwe

Johannes Döbler 3 Aug 1, 2021
Clojure bindings for the Chromium Embedded Framework

clj-cef Clojure bindings for the Chromium Embedded Framework Dependency: Rationale From https://bitbucket.org/chromiumembedded/cef/src/master/ Some us

Adrian 35 Jul 4, 2021
Java (and original) version of Hamcrest

Java Hamcrest Licensed under BSD License. What is Hamcrest? Hamcrest is a library of matchers, which can be combined in to create flexible expressions

Hamcrest 1.9k Sep 10, 2021
A browser automation framework and ecosystem.

Selenium Selenium is an umbrella project encapsulating a variety of tools and libraries enabling web browser automation. Selenium specifically provide

Selenium 21.7k Sep 18, 2021
Toolkit for testing multi-threaded and asynchronous applications

ConcurrentUnit A simple, zero-dependency toolkit for testing multi-threaded code. Supports Java 1.6+. Introduction ConcurrentUnit was created to help

Jonathan Halterman 387 Sep 13, 2021
fabric-carpet extension mod which attempts to fix as many vanilla bugs as possible. Feel free to add as many fixes as you want!

Carpet-Fixes Fabric Carpet extension mod which attempts to fix as many vanilla bugs as possible! Feel free to contribute by adding as many fixes as yo

Fx Morin 16 Sep 10, 2021
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 575 Sep 6, 2021
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

PowerMock 3.6k Sep 15, 2021
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

PowerMock 3.6k Sep 9, 2021
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

null 183 Sep 17, 2021
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

Robert C. Martin 1.7k Sep 18, 2021
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

Stefan Niederhauser 70 May 19, 2021
XMLUnit for Java 2.x

XMLUnit for Java 2.x XMLUnit is a library that supports testing XML output in several ways. XMLUnit 2.x is a complete rewrite of XMLUnit and actually

XMLUnit 242 Sep 7, 2021