27/12/2020

How we test?

Testing is the most crucial step in software development. In test-driven development you even start with the tests and do the implementation independent of the test development. In every professional project you can find following test forms:

  • Unit Test – A black box test, where the public API is tested against the specification
  • Integration Test – Several units are combined to a system and in/output and intermediate states are tested
  • Automated UI Test – The UI is operated from an automatic system by injecting events or operating emulated input devices

C# and Unity are offering unit test frameworks, but testing should not be limited to unit tests. For that purpose, we created a submodule in our HAN Lib. It supports unit, integration and automated UI tests. In the first release version we have been concentrated on verification, integration and output. This enabled us to create all tests using the same API structure and even mix tests: for instance, an integration test can be triggered and manipulated by the automated UI test. By observing each unit’s state via the public APIs, the specification and expectation can be verified in detail.

The integration part allows us to hook into our HAN Lib and observe and filter calls and signals. For instance, each test is installing a filter into the Logger to determine if warnings, errors or assertion messages have been outputted to the log. The tester has to explicitly mark each message es expected, else the test will fail.

Our Input abstraction integration allows us to inject input events into the system. This allows us to create Automated UI Tests without messing around with touch and mouse emulation. However, emulation has also its legitimation and we still create also tests with input emulation, as some errors can’t be triggered when the UI is bypassed. Imagine a transparent object that consumes touch events.

In future we want to include reflections and combine it with generic templates to implement a gmock like method, to verify and expect method calls and parameters.

In the next post I will be explaining our Jenkins integration and CI setup.

Leave a Reply