Skip to content

Testing examples for Java using the JUnit testing framework. Comes with a script to run your tests with either vanilla JUnit or mutation testing. Currently PIT and Jumble mutation testing tools are supported.

Notifications You must be signed in to change notification settings

kill-the-mutants/junit-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

junit-examples

Testing examples for Java using the JUnit testing framework. Comes with a script to run your tests with either vanilla JUnit or mutation testing. Currently PIT and Jumble mutation testing tools are supported.

Structure

Our goal is to make each example simple to follow. Each example has it's own folder with the following files:

Snippet.java

This file is a small class (or 'snippet') that contains the code to be tested.

TestSuite.java

This file is how you run your tests. It should be the same in every example folder.

Tests.java

Here is where the tests go for Snippet.java.

junit-examples
│   README.md
│   run.sh
│
├───examples
│   │
│   ├───example1
│   │   │   Snippet.java
│   │   │   TestSuite.java
│   │   │   Tests.java
│   │
│   ├───example2
│   │   │   Snippet.java
│   │   │   TestSuite.java
│   │   │   Tests.java
│   │
│   │ ...
│
└───dependencies
    │   junit-4.12.jar                         # REQUIRED
    │   hamcrest-core-1.3.jar                  # REQUIRED
    │   pitest-1.1.7.jar                       # IF using PIT
    │   pitest-command-line-1.1.7.jar          # IF using PIT
    │   jumble_binary_1.3.0.jar                # IF using Jumble

Getting it up and running

To make running these tests easier, we created a script to run an example using JUnit, PIT, or Jumble. Here is what you need to know:

The dependencies folder

In order to use our script, we require you to download a few necessary jars. The JUnit ones are required, however the jars for PIT and Jumble are only required if you plan on using those tools for mutation testing. Here is where you can download all of them:

JUnit (REQUIRED):
junit-4.12.jar
hamcrest-core-1.3.jar

PIT:
pitest-1.1.7.jar
pitest-command-line-1.1.7.jar

Jumble:
jumble_binary_1.3.0.jar

The script

The script supplied will compile and run a given example folder. Here is the usage information:

Usage: ./run.sh [example1|example2|...] [junit|pit|jumble]

About

Testing examples for Java using the JUnit testing framework. Comes with a script to run your tests with either vanilla JUnit or mutation testing. Currently PIT and Jumble mutation testing tools are supported.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages