Description
In this lab, you will explore managing a system of software with test suites via JUnit and build management with Make. you will apply your knowledge of JUnit and Makefiles to write a test script for the newest release of the HfxDonairExpress online ordering system, to improve their build automation, and to include your test cases in their existing testing setup.
Preparation
- Download and install GNU Make. You can alternatively use it on timberlea.
Procedure
Set-up
- Download and unzip the source directory posted on Brightspace.
Lab steps
Part 1 – Unit Testing Write a JUnit test suite for HfxDonairExpress, with one test method for each of the following cases. You should put these test cases in a file called UnitTests.java. Your test cases should check that the method in question (either order or makeOrder) returns the correct value.
- order method: Ordering a small donair
- order method: Ordering a large donair with the coupon code “YOLO5”
- order method: Ordering a medium pizza with pepperoni and mushrooms
- makeOrder method: Making 1 order
- makeOrder method: Making 2 orders in a row
1
Part 2 – Understanding Makefiles Answer the following questions about the provided Makefile:
- Which file(s) are included in the SRC variable?
- What file(s) does the all target depend on?
- What is the command used to make the jar file?
- What does the test target do? You may want to try running the command make test to see.
Part 3 – Writing Makefiles Add the following features to the existing Makefile:
- Modify the Makefile so that your unit test class is compiled and included in jar
- Modify the Makefile to put the compiled .html documentation files into a new sub-directory, docs
- Modify the Makefile to include a target clean which deletes the compiled .class and .html Note: the rm command can be used to delete a file
Questions
- Why is it important to have a portable, reproducible build system that isn’t tied to a particular IDE?
- How often should you run a class’ test suite when developing a software system? Explain.
- Can you see any reason to split test cases up into separate files, or should you just include all of your test cases for every class in the same file?