Difference between revisions of "Listing Functions and Test Units"

From STRIDE Wiki
Jump to: navigation, search
Line 34: Line 34:
 
A technique using stride's list capability to automate the running of a subset of tests is shown [[Running A Subset of Tests#Automating the Running of a Stubset of Tests|here]].
 
A technique using stride's list capability to automate the running of a subset of tests is shown [[Running A Subset of Tests#Automating the Running of a Stubset of Tests|here]].
  
The perl script shown above reads from stdin and attempts to match the line to the regular expression <tt>myPrefix_</tt>. If a match is detected, the line is written to stdout prefixed with <tt>-r </tt>,
+
For full details on stride command line parameters, please see [[STRIDE Runner]].
 
 
If you save this script to a file named myTests.pl, you can automate the running of tests that match your prefix as follows:
 
 
 
stride --list --database TestApp.sidb | perl myTests.pl > tests.txt
 
stride --database TestApp.sidb -O tests.txt
 
  
  
 
[[Category:Running Tests & Publishing Results]]
 
[[Category:Running Tests & Publishing Results]]

Revision as of 10:07, 28 August 2009

Overview

While the STRIDE runner is mainly used to execute tests, it can also be used to list the test units that are available in a target build. The listing capability is useful in several scenarios:

  • Verifying that a particular test unit is available in a specific build
  • Creating a command file that will be used to run only tests who's names match a specific text pattern
  • Creating a command file that will be used to run all tests in a particular order

To list the available test units, run stride giving it command line parameters as follows:

stride --list --database TestApp.sidb

List Output

Test units are listed in the order they are encountered in the .sidb file (which reflects the order they were seen by the stride compiler when the target was built).

Each member test unit in the .sidb file is listed, with one test unit per line. A sample of this output from the TestIntro build is shown below.

s2_testintro_cclass
s2_testintro_flist
s2_testintro_testdoubles
s2_testintro_testpoints

Advanced List Usage

The list output can be piped to another program such as grep in order to create a list of test units filtered by name characteristics.

For instance, suppose that you want to run only the test units owned by your department or development group from a target build that includes many tests aggregated from others. Provided that your test units follow a unique naming convention, you can create a filtered list as follows:

stride --list --database TestApp.sidb | grep myPrefix_*

Further, by redirecting the output to a file, you can create a stride command file with a little editing.

A technique using stride's list capability to automate the running of a subset of tests is shown here.

For full details on stride command line parameters, please see STRIDE Runner.