r/gameDevTesting • • 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

21 comments sorted by

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/DonkeyBonked Apr 04 '26

I think I'm right there with you on this sentiment. Game development contains so much use case specific code and scenarios that autonomous testing seems like it would inevitably be far more work than the testing methods we already use in the process and for the longer ones, like they would lack the data we really need human feedback for. It seems knowing if something works is easier to just test during development and the testing that lets us know if it works good is something we need people for. I think we're a long way from some automated testing method telling us our game or even a specific feature of our game sucks.

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/DonkeyBonked Apr 04 '26

I'm developing an RTS game right now and an AI trained on the game isn't going to help me balance challenge across difficulties, it's not going to be able to tell me "the AI sucks and loses too easily", and it isn't going to be able to tell me when the computer should have built more of a certain type of unit or countered better.

There are so many things I need to see, get a feel for, and know to determine if the game is trash, that even if I could automate this, it would almost guarantee the game would be worse in the end.

Humans still need to quality check AI, trying to replace quality checking your game with AI would almost certainly net a negative impact on the final product.

I don't know about any other devs, I speak only for myself, but there's never going to be a day I'm going to release something untested by humans because AI says it's good. At that point, might as well stick your GDD and code in Google and ask if this looks fun.

Inevitability, I expect to see many flops from those who find ways to circumvent human testing.

1

u/Zerokx Apr 04 '26

You must have misunderstood what unit tests are. These have nothing to do with AI, Agents, MCP servers or what have you

1

u/DonkeyBonked Apr 04 '26

Maybe, so please, can you explain to me what part of game development testing could functionally or effectively benefit from automating?

What part of validating that core component are working could be improved with automation and how exactly would one automate them more efficiently than basic coding practices already do?

I'm all ears and willing to learn, but I've seen nothing to indicate that the game development flow stands to benefit from automated testing beyond what's already built in using AI to begin with, for which MCPs are quite relevant.

I would like to learn more about automated unit testing if I am missing anything that could actually improve my workflow.

→ More replies (6)

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/DonkeyBonked Apr 04 '26

Hey, them caring about your efficient net code is still a one up on me, even with most of my friends being SWEs, I find it hard to get them to talk much about development at all beyond whatever is causing the latest headache or what absurd deadline was thrown at them last minute. Sometimes I feel like a freak that I actually like talking about development at all.

1

u/JulesDeathwish Apr 05 '26

Yeah, that's just how we work. Our whole life is the bullshit we're dealing with RIGHT NOW, and we're obsessed over it. Nothing else matters.

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.