diff --git a/05_testing_and_ci/boost_testing_exercise.md b/05_testing_and_ci/boost_testing_exercise.md index c04a7e14..94145ca3 100644 --- a/05_testing_and_ci/boost_testing_exercise.md +++ b/05_testing_and_ci/boost_testing_exercise.md @@ -1,12 +1,12 @@ # Boost.Test and CTest in Action: SideMade Exercise -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. +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. -Deadline: **Thursday, February 5, 2025, 09:00** +Deadline: **Thursday, February 4, 2026, 09:00** ## Preparation and Submission -- 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 +- 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 - Create a new branch `extend-tests` from `main` and work in this branch. - 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. diff --git a/05_testing_and_ci/boost_testing_intro_slides.md b/05_testing_and_ci/boost_testing_intro_slides.md index 183a55ee..1386c79f 100644 --- a/05_testing_and_ci/boost_testing_intro_slides.md +++ b/05_testing_and_ci/boost_testing_intro_slides.md @@ -52,7 +52,7 @@ slideOptions: - Powerful unit test framework - Sometimes called (the) **Unit Test Framework** (UTF) or **Boost.Test** - Valid on all slides: `namespace utf = boost::unit_test;` -- [List of contributors and maintainers](https://www.boost.org/doc/libs/1_87_0/libs/test/doc/html/boost_test/acknowledgements.html) +- [List of contributors and maintainers](https://www.boost.org/doc/libs/latest/libs/test/doc/html/boost_test/acknowledgements.html) --- diff --git a/05_testing_and_ci/boost_testing_precice_demo.md b/05_testing_and_ci/boost_testing_precice_demo.md index d54d13db..76b90eb9 100644 --- a/05_testing_and_ci/boost_testing_precice_demo.md +++ b/05_testing_and_ci/boost_testing_precice_demo.md @@ -17,7 +17,7 @@ Look around preCICE in the terminal + text editor. - Clear separation in preCICE: integration tests only directly use API of preCICE. - They are located in `tests` folder. - Look at `tests/serial/initialize-data/Explicit.cpp`: - - Explain `PRECICE_TEST_SETUP` and how it is used: test is run on two MPI ranks living in seperate MPI communicators. + - Explain `PRECICE_TEST_SETUP` and how it is used: test is run on two MPI ranks living in separate MPI communicators. - Information can be accessed via `context`. - More information: [blog post on bssw.io on multiphysics testing](https://bssw.io/blog_posts/overcoming-complexity-in-testing-multiphysics-coupling-software) @@ -30,11 +30,11 @@ Look around preCICE in the terminal + text editor. - Sometimes, we want white-box testing: - Why? Access and/or check private members - Could `friend` the test, but this quickly gets out of hand -- Example: class `src/time/Waveform.hpp` - - Has public and private members. We want to check the private members in tests. - - Does not `friend` every test, but only `WaveformFixture` - - `src/testing/WaveformFixture.hpp` has functions to access private members - - This fixture is used in many tests in `src/time/tests/WaveformTests` (but not handed over to test like normal UTF fixtures) +- Example: class `src/precice/implDataContext.hpp` + - Has public and protected or private members. We want to check the protected members in tests. + - Does not `friend` every test, but only `DataContextFixture` + - `src/testing/DataContextFixture.hpp` has functions to access protected members + - This fixture is used in many tests in `src/precice/tests/DataContextTest` (but not handed over to test like normal UTF fixtures) ## Test Matrices @@ -53,3 +53,10 @@ Look around preCICE in the terminal + text editor. ## CTest in Parallel - Build preCICE and run tests via `ctest -j 16`, runs tests in parallel, automatic feature of CTest + +## Mocking preCICE + +- Even more important than for "normal" software, since coupling library needs two software stacks to couple. +- WIP: mock shipped with preCICE, currently there is "only" a prototype in Python bindings. + - Look at [how both environments are distinguished](https://github.com/precice/python-bindings/blob/313441ca296da9bbc694bd99ba930c64b48aa11a/setup.py#L35-L39) + - Look at files in [`test/`](https://github.com/precice/python-bindings/tree/develop/test) diff --git a/05_testing_and_ci/boost_testing_sidemade_demo.md b/05_testing_and_ci/boost_testing_sidemade_demo.md index 69a1a673..52f6de92 100644 --- a/05_testing_and_ci/boost_testing_sidemade_demo.md +++ b/05_testing_and_ci/boost_testing_sidemade_demo.md @@ -1,6 +1,6 @@ # Boost.Test and CTest in Action: SideMade Demo -Repository: [testing boost exercise – demo-start branch](https://github.com/Simulation-Software-Engineering/testing-boost-exercise-wt2223/tree/demo-start) +Repository: [testing boost exercise – demo-start branch](https://github.com/Simulation-Software-Engineering/testing-boost-exercise/tree/demo-start) ## 1. Get to Know the Code @@ -46,7 +46,7 @@ Repository: [testing boost exercise – demo-start branch](https://github.com/Si find_package(Boost 1.71 REQUIRED unit_test_framework) file(GLOB_RECURSE TEST_FILES CONFIGURE_DEPENDS tests/*.cpp) add_executable(testsidemade "${TEST_FILES}") - set_property(target testsidemade PROPERTY CXX_STANDARD 11) + set_property(TARGET testsidemade PROPERTY CXX_STANDARD 11) target_link_libraries(testsidemade PRIVATE Boost::unit_test_framework) add_test(NAME "MatrixSolverTests" COMMAND ${CMAKE_CURRENT_BINARY_DIR}/testsidemade) ``` @@ -228,7 +228,7 @@ Repository: [testing boost exercise – demo-start branch](https://github.com/Si - Adjust `CMakeLists.txt`: - In principle OK like it is, but we could organize things a bit better. - - 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): + - Add tests and [filter](https://www.boost.org/doc/libs/latest/libs/test/doc/html/boost_test/runtime_config/test_unit_filtering.html): ```cmake add_test(NAME "MatrixSolverTests" COMMAND ${CMAKE_CURRENT_BINARY_DIR}/testsidemade --run_test=MatrixSolverTests/*) diff --git a/timetable.md b/timetable.md index f2c261cd..a048edb9 100644 --- a/timetable.md +++ b/timetable.md @@ -131,3 +131,14 @@ ## 12.2 – Wed, January 21, 2026 - **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) + +## 13.1 – Wed, January 28, 2026 + +- **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) +- **15** min.: [Lecture evaluation](https://gitlab-sim.informatik.uni-stuttgart.de/simulation-software-engineering-wite2526/challenge/-/issues/42) +- **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) +- **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) + +## 13.2 – Wed, January 28, 2026 + +- **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)