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 104108 - Cannot run tests on 6.0 NetBeans Platform Application
Summary: Cannot run tests on 6.0 NetBeans Platform Application
Status: RESOLVED DUPLICATE of bug 108686
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: PC All
: P2 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-16 19:52 UTC by tomwheeler
Modified: 2007-07-24 22:18 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tomwheeler 2007-05-16 19:52:37 UTC
I have found a problem in 6.0M9 and recent daily builds (such as 200705131800)
when running tests for a NetBeans platform application, built on the IDE itself. 

To reproduce is simple:

1.  Create a new suite project

2.  Add a new module to the suite from step #1

3.  Create a basic class in your module, such as:

     public class SimpleMath {
    
         public long add(int n1, int n2) {
              return n1 + n2;
         }
     }

4.  Right-click your new class and use Tools ->  Create JUnit tests

5.  Update your test with a working implementation, such as:

     public void testAdd() {
        SimpleMath instance = new SimpleMath();        
        long result = instance.add(5, 8);
        assertEquals(13L, result);
     }

6. Right-click on your module and choose "Run unit tests".

The error seems to vary based on whether I am using a daily build or M9, but it
 cannot either find the junit.framework.TestCase class or the assert methods.  I
verified that the JUnit library is shown under Unit Test Libraries of the
module, but it doesn't find these classes/methods anyway.

Repeating these steps in 6.0M8 or 5.5 works as expected -- I can compile and run
the unit test without errors.
Comment 1 tomwheeler 2007-05-16 22:54:20 UTC
I verified this on a colleague's computer with M9 as well.  It fails to
effectively find JUnit as previously described.  Both machines are running
Windows XP, though I can try on Mac, Solaris, Linux and others if it is needed.
Comment 2 tomwheeler 2007-05-30 22:16:06 UTC
moving this to IDE because that may be a better component.
Comment 3 tomwheeler 2007-06-01 22:41:09 UTC
I just installed a recent daily build (20070528) and verified this problem still
exists.  A workaround is to set test.unit.cp.extra in each module's
project.properties file to the path of a junit jar, e.g.:

test.unit.cp.extra=${harness.dir}/extras/junit-3.8.1.jar

However, this should not be necessary as it used to work out of the box in
previous versions of NetBeans.
Comment 4 eduardmanas 2007-06-06 11:56:47 UTC
I think we shouldn't limit what third party libraries can be used for tests.  
Some people will love Netbeans junits, most will prefer junits (some 3.8 and 
others 4.0), others will want to use mock libraries (easymock, jmock...) and so 
on.  

My suggestion is to make third party libraries for tests configurable the same 
way as we configure them for normal applications.

Eduard
Comment 5 Jesse Glick 2007-07-24 22:18:07 UTC

*** This issue has been marked as a duplicate of 108686 ***