In File: exercises/exercise1/tests/ValidateDevelopmentEnvironment.cpp
- Validate environment
- Run the test
- Fix the test
In File: exercises/exercise1/tests/TrigMathTests.cpp
Scenario: In this scenario, we are going to look at getting high test coverage over existing, working code.
We are going to start with code that is simpler to test, so you can figure out what it does by running it, and then preserving its behavior with tests.
- Run first test
- Uncomment the CHECK line
- Confirmation: See failure message
- Get the test to pass
- Confirmation: See green result
- Test Asin() completely
- Write a new test for Asin()
- Check coverage of Asin() with break points
- Add a breakpoint on every line of Asin()
- Remove breakpoint when hit
- Confirmation: No more breakpoints in Asin()
- EITHER Set up code coverage measurement in CLion
- Select "Debug-Visual Studio clang" configuration
- Confirmation: The CLion toolbar shows you can run "Test Asin | Debug-Visual Studio clang"
- Select "Run > Run 'Test Asin' with C/C++ Coverage Plugin"
- Confirmation: You see a message "Missing compilation flags"
- Click the blue Create text - if you can't see it, go to CLion's Event Log.
- Confirmation: The CLion toolbar shows you can run "Test Asin | Debug-Visual Studio clang-Coverage"
- Select "Debug-Visual Studio clang" configuration
- OR Set up code coverage measurement in Visual Studio
- Or OpenCppCoverage in Visual Studio
- Confirmation: Visual Studio's Tools menu has "Run OpenCppCoverage"
- Or OpenCppCoverage in Visual Studio
- Run test coverage
- Confirmation: See what areas of TrigMath.cpp are green (covered)
- Confirmation: See 100% coverage of the Asin() method
- Test TrigMath completely
- Confirmation: See 100% coverage of the code
- Code Coverage reached: ______%
- Explanations and Retrospective
- Print out the homework sheet and keep it by your desk, to increase your awareness throughout the week.
- Redo today’s coding exercises on your own computer
- Start from the code on the master branch
- If you want to see the code we wrote together, check the other branches
- Count Number of times you encounter a functional method at work this week
- (Optional) If you write any tests for those methods, please make a note so we can share at the start of next week.