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
- Move to the branch
dip
. Verify that you are on the correct branch. - 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. - Create a new
Clock
in the files IssueClock.hpp and IssueClock.cpp, and a test program in the file IssueClockTest.cpp. You will need to add these files so that Git will version control them: Do not commit yet. -
The branch
dip-cmake
has an updated version of CMakeLists.txt that knows about the SessionIssue1Test. In the branchdip
, enter the following git command to pull this updated CMakeLists.txt into your code: - Create a minimal test program in SessionIssueTest.cpp. This body of the main should be
assert(false)
with a return. Make sure the test builds and runs, but it will fail. - Fix the test program and the new clock.
-
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:
- The files IssueClock.hpp and IssueClock.cpp are not needed
- The pull is from the branch
mock-cmake
Commit your work with the commit message: