Difference between revisions of "Organizing Tests into Suites"

From STRIDE Wiki
Jump to: navigation, search
(Created page with 'Unless you specify otherwise, stride will publish results from all of your test units into a single top-level test suite. Each As the number of test units grows, it can be very…')
 
Line 1: Line 1:
Unless you specify otherwise, stride will publish results from all of your test units into a single top-level test suite. Each
+
Unless you specify otherwise, stride will publish results from all of your test units into a single top-level test suite. As the number of test units grows, this flat organization is not ideal.
  
As the number of test units grows, it can be very useful to organize them into test suites.
+
By organizing your tests into suites at runtime, you can impose a logical hierarchy on the results.
 +
 
 +
* Subtotals of Time Under Test, Pass/Fail and Error counts are provided for each suite
 +
 
 +
 
 +
== Techniques for Organization ==
 +
 
 +
* Name your test units such that their organization is implicit
 +
 
 +
level1_level2_level3_name
 +
 
 +
* Have each subgroup manage their own file.
 +
 
 +
=== OrganizeIntoSuites.pl ===
 +
<source lang="Perl">
 +
#!/usr/bin/perl
 +
use strict;
 +
use warnings;
 +
 
 +
# set this to your separator character or string
 +
my $token = '::';
 +
 
 +
while( <> ) {
 +
    chomp;
 +
    my @segments = split(/$token/);
 +
    # remove the last segment from the array
 +
    my $testunit = pop @segments;
 +
    print "-r /";
 +
    foreach my $segment (@segments) {
 +
        print "$segment/";
 +
    }
 +
    print "($_)\n";
 +
}
 +
</source>
 +
 
 +
=== Batch File or Shell Script ===
 +
<source lang="dos">
 +
stride --list --database TestApp.sidb | perl OrganizeIntoSuites.pl > TestsInSuites.txt
 +
stride --database TestApp.sidb --device TCP:localhost:8000 -O TestsInSuites.txt
 +
</source>

Revision as of 18:00, 8 September 2009

Unless you specify otherwise, stride will publish results from all of your test units into a single top-level test suite. As the number of test units grows, this flat organization is not ideal.

By organizing your tests into suites at runtime, you can impose a logical hierarchy on the results.

  • Subtotals of Time Under Test, Pass/Fail and Error counts are provided for each suite


Techniques for Organization

  • Name your test units such that their organization is implicit
level1_level2_level3_name
  • Have each subgroup manage their own file.

OrganizeIntoSuites.pl

#!/usr/bin/perl
use strict;
use warnings;

# set this to your separator character or string
my $token = '::';

while( <> ) {
    chomp;
    my @segments = split(/$token/);
    # remove the last segment from the array
    my $testunit = pop @segments;
    print "-r /";
    foreach my $segment (@segments) {
        print "$segment/";
    }
    print "($_)\n";
}

Batch File or Shell Script

stride --list --database TestApp.sidb | perl OrganizeIntoSuites.pl > TestsInSuites.txt
stride --database TestApp.sidb --device TCP:localhost:8000 -O TestsInSuites.txt