While doing test driven development this is an extremely interesting question, well at least for some programming languages.
What I am referring to here is the idea of a failing tested with no source written, followed by a bit of source to make the test pass. When I say no source, what I mean is no source, although we all know that this isn’t possible in a programming language such as Java, C#, etc. In these languages we all know that it is impossible to reference something that does not exist and that is why I am talking about this. I will provide examples in java just for convenience sake, (Since I have my IDE up and going as we speak.) with JUnit as my testing framework. There are several rules that I tend to follow while writing tests. Hopefully they will help.
@Test void realRealWinner( ) throws Throwable { Winner target = new Winner( ) ; AssertTrue(“Winner did not win”, target.isWinner( ) ) ; }
UT-OH! This does not compile, because java requires that thereference to the class you are testing exists:( Let’s Fix it!
Public Class Winner { public Boolean isWinner() { // The body of the function is step 3 } }
Public Class Winner { public Boolean isWinner( ) { throw new NotImplementedException(); // golden nugget } }
The reason I do this is so that if this were to slip into production, or if I were to walk away, there is a clear statement that this method/section of code is indeed “NOT IMPLEMENTED YET”
Hope this helped, Jeremy Rowe