Skip to content

Implementation of junit4 rule for BMUnit

License

LGPL-2.1, Unknown licenses found

Licenses found

LGPL-2.1
LICENSE
Unknown
license.txt
Notifications You must be signed in to change notification settings

starnowski/bmunit-extension

Repository files navigation

bmunit-extension

Build Status codecov Maven Central Java Native Mechanisms Approach CI

Support of junit4 rule for the bmunit library.

Introduction

Project contains junit4 rule which allows integration with byteman framework and use it in junit and spock tests. Enables to use bmunit library in test executed by SpringRunner and Spock tests runner. It also contains types which allows to operate on mechanisms like counters, rendezvous, joins in the tests methods. Those types can also be used with the JUnit 5 library. Please read how to use the "utils" module.

How to attach project

Dependencies for "junit4-rule"

        <dependency>
            <groupId>com.github.starnowski.bmunit.extension</groupId>
            <artifactId>junit4-rule</artifactId>
            <version>1.0.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.byteman</groupId>
            <artifactId>byteman-bmunit</artifactId>
            <version>3.0.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.byteman</groupId>
            <artifactId>byteman</artifactId>
            <version>3.0.10</version>
            <scope>test</scope>
        </dependency>

Dependencies for "utils"

        <dependency>
            <groupId>com.github.starnowski.bmunit.extension</groupId>
            <artifactId>utils</artifactId>
            <version>1.0.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.byteman</groupId>
            <artifactId>byteman</artifactId>
            <version>3.0.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.byteman</groupId>
            <artifactId>byteman-submit</artifactId>
            <version>3.0.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.byteman</groupId>
            <artifactId>byteman-install</artifactId>
            <version>3.0.10</version>
            <scope>test</scope>
        </dependency>

Build project

Build parent project with maven

mvn clean install

How to use project

How to use "junit4-rule" module

To have ability to use anotations " org.jboss.byteman.contrib.bmunit.BMUnitConfig", "org.jboss.byteman.contrib.bmunit.BMRule" and "org.jboss.byteman.contrib.bmunit.BMRules" add the object of "com.github.starnowski.bmunit.extension.junit4.rule.BMUnitMethodRule" type into the test class.

import com.github.starnowski.bmunit.extension.junit4.rule.BMUnitMethodRule;
import org.junit.Rule;

...

@Rule
public BMUnitMethodRule bmUnitMethodRule = new BMUnitMethodRule();

Project contains few modules with tests which demonstrates how to use the BMUnitMethodRule rule with junit4 tests and spock framework tests:

How to use "utils" module

Module "utils" contains object type "com.github.starnowski.bmunit.extension.utils.BMUnitUtils" which contains static methods. Methods allows to operate on mechanism like counters, rendezvous, joins. Thanks to this methods you can manipulate on those objects from tests level The module was also tested for compatibility with the Byteman in version 4.10.0. It means that the module can be used together with the JUnit 5 library.

The project contains few modules with tests which demonstrates how to use static methods of type BMUnitUtils with JUnit 4, JUnit5 tests and Spock framework tests

Demonstrational tests

Issues

  • If you facing any issues related with project usage please check on wiki page if there is already a solution for your problem
  • Any new issues please report in GitHub site

About

Implementation of junit4 rule for BMUnit

Resources

License

LGPL-2.1, Unknown licenses found

Licenses found

LGPL-2.1
LICENSE
Unknown
license.txt

Stars

Watchers

Forks

Packages

No packages published