Unit Testing at Cocos2d-x Game Engine

Several Unit Testing framework for CPP based projects

  • CxxTest
  • Boost Test
  • UnitTest++
  • googletest
  • MsTest
  • NUnit

Cocos2d-x, a multi platform 2d Game Engine, to work with, I chose UnitTest++

Because UnitTest++ is

  • A C++ unit-testing framework designed with game development in mind.
  • Lightweight.
  • Easy to integrate, minimal work required to create a new test.
  • Covers major unit testing features
  • No dependency at monolithic project folder structure
  • Minimal footprint and minimal reliance on heavy libraries.
  • Good assert and crash handling.
  • No dynamic memory allocations done by the framework, which makes it much easier to track memory leaks and generally more attractive for embedded systems.

The driving forces behind the design of UnitTest++ are:

  • Portability. As game developers, we need to write tests for a variety of platforms, most of which are not supported by normal software packages (all the game consoles). So the ability to easily port the framework to a new platform was very important.
  • Simplicity. The simpler the framework, the easier it is to add new features or adapt it to meet new needs, especially in very limited platforms.
  • Development speed. Writing and running tests should be as fast and straightforward as possible. We’re going to be running many tests hundreds of times per day, so running the tests should be fast and the results well integrated with the workflow.


Download UnitTest++ Framework from here.



6 thoughts on “Unit Testing at Cocos2d-x Game Engine

  1. Hi, can you explain how UnitTest++ can be used to test cocos2d-x based games. You wrote: “A C++ unit-testing framework designed with game development in mind.” What does it actually mean? If I have a class based on cocos2d::CCObject what should I do to test my class only without all kitchen sink? Do you have any public examples, e.g. on github?

    • Dear Sir, sorry for late response. Probably I am not wrong, If I am wrong please correct me. I think UnitTest++ has several notable features which easily cope up with Game Development. For example, Minimal amount of work needed to add new tests, Easy to modify and port, Supports different outputs etc. For this reason I wrote “A C++ unit-testing framework designed with game development in mind.”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s