Packageorg.flexunit.internals.builders
Classpublic class MetaDataBuilder
InheritanceMetaDataBuilder Inheritance RunnerBuilderBase Inheritance Object

The MetaDataBuilder potentially builds an IRunner runner that is specificed in the metadata tag for a specific test class. If no metadata tag is present or the IRunner fails to build, no IRunner will be generated. If a test class wants to use a defined IRunner, it should include the [RunWith] tag that lists the full class name of the IRunner. The MetaDataBuilder provides a hug hook for extensibility, allowing many different types of IRunners to be created and used to run tests.
                  
	 [RunWith("org.flexunit.runners.Suite")]
	 public class testSuite {
	 	[Test]
	 	public function testMe():void { ...
	 	}
	 }
               
The IRunner that is to be built by the MetaDataBuilder should have a constructor implemented in one of the two following manners:
                  
	 public function RunnerClass( testClass:Object ) { ...
	 }
	 
               
Where testClass is the class to be run.
                  
	 public function RunnerClass( testClass:Object, suiteBuilder:IRunnerBuilder ) { ...
	 }
	 
               
Where testClass is the class to be run and suiteBuilder is an IRunnerBuilder.



Public Methods
 MethodDefined By
  
Constructor.
MetaDataBuilder
  
buildRunner(runnerClassName:String, testClass:Class):IRunner
Builds an IRunner based on a runnerClassName for the provided testClass.
MetaDataBuilder
  
canHandleClass(testClass:Class):Boolean
[override] Returns a boolean value indicating if this builder will be able to handle the testClass or not
MetaDataBuilder
  
runnerForClass(testClass:Class):IRunner
[override] Returns an IRunner based on the metadata of the provided testClass.
MetaDataBuilder
 Inherited
runners(parent:Class, children:Array):Array
Constructs and returns a list of IRunners, one for each child class in children.
RunnerBuilderBase
 Inherited
safeRunnerForClass(testClass:Class):IRunner
Returns an IRunner that can safely run the provided testClass.
RunnerBuilderBase
Constructor Detail
MetaDataBuilder()Constructor
public function MetaDataBuilder(suiteBuilder:IRunnerBuilder)

Constructor.

Parameters
suiteBuilder:IRunnerBuilder — An IRunnerBuilder to use to build the runner if the runner expects the test class as its first argument and a IRunnerBuilder as its second argument.
Method Detail
buildRunner()method
public function buildRunner(runnerClassName:String, testClass:Class):IRunner

Builds an IRunner based on a runnerClassName for the provided testClass.

Parameters

runnerClassName:String — The name of the runner to be used for the provided testClass.
 
testClass:Class — The test class to provide to the builder.

Returns
IRunner — an IRunner for the provided testClass if it has proper metadata and is successfully built; otherwise, returns a value of null.

Throws
InitializationError — Thrown if there is an issue when building the IRunner.
canHandleClass()method 
override public function canHandleClass(testClass:Class):Boolean

Returns a boolean value indicating if this builder will be able to handle the testClass or not

Parameters

testClass:Class — The class to test to determine an IRunner. Returns false, forcing any new subclasses of RunnerBuilderBase to override this method.

Returns
Boolean
runnerForClass()method 
override public function runnerForClass(testClass:Class):IRunner

Returns an IRunner based on the metadata of the provided testClass.

Parameters

testClass:Class — The test class for which to find an IRunner.

Returns
IRunner — an IRunner for the provided testClass if it has proper metadata and is successfully built; otherwise, returns a value of null.