Are you really using JUnit during your development?

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 | Next >

Are you really using JUnit during your development?

by Jean :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've written JUnit cases for over 1 month.

I have to say it's fun to do the implement coding. But it's suffering to write JUnit cases. Because:
1. I need to know the correct result from the other way around and sometimes it's hard to find another way.
2. Database and JSP pages are difficult to JUnit test.
3. Mock objects brings more than double efforts during the whole develop process.
4. Exception situation is not so easy to make as JUnit claims.

3 friends in 3 different companies (small size and middle size company) complain JUnit as:
1. They planned JUnit testing firstly and they cannot keep it going. TIME reason?
2. It consumes a lot of time but hard to find big problems. JUnit does find small problems as we expected.
3. JUnit testing is not effcient enough.
4. Best JUnit tester is the senior software developer. But senior guys hate to write test cases.
5. For small company, it's really hard to choose between JUnit+develop and develop+functional testing.

Is there anyone who is successful in deploying JUnit during develop as: JUnit + code + JUnit + code + System Testing?

Re: Are you really using JUnit during your development?

by Jean :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Re: Are you really using JUnit during your development?

by Carl Hume :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 8/2/06, Jean <2004jing.lei@...> wrote:

> Is there anyone who is successful in deploying JUnit during develop as:
> JUnit + code + JUnit + code + System Testing?
>




Yes.  Every day.

You're right - some things are easier to unit test then others.  I'm not
perfect, and I'm still learning.  But, I'm doing it (and have been for six
years now).

Cheers!
Carl





--
http://genomescampaigns.blogspot.com


[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Re: Are you really using JUnit during your development?

by Mark Levison :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 8/2/06, Carl Hume <carl.hume@...> wrote:

>
> On 8/2/06, Jean <2004jing.lei@...> wrote:
>
> > Is there anyone who is successful in deploying JUnit during develop as:
> > JUnit + code + JUnit + code + System Testing?
> >
>
> Yes.  Every day.
>
> You're right - some things are easier to unit test then others.  I'm not
> perfect, and I'm still learning.  But, I'm doing it (and have been for six
> years now).


Like Carl for over six years using JUnit/NUnit (for .NET) work. Its hard
work at first but gets easier with time. J.B. Rainsberger's book Junit
recipes (
http://www.amazon.com/gp/product/1932394230/104-6174901-2999136?v=glance&n=283155)
is a great to get up to speed quickly. However nothing replaces practice.
Try, fail, learn, try again.

Cheers
Mark Levison


[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Re: Are you really using JUnit during your development?

by Simon Chappell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That's got me beat. I've only been using it regularly for four years.
[Hangs head in shame!]

As a technical lead and now a mentor, I don't cut code every day
(meetings ... pah!), but when I do cut code, I test most everything I
write.

Over the past four years of writing tests, the time taken to write
individual tests goes down, and the reliability of my code goes up.
Sounds like a good long term trend to me. :-)

Simon
--
www.simonpeter.org


On 8/2/06, Carl Hume <carl.hume@...> wrote:

> On 8/2/06, Jean <2004jing.lei@...> wrote:
>
> > Is there anyone who is successful in deploying JUnit during develop as:
> > JUnit + code + JUnit + code + System Testing?
> >
>
>
>
>
> Yes.  Every day.
>
> You're right - some things are easier to unit test then others.  I'm not
> perfect, and I'm still learning.  But, I'm doing it (and have been for six
> years now).
>
> Cheers!
> Carl
>


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Re: Are you really using JUnit during your development?

by Cédric Beust ♔ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 8/2/06, Jean <2004jing.lei@...> wrote:
>
>
>
> I have to say it's fun to do the implement coding. But it's suffering to
> write JUnit cases.


Don't feel bad, your situation is pretty common in my experience.

The important thing is to realize that tests are important and always do
your best to make them part of your development process.  We all know that
in the real world, sometimes, other tasks take precedence.  Just exercise
your judgment, put testing in the backseat when the circumstances warrant it
(tight deadline, angry customer, etc...) but always remember to get back to
them and pay your technical debt whenever you get a chance.

--
Cédric
http://testng.org


[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Re: Are you really using JUnit during your development?

by Kevin Lawrence :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 8/2/06, Jean <2004jing.lei@...> wrote:
>
> Is there anyone who is successful in deploying JUnit during develop as:
> JUnit + code + JUnit + code + System Testing?
> --

It's tempting to start a new thread asking if there is anyone NOT
using junit during development ;-) ... but that probably wouldn't help
you much.

If there is a single big secret to being successful with JUnit it is
virtuous circle of :

  testability -> more tests -> more testability -> more tests

Three or four times around this loop and you will probably also wonder
how you ever managed without unit tests.

Many newcomers to automated unit tests expect to be able to test their
code with no changes or are reluctant to make changes /just/ to make
it easier to test... they often give up on the whole deal because they
find it too hard.

I blogged about this a while back :
http://www.developertesting.com/archives/month200401/20040116-WhyIsSoftwareSoHardToTest.html

Kevin


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Re: Are you really using JUnit during your development?

by Cédric Beust ♔ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 8/2/06, Kevin Lawrence <kev.lawrence@...> wrote:
>
>
> It's tempting to start a new thread asking if there is anyone NOT
> using junit during development ;-)


Not everybody uses JUnit, you know...

Three or four times around this loop and you will probably also wonder
> how you ever managed without unit tests.


The problem is usually more along the lines of "How can I manage with unit
tests?".  As the original poster pointed out, the reality depicted in books
about testing is very different from the real world, and practical advice
for that is fairly scarce (yes, I read Michael Feather's book).

Many newcomers to automated unit tests expect to be able to test their
> code with no changes or are reluctant to make changes /just/ to make
> it easier to test... they often give up on the whole deal because they
> find it too hard.


That's one reason, there are plenty of others, such as "We're approaching a
deadline and I have to add this feature for our customer, so I'll do that
instead of adding a test".

--
Cédric
http://testng.org


[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Re: Are you really using JUnit during your development?

by jason r tibbetts :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cédric Beust ♔ wrote:

>
> On 8/2/06, Jean <2004jing.lei@...
> <mailto:2004jing.lei%40gmail.com>> wrote:
>  >
>  > I have to say it's fun to do the implement coding. But it's suffering to
>  > write JUnit cases.
>
> Don't feel bad, your situation is pretty common in my experience.
>
> The important thing is to realize that tests are important and always do
> your best to make them part of your development process. We all know that
> in the real world, sometimes, other tasks take precedence. Just exercise
> your judgment, put testing in the backseat when the circumstances warrant it
> (tight deadline, angry customer, etc...) but always remember to get back to
> them and pay your technical debt whenever you get a chance.

I'd have to admit that I find coding the /tests/ quite interesting and
challenging in their own right. Here are just some of the things that
testing has introduced me to, which I may never have otherwise come across:

* java.lang.reflect.Proxy - awesomely powerful. 99% of what you need it
for is covered by mock objects, but for that remaining 1%, it's
indispensible
* Jetty (www.mortbay.org) - I've got network utility tests that stand up
an embedded Web server to serve content. One example is a wrapper around
java.net.URL that verifies content types (e.g. MIME types). Its test
pretty much requires a live Web server to vend the appropriate content.
* java.lang.AccessibleObject.setAccessible(boolean) - the subject of a
recent thread here
* code correctness tools (PMD, findbugs, checkstyle) - technically not
limited to testing, but that's how I got exposed to it
* dependency injection
* and many more



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Re: Are you really using JUnit during your development?

by Kevin Lawrence :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 8/2/06, Cédric Beust ♔ <cbeust@...> wrote:
> On 8/2/06, Kevin Lawrence <kev.lawrence@...> wrote:
> >
> >
> > It's tempting to start a new thread asking if there is anyone NOT
> > using junit during development ;-)
>
>
> Not everybody uses JUnit, you know...
>

I know.

I was assuming that the OP was using 'junit' to mean 'an automated
unit test framework'. I could have made that clearer.

Kevin


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Parent Message unknown Re: Are you really using JUnit during your development?

by Robert Martin-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Aug 2, 2006, at 1:16 PM, junit@... wrote:

4. Best JUnit tester is the senior software developer. But senior  
guys hate
to write test cases.

Senior guys who hate writing tests are not senior guys.  Writing  
tests is a matter of professional ethics.  The only way to truly know  
that the code you have written works, and works in the whole system,  
is to have, and run, a comprehensive set of tests.  Code coverage for  
these tests should be very close to 100% (i.e. high 90s).  If you  
don't have this, then you don't KNOW that your code actually works.  
And shipping code that you aren't as certain as possible about is  
unprofessional.

I wear a green band on my wrist that says "Test First".  (http://
butunclebob.com/ArticleS.UncleBob.GreenWristBand)
It is a symbol of my commitment to produce the best code I can, and  
to be sure that it works to the best of my ability.  It reminds me to  
write tests, to write them first, and to write them diligently.

The argument about "TIME" is laughable.  It is like saying that we  
don't have time to test, but we DO have time to debug.  That's an  
unprofessional attitude.  Time spent writing tests is time that will  
prevent us from having to debug.  Time spent writing tests is time  
spent designing, is time spent thinking, and is time spent making  
sure that our code can be checked again, and again, and again.

Anyone who says that they don't have time to write tests should not  
be writing code.
                 |

----
Robert C. Martin (Uncle Bob)  | email: unclebob@...
Object Mentor Inc.            | blog:  www.butunclebob.com
The Agile Transition Experts  | web:   www.objectmentor.com
800-338-6716                  |






[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Re: Re: Are you really using JUnit during your development?

by Cédric Beust ♔ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rob,

On 8/2/06, Robert Martin <UncleBob@...> wrote:
>
>
> The argument about "TIME" is laughable.  It is like saying that we
> don't have time to test, but we DO have time to debug.


You seem to imply that there are only two kinds of code:

   - Code that is tested and works
   - Code that is not tested and doesn't work

There is actually something in the middle:  it's called "Code that is not
tested but that works".

It's a fairly common occurrence, in my experience, and the reason behind my
comments earlier:  if other circumstances warrant it, it's okay to write the
code, ship it and write the tests later.

Just use your judgment, that's why your employer is paying you.

--
Cédric
http://testng.org


[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Re: Are you really using JUnit during your development?

by J. B. Rainsberger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jean wrote:

> I've written JUnit cases for over 1 month.

That's great!

> I have to say it's fun to do the implement coding. But it's suffering to
> write JUnit cases. Because:

> 1. I need to know the correct result from the other way around and sometimes
> it's hard to find another way.

I understand, but if you don't know the correct result before you write
the code, then how do you know if you're writing the code correctly?

> 2. Database and JSP pages are difficult to JUnit test.

Yes, they are.

> 3. Mock objects brings more than double efforts during the whole develop
> process.

Compared to what?

> 4. Exception situation is not so easy to make as JUnit claims.

Can you give us an example, because I find it quite easy.

> 3 friends in 3 different companies (small size and middle size company)
> complain JUnit as:

> 1. They planned JUnit testing firstly and they cannot keep it going. TIME
> reason?

If you do not need to do it correctly, then don't write tests. For
decades, programmers have pretended that writing correct code is not
part of their job. They are wrong, and have always been wrong.

> 2. It consumes a lot of time but hard to find big problems. JUnit does find
> small problems as we expected.

I find this interesting: but finding all the small problems, there are
very few big problems.

http://c2.com/cgi/wiki?RidiculousSimplicityGivesRidiculousResources

Can you give us an example of a big problem that programmer testing with
JUnit didn't help you/them find?

> 3. JUnit testing is not effcient enough.

In what way is it not efficient enough? What more of something do you
expect to get with the same amount of time?

> 4. Best JUnit tester is the senior software developer. But senior guys hate
> to write test cases.

Senior guys don't have the responsibility to write correct code?

> 5. For small company, it's really hard to choose between JUnit+develop and
> develop+functional testing.

There are many small teams (6-8 people) doing /all three/ effectively,
so perhaps there are some other interesting problems to try to solve there.

> Is there anyone who is successful in deploying JUnit during develop as:
> JUnit + code + JUnit + code + System Testing?

I'd like to hear stories from other JUnit users, of course.
--
J. B. (Joe) Rainsberger :: http://www.jbrains.info
Your guide to software craftsmanship
JUnit Recipes: Practical Methods for Programmer Testing
2005 Gordon Pask Award for contribution Agile Software Practice




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Re: Are you really using JUnit during your development?

by J. B. Rainsberger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cédric Beust ♔ wrote:

> On 8/2/06, Jean <2004jing.lei@...
> <mailto:2004jing.lei%40gmail.com>> wrote:
>  >
>  >
>  >
>  > I have to say it's fun to do the implement coding. But it's suffering to
>  > write JUnit cases.
>
> Don't feel bad, your situation is pretty common in my experience.

I forgot to say something like this, and it's important: we all have
felt the same thing.

> The important thing is to realize that tests are important and always do
> your best to make them part of your development process. We all know that
> in the real world, sometimes, other tasks take precedence. Just exercise
> your judgment, put testing in the backseat when the circumstances warrant it
> (tight deadline, angry customer, etc...) but always remember to get back to
> them and pay your technical debt whenever you get a chance.

Indeed. It takes time, but the investment is worth it: for the rest of
you life, after you master the basics of programmer testing, you will
write better code, sooner and you'll spend less time fixing it. It's great.
--
J. B. (Joe) Rainsberger :: http://www.jbrains.info
Your guide to software craftsmanship
JUnit Recipes: Practical Methods for Programmer Testing
2005 Gordon Pask Award for contribution Agile Software Practice





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Re: Are you really using JUnit during your development?

by J. B. Rainsberger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cédric Beust ♔ wrote:

> On 8/2/06, Kevin Lawrence <kev.lawrence@...
> <mailto:kev.lawrence%40gmail.com>> wrote:
>  >
>  >
>  > It's tempting to start a new thread asking if there is anyone NOT
>  > using junit during development ;-)
>
> Not everybody uses JUnit, you know...

"It's tempting to start a new thread asking if there is anyone NOT
/doing programmer testing/ while programming."

> The problem is usually more along the lines of "How can I manage with unit
> tests?". As the original poster pointed out, the reality depicted in books
> about testing is very different from the real world, and practical advice
> for that is fairly scarce (yes, I read Michael Feather's book).

Which reality depicted in which books is different from what real-world
experience?

Also, if practical advice seems scarce, I venture it's for two reasons:

1. It's not easy.
2. Once someone like Feathers writes about it, there's no real need to
duplicate it.

> That's one reason, there are plenty of others, such as "We're approaching a
> deadline and I have to add this feature for our customer, so I'll do that
> instead of adding a test".

I have felt that pain. Implementing /any/ change program, such as
changing the way you write code, is not a good idea when you're
approaching a deadline. That's why I have found two key ways to
introduce programmer testing into a programmer's practice:

1. by working on a side-project where there are no immediate deadlines,
such as something open source or personal, OR

2. by working on a desperate project where it couldn't get much
worse--if you spend 2 weeks trying to write tests and don't get
anywhere, that's fine, because 2 weeks trying to add to a horrible
codebase probably wouldn't have helped, either.

I happened to do #2 instead of #1. Some people tell me #1 has worked for
them, too.

Take care.
--
J. B. (Joe) Rainsberger :: http://www.jbrains.info
Your guide to software craftsmanship
JUnit Recipes: Practical Methods for Programmer Testing
2005 Gordon Pask Award for contribution Agile Software Practice





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Re: Re: Are you really using JUnit during your development?

by Michael Feathers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cédric Beust ♔ wrote:

>
>You seem to imply that there are only two kinds of code:
>
>   - Code that is tested and works
>   - Code that is not tested and doesn't work
>
>There is actually something in the middle:  it's called "Code that is not
>tested but that works".
>  
>
How do you know? ;-)

Michael Feathers
www.objectmentor.com


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> To unsubscribe from this group, send an email to:
    junit-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Re: Re: Are you really using JUnit during your development?

by Cédric Beust ♔ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 8/2/06, Michael Feathers <mfeathers@...> wrote:

>
> Cédric Beust ♔ wrote:
>
> >
> >You seem to imply that there are only two kinds of c