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.
[ 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.
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.
Created attachment 17092 [details] zipped sample ANT JUnit project made outside of the ide
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.)
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.
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.
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.
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.
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
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
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.
Awaiting UI spec.
Fixed as part of issue #53198. No GUI yet in project properties dialog.