Unit testing tools?

G

Guest

Hello All,

Can anyone please suggest me a good unit testing tool. I have seen NUnit but
not sure on how I can use it to test my methods which involve session
variables, viewstate variables, textbox values.

I understand that NUnit is more suitable for OO methods which take set of
parameters and return an output parameter. How about tools for testing
methods which use state variables and form values?

Thank you!!
 
B

Bruce Barker

this is where interface design is important. if you write test first code,
then you want a wrapper around session and state that supplies a factory.
when running unit tests, normally you supply "mock" objects for any object
referenced by the object under test.

-- bruce (sqlwork.com)
 
R

Robbe Morris [C# MVP]

"methods which involve session
variables, viewstate variables, textbox "

If you have business rule methods or even UI methods
that access these directly, then you've made a design mistake.

Usage of these should be restricted to events
in your page. These types of values should
be passed in a parameters to your methods.
 
J

Jason Hales

I'm in agreeement with the other posters here. You're almost blurring
the distinction between unit testing and system testing

Having said that, there is an ASP flavour of nunit called nunitasp.
See http://nunitasp.sourceforge.net for more info
 
J

Jon Paal

with try catch statements you can see your results or
-- you could just trap the desired information in a output value or
-- javascript alert and then you can see what is happening.

I find this to be much easier than doubling my workload to build nunit tests and tests to test my tests :)
 
R

Robbe Morris [C# MVP]

I would urge you to rethink that. For run of the mill
basic form driven applications, you can often times
scale down your unit testing.

But, as soon you start working on complex
applications with extremely complex business rules,
unit testing is a must. Being able to rerun your
unit tests in mass during development and prior
to builds is an invaluable way to reduce errors
visible to your ui development team and
your quality assurance testers. If implemented
properly, it can be a time saver over not
unit testing at all.

--
Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp
 
J

Jason Hales

A few years ago I discovered the whole eXtreme Programming approach to
software development. I had to be dragged into the mindset of Test
Driven Developement (via nunit) but it totally transformed my outlook
on software development.

I think it made it more fun, forcing me to think about class design
before coding and giving me great confidence in changing other people's
code.

I'm pretty much "test infected" these days; I never want to go back to
the bad old days of purely hacking code together. This is much more
"grown-up". I implement it as much as possible in my own home
projects.

Of course there's always a time when you need to be pragmatic to "just
get the job done", but these things have a habit of coming back and
biting you ;-)
 
J

Jon Paal

There is no "team" in my world. I'm the team.

Until there is a built-in library of pre-programmed (?) tests that can be activated, I could never stop and build all the addtional
code for testing development. My clients won't pay for that extra time, and so far I'm able to produce solid deliverables without
it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top