org.netbeans.modules.nbjunit/1 1.75

org.netbeans.junit
Class NbModuleSuite

java.lang.Object
  extended by org.netbeans.junit.NbModuleSuite

public class NbModuleSuite
extends Object

Wraps a test class with proper NetBeans Runtime Container environment. This allows to execute tests in a very similar environment to the actual invocation in the NetBeans IDE. To use write your test as you are used to and add suite static method:

 public class YourTest extends NbTestCase {
   public YourTest(String s) { super(s); }
 
   public static Test suite() {
     return NbModuleSuite.create(YourTest.class);
   }
 
   public void testXYZ() { ... }
   public void testABC() { ... }
 }
 

Since:
1.46

Nested Class Summary
static class NbModuleSuite.Configuration
          Settings object that allows one to configure execution of whole NbModuleSuite.
 
Method Summary
static junit.framework.Test allModules(Class<? extends junit.framework.TestCase> clazz, String... tests)
          Factory method to create wrapper test that knows how to setup proper NetBeans Runtime Container environment.
static junit.framework.Test create(Class<? extends junit.framework.TestCase> clazz, String clustersRegExp, String moduleRegExp)
          Factory method to create wrapper test that knows how to setup proper NetBeans Runtime Container environment.
static junit.framework.Test create(Class<? extends junit.framework.TestCase> clazz, String clustersRegExp, String moduleRegExp, String... tests)
          Factory method to create wrapper test that knows how to setup proper NetBeans Runtime Container environment.
static junit.framework.Test create(NbModuleSuite.Configuration config)
          Factory method to create wrapper test that knows how to setup proper NetBeans Runtime Container environment.
static NbModuleSuite.Configuration createConfiguration(Class<? extends junit.framework.TestCase> clazz)
          Creates default configuration wrapping a class that can be executed with the NbModuleSuite support.
static NbModuleSuite.Configuration emptyConfiguration()
          Creates empty configuration without any class assiciated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static junit.framework.Test create(Class<? extends junit.framework.TestCase> clazz,
                                          String clustersRegExp,
                                          String moduleRegExp)
Factory method to create wrapper test that knows how to setup proper NetBeans Runtime Container environment. Wraps the provided class into a test that set ups properly the testing environment. The set of enabled modules is going to be determined from the actual classpath of a module, which is common when in all NetBeans tests. All other modules are kept disabled. In addition,it allows one limit the clusters that shall be made available. For example ide|java will start the container just with platform, ide and java clusters.

Parameters:
clazz - the class with bunch of testXYZ methods
clustersRegExp - regexp to apply to name of cluster to find out if it is supposed to be included in the runtime container setup or not
moduleRegExp - by default all modules on classpath are turned on, however this regular expression can specify additional ones. If not null, the specified cluster will be searched for modules with such codenamebase and those will be turned on
Returns:
runtime container ready test

create

public static junit.framework.Test create(Class<? extends junit.framework.TestCase> clazz,
                                          String clustersRegExp,
                                          String moduleRegExp,
                                          String... tests)
Factory method to create wrapper test that knows how to setup proper NetBeans Runtime Container environment. Wraps the provided class into a test that set ups properly the testing environment. The set of enabled modules is going to be determined from the actual classpath of a module, which is common when in all NetBeans tests. All other modules are kept disabled. In addition,it allows one limit the clusters that shall be made available. For example ide|java will start the container just with platform, ide and java clusters.

Parameters:
clazz - the class with bunch of testXYZ methods
clustersRegExp - regexp to apply to name of cluster to find out if it is supposed to be included in the runtime container setup or not
moduleRegExp - by default all modules on classpath are turned on, however this regular expression can specify additional ones. If not null, the specified cluster will be searched for modules with such codenamebase and those will be turned on
tests - names of test methods to execute from the clazz, if no test methods are specified, all tests in the class are executed
Returns:
runtime container ready test
Since:
1.49

allModules

public static junit.framework.Test allModules(Class<? extends junit.framework.TestCase> clazz,
                                              String... tests)
Factory method to create wrapper test that knows how to setup proper NetBeans Runtime Container environment. Wraps the provided class into a test that set ups properly the testing environment. All modules, in all clusters, in the tested applicationwill be included in the test.

Parameters:
clazz - the class with bunch of testXYZ methods
tests - names of test methods to execute from the clazz, if no test methods are specified, all tests in the class are executed
Returns:
runtime container ready test
Since:
1.49

createConfiguration

public static NbModuleSuite.Configuration createConfiguration(Class<? extends junit.framework.TestCase> clazz)
Creates default configuration wrapping a class that can be executed with the NbModuleSuite support.

Parameters:
clazz - the class to test, the actual instances will be created for the class of the same name, but loaded by different classloader
Returns:
config object prefilled with default values; the defaults may be altered with its addition instance methods
Since:
1.48

emptyConfiguration

public static NbModuleSuite.Configuration emptyConfiguration()
Creates empty configuration without any class assiciated. You need to call NbModuleSuite.Configuration.addTest(java.lang.Class, java.lang.String[]) then to register proper test classes.

Returns:
config object prefilled with default values; the defaults may be altered with its addition instance methods
Since:
1.50

create

public static junit.framework.Test create(NbModuleSuite.Configuration config)
Factory method to create wrapper test that knows how to setup proper NetBeans Runtime Container environment. This method allows better customization and control over the executed set of tests. Wraps the provided class into a test that set ups properly the testing environment, read more in NbModuleSuite.Configuration.

Parameters:
config - the configuration for the test
Returns:
runtime container ready test
Since:
1.48
See Also:
NbModuleSuite.Configuration.suite()

org.netbeans.modules.nbjunit/1 1.75

Built on May 24 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.