I am trying to execute a TDD workflow for one of my open source projects. This is an API for other programmers.
Thus, one key aspect, as well as creating a “work” API, also determines how it will be consumed. I heard that some people say that writing tests before they are compiled is a waste of time and a penchant for constantly rewriting until the API is stable. I also heard that he should follow this way:
- Write tests that will not compile
- Make compilation
- Make it green.
I try to follow this workflow, but in the end I get some strange things. For example, in my API, I have two methods:
Handles(string pattern);
Handles(IPatternMatcher pattern);
I needed to get the second form of the method added to my API. So, I ended up with a dead simple test, for example:
public void Handles_SupportsIPatternMatcher()
{
var api=new MyAPI();
api.Handles(new TestPatternMatcher());
}
It seems that after its implementation will be lost.
Should I continue to complete this workflow, or are there ways to improve it? How can I refuse to write tests that mostly check for compiler errors? Since this is a public API, should I worry about trials like this?
source
share