Re: Junit tests, setting up tests without having to create a billion methods



James McGill wrote:
On Wed, 2006-02-15 at 19:42 +0000, Andrew McDonagh wrote:

xyzzy12@xxxxxxxxxxx wrote:

Is there a more dynamic way of setting up tests? We have legacy test
code that we are trying to convert to junit.


I really enjoyed using Fitnesse. A whole different idiom for testing,
but very flexible and accessible to nonprogrammers.

http://fitnesse.org/


Anyway, it sounds like you're working backwards. You've already written
the code you want to test, which is backwards from TDD, which sort of
means JUnit isn't exactly the right tool for what you're doing. Still
it occurs to me that you should be able to automatically generated
wrappers for your legacy tests, and put those into a testsuite, and be
done with the legacy stuff and move forward with JUnit.




Hi James,

You seem have have attributed the OPs remarks to me...

That being said, the OP is specifically talking about the case where we have a legacy code base which wasn't tested with Junit - not that it wasn't tested. There's no mention of whether TDD was used or not - though I think we both suspect it wasn't and that the code base was merely Unit Tested.

Unfortunately, working with legacy code is currently the most common starting point on projects that adopt TDD. Greenfield projects using TDD are still rare.

Also, keep in mind, whilst JUnit was developed as a tool to Aid TDD, Beck et al do realise that some people won't or can't do TDD but still need a decent Unit Testing tool.

As I'm sure you know - but as an aid for others - TDD is not Unit Testing.

TDD is actually a design methodology that happens to use unit tests to describe the design. Much like RUP uses UML, etc. In fact this usage of the term Test has causes so many to concentrate on the testing side of TDD that some are now starting to question whether a better name could be found.

e.g.
Behavior Driven Development (http://behaviour-driven.org/)
Specification Driven Development
etc.


Andrew
.



Relevant Pages

  • Re: New to JUnit... Eclipse Question
    ... The tutorial says "...according to TDD... ... However JUnit4.0 for Eclipse doesn't seem to agree ... I went to create the JUnit Test Case (before ... Now I know what Calculator looks like and can implement just enough to make the test pass. ...
    (comp.lang.java.programmer)
  • Re: Test-Driven Development (was Re: Career? What languages to learn?)
    ... Or is TDD mainly ... in ernest some 15 years ago we were applying these ... legacy code, or the legacy code was changed, or was made ... then unit testing was applied ...
    (comp.programming)
  • Re: New to JUnit... Eclipse Question
    ... The tutorial says "...according to TDD... ... However JUnit4.0 for Eclipse doesn't seem to agree ... I went to create the JUnit Test Case (before ... BUT as soon as you do write foo() ...
    (comp.lang.java.programmer)
  • New to JUnit... Eclipse Question
    ... The tutorial says "...according to TDD... ... However JUnit4.0 for Eclipse doesn't seem to agree ... I went to create the JUnit Test Case (before ... Not that it is terribly annoying since that minimum code would need to ...
    (comp.lang.java.programmer)
  • Re: New to JUnit... Eclipse Question
    ... The tutorial says "...according to TDD... ... However JUnit4.0 for Eclipse doesn't seem to agree ... I went to create the JUnit Test Case (before ... Not that it is terribly annoying since that minimum code would need to ...
    (comp.lang.java.programmer)