I’m working on a server for a very large (feature wise) MMO. After some bad experiences with breaking changes that caused bugs weeks down the line, we’d like to add unit/automated/regression tests to our project before we get much father (we’ve implemented approximately 5% of our requirements).
We haven’t really used “serious” tests before (we’ve done the tutorial check-division-by-zero testing) so I thought I’d locate some guides for developing client-server test solutions. I was not able to find anything of much relevance. How should I deal with testing the following aspects of a typical server?
- Testing the client-server communication (API can be broken down into “parsing”, “handling” and “sending” stages)
- Testing changes to an SQL database
- Testing security measures
- Testing around security measures (ie, making sure our tests don’t trip our own security code)
- Testing timed events
In case it’s relevant, our language is C#, .Net 4.5
4
Automated testing should be all about testing smallest pieces of functionality in as big isolation as possible. This allows you to define tests clearly, define most of the edge cases and have tests run in short time. Trying to test through multiple layers of code results in unclear tests, hard to test edge cases and tests that might take days to run.
So I would recommend to immediately drop the idea of testing the whole “server” as one big bulk of functionality from request handling to game logic. Instead, try to pinpoint the most error-prone code and test just that in as much isolation as possible. This would probably require refactoring, because code that is written without automated tests in mind is rarely testable. That way, you don’t have to worry about most of the things on your list.
2