Why I am proud of my planet sized unit test
I am having a lot of fun with a new project—one where the customer insisted we write unit tests (how rare is that 😁). It’s still very early days, so by the end, I might realize this was wrong. But for now, I’m pretty proud of one specific test: 50 lines of C# + XUnit, with 18 asserts. If standard unit tests are asteroids, this is a planet-sized one.
Is this the norm for the project?
No—it won’t be. Most tests will stay under 10 lines, with just one or two assertions. I estimate planet-sized tests will cover no more than 5% of the total.
"You’re doing unit tests wrong!"
No—but I’m ignoring some advice, and that’s okay. Why does that advice exist? Because experienced developers know: the larger (and more complex) a test is, the more brittle it becomes, and the more time you’ll waste maintaining it. The value vs. risk tradeoff matters—high value + low risk is great, but high risk + low value? Not so much.
Here’s the twist: for those 5% of tests, we accept high risk because they validate massive value—end-to-end workflows a normal unit test can’t catch.
So what does it really test?
I don’t think calling it a "unit test" is accurate. While it uses XUnit and lives in the unit test project, it’s more of a process test. It simulates how a user would walk through a full workflow, exercising interactions that a single unit test might miss.
I initially thought to call these integration tests, but since everything’s mocked and injected, that doesn’t quite fit. Another way to frame it: a chain of unit tests, each following arrange-act-assert—but stitched together into a single test.
I’ve used these before, and their value is huge. They often find issues far earlier than standard unit tests because they test coupled scenarios—where complexity ironically increases their worth.
Why so many asserts?
Simple: assert every assumption. For a unit test, assumptions are simple. For a process test? Complexity demands more assertions at each step.
Ever written a "planet-sized" or process test? What did you discover in them?