[MonoDevelop] First go at unit tests

Lluis Sanchez lluis at ximian.com
Fri Dec 2 13:10:20 EST 2005


Hi,

> Ok, I tried testing the SourceViewTextIterator class in
> SourceEditorDisplayBinding.cs. The class is private and this turned
> out to be quite problematic. I had to start up a lot of MD
> infrastructure in the test to even get this class instantiated. This
> is a bad smell IMO. 

That was expected.

> 
> I do not think it is feasible to do it this way. So how do I go about
> testing this class? I see a couple of options:
> 
> * Put the test in the class.
> * Make the class public.
> * Move the class somewhere else. 

None of those options are acceptable.

> 
> It ought not be so hard to unit test a search algorithm. Maybe the
> algorithm should be moved somewhere else?
> 
> Any good ideas out there? :-)

I think that the best solution would be to implement a Tester add-in,
which once loaded in MD would use the public API to test whatever needs
to be tested. 

You would not directly test the SourceViewTextIterator class, but
instead you would use the MonoDevelop.Ide.Gui.Search api, which
internaly relies on that class.

Lluis.




More information about the Monodevelop-list mailing list