TL;DR Soft-code JUnit path location + Automate installation of JUnit (with Maven?) so that testing can run when not at CSIL.
ant test will give an error if run anywhere outside of CSIL. This is because:
the junit package is only installed on CSIL machines, and is in pconrad's directory /cs/faculty/pconrad/public_html/cs56/lib/junit-4.8.2.jar
the ant file currently references pconrad's location for the junit package
the PasswordTest.java file will not compile if not on CSIL because the JUnit package is missing!
So, I created the following fix (commit 262e95a on Vince's fork of the repo) to this problem that differentiates compiling into two options:
a compile target that is default, and EXCLUDES *_/_Test.java files from compiling (the */ is a wildcard that tells ant to ignore any Test.java files recursively aka in any subdirectory). This is the default compile target, and is depended upon by run, javadoc, etc.
a compileForTest target that is depended on by test; this INCLUDES any *_/_Test.java files.
This workaround allow the project to run anywhere outside of CSIL, but not test.
So, here are some suggested ways to make the project truly independent of CSIL:
Gracefully handle exceptions create a block in the build.xml file that will check whether the current system has a junit package. Suggested value: 25 points
If the package exists, and is configured, run normally.
If not, write a message to the command line prompting the user to install JUnit and configure the build.xml to route to THEIR junit location instead.
expanding on the above functionality, have ant run a routine that installs JUnit on the user's local machine, and configures the build.xml file to the according path. Suggested value: 75 points
use Ant (or Java...or Maven!) to run a routine that would get and configure JUnit to the user's local machine. Note that this would probably require different routines depending on the user's operating system. In fact, Prof. Conrad mentioned this as one of the benefits to Maven vs Ant, so tackling converting this project into Maven from Ant would most likely also solve this problem, though would warrant a new, seperate issue, and more points than my estimate for only fixing THIS issue.
soft-code the location of Junit so that it can instead be mapped to the user's install location if OR after JUnit is installed
@jhpenger and @EdieS Please consider doing this issue. It is a VERY easy issue, and it will make it much more convenient for folks to work with this code.
TL;DR Soft-code JUnit path location + Automate installation of JUnit (with Maven?) so that testing can run when not at CSIL.
ant test
will give an error if run anywhere outside of CSIL. This is because:/cs/faculty/pconrad/public_html/cs56/lib/junit-4.8.2.jar
So, I created the following fix (commit 262e95a on Vince's fork of the repo) to this problem that differentiates compiling into two options:
compile
target that is default, and EXCLUDES *_/_Test.java files from compiling (the */ is a wildcard that tells ant to ignore any Test.java files recursively aka in any subdirectory). This is the default compile target, and is depended upon by run, javadoc, etc.compileForTest
target that is depended on bytest
; this INCLUDES any *_/_Test.java files.This workaround allow the project to run anywhere outside of CSIL, but not test.
So, here are some suggested ways to make the project truly independent of CSIL:
Total estimated value: 100 points