oliverdavies.uk/content/node.d49068cf-7aaf-4a24-9b22-98f85ac97f11.json
2025-05-11 20:02:12 +01:00

100 lines
No EOL
5.5 KiB
JSON

{
"uuid": [
{
"value": "d49068cf-7aaf-4a24-9b22-98f85ac97f11"
}
],
"langcode": [
{
"value": "en"
}
],
"type": [
{
"target_id": "daily_email",
"target_type": "node_type",
"target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7"
}
],
"revision_timestamp": [
{
"value": "2025-04-16T14:12:56+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": "Automated tests reduce debugging time"
}
],
"created": [
{
"value": "2025-04-01T00:00:00+00:00"
}
],
"changed": [
{
"value": "2025-04-16T14:12:56+00:00"
}
],
"promote": [
{
"value": false
}
],
"sticky": [
{
"value": false
}
],
"default_langcode": [
{
"value": true
}
],
"revision_translation_affected": [
{
"value": true
}
],
"path": [
{
"alias": "\/daily\/2025\/04\/01\/debugging",
"langcode": "en"
}
],
"body": [
{
"value": "\n <p>In my <a href=\"http:\/\/localhost:8000\/presentations\/tdd-test-driven-drupal\">talk about automated testing and test-driven development<\/a>, I speak about a custom module I wrote for a client's Drupal project.<\/p>\n\n<p>It was to integrate with a third-party job application system that they would log into and enter information via a form (similar to Drupal's node forms) that they wanted to appear on the Drupal website.<\/p>\n\n<p>Once submitted, the system would send a POST request to an endpoint provided by the custom module. The module would process it and create the job node with the appropriate field values.<\/p>\n\n<p>I wrote automated tests and did test-driven development.<\/p>\n\n<p>Everything worked great for a few weeks or months.<\/p>\n\n<p>Later, we had a message from the client saying the integration was broken and we needed to fix it.<\/p>\n\n<p>I don't think I'd worked on this module for a while, but I was concerned that a Drupal core update or another change could have caused a regression.<\/p>\n\n<p>The first thing I did was run the tests I'd written and verify they still passed, which they did.<\/p>\n\n<p>This confirmed that as long as the data was being sent in the expected format, the node would be created and the integration would work.<\/p>\n\n<p>Due to an upstream issue, the data was no longer in the expected format, which meant the node could not be created.<\/p>\n\n<p>Once it was fixed, everything started working again.<\/p>\n\n<p>My debugging time was practically zero as I was able to rely on my tests and that they were still passing.<\/p>\n\n<p>I could confidently tell the client that the issue wasn't with our code and must've been an third-party issue.<\/p>\n\n<p>Writing tests takes some time, but having tests saves time.<\/p>\n\n ",
"format": "full_html",
"processed": "\n <p>In my <a href=\"http:\/\/localhost:8000\/presentations\/tdd-test-driven-drupal\">talk about automated testing and test-driven development<\/a>, I speak about a custom module I wrote for a client's Drupal project.<\/p>\n\n<p>It was to integrate with a third-party job application system that they would log into and enter information via a form (similar to Drupal's node forms) that they wanted to appear on the Drupal website.<\/p>\n\n<p>Once submitted, the system would send a POST request to an endpoint provided by the custom module. The module would process it and create the job node with the appropriate field values.<\/p>\n\n<p>I wrote automated tests and did test-driven development.<\/p>\n\n<p>Everything worked great for a few weeks or months.<\/p>\n\n<p>Later, we had a message from the client saying the integration was broken and we needed to fix it.<\/p>\n\n<p>I don't think I'd worked on this module for a while, but I was concerned that a Drupal core update or another change could have caused a regression.<\/p>\n\n<p>The first thing I did was run the tests I'd written and verify they still passed, which they did.<\/p>\n\n<p>This confirmed that as long as the data was being sent in the expected format, the node would be created and the integration would work.<\/p>\n\n<p>Due to an upstream issue, the data was no longer in the expected format, which meant the node could not be created.<\/p>\n\n<p>Once it was fixed, everything started working again.<\/p>\n\n<p>My debugging time was practically zero as I was able to rely on my tests and that they were still passing.<\/p>\n\n<p>I could confidently tell the client that the issue wasn't with our code and must've been an third-party issue.<\/p>\n\n<p>Writing tests takes some time, but having tests saves time.<\/p>\n\n ",
"summary": null
}
],
"feeds_item": [
{
"imported": "2025-04-16T14:12:56+00:00",
"guid": null,
"hash": "7c623d0cb081900a5789141273a4a84a",
"target_type": "feeds_feed",
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
}
]
}