Testing Types During Development

  • Thread starter Thread starter Primera
  • Start date Start date
P

Primera

I'm looking for the best way to test individual methods and such during development.
I use VS2005, but am still new to .NET. I'd like to test things as I develop
without executing the entire app etc.
Thanks
 
Primera said:
I'm looking for the best way to test individual methods and such during
development. I use VS2005, but am still new to .NET. I'd like to test
things as I develop without executing the entire app etc.
Thanks

Use the Object Test Bench of VS2005. Right-click the type you wish to create
using the Class Designer, and from the resulting context menu select Create
Instance. It will display a dialog box that allows you to name your
temporary object variable and supply any constructor arguments if required.
Once the process is complete, you will find your object hosted within the
IDE. Right-clicking the object icon will allow you to invoke its methods.

Hope this helps,
 
csharpnb said:
Use the Object Test Bench of VS2005. Right-click the type you wish to create
using the Class Designer, and from the resulting context menu select Create
Instance. It will display a dialog box that allows you to name your
temporary object variable and supply any constructor arguments if required.
Once the process is complete, you will find your object hosted within the
IDE. Right-clicking the object icon will allow you to invoke its methods.

That lets you "play" with an object, but that's not the same as
systematically testing it. Unit tests are much better for that. I'd
second the recommendation for NUnit.
 
Jon said:
That lets you "play" with an object, but that's not the same as
systematically testing it. Unit tests are much better for that. I'd
second the recommendation for NUnit.
A second great tool is VS2005 itself. The build in unit tests in VS2005
are as good as NUnit and much better integrated into VS. You can
execute/debug single/multiple test, it can generate and (semi automatic)
maintain Test wrappers for private and internal components, etc.
However, extra functionality like NMock is not available :-(

HTH,
Andy
 
A second great tool is VS2005 itself. The build in unit tests in VS2005
are as good as NUnit and much better integrated into VS. You can
execute/debug single/multiple test, it can generate and (semi automatic)
maintain Test wrappers for private and internal components, etc.
However, extra functionality like NMock is not available :-(

Just to be clear - this is only available in Team System. The "lower"
editions of VS2005 (including Professional) don't include unit testing,
unfortunately. (I've suggested to many people at Microsoft that this
should be changed.)

I haven't used the built-in version myself, but I seem to remember it
doesn't have an overall green/red bar. I know it's a little thing, but
it's a big psychological help which I'm surprised MS did away with.
 
Back
Top