CPSC 480-020 Software Engineering (SE) Fall 2024

Exercise 45: Team DIP & Mock Objects II Posted: Nov 05

If you haven't completed the previous Mock Clock exercise, do so before completing this one.

A team member created an issue in your repository. You have been asked to add a test for this issue. Go to the Issues for your repository at GitHub and read it.

Session Testing

Record In your notes, explain why you cannot practically write a test for this issue without using dependency inversion.

Session Testing with DIP

  1. Move to the branch dip. Verify that you are on the correct branch.
  2. As you work on this branch, record a list of git commands you entered. Order does not matter, and you don't have to repeat them.
  3. Create a new Clock in the files Issue1Clock.hpp and Issue1Clock.cpp, and a test program in the file Issue1ClockTest.cpp. You will need to add these files so that Git will version control them: Do not commit yet.
  4. The branch dip-cmake has an updated version of CMakeLists.txt that knows about the SessionIssue1Test. In the branch dip, enter the following git command to pull this updated CMakeLists.txt into your code:

  5. Create a minimal test program in SessionIssue1Test.cpp. This body of the main should be assert(false) with a return. Make sure the test builds and runs, but it will fail.
  6. Complete the verification with the test program and the new clock.
  7. Commit your work with the commit message:

Session Testing with DIP and Mock

As you work on this branch, record a list of git commands you entered. Order does not matter, and you don't have to repeat them.

Repeat the Software Testing with DIP, but this time on the branch mock. Note the following:

Commit your work with the commit message: