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.
If a project A defines an interface IA then it is logical for that project to also define an (abstract) test class/testcase (TA) for that interface with a factory method for creating instances that need to be tested. If project B has a class (CB) that implements interface IA, it could then create a test TB by simply extending TA and implementing the factory method. Since there are no options to generate a jar containing all test classes/testcases, there is currently no portable (automatic) way to reuse tests across projects. (including the build/test directory is not portable imho) Enhancement request: add functionality to create a jar containing all test code so that test code can be reused in other projects.
Just include ${A}/build/test/classes/ in the test compilation classpath for B. It should work AFAIK. I'm not sure what your meaning of "portable" is.
'Portable' as in 'usable in another IDE'. If I could give a jar containing tests to an Eclipse using developer, he/she can extend the (test)classes in that jar. One can add this to the build script manually, but that does not 'feel' right to me. Having the test code in the production code jar is a big no-no in my book.
Obviously you would not put test classes into the production JAR. Could be useful to have a separate test JAR target in a few situations. But you can already add a target to build.xml, e.g. <target name="jar-tests" depends="compile-test"> <jar jarfile="dist/tests.jar"> <fileset dir="${build.test.classes.dir}"/> </jar> </target> and you are done. Not sure why this doesn't "feel" right to you, other than the obvious fact that it takes an extra thirty seconds or so, and it is a little more cumbersome to run the target, though you can fix that by adding e.g. <target name="-post-jar" depends="jar-tests"/> so that Build makes the test JAR too. For that matter, people using other IDEs can also compile against unJARred test base classes, I presume. Main interesting enhancement in NB IDE would be to export this JAR as an artifact so you could choose to use it from the Add Project... dialog in a dependent project's test classpath. No immediate plans to implement however.
Your last alinea should have been in the original enhancement request. Maybe it could be handy to create an ant-task that can export JARs (or other files?) as artifacts to be included in other projects through 'Add Project'? It would be a generic solution to my particular 'problem'.
The "artifact" isn't currently a disk format, it's information provided directly from the subproject.
*** Issue 50621 has been marked as a duplicate of this issue. ***