Harnesses! The other kind
Lately I've been noticing how much more I'm leaning on building test harnesses that I would never have bothered building before. I have three test harnesses now that I am using to verify my software and part of the reas
Lately I've been noticing how much more I'm leaning on building test harnesses that I would never have bothered building before.
I have three test harnesses now that I am using to verify my software and part of the reason here is when you have LLMs writing code you want to really improve your verification game. Another thing is that things that might have required a prohibitive amount of effort to test are now no longer that much effort with the help of LLMs.
So I have 3 harnesses I've added on to the usual vite/jest/pytest type testing I do on my site and apps.
-
An upload harness - this is an e2e reliability rig that tests my upload mechanism. Part of my app requires uploading lots of image files to an S3 bucket using pre-signed URLs that will later be added to photo albums. These are reasonably big files which may take a long time, the user might get bored and close the browser window or switch to another browser window, their network might be slow, the s3 bucket might go down intermittently.
So to mimic this variety of errors happening while the browser is uploading upto 100 large files, I made a harness that injects a variety of errors such as
- S3 bucket stops responding
- S3 presigned urls expire or fail
- Transactions time out once
- Transactions retry and get exhausted
- Responses get dropped
- Latency injection
ο»Ώο»Ώ It deliberately does not mock the upload pipeline. Instead it drives the real UI - file input, image grid, retry buttons - against a real backend and a real S3-compatible store. This helps test the connections between browser, presigned storage PUTs, batching and confirmations, Celery tasks, and the database.
It's playwright, it's slow, I don't run it in CI, but anytime we touch anything near the upload pipeline, it gives me so much peace to run this and ensure it is still passing.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.