mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-17 15:31:27 +00:00
Enable coverage and add Howto for coverage
Updated CMakeLists.txt to enable coverage. Updated instructions with howto for coverage and also a separate set of instructions how to run during a TDD cycle with coverage.
This commit is contained in:
parent
760fa27d4a
commit
c54cdfbb5b
@ -28,8 +28,8 @@ endif()
|
|||||||
# Bring the populated content into the build
|
# Bring the populated content into the build
|
||||||
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
|
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
|
||||||
|
|
||||||
# uncomment this line to enable coverage measurements using gcov
|
# comment this line to disable coverage measurements using gcov
|
||||||
# set(CMAKE_CXX_FLAGS "--coverage")
|
set(CMAKE_CXX_FLAGS "--coverage")
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|||||||
@ -49,6 +49,18 @@ The `GildedRose.cc` file, i.e. the code under test, is identical in all four var
|
|||||||
|
|
||||||
$ ctest -VV --tests-regex Catch2Approval
|
$ ctest -VV --tests-regex Catch2Approval
|
||||||
|
|
||||||
|
## How to run with test coverage
|
||||||
|
1. go to build directory
|
||||||
|
2. Run:
|
||||||
|
$ lcov --directory ./ --capture --output-file ../lcov.info -rc lcov_branch_coverage=1
|
||||||
|
3. in bottom right corner of VS Code press "Watch"
|
||||||
|
3. Coverage will now be visible in VSCode.
|
||||||
|
|
||||||
|
## How to run during a typical TDD cycle
|
||||||
|
$ cmake --build .
|
||||||
|
$ ctest -VV --tests-regex GildedRoseGoogletestUnitTests
|
||||||
|
$ lcov --directory ./ --capture --output-file ../lcov.info -rc lcov_branch_coverage=1
|
||||||
|
|
||||||
## How to build and run tests using the [CLion IDE](https://www.jetbrains.com/clion/)
|
## How to build and run tests using the [CLion IDE](https://www.jetbrains.com/clion/)
|
||||||
|
|
||||||
1. Start CLion
|
1. Start CLion
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user