Unit testing is great because it helps us make better software. A good test suite will catch bugs, maintain stability, measure performance, and more.
Yet to be honest, those arenβt the reasons I like testing so much. I like writing tests because it just feels great to run them. Sometimes I catch myself watching the Amatino API test suite running, not because I need test changes, but because I simply want to watch it run.
At upper left, we have the HTTP returns for the public-facing API. At lower left, the internal API. At right, the list of successful tests marching downwards.
It is the closest I can be to watching the machine think. All the thousands of lines of code, the weeks of agonising over tough problems, the frustrations of insidious bugs, the joys of successful output. All distilled into a real-time ballet of virtual machines, database queries, http requests, and code execution that I can see with my own eyes.
Write tests. Not because the bloggerverse told you to, but because it just feels good.
Top comments (7)
Thanks! Since I don't write any tests, I'll watch this fullscreen before every commit and feel peaceful.
Btw, any good resources or strategies for testing in game development, particularly Unity 3D? I find it very difficult or awkward to adapt common testing ways to gaming.
And how do you handle testing when budgets and time is critical, that is the most of the case when working for startups.
On Subnautica, which runs on a heavily modified version of Unity, we've found automated testing to be utterly crucial. Agree it's really hard. I think the proliferation of state across game objects makes it harder. On non-game projects I find eliminating all object state significantly simplifies building a test suite. Until we got a good handle on robust automated testing we were facing really horrific stability issues. I'd recommend asking Jonas (@CodeLumpn) for tips - He might have given a talk or written down his thoughts in a blog post somewhere.
Oh I wasn't expecting the author to be a game developer. What a nice coincidence. Thanks for the advice:)
The game looks impressive! Maintaining it on so many platforms looks unimaginable without a good test approach.
I'll think about achieving a design that is defined by stateful and stateless objects. I just know a little but it looks like Flutter benefits a lot by having that separation in the language design right from the beginning.
Thanks for the reference. I'll reach out.
Must admit, that looks satisfying af
Thank you I'm not alone ! I also like running my tests just for the pleasure to see that everything works fine :-)
Looks cool, what do you use as your test suite/runner?
It's a bespoke solution built alongside the Amatino API... Nothing too flash but it gets the job done! At a very basic level it' just a sequence of objects that build on a simple base class: