In which we automate one trivial test, and plan how to attack the rest.
An easy one with a minor suprise #
Before shifting gears a little, let’s finish up connect.feature
with the one remaining
scenario: “Disallow connection if server in ShuttingDown mode”.
|
|
If we flesh this out a bit, we already have most of the pieces:
|
|
The “and am immediately disconnected” part came as a bit of a surprise. I wasn’t expecting it, but after seeing it happen I was led to consult the main game loop:
|
|
Since DragonsSpineMain.ServerState.Locked
is 2 and DragonsSpineMain.ServerState.ShuttingDown
is
3, we fall out of the loop and shut down as soon as the state is set. Just goes to show that my
searching the source for ShuttingDown
was not sufficient to reveal the effects.
9 scenarios (9 passed)
49 steps (49 passed)
3m21.522s
A Cunning Plan #
I have two goals in the test-writing phase of this project:
- Establish an exhaustive-enough set of tests to know when I’ve successfully recreated the behaviour of the existing code.
- Learn enough about the existing code to effectively recreate its behaviour.
I’ve been uncertain how to tackle this. The initial tests came from poring through some of the server source files, but I don’t think that’s the best way to proceed. It’s clear that as the code evolved over time, it developed a lot of structure that’s pretty foreign to me. I can’t be confident that my reading of it will accurately capture all of the behaviour that I need to verify.
So I’m adopting something closer to a data-driven testing approach, although not purely so (the tests will still be more narrative than data). The flow of data through the server logic comes from a set of inputs:
- Config XML
- Database
- Map files
- Outside-of-game players
- In-game players
- Internal server state
- Clock/calendar
- Hardcoded values
… and goes to one or more of a set of outputs:
- Database
- Outside-of-game players
- In-game players
- Internal server state
- Logs
… giving me thirteen major sections of tests. Breaking them down further can also be guided by which I/O pairs are in play.
It’ll all make sense once we really get started. Tomorrow.
Random nostalgia #
I came across this old issue of Computer Gaming World from the summer of 1986 (bless you, textfiles.com) covering Island of Kesmai in their “Telecommunication Gaming” column. I’m pretty certain I had this magazine at some point.