p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET MVC 1.0 ISBN: 978-0-470-43399-7
This is the forum to discuss the Wrox book Beginning ASP.NET MVC 1.0 by Simone Chiaretta, Keyvan Nayyeri; ISBN: 9780470433997

Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET MVC 1.0 ISBN: 978-0-470-43399-7 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 29th, 2009, 10:02 PM
Registered User
Points: 14, Level: 1
Points: 14, Level: 1 Points: 14, Level: 1 Points: 14, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unit Testing Question

I have a question about unit testing. In general, should you try several values? I ask because in your example, you used addition for the Multiply() function to show a failing result.

But, what if you used Multiply(2, 2) and Assert.AreEqual(4, result)? The test would pass even if the code is wrong. I realize that in this simple example, it is easy to figure out that you shouldn't use 2 and 2, but in a more complex situation, I imagine it won't always be so obvious.

So, is it common testing practice to use more than one example test?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old September 30th, 2009, 11:01 PM
Wrox Author
Points: 18, Level: 1
Points: 18, Level: 1 Points: 18, Level: 1 Points: 18, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2005
Location: Tehran, Iran
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

adimauro

Please note that Simone (the author of unit testing chapter) is on travel and it may take him a few days to respond.
__________________
Keyvan Nayyeri
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old October 6th, 2009, 06:23 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Location: Milano, Italy
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Antonio,
in general you should test a general case when you are doing the first tests (or when you are designing the application via TDD.
And then you usually need to test the boundaries cases or the the special cases.
Simo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old October 7th, 2009, 01:05 AM
Friend of Wrox
Points: 941, Level: 11
Points: 941, Level: 11 Points: 941, Level: 11 Points: 941, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 278
Thanks: 0
Thanked 4 Times in 4 Posts
Default

It does bring up an important point. The purpose of TDD is to require you to do proper program development. Good requirements research, good architecture planning, etc. If you plan out your tests and find your boundary cases well, your tests will demonstrate when the code that you're writing is doing a great job or not. If you quickly dash off some haphazard tests however, you can get into all kinds of trouble. So TDD can't save you from bad programming, it just makes it more obvious when you do.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unit Testing jasonchrin BOOK: Professional Software Testing with Visual Studio 2005 Team System ISBN: 978-0-470-14978-2 2 July 7th, 2008 10:58 AM
Requirement base unit testing elliscnck Assembly Language 0 February 14th, 2008 10:32 AM
Unit Testing jeffmorris BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 7 May 14th, 2007 07:51 AM
Unit Testing userrob BOOK: ASP.NET Website Programming Problem-Design-Solution 2 November 9th, 2005 10:35 AM
Unit Testing XSLT N.Todd XSLT 2 March 1st, 2005 08:31 PM



All times are GMT -4. The time now is 09:54 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc