Skip navigation links

Introduction

This document lists changes made to the NetBeans JUnit Extensions API.


Index of APIs

Incompatible changes by date

Fuller descriptions of all changes can be found below (follow links).

Not all deprecations are listed here, assuming that the deprecated APIs continue to essentially work. For a full deprecation list, please consult the Javadoc.

All changes by date

Changes by version

These API specification versions may be used to indicate that a module requires a certain API feature in order to function. For example, if you see here a feature you need which is labelled 1.20, your manifest should contain in its main attributes the line:

OpenIDE-Module-Module-Dependencies: org.netbeans.modules.nbjunit > 1.20

Changes by affected class

org.netbeans.junit.Log

org.netbeans.junit.MockServices

org.netbeans.junit.NbModuleSuite

org.netbeans.junit.NbTestCase

org.netbeans.junit.RandomlyFails


Details of all changes by API and date


NetBeans JUnit Extensions

Support for Hamcrest library

Jul 15 '20; API spec. version: 1.99; affected top-level classes: NbModuleSuite; made by: sdedic

NbModuleSuite loads org.hamcrest from the same classloader as org.junit classes to prevent LinkageErrors.

JUnit ignore annotation

Jun 21 '20; API spec. version: 1.98; affected top-level classes: NbTestCase; made by: hectorespert

Add support for JUnit @Ignore annotation on NbTestCase test case extension.

NbModuleSuite.Configuration.parentClassLoader()

Jun 17 '18; API spec. version: 1.91; affected top-level classes: NbModuleSuite; made by: jlahoda

Adding a way to set parent classloader on which the NB platform should start.

System property branding.token

Dec 1 '11; API spec. version: 1.72.2; affected top-level classes: NbModuleSuite; made by: jtulach; issues: #197066

System.getProperty("branding.token") recognized and influences branding used during the test.

NbModuleSuite.Configuration.hideExtraModules()

Nov 11 '11; API spec. version: 1.72; affected top-level classes: NbModuleSuite; made by: jtulach; issues: #185291

Now there is a way to disable not explicitly enabled modules.

NbModuleSuite.Configuration.suite()

May 19 '11; API spec. version: 1.70; affected top-level classes: NbModuleSuite; made by: jglick; issues: #197720

You may now call suite() directly on a Configuration object.

NbTestCase.logRoot to collect messages from just some code

May 5 '11; API spec. version: 1.68; affected top-level classes: NbTestCase; made by: jglick; issues: #197572

Overridable method to avoid excessive logging of uninteresting components.

NbModuleSuite.Configuration.addStartupArgument

Apr 8 '11; API spec. version: 1.69; affected top-level classes: NbModuleSuite; made by: tomwheeler; issues: #197065

NbModuleSuite.Configuration now has a addStartupArgument method which allows one to append one or more command line arguments which will be used to start the application. Arguments which must be passed directly to the JVM should still be specified in the test.run.args property.

Easy way to fail the test on error or warning

Mar 15 '09; API spec. version: 1.58; affected top-level classes: NbModuleSuite; made by: jtulach; issues: #155444

Do you need to fail the test when some wrong message or exception is logged? Easy now with Configuration.failOnMessage(Level.WARNING) and Configuration.failOnException(Level.INFO).

Leave autoloads as autoloads and eagers as eager

Feb 13 '09; API spec. version: 1.57; affected top-level classes: NbModuleSuite; made by: jtulach

One can decide to not enable autoload modules by calling Configuration.honorAutoEager(true).

Ignore modules on classpath

Jan 5 '09; API spec. version: 1.56; affected top-level classes: NbModuleSuite; made by: jtulach

One can decide to not include modules on classpath in the test by calling Configuration.enableClasspathModules(false).

Enable modules in a cluster

Dec 20 '08; API spec. version: 1.55; affected top-level classes: NbModuleSuite; made by: jtulach; issues: #153624

It is now possible to easily enable modules in one cluster due to Configuration.enableModules method.

NbModuleSuite's clusters method can be called multiple times

Dec 20 '08; API spec. version: 1.55; affected top-level classes: NbModuleSuite; made by: jtulach; issues: #153624

Semantics of Configuration.clusters method has been extended. It can now be called multiple times to accumulate the results.

Log.assertInstances can take list of names one is searching for

Aug 8 '08; API spec. version: 1.53; affected top-level classes: NbModuleSuite; made by: mrkam

Enhanced version of assertInstances(String msg, String... types) added.

Added @RandomlyFails

Jun 19 '08; API spec. version: 1.51; affected top-level classes: RandomlyFails; made by: jglick; issues: #137069

New annotation added to easily mark tests which occasionally fail for no particular reason.

NbModuleSuite.Configuration.reuseUserDir(boolean reuse)

Jun 18 '08; API spec. version: 1.52; affected top-level classes: NbModuleSuite; made by: mrkam

NbModuleSuite.Configuration now has reuseUserDir(boolean) method which enables test suite to reuse userdir from previous suite run.

NbModuleSuite.Configuration.addTest(Class < ? extends Test> test)

Jun 11 '08; API spec. version: 1.51; affected top-level classes: NbModuleSuite; made by: jsedek

NbModuleSuite.Configuration now has addTest(java.lang.Class) method which allows to add Test implementation classes into configuration and execution of the NbModuleSuite.

NbModuleSuite.emptyConfiguration()

Jun 10 '08; API spec. version: 1.51; affected top-level classes: NbModuleSuite; made by: jtulach

NbModuleSuite now has emptyConfiguration() method which returns empty, ready to be configured configuration.

NbModuleSuite can now wrap multiple TestCase

Jun 3 '08; API spec. version: 1.50; affected top-level classes: NbModuleSuite; made by: jtulach

NbModuleSuite.Configuration now has addTest(clazz, tests) method which allows to add multiple test classes into single configuration and execution of the NbModuleSuite.

New Utilitity methods in NbModuleSuite

Jun 3 '08; API spec. version: 1.49; affected top-level classes: NbModuleSuite; made by: jtulach

Shura requested few new methods to simplify creation of NbModuleSuite's. Added, allModules and another variant of create to complement the general customization with NbModuleSuite.Configuration.

Support class to allow excution of unit tests inside of NetBeans Runtime Container

Feb 29 '08; API spec. version: 1.46; affected top-level classes: NbModuleSuite; made by: jtulach

It always used to be hard to setup the right environment for test execution. In case this NetBeans this is even harder. The module system is ready to work without classpath isolation, however not every feature is available and not every behavior remains the same That is why there is now the new NbModuleSuite support class that allows to really start the whole NetBeans Runtime Container, satisfy all the dependencies and only then load the testing class and execute it.

Support for Garbage Collecting of Log Message Arguments

Dec 14 '07; API spec. version: 1.44; affected top-level classes: Log; made by: jtulach

Methods enableInstances and assertInstances added to Log class to simplify writing memory leaks tests integrated with timers/counters infastructure.

Default implementation of Preferences isn't used for running tests anymore

Oct 13 '06; API spec. version: 1.38; affected top-level classes: NbTestCase; made by: rmatous

Not persistent implementation of java.util.prefs.Preferences is installed in place of the platform-specific default implementation for running tests. See document Preferences in NetBeans to learn more.

Added class MockServices

Jun 30 '06; API spec. version: 1.33; affected top-level classes: MockServices; made by: jtulach

The MockServices class now supports closer cooperation with Lookup. By default, clients listening to Lookup.Result changes will be notified about change in its content whenever one calls MockServices.setServices.

Added class MockServices

May 11 '06; API spec. version: 1.30; affected top-level classes: MockServices; made by: jglick

Added new utility to help unit tests create mock implementations of global services for lookup.

Non-deterministic execution can be made deterministic

Apr 1 '06; API spec. version: 1.28; affected top-level classes: NbTestCase Log; made by: jtulach; issues: #35067

An excelent tool to emulate race condition, deadlock or any other non-deterministic behaviour created in the form of Log.controlFlow method.

Added support for logging

Apr 1 '06; API spec. version: 1.27; affected top-level classes: NbTestCase Log; made by: jtulach; issues: #35067

Added two ways how to enable logging in a test case. One can either overwrite NbTestCase.logLevel method and return the right level to capture in the test and then all the messages logged with the level and greater will be sent to NbTestCase.getLog() stream which is placed in working directory.

Or one can directly call Log.enable to capture all the logging into a CharSequence which can be later queried for its content, usually by calling its.toString() method.