Why game developers don’t write tests?

Profits

There is great art about testing games at Gamastura Automated Tests and Continuous Integration in Game Projects. The main conclusion is that:

automated tests and continuous integration makes development teams more efficient and results in more reliable, and often quite simply, better software. Additionally, it reduces the pressure and workload on development teams by reducing the effort for manual testing, and allows bugs to be found earlier in the development process.

So that this effort is worth to regain time. Introduction of writing test is more  about 30% of implementation. This is investment which turns back in long run.

We need also to be aware that testing takes part at different level. Unit testing – tests methods. Integration – tests objects. Unit testing is most stable & easy to test.

Testing is also connected with design by contract principle. Simple assert of input & output also leads to earlier finding of bugs. And earlier found bug are cheaper as we know.

Reasons

So why we neglect to write test code if we understand that it’s profitable?

There are many reasons.

First is that we think that this make us slower, because it’s more work. No one like to work more, for sure. And it’s true, but we must remember that it’ll pay off later, when we didn’t have to find & fixing the same bug over and over again.

We could also justify that writing test is hard. And this is main excuse, why game developers ignore writing test. Nothing could be more wrong.

In Unity 5.5 all what we must to do is:

1. click Window / Editor Test Runner

2. click Create Editor test

This brings us example test

3. hit Run All

That’s all. Fairly simple isn’t it?

I’ve written some test EditorTest for my CustomShortcuts

Conclusion

Test-driven development (TDD) is a kind of habit. We write tests before and production code. Before fixing bugs. And I that this is true, main reason, why game developers doesn’t write test. Because we must develop new habit first. And this, what is hard. Not writing test themselves.

Testing couldn’t be done at once. It must be part of our daily process. One test is not much. But one test a day after one year of project development is great. And it will make our coding even faster. And also what’s important it’s kind of DRY method. If we don’t want to repeat our code we should also don’t want to repeat same mistakes. And this is main value of testing.

Leave a Reply