TSTool / Command / CheckFile
Overview
The CheckFile
command checks a file's statistic (properties) against criteria.
See also the CompareFiles
command,
which can be used to compare the properties of two files.
Examples of use include:
- check that a file has non-zero size as output from a process
- check for lines matching expected output (or check that an error indicator is not present) a pattern as part of automated testing
Use the CompareFiles
command
if it is necessary to compare two files, for example size or modification time.
Command Editor
The following dialog is used to edit the command and illustrates the command syntax for statistic parameters.
CheckFile
Command Editor for Statistic Parameters (see also the full-size image)
The following parameters indicate the check criteria.
CheckFile
Command Editor for Criteria and Action Parameters (see also the full-size image)
The following parameters will output the check results to a table, which can be further manipulated.
CheckFile
Command Editor for Output Parameters (see also the full-size image)
Command Syntax
The command syntax is as follows:
CheckFile(Parameter="Value",...)
Command Parameters
Tab | Parameter | Description | Default |
---|---|---|---|
InputFile required |
Name of the input file to process. Can use ${Property} notation. |
None - must be specified. | |
IfNotFound |
Indicate an action if the input file is not found:
|
Warn |
|
Statistic | Statistic required |
Statistic to compute. See the table below. | None - must be specified. |
SearchPattern |
A string to match if Statistic =PatternMatchLineCount .
|
||
Check Criteria and Actions | CheckCriteria |
The criteria that is checked, one of:
${Property} notation. |
None – must be specified. |
CheckValue1 |
A parameter that is used for specific CheckCriteria values. Can use ${Property} notation. |
||
CheckValue2 |
A parameter that is used for specific CheckCriteria values, currently only needed for InRange and OutOfRange criteria. Can use ${Property} notation. |
||
ProblemType |
The problem type that will be shown in warning messages. Can use ${Property} notation. |
Statistic-CheckCriteria |
|
IfCriteriaMet |
Indicate whether to set the command status if the statistic meets the criteria, one of:
|
The command status will not be changed. | |
PropertyName |
If the statistic meets the criteria, set the property identified by PropertyName to PropertyValue . Can use ${Property} notation. |
No property is set. | |
PropertyValue |
If the statistic meets the criteria, set the property identified by PropertyName to PropertyValue . Can use ${Property} notation. |
No property is set. | |
Output | TableID |
Identifier for table that receives the statistic. Can use ${Property} notation. |
Optional – table output is not required. |
TableFilenameColumn |
Table column name that is used to look up the file. If a matching filename is not found, a row will be added to the table. If a filename is found, the statistic cell value for the file is modified. Can use ${Property} notation. |
Optional – table output is not required. | |
TableStatisticColumn |
Table column name to receive the statistic name. If not found in the table, a new column is added automatically. Can use ${Property} notation. |
Statistic |
|
TableStatisticValueColumn |
Table column name to receive the statistic value. If not found in the table, a new column is added automatically. Can use ${Property} notation. |
StatisticValue |
The following statistics can be used for the Statistic
command parameter.
File Statistics
Statistic | Description |
---|---|
FileSizeBytes |
File size in bytes. |
FileSizeLines |
File size as number of lines. |
PatternMatch |
Planned future feature. The number of matching text patterns, can be more than one match on a line. |
PatternMatchLineCount |
The number of lines that contain a matching text pattern. |
Examples
See the automated tests.
Troubleshooting
See Also
CheckTimeSeries
commandCheckTimeSeriesStatistic
commandCompareFiles
commandCompareTables
command