From 98f153ad0370cb89c65f98060f31f8cc4ade318e Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 16 Dec 2023 11:57:49 +0000 Subject: [PATCH] Add daily email for 2023-12-16 Adding snapshot tests to Build Configs --- src/content/daily-email/2023-12-16.md | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/content/daily-email/2023-12-16.md diff --git a/src/content/daily-email/2023-12-16.md b/src/content/daily-email/2023-12-16.md new file mode 100644 index 00000000..5149f5b9 --- /dev/null +++ b/src/content/daily-email/2023-12-16.md @@ -0,0 +1,28 @@ +--- +title: > + Adding snapshot tests to Build Configs +pubDate: 2023-12-16 +permalink: > + archive/2023/12/16/adding-snapshot-tests-to-build-configs +tags: + - software-development + - php + - symfony + - build-configs + - automated-testing + - test-driven-development +--- + +This week, I've started to add snapshot tests to the [Build Configs project][build configs]. + +I had unit tests for the DTO validation to ensure the configuration was correct, but the main thing I wanted to test was I could run it for a given configuration file and get the expected files and contents to be generated. + +With snapshot tests, I generate the files for each configuration and compare them to a set that I know to be correct. + +If the files match, the tests pass, but, if they don't - such as a bug in the code, the tests will fail. + +This is the level that I want to be testing this project and that provides the most value. + +If a snapshot test fails, I can try to replicate the underlying issue in a unit test whilst also fixing the snapshot test. + +[build configs]: https://www.oliverdavies.dev/build-configs