This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 194911 - Cannot run JUnit tests
Summary: Cannot run JUnit tests
Status: REOPENED
Alias: None
Product: java
Classification: Unclassified
Component: JUnit (show other bugs)
Version: 7.0
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-31 13:51 UTC by Peter Nabbefeld
Modified: 2011-11-04 12:09 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Nabbefeld 2011-01-31 13:51:12 UTC
I've tried to create a JUnit test (works) and run it. Always getting
    "taskdef class org.testng.TestNGAntTask cannot be found"

Seems, NetBeans insists on TestNG while I'm trying to use JUnit.
NetBeans should either automatically detect, which libraries are used,
or at least there need to be a property.
Comment 1 Yulia Novozhilova 2011-02-15 15:17:22 UTC
Which NetBeans version do you use? How do you create tests? Have you installed TestNG Support plug-in (menu Tools -> Plugins -> Installed tab)? 
Please read the tutorial (http://netbeans.org/kb/docs/java/junit-intro.html) and try again. 

Even after installing TestNG Support plug-in (http://wiki.netbeans.org/TestNG) I can't reproduce your issue.
Comment 2 Peter Nabbefeld 2011-02-15 15:52:58 UTC
(In reply to comment #1)
> Which NetBeans version do you use?
Daily build

> How do you create tests? Have you installed
> TestNG Support plug-in (menu Tools -> Plugins -> Installed tab)? 
Of course, otherwise there couldn't be a reference to TestNG.

> Please read the tutorial (http://netbeans.org/kb/docs/java/junit-intro.html)
> and try again. 
> 
> Even after installing TestNG Support plug-in (http://wiki.netbeans.org/TestNG)
> I can't reproduce your issue.

I've already tried to fix this. First I've uninstalled TestNG, but this has been insufficient, so I fixed some files (don't remember exacly which).

The problem seems to be caused the following way:
1. Installed TestNG
2. Created new project.
   Seems to automatically integrate TestNG as a testing tool.
3. When I want to use the project without TestNG (removing also
   the lib from testing), I'm getting an error message, because
   the build script still wants to run TestNG.

Perhaps, tt'd be a good idea, to make the testing framework selectable in
project properties.
Comment 3 Yulia Novozhilova 2011-02-16 14:49:41 UTC
I managed to reproduce. it looks like TestNG plugin changes build-impl.xml and forces it to use testng-impl.xml. It is possible to fix them manually but I agree it would be nice to have such a property in the project.