The tests
directory contains JUnit tests for classes
in the Polymorphic Purse lab.
You need the JUnit 4 libraries (JARs) to run these tests. BlueJ and Eclipse include JUnit 4. IntelliJ IDEA will download the JUnit files when it detects a project that needs them (it prompts you for permission). For VS Code you need to install JUnit yourself, then add the JARs as project dependencies.
test
is the standard name for a folder containing test
source code. Its not a package name.
So, test/coinpurse/CoinTest.java
is in package coinpurse
.
Eclipse, IDEA, and NetBeans support projects with separate folders for application source and test source, but BlueJ does not. If you are using BlueJ you will need to copy the test classes into your BlueJ project.
You can run each test separately (as a JUnit test suite) or run the TestRunner class as an ordinary Java "main" class.
The lab2-test repository has instructions for using JUnit with BlueJ and VS Code.