Useful Test Classes in Modules

Apache NetBeans Wiki Index

Note: These pages are being reviewed.

If you are writing unit tests, here are some helpful classes present in modules (you need a <test/> dependency in your project.xml):

  • org.openide.util.test.MockChangeListener

  • org.openide.util.test.MockPropertyChangeListener

  • org.openide.util.test.MockLookup

Don’t be shy to add your own utilities to the appropriate modules - anything which makes it faster and less trouble-prone to write new unit tests will be good for product quality. If they are of general interest please add them here. (Some day we should put together Javadoc for them.)

Do you want to know who is using unit test classes? Run

ant -f nbbuild/build.xml generate-golden-files

and examine nbbuild/build/generated/test-deps.txt to find out. Since at least for now these utilities are only available for modules, there is no serious compatibility issue if you need to make some signature changes - but please do update existing users. You can find these by opening all projects listed as using the class in test-deps.txt and then using Find Usages to get the details.

For now you need to run test-build in the module with the test API before compiling your own tests. issue #102810.