Brad Wilson wrote:
> Dean Cleaver wrote:
>
> > So to test the user create function, I have to create 3 such that on
> > creation of the last one I have someone with the right permissions to be
> > able to create it... Whereas being able to test the several component
> > functions of this would have been useful.
>
> Yes, but this isn't how it gets used in the real world. Doesn't
> it worry you
> to create these tests that don't accurately simulate what
> _really_ happens?
> Sometimes (many times?) bugs are interplay between two components.


I divide my code into assemblies for semantic reasons, not deployment
reasons.
So, I test internal functions as much as I test exported functions.

For example, one of my assemblies is a parser. Inside the assembly is an
internal class for lexing. I use NUnit to test this:

----

Lexer l=new Lexer(inputStream);

l.nextToken();
AssertEquals("foo", l.Lexema);

l.nextToken();
AssertEquals("bar", l.Lexema);

----

This is just good programming practice, and equally worthy of being NUnit
tested as any public interface.


Richard

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to