{ "uuid": [ { "value": "9834732b-1b38-471a-b1bb-64471b27a2ee" } ], "langcode": [ { "value": "en" } ], "type": [ { "target_id": "daily_email", "target_type": "node_type", "target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7" } ], "revision_timestamp": [ { "value": "2025-05-11T09:00:28+00:00" } ], "revision_uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "revision_log": [], "status": [ { "value": true } ], "uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "title": [ { "value": "Why I prefer integration tests to unit tests\n" } ], "created": [ { "value": "2023-11-14T00:00:00+00:00" } ], "changed": [ { "value": "2025-05-11T09:00:28+00:00" } ], "promote": [ { "value": false } ], "sticky": [ { "value": false } ], "default_langcode": [ { "value": true } ], "revision_translation_affected": [ { "value": true } ], "path": [ { "alias": "\/daily\/2023\/11\/14\/why-i-prefer-integration-tests-to-unit-tests", "langcode": "en" } ], "body": [ { "value": "\n

With unit tests, you need to mock everything<\/strong>.<\/p>\n\n

If what you're testing has a dependency, you need to create and use a mock version.<\/p>\n\n

If the mock has its own dependencies, you need to mock those, too.<\/p>\n\n

I've written unit tests with mocks and accidentally only tested the mocks instead of the functionality I intended.<\/p>\n\n

Here's the thing<\/h2>\n\n

With integration tests, you can use and test the real dependencies.<\/p>\n\n

Whilst they may be slightly slower to run, I prefer the simpler setup, less need for mocks, and knowing the real services work - not just the mocked versions.<\/p>\n\n ", "format": "full_html", "processed": "\n

With unit tests, you need to mock everything<\/strong>.<\/p>\n\n

If what you're testing has a dependency, you need to create and use a mock version.<\/p>\n\n

If the mock has its own dependencies, you need to mock those, too.<\/p>\n\n

I've written unit tests with mocks and accidentally only tested the mocks instead of the functionality I intended.<\/p>\n\n

Here's the thing<\/h2>\n\n

With integration tests, you can use and test the real dependencies.<\/p>\n\n

Whilst they may be slightly slower to run, I prefer the simpler setup, less need for mocks, and knowing the real services work - not just the mocked versions.<\/p>\n\n ", "summary": null } ], "feeds_item": [ { "imported": "1970-01-01T00:33:45+00:00", "guid": null, "hash": "b38408f033b23dc55649c0a05a3af78b", "target_type": "feeds_feed", "target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76" } ] }