Test Driven Development Exercise – 50 points
CS 355, Spring 2020
1. Get the TDDExercise.jar file from Canvas and copy this to a safe location on your H: drive
2. Create a Java project in Eclipse or IntelliJ IDEA, and bring the Java source files from this JAR file into
a. Eclipse: Create a new Java project, import the JAR file directly into the src folder of your
b. IntelliJ IDEA: Create a new Java project, extract the JAR file somewhere else, and copythe
extracted code and tests folders into the src folder of your project.
3. You should see both the TicketMachine class (Java) and a TestTicketMachine class (for the JUnit tests).
4. JUnit support is available as a library that can be added through your IDE. – do the following:
a. Eclipse: Right-click on your project, choose Java Build Path, Libraries, Add Library, JUnit,
JUnit library version: JUnit4
b. IntelliJ IDEA: Open the TestTicketMachine.java file in your project and click on one ofthe
@Test annotations. Click on the red bulb that appears and choose Add Junit 4 Library.
5. Work through the stories in the TicketSystem.pdf file (also available on Canvas) using the test-driven
a. Add test case(s) first for each story/step, and then add code to make the test case pass.
b. You can of course add variables as well as methods to the TicketMachine class to extend its
functionality to meet a test case you specify.
6. The first story regarding creating a TicketMachine with a cost and being able to get that cost has been
done for you. The two test cases were added first, which caused errors when no TestMachine code was
written, then passed once TestMachine constructors and the getCost method were added.
7. Work to accomplish the Basic Stories and More Stories using test-driven development, which hopefully
is not more than an hour or two of work. You do not have to complete the future stories (unless you
have time and want to do so).
8. At this point, write up a short document (several paragraphs are fine) with the names of each
participating student (again, must be one or two only), discussing:
a. From this short exercise, what do you see as the benefits of test-driven development?
b. What are your concerns regarding the possible issues or problems relating to test-driven
本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易！
E-mail: [email protected] 微信:itcsdx