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 47835 - [40cat] No UnitTestForSourceQueryImplementation in freeform projects
Summary: [40cat] No UnitTestForSourceQueryImplementation in freeform projects
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Freeform (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords: API
Depends on: 51151 53198 53533
Blocks: 42682
  Show dependency tree
 
Reported: 2004-08-24 20:22 UTC by jcstover
Modified: 2005-01-18 00:56 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
zipped sample ANT JUnit project made outside of the ide (12.78 KB, application/octet-stream)
2004-08-24 21:46 UTC, dmladek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jcstover 2004-08-24 20:22:45 UTC
[ BUILD # : beta1 ]
[ JDK VERSION : J2SE 1.5.0 ]

- I started using Netbeans 4.0 Beta1 using an exsisting project which is 
stored in cvs.
 - I set up my classpath/sourcedir etc.
 - There are sourcedir in where junit tests are living which are not created 
with Netbeans.
 - On a class I try to create a JUnit test which brings up de create test 
dialog message. So far everything goes as expected.
 - On ok it generates a the next text inside a errordialog : 

JUnit testing is not set up for source file MasterFileObject@<knip>
Usally this means that you have to first activate JUnit testing in the One thing to note I don't have a testing package inside the source tree. I 
don't know where to set a property to a src directory to indicate it is a 
test directory. My guess is that this is the problem. 

Is there a way to create a testdir or set an exsisting directory to status 
test? 
project this file belongs to.
Comment 1 dmladek 2004-08-24 21:39:34 UTC
thanks for the report!

I would complete some addition information:
User had Ant based project with JUnit task in defined in it.
This Project he imported to ide Java Proj with existing Ant script.

I've created sample ant project outside of ide which you could easily
import to ide and then reproduce this bug.
Comment 2 dmladek 2004-08-24 21:46:09 UTC
Created attachment 17092 [details]
zipped sample ANT JUnit project made outside of the ide
Comment 3 Jesse Glick 2004-08-24 23:29:11 UTC
Freeform projects for 4.0 do not have any mapping of source to test
dirs. Instead, just make empty test classes in the package root of
your choice and write the test methods you need.

(It would be simple enough to make such a mapping possible in
project.xml, but it is questionable how many users would ever discover
and use this, even if it were exposed in the GUI somehow.)
Comment 4 jcstover 2004-08-25 07:08:14 UTC
The way you describe to set up testclasses is doing it by hand. But
using ctrl-alt-j to create the stubs of the testingclass is a way to
good feature to get lost. If you can make a source-to-testdirectory
mapping in the properties of a project, it would be great. 

In Netbeans 3.6 creating JUnit testclasses always ask in which package
to create them. In 4.0 this isn't asked anymore, so automatically I
try to find it in the Project properties.
Comment 5 Ondrej Rypacek 2004-08-25 15:24:34 UTC
On the JUnit side, I hot-fixed this problem (see issue #47845) by
using source root for tests when the dedicated test root is not
available. 
The UI for selection of target package for newly created tests is not
optimal.We know that and plan to address it in the next release. 

I leave the bug open as I agree with jcstover in that there should be
some way to specify test root manually to gain full testing support. 
Comment 6 Jesse Glick 2004-08-25 20:02:08 UTC
I would love to do this, but it would be a format change in freeform
projects and I think it is too late for 4.0 to do format changes. No
one expressed much interest in it when the format was still in flux,
unfortunately, and we did a beta after freezing everything of interest.

Re. the hotfix to generate tests into the same source dir - may be
worse than nothing, I don't know. Generally you do not want them
there. You can cut and paste them into the test dir, of course.
Comment 7 Jesse Glick 2004-09-20 22:08:02 UTC
Will put in a workaround for 4.0: if there is exactly one source
package in the project whose folder name begins with the letters
"test", that will be considered to be the test folder for any other
source folders. Since people usually name test folders "test",
"tests", "testcases", etc., this should cover many common cases
adequately.
Comment 8 Jesse Glick 2004-09-21 21:17:05 UTC
Workaround in place for 4.0:

committed   * Up-To-Date  1.29       
ant/freeform/src/org/netbeans/modules/ant/freeform/FreeformProject.java
added       * Up-To-Date  1.1        
ant/freeform/src/org/netbeans/modules/ant/freeform/TestQuery.java
Comment 9 jcstover 2004-10-20 11:17:39 UTC
Just tested the issue in qbuild from 18 oct. The workaround works, and
will cover most cases. Hopefully it can also be added somewhere in the
documentation. Thanx
Comment 10 Jesse Glick 2004-10-20 19:44:41 UTC
JJ, consider mentioning 4.0 workaround in online help. Don't need to
refer to it as a "workaround". :-) Just say that if some source root
has a folder named "test" or something starting with "test", it should
be used by JUnit wizards when looking for a place to put tests etc.
Comment 11 Jesse Glick 2004-12-02 21:01:10 UTC
Awaiting UI spec.
Comment 12 Jesse Glick 2005-01-18 00:56:29 UTC
Fixed as part of issue #53198. No GUI yet in project properties dialog.