Studio:Test Script Perl Template: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
No edit summary
m (Text replace - 'Category:Documentation' to 'Category:Studio:Documentation')
 
(24 intermediate revisions by 5 users not shown)
Line 1: Line 1:
The following sample represents a starting point for perl test scripts.
The following sample represents a starting point for perl test scripts.


{| class="wikitable"
!Source
|-
| style="background-color: white;" |
<source lang="perl">
<source lang="perl">
=head1 NAME
=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
Line 49: Line 37:
BEGIN {
BEGIN {
     my $strideDir = $Registry->{"LMachine/SOFTWARE/S2 Technologies/STRIDE/InstallDir"} || $ENV{'STRIDE_DIR'};
     my $strideDir = $Registry->{"LMachine/SOFTWARE/S2 Technologies/STRIDE/InstallDir"} || $ENV{'STRIDE_DIR'};
     $StrideLibDirectory = File::Spec->catdir($StrideDirectory, 'lib', 'perl');   
     $StrideLibDirectory = File::Spec->catdir($strideDir, 'lib', 'perl');   
}
}
use lib $StrideLibDirectory;
use lib $StrideLibDirectory;
</source>
</source>
|}


This template uses [http://perldoc.perl.org/perlpod.html|pod] for documentation, which is an ubiquitous standard for self-contained docs in perl. The pod is easily displayed by simply calling [http://perldoc.perl.org/perldoc.html|perldoc] (for command line/shell output) or [http://perldoc.perl.org/pod2html.html|pod2html] for html output. The template above produces the following HTML output:
<div name="index">
<p><a name="__index__"></a></p>
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<ul>
<li><a href="#tests">TESTS</a></li>
</ul>
<li><a href="#test_specification">TEST SPECIFICATION</a></li>
<li><a href="#copyright">COPYRIGHT</a></li>
</ul>
<hr name="index" />
</div>
<!-- INDEX END -->
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>[scriptname].pl - [few word summary]</p>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>Here is some description text.  It can have text that is <strong>bolded</strong>, <em>italicized</em>, and <code>$code-formatted</code>.</p>
<p>
</p>
<h2><a name="tests">TESTS</a></h2>
<dl>
<dt><strong><a name="test_case_1" class="item">test case 1.</a></strong>
<dd>
<p>description</p>
</dd>
</li>
<dt><strong><a name="test_case_2" class="item">test case 2</a></strong>
<dd>
<p>description</p>
</dd>
</li>
<dt><strong><a name="etc" class="item">etc...</a></strong>


<dd>
This template uses [http://www.naturaldocs.org NaturalDocs] for documentation, which is a utility for documenting diverse codebases (including perl, c++, javascript). The documentation can be generated for your files by invoking the [http://www.naturaldocs.org/running.html NaturalDocs Utility]. The code above produces the following HTML output:
<p>description</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="test_specification">TEST SPECIFICATION</a></h1>
<p><a href="http://project-portal.s2technologies.com/index.php/MyTestPlan">http://project-portal.s2technologies.com/index.php/MyTestPlan</a>.</p>


<p>
[[Image:NaturalDocs_Out_1.JPG|frame|none|Example NaturalDocs Output]]
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright 2008 S2 Technologies &lt;<a href="mailto:support@s2technologies.com">support@s2technologies.com</a>&gt;.</p>




[Category: Document Templates]
[[Category:Studio:Documentation]]

Latest revision as of 22:42, 20 August 2009

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

Source
=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($strideDir, 'lib', 'perl');  
}
use lib $StrideLibDirectory;


This template uses NaturalDocs for documentation, which is a utility for documenting diverse codebases (including perl, c++, javascript). The documentation can be generated for your files by invoking the NaturalDocs Utility. The code above produces the following HTML output:

Example NaturalDocs Output