Tester

From fmepedia

Tester is a Workbench Transformer.


Table of contents



Description

The Tester tests an argument or set of arguments for a Feature, and then routes that feature through either a PASSED or FAILED port depending on the results of the test(s). Because it is a feature routing transformer it comes under the 'Filters' category in the Workbench gallery.


The arguments to test can include two attributes (for example, attribute1 = attribute2?) or one attribute and one constant (for example, attribute1 != 10?). It could even be two constants (for example, 10 > 5?) - though there isn't much point in doing that.



Most Used Transformer

In a poll of the Safe Professional Services team the Tester transformer is the one most used within our workspaces!



Updates

In FME2010 the Tester received updates to the GUI to permit composite tests (a combination or ANDs and ORs).



Above: A composite test; testing where Attr1 is equal to 10 or 20, and Attr2 is not equal to 999



Supported Operators

Test  Description  Example

=
>
<
>=
<=
!=

  • Equals
  • Greater Than
  • Less Than
  • Greater Than or Equal To  
  • Less Than or Equal To
  • Not Equal To
  • Road_Name = 'High Street'
  • Property_Size > 200
  • Attribute1 < Max_Attribute1
  • Road_Length >= 100
  • Vegetation_Area <=499
  • Property_Owner != Property_Resident   



Pass Criteria

The Pass Criteria setting can be 'One Test Must Pass' or 'All Tests Must Pass' - the difference being whether the arguments are AND or OR; for example...

Test1         : Road_Type = Highway
Test2         : Road_Length > 100
Pass Criteria : One Test Must Pass

Argument      : Road_Type = Highway OR Road_Length > 100
Test1         : Road_Type = Highway
Test2         : Road_Length > 100
Pass Criteria : All Tests Must Pass

Argument      : Road_Type = Highway AND Road_Length > 100



Test Modes

The Test Mode function allows a user to distinguish between numeric and alphanumeric tests; for example...

Attribute1    = 4E54
Test1         : Atttribute1 = 4D54
Test Mode     : Numeric

Result        : Test Passed (because in numeric terms 4E54 is the same as 4D54 - both are equivalent to 4.0e+54)
Attribute1    = 4E54
Test1         : Atttribute1 = 4D54
Test Mode     : AlphaNumeric

Result        : Test Failed (because in alphanumeric terms 4E54 is not the same as 4D54)


Unfortunately, where there are multiple tests within a single Tester transformer, it it not possible to have different test modes for each test; i.e. the test mode applies to all tests: either all tests are numeric or all tests are alphanumeric. The same does not apply to the TestFactory where a single instance is capable of multi-mode testing.



Example

The attached workspace shows an example use of the Tester transformer.

In this example parks are tested according to an area attribute - there are examples of both AND and OR based tests.


Workspace Screenshot

Attached Files
filesizedate
Tester Example.jpg106.5 kB08/19/09
Tester Example.zip96.5 kB08/19/09
TesterComposite.png26.2 kB08/20/09
index.php------
test.php------
User Comments Add a new comment