[Tutorial] Test-Driven Development in Unity (Updated)

Test-Driven Development (TDD) is a software development process that aims to increase code quality and productivity through a short, repetitive cycle called Red-Green-Refactor. As the process grows in popularity among software developers the question often arises, “can TDD be used in game development?”.

The goal of TDD in Unity is to demonstrate that not only is Test-Driven Development possible in game development, but that following this easy process will result in a more SOLID codebase that can scale as your game grows.

Throughout this series we’ll be developing a heart based health system, much like the one found in the Zelda franchise. Through this implementation you’ll learn how the Red-Green-Refactor cadence can increase your productivity, how an automated test suite can build your confidence, and how Test-Driven Development can lead to a more SOLID design.

If this TDD in Unity proves to be valuable to the community then my plan is to produce more seasons of the series, where each season is a different game mechanic or feature.

In the meantime, I’ll be releasing a new part ever 1 to 2 weeks. I’d appreciate any comments or feedback, both positive and negative, so that I can improve the series organically with the community.

Thank you for watching! Please enjoy!

13 Likes

Part 5 is up! For anyone who’s following the series head on over to the associated blog post here: http://infalliblecode.com/better-unit-tests-test-data-builders/

or check out the link in the original post.

5 Likes

Thanks for posting this Charles! Great initial tutorial.

Thx you so much! Now is more simple in Unity.

I found more about this practice here: