Venus::Test - Test Automation
Test Automation for Perl 5
package main; use Venus::Test; my $test = test 't/Venus_Test.t'; # $test->for('name');
This package aims to provide a standard for documenting Venus derived software projects, a framework writing tests, test automation, and documentation generation.
This package inherits behaviors from:
Venus::Data
This package integrates behaviors from:
Venus::Role::Buildable
This package provides the following functions:
test(Str $file) (Test)
The test function is exported automatically and returns a Venus::Test object for the test file given.
Since 0.09
0.09
package main; use Venus::Test; my $test = test 't/Venus_Test.t'; # bless( { ..., 'value' => 't/Venus_Test.t' }, 'Venus::Test' )
This package provides the following methods:
data(Str $name, Any @args) (Str)
The data method attempts to find and return the POD content based on the name provided. If the content cannot be found an exception is raised.
# given: synopsis my $data = $test->data('name'); # Venus::Test
# given: synopsis my $data = $test->data('unknown'); # Exception!
for(Str $name | CodeRef $code, Any @args) Any
The for method attempts to find the POD content based on the name provided and executes the corresponding predefined test, optionally accepting a callback which, if provided, will be passes a Venus::Try object containing the POD-driven test. The callback, if provided, must always return a true value. Note: All automated tests disable the "redefine" class of warnings to prevent warnings when redeclaring packages in examples.
# given: synopsis my $data = $test->for('name'); # Venus::Test
# given: synopsis my $data = $test->for('synosis'); # true
# given: synopsis my $data = $test->for('example', 1, 'data', sub { my ($tryable) = @_; my $result = $tryable->result; ok length($result) > 1; $result }); # Venus::Test
pdml(Str $name | CodeRef $code, Any @args) Str
The pdml method attempts to find the POD content based on the name provided and return a POD string for use in documentation.
# given: synopsis my $pdml = $test->pdml('name'); # =head1 NAME # # Venus::Test - Test Automation # # =cut
# given: synopsis my $pdml = $test->pdml('synopsis'); # =head1 SYNOPSIS # # package main; # # use Venus::Test; # # my $test = test 't/Venus_Test.t'; # # # $test->for('name'); # # =cut
# given: synopsis my $pdml = $test->pdml('example', 1, 'data'); # =over 4 # # =item data example 1 # # # given: synopsis # # my $data = $test->data(\'name\'); # # # Venus::Test # # =back
render(Str $file) Path
The render method returns a string representation of a valid POD document.
# given: synopsis my $path = $test->render('t/Test_Venus.pod'); # =over 4 # # =item data example 1 # # # given: synopsis # # my $data = $test->data(\'name\'); # # # Venus::Test # # =back
text(Str $name, Any @args) (Str)
The text method attempts to find and return the POD content based on the name provided. If the content cannot be found an empty string is returned. If the POD block is not recognized, an exception is raised.
# given: synopsis my $text = $test->text('name'); # Venus::Test
# given: synopsis my $text = $test->text('includes'); # function: test # method: data # method: for # method: pdml # method: render # method: text
# given: synopsis my $text = $test->text('attributes'); # ''
# given: synopsis my $text = $test->text('unknown'); # Exception!
To install Venus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Venus
CPAN shell
perl -MCPAN -e shell install Venus
For more information on module installation, please visit the detailed CPAN module installation guide.