Brandon Rozek

Photo of Brandon Rozek

PhD Student @ RPI studying Automated Reasoning in AI and Linux Enthusiast.

JUnit Script

Published on

Updated on

Running a JUnit test on the terminal is a little annoying. Here is a quick script to make it easier, make it executable and drop it in ~/.local/bin for easy use.


set -o errexit
set -o nounset
set -o pipefail


show_usage() {
    echo "Usage: junit [class file path]"
    exit 1

# Check argument count
if [ "$#" -ne 1 ]; then

java -cp "$JUNIT_PATH":. org.junit.runner.JUnitCore "$1"

Replacing JUNIT_PATH with the location of the junit4.jar on your system.

Reply via Email Buy me a Coffee
Was this useful? Feel free to share: Hacker News Reddit Twitter

Published a response to this? :