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 108686 - JUnit 3 & 4 not found in module project tests (in editor, and during build)
Summary: JUnit 3 & 4 not found in module project tests (in editor, and during build)
Status: VERIFIED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
: 104108 106982 111058 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-07-02 20:38 UTC by _ tboudreau
Modified: 2007-07-26 20:07 UTC (History)
3 users (show)

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 _ tboudreau 2007-07-02 20:38:02 UTC
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)
Comment 1 _ tboudreau 2007-07-02 20:42:24 UTC
If you do JUnit-3 based tests, it does work, it appears.  So the problem is finding the JUnit 4 jar.
Comment 2 _ tboudreau 2007-07-02 20:43:14 UTC
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)
Comment 3 _ tboudreau 2007-07-02 20:48:35 UTC
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.
Comment 4 pzajac 2007-07-03 09:10:43 UTC
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
Comment 5 pzajac 2007-07-03 12:46:02 UTC
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
Comment 6 Jesse Glick 2007-07-10 00:41:52 UTC
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
Comment 7 pzajac 2007-07-10 10:56:28 UTC
verified
Comment 8 John Baker 2007-07-23 22:58:07 UTC
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
Comment 9 Jesse Glick 2007-07-23 23:05:42 UTC
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.
Comment 10 John Baker 2007-07-23 23:47:49 UTC
that was it - restarting the IDE resolved the org.junit package not found
Comment 11 Jesse Glick 2007-07-24 22:18:07 UTC
*** Issue 104108 has been marked as a duplicate of this issue. ***
Comment 12 pzajac 2007-07-26 12:44:01 UTC
*** Issue 111058 has been marked as a duplicate of this issue. ***
Comment 13 Jesse Glick 2007-07-26 16:09:49 UTC
Adjusting summary to reflect that a couple of things were actually covered here.
Comment 14 Marian Petras 2007-07-26 19:16:53 UTC
*** Issue 106982 has been marked as a duplicate of this issue. ***
Comment 15 John Baker 2007-07-26 20:07:18 UTC
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