Skip to main content

Updated for Fall 2026

This workshop is part of Milestone 1 — see that page for the milestone’s deliverables, rubric, and deadlines.

In this workshop, we’ll be looking at the new technologies in CSC 326 and how we can test each of them to make sure that the different layers of our system are working properly. In the previous workshop, we covered how to explore and debug each layer of the system by finding and fixing bugs present in them. Our focus here will be learning more about automated tests for each layer of the system and how to write these tests to increase confidence the system is working properly.

Team Repository

You’ve been added to a new GitHub repository for your team. It is not a copy of your individual repository — the project has moved on since Milestone 0, and several things are set up for you. Read this section before you start; some of it changes how you work.

Bug fixes

  • The Milestone 0 bugs are already fixed, including the bonus copy-paste bug in RecipeComponent where every form field was bound to value={name}.
  • Extra, unneeded code has been removed from Inventory and Recipe.

Tests you have been given

Your individual repository had no tests at all. The team repository ships with a set:

  • InventoryRepositoryTest, InventoryServiceTest, InventoryControllerTest, and InventoryControllerWebMvcTest — complete, one per layer. These are your reference implementations; read the one for the layer you are working on before writing your own tests.
  • RecipeRepositoryTest — a scaffold with one worked test and three @Disabled stubs for you to implement.
  • TestUtils — helpers you will use in the API workshop.

Database configuration

  • Tests run against a separate coffee_maker_test schema, so testing never disturbs the data in the running application.
  • application.properties is committed for both src/main and src/test and reads environment variables with sensible local defaults, so a fresh clone works with no editing. The old application.properties.template is gone.
  • If your MySQL setup differs, copy coffee_maker/.env.template to coffee_maker/.env and override only what you need. .env is gitignored.

Coverage is now measured by the build

The build now includes JaCoCo, which measures how much of src/main/java your tests execute and compares it against 60% line and 50% branch across the project.

It reports a shortfall rather than failing the build, so a green check does not mean you have met the expectation — you have to read the number. Coverage is still part of your grade.

  • ./mvnw test runs the tests and writes a coverage report.
  • ./mvnw verify — what GitHub Actions runs — also compares your coverage against the minimums and reports where you stand.
  • The browsable report is at coffee_maker/target/site/jacoco-ut/index.html, and Actions publishes the numbers to the run summary.

Continuous integration

  • The build runs on every branch, not just main and development, so you get feedback on a feature branch before you open a pull request.
  • It runs against a MySQL service container, so it does not depend on anyone’s local database.
  • Coverage numbers appear on the run’s summary page, and the test results, the browsable JaCoCo report, and the Checkstyle report are all uploaded as downloadable artifacts.

Project management

  • project-management/index.md has sections for your team’s communication policy and AI policy, plus task lists tasks-m1.md through tasks-m6.md. See Project Management.
  • There is no retros folder here — retrospectives are individual and stay in your individual repository.

Team and Individual Projects

Clone your team repository alongside your individual one, and keep the two open as separate IntelliJ projects so you don’t mix up team and individual work:

  • File > Open, select the folder for your cloned team repository, and choose New Window when IntelliJ asks where to open it.
  • Switch between the two projects from the Window menu.
  • Set up the team project’s coffee_maker as a Maven project and configure application.properties the same way you did in Setup.

Check the Git branch widget before you start working — it is easy to commit team work to your individual repository when both are open.

Running Tests

There are two ways you can run the automated back end tests:

  • Right click on src/test/java and select Run ‘All Tests’. To collect coverage, select Run ‘All Tests’ with Coverage instead.
  • In the Maven side panel, expand coffee_maker > Lifecycle and double-click test.

Running the tests directly gives you faster feedback and lets you run instrumented for coverage. Running through Maven uses the Maven build resources and simulates what will happen (eventually) when GitHub actions are run.

Activity: Workshops

The sections below should be completed as a team in the team repository.

Done Criteria

  • At least 60% statement coverage and 50% branch coverage across the Inventory* and Recipe* portions of the project.
  • Tests for recipe functionality that has been implemented at all layers of the system.

If you find bugs while writing automated tests, you do not need to fix them yet. But you do need to test the working functionality to achieve sufficient coverage!

Your project should now build successfully on Github Actions and have no errors at any stage-

Next Steps

Head back to the Milestone 1 Overview and work on the individual portion of the project.