Assignment Week 1
Here is the solution for the assignment.
The assignment for the first week is
- To make sure that a recent version of the Java SE 8 development kit is installed. If you can execute "javac -version", you get something like "javac 1.8.0_161". Here is a link where you can download the latest Java version
- Make sure that you have the latest Eclipse version installed (Oxygen 2 from Dec. 2017). You can download Eclipse here. Note that the simple version for Java developers is sufficient.
- From the Eclipse market place (from inside the Help menu of Eclipse), download the "Natural" plugin.
- Download the zip file library01.zip.
- Import the zip file into Eclipse which gives you the project "library01".
- Implement the production code such that the scenarios "Admin login", "Admin logout", "Add book", and "Search book" pass. You do this, by uncommenting the relevant scenarios and step definitions one after the other. Only uncomment a scenario, if the previous scenario runs successfully.
I have uploaded a video that shows you how to start with the development.
This is a very important exercise. In the future, all the functionality that you write in this course should be based on a scenario within a feature file (which you have written yourself).
The technologies used for behaviour-driven development (BDD) and automated testing are Cucumber and JUnit 4 (note that Cucumber is still relying on JUnit 4 instead of Junit 5). It is okay, if you include JUnit 5 in your classpath, but Cucumber maven dependencies will automatically include JUnit 4 too.
Cucumber has been developed to be used together with Ruby and for Web development. Thus it is difficult to find good resources for using Cucumber with Java. There is a nice book called "The Cucumber for Java" book written by Aslak Hellesoy; Matt Wynne; Seb Rose in 2015 which fills this gap. It is available online via the DTU library. I highly recommend reading the book.
Please also have a look at the Java Tips and Tricks, which provide information on the use of Exceptions and the error message "Compiler error: Unreachable catch block" plus how to iterate over lists.
Part of Programming Exercise: A library application
Hubert Baumeister
April 23, 2018