Improve examples of newer tool functional test features.

This commit is contained in:
John Chilton
2014-02-03 10:11:31 -06:00
parent 3b6eb6f7a5
commit d7a5f28121
3 changed files with 56 additions and 31 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
This directory contains tools only useful for testing the tool test framework
and demonstrating it features. Run the driver script 'run_functional_tests.sh'
with '-installed' as first argument to run through these tests.
with '-framework' as first argument to run through these tests.
+20 -13
View File
@@ -46,19 +46,8 @@
<data name="out_file1" format="txt" />
</outputs>
<tests>
<test>
<param name="p1|use" value="True"/>
<param name="p2|use" value="False"/>
<param name="p3|use" value="True"/>
<param name="p4|use" value="True" />
<param name="p4|file" value="simple_line.txt" />
<output name="out_file1">
<assert_contents>
<has_line line="4 7 4" />
<has_line line="This is a line of text." />
</assert_contents>
</output>
</test>
<!-- Can use nested conditional blocks as shown below to disambiguate
various nested parameters. -->
<test>
<conditional name="p1">
<param name="use" value="False"/>
@@ -83,5 +72,23 @@
</assert_contents>
</output>
</test>
<!-- Can also use a more concise, flat verison of this, but it the
above version is more clear and should be considered preferable.
-->
<test>
<param name="p1|use" value="True"/>
<param name="p2|use" value="False"/>
<param name="p3|use" value="True"/>
<param name="p4|use" value="True" />
<!-- Only need to specify enough of a suffix to disambiguate,
but don't do this - it is too clever. -->
<param name="p4|file" value="simple_line.txt" />
<output name="out_file1">
<assert_contents>
<has_line line="4 7 4" />
<has_line line="This is a line of text." />
</assert_contents>
</output>
</test>
</tests>
</tool>
+35 -17
View File
@@ -14,7 +14,41 @@
<data name="out_file1" format="txt" />
</outputs>
<tests>
<!-- Can use prefixes to disambiguate inputs or force order. -->
<!-- Can disambiguate repeats and specify multiple blocks using,
nested structure. -->
<test>
<repeat name="queries">
<param name="input" value="simple_line.txt"/>
</repeat>
<repeat name="more_queries">
<param name="input" value="simple_line_alternative.txt"/>
</repeat>
<output name="out_file1">
<assert_contents>
<has_line line="This is a line of text." />
<has_line line="This is a different line of text." />
</assert_contents>
</output>
</test>
<!-- Multiple such blocks can be specified but only with newer API
driven tests. -->
<test>
<repeat name="queries">
<param name="input" value="simple_line.txt"/>
</repeat>
<repeat name="queries">
<param name="input" value="simple_line_alternative.txt"/>
</repeat>
<repeat name="more_queries">
<param name="input" value="simple_line.txt"/>
</repeat>
<repeat name="more_queries">
<param name="input" value="simple_line_alternative.txt"/>
</repeat>
<output name="out_file1" file="simple_lines_interleaved.txt"/>
</test>
<!-- Can also use prefixes to disambiguate inputs or force order, but
the above nested structure is preferable. -->
<test>
<param name="queries_1|input" value="simple_line_alternative.txt"/>
<param name="queries_0|input" value="simple_line.txt"/>
@@ -25,21 +59,5 @@
<output name="out_file1" file="simple_lines_interleaved.txt"/>
</test>
<test>
<repeat name="queries">
<param name="input" value="simple_line.txt"/>
</repeat>
<repeat name="queries">
<param name="input" value="simple_line_alternative.txt"/>
</repeat>
<repeat name="more_queries">
<param name="input" value="simple_line.txt"/>
</repeat>
<repeat name="more_queries">
<param name="input" value="simple_line_alternative.txt"/>
</repeat>
<output name="out_file1" file="simple_lines_interleaved.txt"/>
</test>
</tests>
</tool>