Test Runner - Filters
Filters allow you to enforce certain constraints on scanners. All scanners use a simple strpos() type string matching technique which allows for fairly flexible white/black listing schemes.
Global Filtering
As of version 0.6 the capability to provide globalized filtering over every scanner has been added. The following snippit shows where this may be located in a typical configuration.
<config>
...
<scanners>
<filters>
<filter> ... </filter>
</filters>
<scanner> ... </scanner>
</scanners>
</config>
Filter Types
Each type of filter is currently either white or black list based which is covered in the filter tabs below.
Directory Filter (Blacklist)
This filter blocks the retrieval of any files within a directory that contains any of the configured paths. Paths may be relative or absolute as the matching is done via a string search (strpos) on the current directory's full path.
Configuration
<config>
...
<scanners>
<scanner>
...
<filters>
<filter>
<type>Directory</type>
<options>
<directories>C:\absolute\to\skip,relative/skipped</directories>
</options>
</filter>
</filters>
</scanner>
</scanners>
</config>
Note: you may also use <directory>C:\absolute\skip</directory><directory>relative/skipped</directory> .. etc instead of comma delimiting
Source
Source for the Directory Filter: TestRunner/library/Blerby/TestRunner/Filter/Directory.php
Extension Filter (Whitelist)
This filter enforces the fact that the files retrieved have one of the explicitly configured file extensions. If you're tests end with something like ***.test.php, and they are intermixed with other files this filter can be used to filter them out. (example: <file>.test.php</file>)
Configuration
<config>
...
<scanners>
<scanner>
...
<filters>
<filter>
<type>Extension</type>
<options>
<extensions>.php,.php5,.inc</extensions>
</options>
</filter>
</filters>
</scanner>
</scanners>
</config
Note: you may also use <extension>.php</extension><extension>.php5</extension> .. etc instead of comma delimiting
Source
Source for the Extension Filter: TestRunner/library/Blerby/TestRunner/Filter/Extension.php
File Filter (Blacklist)
This filter skips files that are fully/partially matched. You may specify a relative / absolute path with these if the situation requires.
Configuraion
<config>
...
<scanners>
<scanner>
...
<filters>
<filter>
<type>File</type>
<options>
<files>file1.php,file2.php</files>
</options>
</filter>
</filters>
</scanner>
</scanners>
</config>
Note: you may also use <file>file1.php</file><file>file2.php</file> .. etc instead of comma delimiting
Source
Source for the File Filter: TestRunner/library/Blerby/TestRunner/Filter/File.php
Source
Source to the base filter implementation: TestRunner/library/Blerby/TestRunner/Filter.php
Related