Skip to content

Commit 917c70f

Browse files
authored
Update boost testing lecture (#260)
* Update boost testing lecture * Update boost exercise * Add info on mocking in preCICE * Fix md formatting
1 parent 40601f9 commit 917c70f

5 files changed

Lines changed: 31 additions & 13 deletions

File tree

05_testing_and_ci/boost_testing_exercise.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Boost.Test and CTest in Action: SideMade Exercise
22

3-
In this exercise, you extend and automate the unit tests of the [SideMade code](https://github.com/Simulation-Software-Engineering/testing-boost-exercise-wt2425), on which we worked during the lecture.
3+
In this exercise, you extend and automate the unit tests of the [SideMade code](https://github.com/Simulation-Software-Engineering/testing-boost-exercise), on which we worked during the lecture.
44

5-
Deadline: **Thursday, February 5, 2025, 09:00**
5+
Deadline: **Thursday, February 4, 2026, 09:00**
66

77
## Preparation and Submission
88

9-
- Import the [testing boost exercise repository](https://github.com/Simulation-Software-Engineering/testing-boost-exercise-wt2425) in your own account/namespace on GitHub and name it `testing-boost-exercise` again. **Note**: We cannot work with forks here because GitHub Actions may not work in pull requests without explicit approval of the owner of the target repository
9+
- Import the [testing boost exercise repository](https://github.com/Simulation-Software-Engineering/testing-boost-exercise) in your own account/namespace on GitHub and name it `testing-boost-exercise` again. **Note**: We cannot work with forks here because GitHub Actions may not work in pull requests without explicit approval of the owner of the target repository
1010
- Create a new branch `extend-tests` from `main` and work in this branch.
1111
- To submit, open a PR from `extend-tests` to `main` in your own repository. Then paste a link to this PR in a new issue in the original repository. Use `[GITLAB-USERNAME] Boost test exercise` as title of the issue.
1212

05_testing_and_ci/boost_testing_intro_slides.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ slideOptions:
5252
- Powerful unit test framework
5353
- Sometimes called (the) **Unit Test Framework** (UTF) or **Boost.Test**
5454
- Valid on all slides: `namespace utf = boost::unit_test;`
55-
- [List of contributors and maintainers](https://www.boost.org/doc/libs/1_87_0/libs/test/doc/html/boost_test/acknowledgements.html)
55+
- [List of contributors and maintainers](https://www.boost.org/doc/libs/latest/libs/test/doc/html/boost_test/acknowledgements.html)
5656

5757
---
5858

05_testing_and_ci/boost_testing_precice_demo.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Look around preCICE in the terminal + text editor.
1717
- Clear separation in preCICE: integration tests only directly use API of preCICE.
1818
- They are located in `tests` folder.
1919
- Look at `tests/serial/initialize-data/Explicit.cpp`:
20-
- Explain `PRECICE_TEST_SETUP` and how it is used: test is run on two MPI ranks living in seperate MPI communicators.
20+
- Explain `PRECICE_TEST_SETUP` and how it is used: test is run on two MPI ranks living in separate MPI communicators.
2121
- Information can be accessed via `context`.
2222
- More information: [blog post on bssw.io on multiphysics testing](https://bssw.io/blog_posts/overcoming-complexity-in-testing-multiphysics-coupling-software)
2323

@@ -30,11 +30,11 @@ Look around preCICE in the terminal + text editor.
3030
- Sometimes, we want white-box testing:
3131
- Why? Access and/or check private members
3232
- Could `friend` the test, but this quickly gets out of hand
33-
- Example: class `src/time/Waveform.hpp`
34-
- Has public and private members. We want to check the private members in tests.
35-
- Does not `friend` every test, but only `WaveformFixture`
36-
- `src/testing/WaveformFixture.hpp` has functions to access private members
37-
- This fixture is used in many tests in `src/time/tests/WaveformTests` (but not handed over to test like normal UTF fixtures)
33+
- Example: class `src/precice/implDataContext.hpp`
34+
- Has public and protected or private members. We want to check the protected members in tests.
35+
- Does not `friend` every test, but only `DataContextFixture`
36+
- `src/testing/DataContextFixture.hpp` has functions to access protected members
37+
- This fixture is used in many tests in `src/precice/tests/DataContextTest` (but not handed over to test like normal UTF fixtures)
3838

3939
## Test Matrices
4040

@@ -53,3 +53,10 @@ Look around preCICE in the terminal + text editor.
5353
## CTest in Parallel
5454

5555
- Build preCICE and run tests via `ctest -j 16`, runs tests in parallel, automatic feature of CTest
56+
57+
## Mocking preCICE
58+
59+
- Even more important than for "normal" software, since coupling library needs two software stacks to couple.
60+
- WIP: mock shipped with preCICE, currently there is "only" a prototype in Python bindings.
61+
- Look at [how both environments are distinguished](https://github.com/precice/python-bindings/blob/313441ca296da9bbc694bd99ba930c64b48aa11a/setup.py#L35-L39)
62+
- Look at files in [`test/`](https://github.com/precice/python-bindings/tree/develop/test)

05_testing_and_ci/boost_testing_sidemade_demo.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Boost.Test and CTest in Action: SideMade Demo
22

3-
Repository: [testing boost exercise – demo-start branch](https://github.com/Simulation-Software-Engineering/testing-boost-exercise-wt2223/tree/demo-start)
3+
Repository: [testing boost exercise – demo-start branch](https://github.com/Simulation-Software-Engineering/testing-boost-exercise/tree/demo-start)
44

55
## 1. Get to Know the Code
66

@@ -46,7 +46,7 @@ Repository: [testing boost exercise – demo-start branch](https://github.com/Si
4646
find_package(Boost 1.71 REQUIRED unit_test_framework)
4747
file(GLOB_RECURSE TEST_FILES CONFIGURE_DEPENDS tests/*.cpp)
4848
add_executable(testsidemade "${TEST_FILES}")
49-
set_property(target testsidemade PROPERTY CXX_STANDARD 11)
49+
set_property(TARGET testsidemade PROPERTY CXX_STANDARD 11)
5050
target_link_libraries(testsidemade PRIVATE Boost::unit_test_framework)
5151
add_test(NAME "MatrixSolverTests" COMMAND ${CMAKE_CURRENT_BINARY_DIR}/testsidemade)
5252
```
@@ -228,7 +228,7 @@ Repository: [testing boost exercise – demo-start branch](https://github.com/Si
228228
229229
- Adjust `CMakeLists.txt`:
230230
- In principle OK like it is, but we could organize things a bit better.
231-
- Add tests and [filter](https://www.boost.org/doc/libs/1_78_0/libs/test/doc/html/boost_test/runtime_config/test_unit_filtering.html):
231+
- Add tests and [filter](https://www.boost.org/doc/libs/latest/libs/test/doc/html/boost_test/runtime_config/test_unit_filtering.html):
232232
233233
```cmake
234234
add_test(NAME "MatrixSolverTests" COMMAND ${CMAKE_CURRENT_BINARY_DIR}/testsidemade --run_test=MatrixSolverTests/*)

timetable.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,14 @@
131131
## 12.2 – Wed, January 21, 2026
132132

133133
- **90** min.: [Exercise: Automating Workflows with GitHub Actions](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/automation_exercise.md)
134+
135+
## 13.1 – Wed, January 28, 2026
136+
137+
- **20** min.: Introduction to Boost.Test: [slides](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/boost_testing_intro_slides.md), [demo](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/boost_testing_intro_demo.md)
138+
- **15** min.: [Lecture evaluation](https://gitlab-sim.informatik.uni-stuttgart.de/simulation-software-engineering-wite2526/challenge/-/issues/42)
139+
- **60** min.: [Boost.Test and CTest in Action: SideMade Demo](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/boost_testing_sidemade_demo.md)
140+
- **10** min.: [Boost.Test in the Real World: preCICE Demo](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/boost_testing_precice_demo.md)
141+
142+
## 13.2 – Wed, January 28, 2026
143+
144+
- **90** min.: [Boost.Test and CTest in Action: SideMade Exercise](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/boost_testing_exercise.md)

0 commit comments

Comments
 (0)