mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-15 18:43:53 +00:00
Introduce four CMake options to enable/disabled test variants or test frameworks
By default all four test variants (Catch2 vs. GTest and Approval vs. Unit) are enabled.
This commit is contained in:
1 parent
afd4627ee1
commit
784920714a
8 files changed
+127
-92
No files matched your search
+22
-9
@@ -6,16 +6,16 @@ The C++ version of the Gilded Rose refactoring kata is available in four variant
|
||||
* Catch2 test framework
|
||||
1. Traditional unit test with the [Catch2](https://github.com/catchorg/Catch2) test framework in the `test/cpp_catch2_unittest` folder.
|
||||
2. [Approval tests](https://github.com/approvals/ApprovalTests.cpp) with the [Catch2](https://github.com/catchorg/Catch2) test framework in the `test/cpp_catch2_approvaltest` folder.
|
||||
* Google Test framework
|
||||
1. Traditional unit test with the [Googletest](https://github.com/google/googletest) test framework in the `test/cpp_googletest_unittest` folder.
|
||||
2. [Approval tests](https://github.com/approvals/ApprovalTests.cpp) with the [Googletest](https://github.com/google/googletest) test framework in the `test/cpp_googletest_approvaltest` folder.
|
||||
* GoogleTest framework
|
||||
1. Traditional unit test with the [GoogleTest](https://github.com/google/googletest) test framework in the `test/cpp_googletest_unittest` folder.
|
||||
2. [Approval tests](https://github.com/approvals/ApprovalTests.cpp) with the [GoogleTest](https://github.com/google/googletest) test framework in the `test/cpp_googletest_approvaltest` folder.
|
||||
|
||||
The `GildedRose.cc` file, i.e. the code under test, is identical in all four variants.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* CMake version >= 3.13
|
||||
* C++ compiler that supports C++14
|
||||
* CMake version ≥ 3.13
|
||||
* C++ compiler that supports C++14
|
||||
|
||||
## How to build and run tests in a terminal
|
||||
|
||||
@@ -27,6 +27,19 @@ The `GildedRose.cc` file, i.e. the code under test, is identical in all four var
|
||||
$ cmake ..
|
||||
$ cmake --build .
|
||||
|
||||
The following test specific options for building with CMake are available.
|
||||
|
||||
* `BUILD_APPROVAL_TESTS_WITH_CATCH2:BOOL=ON`
|
||||
This option builds the approval tests with the Catch2 test framework.
|
||||
* `BUILD_UNIT_TESTS_WITH_CATCH2:BOOL=ON`
|
||||
This option builds the unit tests with the Catch2 test framework.
|
||||
* `BUILD_APPROVAL_TESTS_WITH_GTEST:BOOL=ON`
|
||||
This option builds the approval tests with the GoogleTest test framework.
|
||||
* `BUILD_UNIT_TESTS_WITH_GTEST:BOOL=ON`
|
||||
This option builds the unit tests with the GoogleTest test framework.
|
||||
|
||||
For example, run the CMake configuration `cmake -DBUILD_APPROVAL_TESTS_WITH_CATCH2=OFF -DBUILD_UNIT_TESTS_WITH_CATCH2=OFF ..` to disable the Catch2 based tests.
|
||||
|
||||
### Show available tests
|
||||
|
||||
$ cd ${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp/build
|
||||
@@ -55,12 +68,12 @@ The `GildedRose.cc` file, i.e. the code under test, is identical in all four var
|
||||
2. Select menu `File - Open...`
|
||||
3. Select folder `${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp`
|
||||
4. Select menu `Build - Build Project`
|
||||
4. Select menu `Run - Run...`
|
||||
4. Select what test variant to run, e.g. `GildedRoseCatch2ApprovalTests`.
|
||||
5. Select menu `Run - Run...`
|
||||
6. 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
|
||||
1. Start Visual Studio
|
||||
2. Select `Open a local folder`
|
||||
3. Select folder `${GIT_FOLDER}/GildedRose-Refactoring-Kata/cpp`
|
||||
4. Wait for message `CMake generation finished.` in the CMake output window at the bottom
|
||||
|
||||
Reference in new issue
Block a user