• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

How to run JUnit test in Netbeans 4.0

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Chris Johnston
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
 
author & internet detective
Posts: 42135
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chris,
Thanks for sharing your experiences. I haven't used Netbeans, but I did come across this page. Have you seen it?
 
Chris Johnston
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic