Bump version of googletest and disable other types of tests

This commit is contained in:
Ulf Ivraeus 2023-02-20 15:21:38 +01:00
parent 317d04c61d
commit f5718c05d6
4 changed files with 14 additions and 14 deletions

1
cpp/.gitignore vendored
View File

@ -2,3 +2,4 @@
.vs
cmake-build-debug
build
coverage

View File

@ -8,7 +8,7 @@ include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.1
GIT_TAG release-1.12.1
)
# Fetch GoogleTest amd make build scripts available

View File

@ -32,10 +32,7 @@ The `GildedRose.cc` file, i.e. the code under test, is identical in all four var
$ cd ${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp/build
$ ctest -N
Test project ${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp/build
Test #1: GildedRoseCatch2ApprovalTests
Test #2: GildedRoseCatch2UnitTests
Test #3: GildedRoseGoogletestApprovalTests
Test #4: GildedRoseGoogletestUnitTests
Test #1: GildedRoseGoogletestUnitTests
### Run all tests
@ -52,14 +49,16 @@ The `GildedRose.cc` file, i.e. the code under test, is identical in all four var
## 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.
$ mkdir ../coverage
3. Run:
$ lcov --directory ./ --capture --output-file ../coverage/lcov.info -rc lcov_branch_coverage=1
4. In VS Code run "Coverage Gutters: Display Coverage"
5. Coverage will now be visible in VSCode (left border in the editor when viewing source code).
## 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
$ lcov --directory ./ --capture --output-file ../coverage/lcov.info -rc lcov_branch_coverage=1
## How to build and run tests using the [CLion IDE](https://www.jetbrains.com/clion/)
@ -70,7 +69,7 @@ The `GildedRose.cc` file, i.e. the code under test, is identical in all four var
4. Select menu `Run - Run...`
4. Select what test variant to run, e.g. `GildedRoseCatch2ApprovalTests`.
## How to build and run tests using Visual Studio 2019
## How to build and run tests using Visual Studio 2019
1. Start Visual Studio 2019
2. Select `Open a local folder`

View File

@ -1,5 +1,5 @@
add_subdirectory(cpp_catch2_approvaltest)
add_subdirectory(cpp_catch2_unittest)
add_subdirectory(cpp_googletest_approvaltest)
#add_subdirectory(cpp_catch2_approvaltest)
#add_subdirectory(cpp_catch2_unittest)
#add_subdirectory(cpp_googletest_approvaltest)
add_subdirectory(cpp_googletest_unittest)
add_subdirectory(cpp_texttest)
#add_subdirectory(cpp_texttest)