Skip to content

Test Locator

JohnBeaufoy edited this page Oct 8, 2018 · 4 revisions

Overview

This component collates unit tests for execution based on the following criteria:

  • Which schema or class the test is located in
  • Which schema or class the test has as a parent
  • Any prefix naming convention of the unit test method
  • Commented Data annotations

Primarily this is used by the Batch runner.

Implementation

Create an instance of ATLocator, specify your criteria, and the results will appear in ATLocator::unitTests

vars
	testLocator	: ATLocator;
		
begin
	create testLocator transient;
	
	// specify filters

	write testLocator.unitTests.size());

Filter examples

Find all tests in the environment:

	testLocator.addSchema( rootSchema, true );

Find all tests in the current schema:

	testLocator.addSchema( currentSchema, false );

Find all tests on specific unit test classses:

	testLocator.addClass( ATLocatorTests );
	testLocator.addClass( ATDatabaseTests );

Find all tests in the current schema that are marked as Integration tests:

	testLocator.sourceAnnotations.add( "#IntegrationTest" );
	testLocator.addSchema( currentSchema, false );

Find all tests in the environment which are considered Fast (those NOT marked as Slow):

	testLocator.sourceAnnotationsAvoid.add( "#SlowTest" );
	testLocator.addSchema( rootSchema, true );
Clone this wiki locally