Let's say I'm starting to do a game with TDD. Is this a good first test?
[TestMethod]
public void Can_Start_And_End_Game()
{
Tetris tetris = new Tetris();
tetris.Start();
tetris.End();
}
It basically forces me to define 3 things: the Tetris
class and its Start()
and End()
methods, but besides that it's pretty useless. It might have its interest immediately as with them I can define that class and those methods, but later it probably won't serve any kind of purpose. Its only purpose would maybe show that it must be possible to start a game and end it without getting an exception in the middle.
What are your thoughts on that?
It basically forces me to define 3 things: the Tetris class and its Start() and End() methods,
True.
but besides that it's pretty useless.
False.
later it probably won't serve any kind of purpose
False, also.
Its ... purpose [is to] show that it must be possible to start a game and end it without getting an exception in the middle
And that's HUGE. Epic. Monumental.
Indeed, that test will fail so often that you'll grow to hate it. Every unhandled, uncaught exception from all kinds of random places in your program will fail this test. You'll build careful logging and debugging because of this test.
This test is EPIC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With