If the module doesn't contain Unit Test Packages then, there are some manual steps to follow for the setup. Without this setup, an error will occur when creating a Unit test from a class - "No test target folders found for file "foo.java". Cannot create any tests."
cfg-unit.xml sample
<?xml version="1.0" encoding="UTF-8"?>
<!--
The contents of this file are subject to the terms of the Common Development
and Distribution License (the License). You may not use this file except in
compliance with the License.
You can obtain a copy of the License at http://www.netbeans.org/cddl.html
or http://www.netbeans.org/cddl.txt.
When distributing Covered Code, include this CDDL Header Notice in each file
and include the License file at http://www.netbeans.org/cddl.txt.
If applicable, add the following below the CDDL Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The Original Software is NetBeans. The Initial Developer of the Original
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
Microsystems, Inc. All Rights Reserved.
-->
<!-- Configation file to group tests into testbags. For details see
http://xtest.netbeans.org/xtest_config.html
-->
<mconfig name="visualweb/dataconnectivity">
<testbag testattribs="stable" executor="unit-executor" name="visualweb/dataconnectivity">
<testset dir="unit/src">
<patternset>
<include name="**/*Test.class"/>
<exclude name="org/netbeans/modules/visualweb/dataconnectivity/datasource/FooTest.class"/>
</patternset>
</testset>
</testbag>
<compiler name="default-compiler" antfile="build-unit.xml" target="default-compiler" default="true"/>
<executor name="unit-executor" antfile="build-unit.xml" target="run-unit-test"/>
</mconfig>
build-unit.xml sample
<?xml version="1.0"?>
<!--
The contents of this file are subject to the terms of the Common Development
and Distribution License (the License). You may not use this file except in
compliance with the License.
You can obtain a copy of the License at http://www.netbeans.org/cddl.html
or http://www.netbeans.org/cddl.txt.
When distributing Covered Code, include this CDDL Header Notice in each file
and include the License file at http://www.netbeans.org/cddl.txt.
If applicable, add the following below the CDDL Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
The Original Software is NetBeans. The Initial Developer of the Original
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
Microsystems, Inc. All Rights Reserved.
-->
<project name="org.netbeans.modules.visualweb.dataconnectivity/test-unit" basedir="." default="all">
<!-- Imports default-compiler, run-unit-test targets referenced from cfg-unit.xml. -->
<import file="../../nbbuild/templates/xtest-unit.xml"/>
</project>
<property name="xtest.testtype" value="unit"/>
<test-dependencies>
<test-type>
<name>unit</name>
<test-dependency>
<code-name-base>org.netbeans.modules.projectapi</code-name-base>
<recursive/>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.openide.modules</code-name-base>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.masterfs</code-name-base>
</test-dependency>
<test-dependency>
<code-name-base>org.openide.util</code-name-base>
<compile-dependency/>
<test/>
</test-dependency>
</test-type>
<test-type>
<name>qa-functional</name>
</test-type>
</test-dependencies>
This will create a JUnit test under Unit Test Packages
For more info: