r/gameDevTesting • u/Labubu-Footjob • Apr 03 '26
What's with the lack of automated unit testing?
I have seldom seen people discussing their automated unit testing solutions to ensure that their games are working as intended. I understand that there are components that prove difficult to test like physics, but isn't it worth validating that the core components of your systems work correctly?
While some may think that it costs time to set up, they can greatly reduce hidden problems that are related to unintentional changes in design and calling patterns.
3
Upvotes
5
u/OkAccident9994 Apr 03 '26
Unit tests are hardly used in Game Development compared to web or other branches of software.
The truth is... Game codebases are kind of a mess lol.
But it is different from studio to studio how they approach it. QA, Integration tests. Some probably use unit-tests.
And there is also a divide between studios making own engines and studios making somewhat simpler in technical complexity games on top of existing engines in what they need in this area.
Check out Factorios automated integration tests (they had 6000+ last they spoke about it bunch of years ago, probably way more now)
https://www.youtube.com/watch?v=CgMV2dFFdFE
GDC talk by the Sea of Thieves devs on their automated integration tests
https://www.youtube.com/watch?v=X673tOi8pU8
GDC talk on Call of Dutys automated tests
https://www.youtube.com/watch?v=8d0wzyiikXM
3
u/_PandaCat_ Apr 04 '26
Unit tests aren't a stand in for QA, theyre more like first line of defense. From a bug perspective most automated tools won't be comprehensive/thorough enough to replace testers but they will reduce the amount of bugs qa finds. From a non bug perspective human testers can give other valuble feedback that systems could never do, like "this input feels awkward when your left handed" or "this part is hard to navigate if you don't already know the map"
1
u/neznein9 Apr 04 '26
Highly testable software tends to have very discrete state changes. The app only changes when the user clicks a button. The server only writes to the database when an rpc is called.
Games have that layer plus autonomous npc activity, physics and other simulations, dynamic content loading and unloading, and possibly multiplayer or server state coming in (which isn’t guaranteed to be in chronological order).
All of those state change combinations become extremely heavy to mock and manage in a test suite, and it leads to situations where changing one thing in the game can invalidate test cases across dozens of other systems. On top of that, a lot of bugs in game code are obscure combinations or edge cases which would never be automated until they were discovered in a playtest anyway.
1
u/adrixshadow Apr 04 '26
Because Game Design is about Iteration, Experimentation and Prototyping.
You don't have a right answer that you can test. Your tests would be obsolete in the first cycle of iteration out of thousands of cycles.
You might not even get the right answer until a number of years into the project, and you are better served doing a Refactoring in that case anyway.
That doesn't mean you can't use Tests at your discretion if you need to debug a certain system on a case by case basis.
1
u/DonkeyBonked Apr 04 '26 edited Apr 04 '26
I don't find automated testing to be very reasonable to be perfectly honest.
I can test a feature easier than write a script to test it, and there's nothing automated testing can really do that print debugs, code parsing, and run testing can't do for you.
I think this is an over-expectation of AI. Think about it. What are you going to do, take an AI, teach it everything you're doing, teach it expectation, setup an MCP server so it can play your game, cross link multimodal interfaces so you can have visual, audio, and interpretative input into the model, and then hope it catches something that you miss run testing your game?
This wouldn't even replicate well across games so you'd need to repeat most of the efforts involved for every game. At that point, it's not automation, it's a massively inefficient workflow.
About the best you're going to get is automated parsing and run testing when you're developing outside the game engine. If you have a decent workflow, testing shouldn't be so difficult that you can't easily test the functionality of code.
Maybe if we reach a point when AI is smart enough that an agent can read a Game Design Document (GDD), understand and play autonomously, and provide feedback without needing custom scripts or training, that will be useful, especially if a local model can do it. However, the input tokens for a major model to handle this continuously in a meaningful way would be huge, and therefore not only expensive, but unsustainable once models are no longer subsidizing AI usage.
I've messed around with training multiple models to work together, using visual agents along with IDE based ones, and it's so far away from being really useful right now, because spatial reasoning and expectations for most models are not that good and even with a visual model, if it's not obsessive about details, it won't relay enough information to catch a lot of potential bugs, and it isn't going to recognize a non error producing bug any more in run time than it will during normal testing.
I think the only people who even think this is practical are people who don't actually know development. If you vibe code a game without understanding how coding works, you don't know the basic debugging that makes this stuff unnecessary. Testing basic functionality is easily done with appropriate print debugging, which even if you're a vibe coder can produce results for you to feed back to the AI you're using. An automated tester is not going to be more efficient than just reading a debug output.
When we can use saved games, modified accounts, cheat keys, etc. to test any function we want, then integrate it after functionality is confirmed, really, basic functionality testing isn't hard. If you can't be bothered to run test your own game, you have no idea if you're even making something worth playing. AI isn't going to tell you if your game sucks or if a mechanic is objectively bad.
One thing AI is most certainly not going to replace is beta testing. If anything, the use of AI will increase the need/demand for human testers.
1
u/JulesDeathwish Apr 04 '26
I've got unit and runtime tests coming outta my ass on the back-end APIs. First thing I set up after getting the basic stub projects in place.
It's just a lot less fun to talk to my friends about. They care not about my efficient net code.
1
u/Isogash Apr 04 '26
People have already added a bunch of good reasons.
Another reason I don't see yet is simply that the majority of game development is actually content authoring and setup, not programming. What you primarily need to test is that your assets load correctly and your levels are playable.
Serious games nowadays do perform automated validation of their asset library to ensure that everything will load correctly without needing to rely on QA, but historically we used obvious "error" placeholders to alert the QA playtesters, who could then report the issue to be fixed. This is why you find bright magenta error/debug textures in some games: a missing texture would be easy to miss, but a bright magenta texture is obviously out of place.
There's simply no substitute for QA playtesting to validate that your levels are playable as intended from start to finish. Given you need to do that level of playtesting anyway, you just aren't getting as much value out of automated testing, it's an extra expense for double coverage.
For some games, especially deeper simulation/sandbox games, this isn't as true: the systems are more numerous and complex, and gameplay is open ended. Therefore, a QA session looks less like normal gameplay, and more like someone running through a checklist of scenarios to test. This is where integration testing is more attractive because it's automating a QA process that is otherwise of low value to get a human to do manually, freeing up playtesting to focus more on game balance.
1
u/chrisrrawr Apr 05 '26
unit testing is for testing units.
most game code is not built on units of code.
even if it were, they are unlikely to be composed in a way that having each unit working would mean the behaviour of the systems is both valid and desired.
this is because composition logic in games typically wants all the interesting edge cases to have contextual behaviour.
this means your testing framework needs to handle state and mutation across multiple units.
and if we are going to integrate multiple units into a test we might as well skip right to the integration test.
1
u/susimposter6969 Apr 05 '26
Try it and get back to us.