This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes How to run JUnit test in Netbeans 4.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How to run JUnit test in Netbeans 4.0" Watch "How to run JUnit test in Netbeans 4.0" New topic
Author

How to run JUnit test in Netbeans 4.0

Chris Johnston
Ranch Hand

Joined: Dec 13, 2004
Posts: 85
Hello all,

I am trying out the new Netbeans 4.0 IDE and have hit a snag. Before giving up completely and going back to Eclipse, I thought I would ask for some help here.

I have a web project that I am working on using Tomcat 5 and setup as a proper J2EE web project in Netbeans. I am also using Hibernate. As such, I have created a few JUnit tests to run against my persisted objects and hibernate to ensure that the mappings are working correctly. However, I can not seem to get the tests to run within Netbeans. This is a very simple thing to do in Eclipse, but how do you do it in netbeans?

I can not find a "run junit test" button anywhere and the only things I can find to run the test results in an error message -- No servlet mapping in web.xml file.

Is this a limitation of Netbeans?


www.fuzzylizard.com
Chris Johnston
Ranch Hand

Joined: Dec 13, 2004
Posts: 85
In case anyone cares, I don't think this is possible to do. I have tried every which way I can think of and I can not find any way of running JUnit tests on a standard java object in Netbeans if the project is configured as a web project.

In fact, I have found that Netbeans is severaly lacking in its support for JUnit. One definite strike against it when compared with Eclipse.

I personally like seeing that nice green line when all my tests pass, in Netbeans, I don't even get a line saying "All Tests: OK"
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

Chris,
Thanks for sharing your experiences. I haven't used Netbeans, but I did come across this page. Have you seen it?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Chris Johnston
Ranch Hand

Joined: Dec 13, 2004
Posts: 85
Hi,

I have not seen that page, but I have seen all of the linked pages off that page pertaining to running JUnit in Netbeans 4.0. If you are working on a straight Java project, running JUnit is no problem. The steps outlined in the help files and other pages work great (although I have been unable to find any evidence of a nice little graphical Swing UI for JUnit). I have confirmed this by running JUnit tests against classes in a simply Java project.

The problem exists when you try to run JUnit tests for a web project. These simply do not work which makes no sense to me. I should be able to test straight Java classes with JUnit from within the IDE. However, this most basic ability is lacking in Netbeans 4.0.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to run JUnit test in Netbeans 4.0
 
Similar Threads
what IDE my company need ?
Should I use TestSuite in Junit 4?
How to run UT in Eclipse/Maven
Junit in WSAD problems
TestNg or Junit