Skip to main content

Posts

Showing posts with the label JUnit

What is JUnit & How To Use It?

JunitPithy is built using Apache Ant and Ant has JUnit support as an optional package. With junit.jar in the classpath, Ant should automatically detect it, but where you want to keep your default classpath clean, which is my preference when you are trying to have a code tree with minimal external dependencies, the quickest way to enable it is to copy the junit.jar file into the $ANT_HOME/lib directory. With junit.jar in place, the Ant task <junit> is enabled. With that in place, we can organise the test classes. Rather than mix the test code with the actual code, it is better to have a separate test hierarchy with its own class tree. Here's the opening of build.xml: <project name="PithyDerby" default="compile" basedir="."> <property name="sourceDir" value="src" /> <property name="outputDir" value="bin" /> <property name="testDir" value="tests" /> <propert...