Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Advocacy > Re: The real ad...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 7 Topic 2356 of 2456
Post > Topic >>

Re: The real advantage of unit testing?

by Daniel Pitts <newsgroup.spamfilter@[EMAIL PROTECTED] > Feb 25, 2008 at 03:19 PM

Lion-O wrote:
>> JUnit saves time - compared to writing your own test framework.
> 
> Leading up to: why would you need an entire framework?
> 
> 
Re****ting, assertions, setup/teardown, to name a few.
To write two tests in JUnit:

public class MyTest extends TestCase {
     public void testMyFirstTest() {
         String foo = " foo ";
         assertEqual("foo", foo.trim());
     }

     public void testMyOtherTest() {
        String foo = "Hello world";
        assertEquals("world", foo.substring(6));
     }
}

Now, this is using older JUnit, there are things you can do with 
annotations that make it even more powerful.

JUnit isn't a complex framework, but its useful and one less thing to 
worry about.

-- 
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
 




 7 Posts in Topic:
The real advantage of unit testing?
Lion-O <nosp@[EMAIL PR  2008-02-24 12:56:40 
Re: The real advantage of unit testing?
Tim Tyler <seemysig@[E  2008-02-25 12:40:42 
Re: The real advantage of unit testing?
Lion-O <nosp@[EMAIL PR  2008-02-25 15:38:46 
Re: The real advantage of unit testing?
Daniel Pitts <newsgrou  2008-02-25 15:19:37 
Re: The real advantage of unit testing?
Lion-O <nosp@[EMAIL PR  2008-02-27 15:29:45 
Re: The real advantage of unit testing?
Tim Tyler <seemysig@[E  2008-02-26 13:46:17 
Re: The real advantage of unit testing?
Lothar Kimmeringer <ne  2008-03-14 23:07:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Oct 12 23:38:41 CDT 2008.