The main goal of the generic support for unit testing is to provide an API that would allow to easily add support for various specific types of unit test frameworks (JUnit, PHPUnit, J2MEUnit, Ruby tests, …) into various project types (J2SE projects, NB modules, WebApps, C/C++, Ruby, …) into the IDE.
The most important changes from the current state:
One external module can add support for multiple specific testing frameworks (but will usually add support for only one).
It is not necessary for one external module to add support to all project types – it can add support only to a small number of project types, while another module adds support for the same testing framework to other project types.
So far, the NetBeans support for unit testing is spread across several modules as follows:
One of the consequences is that every time the test execution mechanism needs to be changed (e.g. make Ant-based projects generate XML report files), the developer who wants this change must make the change not only in the JUnit module, but also in modules defining web projects, NetBeans module projects, several sub-types of J2SE projects, J2ME projects, etc. For each type of project, the change requires a change of a (typically) quite large build file and possibly also some changes in the Java code. As more and more project types are supported, this is becoming a maintenance nightmare.
These are the expected results of the transition to a generic support for unit tests:
In the description below, the term "testing framework" refers to the generic unit testing framework being described by this document.
Module Projects UI does not know anything about unit testing. Module Generic Unit Testing Framework provides all the tests-related actions currently provided by module Projects UI. It depends on the projects Modules providing support for project types may not know anything about unit testing either.
Features provided by the testing framework:
API changes required in the projects infrastructure:
SPI of modules providing support for individual unit testing frameworks
The description so far only assumed that all projects are Ant-based. But this was a wrong assumption. So we should either make it more general (such that it works with projects not based not Ant, for example with C/C++ projects) or declare that it is only for Ant-based projects.
Shortcuts for execution of unit tests should be changed as follows:
| Ctrl+F6 | Executes a unit test corresponding to the currently selected class, using the appropriate unit testing framework. The change is that if the currently selected class represents a unit test, it is executed itself. |
| Shift+F6 | Executes the currently selected class using the project's main execution mechanism, i. e. not using any testing framework. |