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 >

plz help me

by Ravi k :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi
   
  Iam trying to execute  simple test case from eclipse3.1 IDE using ant build.xml.
   
  I have written for that
   
  <!-- Setup Junit framework -->
 <target name="JUNIT" >
       <available property="junit.present" classname="junit.framework.TestCase" classpathref="classpath"/>
 </target>
 
   
  <!-- Compile the application test classes -->
 <target name="compile-tests" depends="JUNIT">
  <mkdir dir="${build.dir}" />    
  <javac srcdir="${testsrc.dir}" destdir="${build.dir}">
           <classpath refid="classpath"/>
              <include name="**/*Test.java"/>
         </javac>
 
    </target>
   
  <!-- Run the application test classes -->
 <target name="runtest" depends="compile-tests" if="junit.present">
    <junit>
      <formatter type="plain" usefile="false" />
     <classpath refid="classpath"/>
     <test name="NumTest"/>
    </junit>
 </target>
 
  when i run this test case iam getting following error as follows:
   
   
  Buildfile: E:\TestApp\Build.xml
  JUNIT:
  compile-tests:
  [javac] Compiling 1 source file to E:\TestApp\testcases
  runtest:
  [junit] Testsuite: ./testcases/test/NumTest.class
  [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
  [junit] Caused an ERROR
  [junit] ./testcases/test/NumTest.class
  [junit] java.lang.ClassNotFoundException: ./testcases/test/NumTest.class
  [junit] at java.lang.Class.forName0(Native Method)
  [junit] at java.lang.Class.forName(Unknown Source)
  [junit] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
  [junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
  [junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
  [junit] Test ./testcases/test/NumTest.class FAILED
  BUILD SUCCESSFUL
  Total time: 1 second
   
   
   
  plz if you find solution for this help me.
   
   
   
   
 

Michael Feathers <mfeathers@...> wrote:
          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


         

 
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers

[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: Not doing testing (was: Re: Re: Are you really using JUnit during your development?)

by Joakim Ohlrogge :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>  I'll just repeat what I said in my previous email:  most of the software out
>  there is 1) not tested and 2) works great.

Hi Cédric,

1) I would change this statement to "most software is not
automatically tested with tools such as TestNG, JUnit or FIT or
similar". Then I would agree with you. I think that ALL software out
there is tested but a lot of the time it is a manual effort and the
whole piece of software is not guaranteed to be tested every release.
Also a lot of testing is sadly deferred to end users.

2) I certainly don't think that most software out there works great. I
think most software is living up to our expectations of how it should
work but I have certainly been on projects where nothing has been
tested automatically and that had a level that we thought were
acceptable that I now think is embarrasing. Everything is relative.

As an example:

I know if a company that released a whole lot of custom made software
to their very large userbase. When a new feature or "application" as
it was called (this was a web-portal) was released live it was
perfecly natural to have a "break in period" of a few weeks/months.
Evreybody knew that this is what to expect when new software is
released. The customer was used to this and did not find it strange
although they found it a bit stressfull. The developers of course made
sure that they had their evenings free atleast the first week after
going live. The applications were devloped mainly by contractors.

Of course testing was done, rigorous testing, the code was moved
between and tested in different environments according to a very
strict process. A LOT of manual effort was spent testing the software
and still over a 100 bug reports in the first week, after going live,
from end-users was not unheard of. This was for relatively small and
simple applications.

I don't know about you, but I don't think I ever submitted a bugreport
to a site I visited that gave me an error. Aparently some people do
and my guess is that they are not happy when they take time out of
their schedules to do that.

One application was later developed where automatic unit testing was
used (with JUnit). That application was a real application and a
"proof of concept" for unit testing. The people that coded the
application had not used JUnit before in their development but were
well familiar with the concept and had finally convinced the right
people that it should be tried. So the developers were learning while
coding and there were some personal prestige at stake so I bet they
were more careful than normal.

When that application went live it was a success. To this day I only
know of one or two bugs that have been submitted ever about that
application.

I think that using JUnit was a big part of that success but of course
the extra prestige and strong commitment from the team was a highly
contributing factor. Since then JUnit has been a requirement by the
customer. It has worked better but not as good as that success-story.
I think the biggest reason it could not be reproduced fully was that
JUnit was forced on people without any education effort. JUnit doesn't
work "well"/"at all" if you don't understand why you should use it.
More importantly, It doesn't fix any problems if you think that
everything is fine (there are no real problems, so what if we release
a few bugs! this is software!)

To sum it up, I agree that most applications out there are not tested
the way we would like them to have been tested. I think most of them
work well enough but I also think there are generally /too many/ bugs
in software today. I think that users and more importantly
/developers/ have an unhealthily high acceptance for this situation. I
think we as developers should not be satisfied with delivering
software that contains stuff that doesn't work even if /most/ of the
stuff delivered works. I think this attitude is unproffesional and I
don't want to work that way. I want to /know/ what I delver works. I
am not 100% sure all of the time about this but until I am I am not
satisfied with the situation.

I am convinced that whenever you trade testing for features it will
bite you sooner or later. I still do this more often than I would
like, it happens from time to time but I hope that I have learned
before I can no longer get away with that "my stuff tend to work
better than other stuff" (the stuff that is not tested as well).


>  I'd like everybody to reflect on that for a while before I send my next
>  message...

I look forward to your next message. It is uch an interesting subject.
Thanks for the discussion.

/Joakim Ohlrogge


 
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: plz help me

by Ravi k :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

      Hi

Iam trying to execute simple test case from eclipse3.1 IDE using ant build.xml.

I have written for that

<!-- Setup Junit framework -->
<target name="JUNIT" >
<available property="junit.present" classname="junit.framework.TestCase" classpathref="classpath"/>
</target>


<!-- Compile the application test classes -->
<target name="compile-tests" depends="JUNIT">
<mkdir dir="${build.dir}" />
<javac srcdir="${testsrc.dir}" destdir="${build.dir}">
<classpath refid="classpath"/>
<include name="**_/*Test.java"/>
</javac>

</target>

<!-- Run the application test classes -->
<target name="runtest" depends="compile-tests" if="junit.present">
<junit>
<formatter type="plain" usefile="false" />
<classpath refid="classpath"/>
<test name="NumTest"/>
</junit>
</target>

when i run this test case iam getting following error as follows:


Buildfile: E:\TestApp\Build.xml
JUNIT:
compile-tests:
[javac] Compiling 1 source file to E:\TestApp\testcases
runtest:
[junit] Testsuite: ./testcases/test/NumTest.class
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Caused an ERROR
[junit] ./testcases/test/NumTest.class
[junit] java.lang.ClassNotFoundException: ./testcases/test/NumTest.class
[junit] at java.lang.Class.forName0(Native Method)
[junit] at java.lang.Class.forName(Unknown Source)
[junit] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
[junit] Test ./testcases/test/NumTest.class FAILED
BUILD SUCCESSFUL
Total time: 1 second



plz if you find solution for this help me.







Ravi k <c_itsreddy@...> wrote:          Hi

Iam trying to execute simple test case from eclipse3.1 IDE using ant build.xml.

I have written for that

<!-- Setup Junit framework -->
<target name="JUNIT" >
<available property="junit.present" classname="junit.framework.TestCase" classpathref="classpath"/>
</target>


<!-- Compile the application test classes -->
<target name="compile-tests" depends="JUNIT">
<mkdir dir="${build.dir}" />
<javac srcdir="${testsrc.dir}" destdir="${build.dir}">
<classpath refid="classpath"/>
<include name="**/*Test.java"/>
</javac>

</target>

<!-- Run the application test classes -->
<target name="runtest" depends="compile-tests" if="junit.present">
<junit>
<formatter type="plain" usefile="false" />
<classpath refid="classpath"/>
<test name="NumTest"/>
</junit>
</target>

when i run this test case iam getting following error as follows:


Buildfile: E:\TestApp\Build.xml
JUNIT:
compile-tests:
[javac] Compiling 1 source file to E:\TestApp\testcases
runtest:
[junit] Testsuite: ./testcases/test/NumTest.class
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Caused an ERROR
[junit] ./testcases/test/NumTest.class
[junit] java.lang.ClassNotFoundException: ./testcases/test/NumTest.class
[junit] at java.lang.Class.forName0(Native Method)
[junit] at java.lang.Class.forName(Unknown Source)
[junit] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
[junit] Test ./testcases/test/NumTest.class FAILED
BUILD SUCCESSFUL
Total time: 1 second



plz if you find solution for this help me.






Michael Feathers <mfeathers@...> wrote:
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


---------------------------------
Here’s a new way to find what you're looking for - Yahoo! Answers

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



         

 
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers

[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: plz help me

by Anna Skawinska-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,


  you snipped out the path object named "classpath", so we can't see
what you included there. But if the tests compile successfully, I
assume you did declare it, including your junit-xxx.jar to it.
  If your compiled test class is placed in your build directory now,
make sure you added this directory to your classpath object:

        <path id="classpath">
                <!-- junit.jar, ant-junit.jar, whatever u need... -->
                <pathelement location="${build.dir}" />
        </path>

  Hope it helps. Tampered with build.xml file all day yesterday, I
know what fun it is to debug it :)

Anna



 
>   Iam trying to execute  simple test case from eclipse3.1 IDE using
ant build.xml.
>    
>   I have written for that
>    
>   <!-- Setup Junit framework -->
>  <target name="JUNIT" >
>        <available property="junit.present"
classname="junit.framework.TestCase" classpathref="classpath"/>

>  </target>
>  
>    
>   <!-- Compile the application test classes -->
>  <target name="compile-tests" depends="JUNIT">
>   <mkdir dir="${build.dir}" />    
>   <javac srcdir="${testsrc.dir}" destdir="${build.dir}">
>            <classpath refid="classpath"/>
>               <include name="**/*Test.java"/>
>          </javac>
>  
>     </target>
>    
>   <!-- Run the application test classes -->
>  <target name="runtest" depends="compile-tests" if="junit.present">
>     <junit>
>       <formatter type="plain" usefile="false" />
>      <classpath refid="classpath"/>
>      <test name="NumTest"/>
>     </junit>
>  </target>
>  
>   when i run this test case iam getting following error as follows:
>    
>    
>   Buildfile: E:\TestApp\Build.xml
>   JUNIT:
>   compile-tests:
>   [javac] Compiling 1 source file to E:\TestApp\testcases
>   runtest:
>   [junit] Testsuite: ./testcases/test/NumTest.class
>   [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
>   [junit] Caused an ERROR
>   [junit] ./testcases/test/NumTest.class
>   [junit] java.lang.ClassNotFoundException:
./testcases/test/NumTest.class
>   [junit] at java.lang.Class.forName0(Native Method)
>   [junit] at java.lang.Class.forName(Unknown Source)
>   [junit] at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
>   [junit] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
>   [junit] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
>   [junit] Test ./testcases/test/NumTest.class FAILED
>   BUILD SUCCESSFUL
>   Total time: 1 second
>    
>    
>    
>   plz if you find solution for this help me.
>    






 
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: Not doing testing

by dsaff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Joakim Ohlrogge wrote:
> 2) I certainly don't think that most software out there works great. I
> think most software is living up to our expectations of how it should
> work but I have certainly been on projects where nothing has been
> tested automatically and that had a level that we thought were
> acceptable that I now think is embarrasing. Everything is relative.
>  

Actually, I would go farther out there.  There's three kinds of software
out there:

1) Software good enough that some company finally decides to shrink-wrap
it and ship it to millions, or put it up on their public website and
wait to get bought by Yahoo!
2) Software just good enough for the single customer that paid for it to
pay off the contract.
3) Software that never sees the light of day. (try googling for "* of
software projects fail")

While a majority of the software many of us _use_ is in category 1, I
think that a lot of us work in category 2, and I'll guess that more than
a few of us have had to escape from a category 3 project at some time.

Let me throw on another anecdote, just for fun.  My wife is a medical
student, and has recently been considering places to do her clinical
residency.  One place was still using drug orders written on pieces of
paper (finally, in 2006, this is unusual even in medicine).  However,
she was told: 1) They're rolling out a new computer system next year, 2)
Of course, it will probably take about six months to shake out all the
bugs, but after that, it will be really nice.

I was floored that: 1) My wife and her informant both took it for
granted that the software would release with significant bugs, 2) My own
first reaction was actually "Yeah, what can you do." (indignation came
later), 3) We're talking about _prescribing drugs to hospital patients_
here.

However, perhaps none of this is the point.  In the end, it doesn't
matter if the global software industry is producing software that meets
some criteria of "good enough".  What matters to most of our paychecks
is that our software is better than what our customers could get more
cheaply from someone else.  I submit that disciplined unit testing has
enough success stories that it's worth trying it to see if it makes
things better.

    David Saff


 
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: Not doing testing

by dsaff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cédric Beust ♔ wrote:
> I don't always do TDD and I claim that very few people do.
>
> It doesn't mean that their software is worthless or that they are bad
> developers.  

I hope no one would ever hear me saying that they were. I try to spend
less time worrying about whether I fit global definitions of "bad" or
"worthless", and more time trying to get better. I think:

1) There are people who would have more fun and write better software if
they did more developer testing. Encouraging everyone to try it is a
good thing. I like a Martin Fowler quote: "Often when you come across
something new it can be a good idea to overuse it in order to find out
it's boundaries. This is a quite reasonable learning strategy."

2) There are people who would have more fun and write better software if
they did less developer testing. Most of these people, I'll guess, have
developer testing forced on them from above. However, if there are
people on the list who used to be happy, gung-ho developer testers, and
now have seen that they were wrong, I'd love to hear their stories.

David Saff


 
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: Not doing testing (was: Re: Re: Are you really using JUnit during your development?)

by Yagiz Erkan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I'll just repeat what I said in my previous email:  most of the software out
> there is 1) not tested and 2) works great.

I think you wanted to say "1) not unit-tested"...

--
 -- Yagiz Erkan --
 http://blog.decaresystems.ie


 
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 J. B. Rainsberger :: 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".

There is no such thing as code that is not tested, but works. Or, that
is only a theoretical existence, since you can't know such code exists,
until you test it, even if only by using it.

If a person has time to test it manually, and he uses the tests as
change detectors (so he runs them more than once in his life), then he
very likely has time to automate at least some non-trivial subset of
those tests. Over time, he'll find that automating some of those tests
up front is faster than running them manually any number of times.

What I have observed is that the "time problem" is not a matter of "I
don't have time to write the tests", but rather a matter of "I don't
have time to learn how to write the tests". Those are two very different
animals. In that case, I concur with Bob, that "senior guys" are guys
who take time to learn; and conversely, you can't be a "senior guy" if
you don't take time to learn. (Note, that doesn't have to be project
time. It's often spare time for those senior guys.)

> 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.

If it doesn't have to work, that's fine.

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

I agree with this statement; however, "judgment" without information is
just guessing.

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 J. B. Rainsberger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cédric Beust ♔ wrote:

>
>
> On 8/2/06, Michael Feathers <mfeathers@...
> <mailto:mfeathers%40mindspring.com>> wrote:
>  >
>  > 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? ;-)
>
> Because a lot of software companies are still in business and I know for a
> fact they don't do a lot of testing :-)

Now /your/ implication is that software companies need to ship working
software to stay in business. One day, that might be true, but for now,
it certainly isn't. :)
--
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 Andreas G Guther :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Maybe I am mis-reading the sentence, but it seems hard to believe that there are a lot of companies in business that don’t do a lot of testing.

 

My experience is that everyone does testing in one way or the other.  The problem I see is the lack of automated and repeatable testing as it is provided by unit test frameworks like JUnit and TestNG.  If I ask in interviews about testing there is very seldom someone who does not know about JUnit.  But there is a surprisingly high percentage of companies that actually do not require the developer to write repeatable tests.  And that amazes me all the time.

 

If you test your code, why don’t you want to make it repeatable?

 

Andreas

 

________________________________

From: junit@... [mailto:junit@...] On Behalf Of Cédric Beust ?
Sent: Wednesday, August 02, 2006 8:23 PM
To: junit@...
Subject: Re: [junit] Re: Are you really using JUnit during your development?

 

On 8/2/06, Michael Feathers <mfeathers@... <mailto:mfeathers%40mindspring.com> > wrote:

>
> 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? ;-)

Because a lot of software companies are still in business and I know for a
fact they don't do a lot of testing :-)

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

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

 



[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/
 



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 3, 2006, at 9:54 AM, "Cédric Beust ♔ " cbeust@...  
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".

The two kinds of code are:

  - Code you have tested, and you know works to the best of your  
ability to determine.
  - Code you have not tested and don't know if it works.

If you haven't tested the code, you don't know that it works.  If you  
HAVE tested the code then you know that it passes your tests.  No  
employer is paying you to guess as to whether the code works.  Your  
employer is paying you to be as certain as you can be that the code  
works.  The only way to do that is to write tests, and to write them  
*before* you write the code.  Writing tests after the fact is far  
less effective because the code was almost certainly not written to  
be testable.

----
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/
 



Parent Message unknown Re: Not doing testing

by Robert Martin-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Aug 3, 2006, at 9:54 AM, "Cédric Beust ♔ " cbeust@...  
wrote:

> I don't always do TDD and I claim that very few people do.

There was a period of time when very few surgeons washed their hands  
before operating.  Anton Semmelweis tried to convince them to change,  
but most would not.  He died without seeing the change in practice  
become accepted.

You are correct that few people do TDD, but more and more are  
adopting it.  I expect it to be the standard of behavior in the  
coming decades.
----
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

On 8/3/06, Robert Martin <UncleBob@...> wrote:

>
>
> On Aug 3, 2006, at 9:54 AM, "Cédric Beust ♔ " cbeust@...
> 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".
>
> The two kinds of code are:
>
>   - Code you have tested, and you know works to the best of your
> ability to determine.
>   - Code you have not tested and don't know if it works.
>
> If you haven't tested the code, you don't know that it works.


What if my customers tell me the code works?

What if my software has been working for them for years?

If such were the case, I'd feel comfortable taking the bet that my code
works, even if I don't have automated tests to prove it.  Would you bet
against me?

If you HAVE tested the code then you know that it passes your tests.


Right, it passes my tests.  It doesn't mean that it works.

Just like having 100% coverage doesn't mean that my code works.

Developer tests are biased, they only cover a part of the story.  Customer
usage is, of course, biased as well, but it's a yardstick that's just as
valid.

 The only way to do that is to write tests,


Yes. Well, that's one way to prove it, there are more.

and to write them *before* you write the code.


No.

Why is test written first better than test written after?

Writing tests after the fact is far
> less effective because the code was almost certainly not written to
> be testable.


Why?  If someone like you write the code, you're going to design it to be
testable, aren't you?  You will be using well-known principles such as
interfaces, dependency injection, avoiding statics, methods with too many
parameters, decoupling your classes, etc...

It can be argued that writing test firsts can be detrimental to your
velocity because it introduces churn:  you don't know yet what your final
code will look like, and before you reach something you're comfortable with,
you might have to rewrite it two or three times.  And every time, you will
have to modify these tests as well.  TDD can be a big waste of time.

Here is why.

With test first, you have something like:  Test v1, Code v1, Test v2, Code
v2, Test v3, Code v3.  Check in.

If you postpone your testing a bit, you have:  Code v1, Code v2, Code v3,
Test v3, Commit.

The latter approach will get you to your goal much faster.

Again, I'm not saying that TDD is bad, just that it comes at a price and
that this price needs to be evaluated before *every* single project or task
that you undertake.

--
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: Re: Are you really using JUnit during your development?

by dsaff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cédric Beust ♔ wrote:

> It can be argued that writing test firsts can be detrimental to your
> velocity because it introduces churn:  you don't know yet what your final
> code will look like, and before you reach something you're comfortable with,
> you might have to rewrite it two or three times.  And every time, you will
> have to modify these tests as well.  TDD can be a big waste of time.
>
> Here is why.
>
> With test first, you have something like:  Test v1, Code v1, Test v2, Code
> v2, Test v3, Code v3.  Check in.
>
> If you postpone your testing a bit, you have:  Code v1, Code v2, Code v3,
> Test v3, Commit.
>
> The latter approach will get you to your goal much faster.
>  

Cedric,

I think we disagree here, but before I say more, I'd like to know how
much.  I hear that "It _can be argued_ that writing test firsts can be
detrimental to your velocity", and then "TDD _can be_ a big waste of
time", and then "The latter approach _will_ get you to your goal much
faster".  Which of these is your personal experience?

    David Saff


 
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: