I ran into something really weird with
FitNesse (the acceptance testing framework) today. Chances are, it’s something I’ve done wrong -
but I can’t work out what. If you know, please comment below!– Updated below with the solution.
Boiling the whole thing down into a simple test case, what I’ve found is the following.
First, create the following Query test fixture on a page of it’s own:
Next, create a simple C# class that returns two rows. Run the test, and get these results:
Now, modify the test fixture to wrap Don with square brackets:
This time, when you run the test, it fails with a stacktrace:
This is with Release v20090818 of FitNesse.
Interestingly, the exception only seems to happen when something short is wrapped in [ ]. If I instead wrap Name,
thusly:
The problem here is that the Substring() call will throw an exception if the string is short. To fix this, we just
need to add another check on the length of the string:
Comments
blog comments powered by Disqus