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.
Download and install a daily build, minimal configuration. Create a new module with some unit tests. Try to test it. JUnit seems not to be found. Compiling 1 source file to /space/EditorThemeSuite/editorthemes/build/test/unit/classes /space/EditorThemeSuite/editorthemes/test/unit/src/org/netbeans/modules/editorthemes/SingleColoringPanelTest.java:16: package org.junit does not exist import org.junit.Test; /space/EditorThemeSuite/editorthemes/test/unit/src/org/netbeans/modules/editorthemes/SingleColoringPanelTest.java:17: package org.junit does not exist import static org.junit.Assert.*; /space/EditorThemeSuite/editorthemes/test/unit/src/org/netbeans/modules/editorthemes/SingleColoringPanelTest.java:28: package org.junit does not exist @org.junit.Before /space/EditorThemeSuite/editorthemes/test/unit/src/org/netbeans/modules/editorthemes/SingleColoringPanelTest.java:29: warning: [dep-ann] deprecated name isnt annotated with @Deprecated public void setUp() throws Exception { 3 errors 1 warning /Users/tim/Desktop/NetBeans 6.0 200707020000.app/Contents/Resources/NetBeans 6.0 200707020000/harness/common.xml:387: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 1 second)
If you do JUnit-3 based tests, it does work, it appears. So the problem is finding the JUnit 4 jar.
On second thought, I spoke too soon...looks fine in the editor, just can't actually build tests. Compiling 1 source file to /space/EditorThemeSuite/editorthemes/build/test/unit/classes /space/EditorThemeSuite/editorthemes/test/unit/src/org/netbeans/modules/editorthemes/SingleColoringPanelTest.java:17: package junit.framework does not exist import junit.framework.TestCase; /space/EditorThemeSuite/editorthemes/test/unit/src/org/netbeans/modules/editorthemes/SingleColoringPanelTest.java:24: cannot find symbol symbol: class TestCase public class SingleColoringPanelTest extends TestCase { 2 errors /Users/tim/Desktop/NetBeans 6.0 200707020000.app/Contents/Resources/NetBeans 6.0 200707020000/harness/common.xml:387: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 0 seconds)
Note if I run Ant in debug mode, I find the following Setting project property: libs.junit.classpath -> /Users/tim/Desktop/NetBeans 6.0 200707020000.app/Contents/Resources/NetBeans 6.0 200707020000/ java1/modules/ext/junit-3.8.2.jar:/Users/tim/Desktop/NetBeans 6.0 200707020000.app/Contents/Resources/NetBeans 6.0 200707020000/java1/ modules/ext/junit-4.1.jar The paths are correct, they just don't end up on the classpath for building the tests.
I am not sure if junit 4.x is supported in NBM projects. I found more serious problem in build [070703]. Compilation for junit 3.x test cases fails in module site and standalone module projects. Compiling 1 source file to /home/pzajac/NetBeansProjects/ddd/build/test/unit/classes /home/pzajac/NetBeansProjects/ddd/test/unit/src/s/NewEmptyJUnitTest.java:10: package junit.framework does not exist import junit.framework.TestCase; /home/pzajac/NetBeansProjects/ddd/test/unit/src/s/NewEmptyJUnitTest.java:16: cannot find symbol symbol: class TestCase public class NewEmptyJUnitTest extends TestCase { /home/pzajac/NetBeansP
I fixed (harcoded another one path) problem with mising junit on compilation and runtime classpath. It was caused by moving junit.jar to java cluster. IDE: [7/3/07 1:40 PM] Committing started Checking in build.xml; /cvs/apisupport/harness/release/build.xml,v <-- build.xml new revision: 1.26; previous revision: 1.25 done Compilation also work for Junit 4. Junit 4 are not on classpath in editor. It has to be fixed in apisupport/project
Checking in Evaluator.java; /shared/data/ccvs/repository/apisupport/project/src/org/netbeans/modules/apisupport/project/Evaluator.java,v <-- Evaluator.java new revision: 1.25; previous revision: 1.24 done
verified
The use case below seems to be related: If a module is setup for Functional tests already (but not unit tests), it appears the JUnit4 jar file is not found. I'm using the July 23 Full install nightly build. I added unit/src folders under the test folder then created a JUnit 4 test from an existing class. To reproduce: 1) open visualweb/dataconnectivity 2) create folders unit and src under the test folder (required for step 3) (I'll file an issue for this) 3) create a new JUnit 4 test for datasource/DataSourceUISettings.java The test class is generated but there are syntax errors: org.junit is not found
You probably need to at least restart the IDE for changes to take effect after adding a new test root. The live refresh logic is not very sophisticated.
that was it - restarting the IDE resolved the org.junit package not found
*** Issue 104108 has been marked as a duplicate of this issue. ***
*** Issue 111058 has been marked as a duplicate of this issue. ***
Adjusting summary to reflect that a couple of things were actually covered here.
*** Issue 106982 has been marked as a duplicate of this issue. ***
my earlier comment, desc11 was incorrect. When the test source file opens, syntax errors don't appear until the mouse is scrolled down or keys typed. please try the steps in desc9, including restarting the IDE