Studio:Test Script Perl Template: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:
| style="background-color: white;" |
| style="background-color: white;" |
<source lang="perl">
<source lang="perl">
=head1 NAME
=begin nd


[scriptname].pl - [few word summary]
Brief summary...


=head1 DESCRIPTION
About: Description
Here is some description text.  It can have text that is *bolded* and _underlined_.


Here is some description text. It can have text that is B<bolded>, I<italicized>, and C<$code-formatted>.
About: Tests
test case 1 - description of test case 1
test case 2 - description of test case 2
etc - more cases...


=head2 TESTS
About: Test Plan
See <http://project-portal.s2technologies.com/index.php/MyTestPlan>


=over 4
About: Copyright
 
Copyright 2008 S2 Technologies support@s2technologies.com.
=item test case 1.
 
description
 
=item test case 2
 
description
 
=item etc...
 
description
 
=back
 
=head1 TEST SPECIFICATION
 
L<http://project-portal.s2technologies.com/index.php/MyTestPlan>.
 
=head1 COPYRIGHT
 
Copyright 2008 S2 Technologies <support@s2technologies.com>.


=cut
=cut

Revision as of 17:24, 3 November 2008

The following sample represents a starting point for perl test scripts.

Source
=begin nd

Brief summary...

About: Description
Here is some description text.  It can have text that is *bolded* and _underlined_.

About: Tests
test case 1 - description of test case 1
test case 2 - description of test case 2
etc - more cases...

About: Test Plan
See <http://project-portal.s2technologies.com/index.php/MyTestPlan>

About: Copyright
Copyright 2008 S2 Technologies support@s2technologies.com.

=cut

use strict;
use warnings;
use Carp;
use Win32::TieRegistry(Delimiter=>"/");
use File::Spec;
use Win32::OLE;

Win32::OLE->Option(Warn => 3);
use vars qw( $StrideLibDirectory );
BEGIN {
    my $strideDir = $Registry->{"LMachine/SOFTWARE/S2 Technologies/STRIDE/InstallDir"} || $ENV{'STRIDE_DIR'};
    $StrideLibDirectory = File::Spec->catdir($StrideDirectory, 'lib', 'perl');  
}
use lib $StrideLibDirectory;


This template uses pod for documentation, which is an ubiquitous standard for self-contained docs in perl. The pod is easily displayed by simply calling perldoc for command line/shell output or pod2html for html output. There are also utilities available for generating wiki text from pod,which could provide a convenient way to autopublish the script documentation to the project wiki. The code above produces the following HTML output:

HTML result

NAME

[scriptname].pl - [few word summary]


DESCRIPTION

Here is some description text. It can have text that is bolded, italicized, and $code-formatted.

TESTS

test case 1

description

test case 2

description

etc...

description


TEST SPECIFICATION

<http://project-portal.s2technologies.com/index.php/MyTestPlan>.


COPYRIGHT

Copyright 2008 S2 Technologies <support@s2technologies.com>.