Re: JUnit Newbie trouble



On 30 Okt, 00:24, Hunter Gratzner <a24...@xxxxxxxxxxxxxx> wrote:
On Oct 29, 10:40 pm, Are Nybakk <n...@xxxxxxxxxxxxx> wrote:

Hi.

I havn't really been seriously into testing yet and therefore I was
looking into JUnit as it seems it is much used. Also version 4 uses
annotations which looked very much simpler than previous versions.

NetBeans doesn't support JUnit 4. Run your JUnit 4 tests as a normal
application, run them outside of the IDE, or use the supported Junit
3.

I have tested it with NetBeans 6, which supposedly, supports JUnit 4.
The JUnit 4.1 library is included in the IDE. The code I wrote gave no
result there either.

As a side question, how is this testing usually performed? Is it common
to add testing from the very beginning

Yes. Before you write the code you write the unit test.

and are they left in the code
after the tests has been conducted?

Unit tests are not in the production code. Unit tests are right from
the beginning supposed to be in own, separate classes.

I thought the thing about JUnit 4 was that one doesn't have to make a
separate test class?

Open a class in NetBeans. Press Shift-Ctrl-U. See how NetBeans creates
a separate test class for your class. Implement the unit tests for
your class in that separate test class.

It's clutter in a sense I guess, but
on the other hand it could become quite a lot to remove?

Unit tests are not removed, because they are not in the production
code. They are in separate classes which one usually doesn't ship.


.



Relevant Pages

  • The real advantage of unit testing?
    ... While the interview itself sort of bored me I did pick up a ... Netbeans has supported junit from the moment I started using it. ... using this framework. ... doing unit tests I'd also tell them no. ...
    (comp.lang.java.advocacy)
  • Re: JUnit - HTML report
    ... Where are its own unit tests? ... but what the creator needs and had the time to complete. ... add-on for a free tool that is not able to be used by the majority of the free tools user is a waste. ... If the op wants to use J1.5, then their time might be better spent creating the add on for JUnit 4.0 which is just about to be released. ...
    (comp.lang.java.programmer)
  • Re: JUnit Newbie trouble
    ... NetBeans doesn't support JUnit 4. ... Unit tests are not in the production code. ... your class in that separate test class. ...
    (comp.lang.java.help)
  • Re: Junit tests, setting up tests without having to create a billion methods
    ... Right now we just have runAllTests, but that makes the junit report too ... a custom TestRunner might be able to do what the OP wants. ... What if I want an automated integration test? ... You only really care about the external interface; you do not have time to reverse engineer every class to create unit tests. ...
    (comp.lang.java.programmer)
  • Re: JUnit Newbie trouble
    ... NetBeans doesn't support JUnit 4. ... I have tested it with NetBeans 6, which supposedly, supports JUnit 4. ... Unit tests are not in the production code. ...
    (comp.lang.java.help)