NAME
Venus::Test - Test Automation
ABSTRACT
Test Automation for Perl 5
SYNOPSIS
package main;
use Venus::Test;
my $test = test 't/Venus_Test.t';
# $test->for('name');
DESCRIPTION
This package aims to provide a standard for documenting Venus derived software projects, a framework writing tests, test automation, and documentation generation.
INHERITS
This package inherits behaviors from:
INTEGRATES
This package integrates behaviors from:
FUNCTIONS
This package provides the following functions:
test
test(Str $file) (Test)
The test function is exported automatically and returns a Venus::Test object for the test file given.
Since 0.09
- test example 1
-
package main; use Venus::Test; my $test = test 't/Venus_Test.t'; # bless( { ..., 'value' => 't/Venus_Test.t' }, 'Venus::Test' )
METHODS
This package provides the following methods:
data
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.
Since 0.09
for
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.
Since 0.09
- for example 3
-
# given: synopsis my $data = $test->for('example', 1, 'data', sub { my ($tryable) = @_; my $result = $tryable->result; ok length($result) > 1; $result }); # Venus::Test
pdml
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.
Since 0.09
- pdml example 1
-
# given: synopsis my $pdml = $test->pdml('name'); # =head1 NAME # # Venus::Test - Test Automation # # =cut
- pdml example 2
-
# 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
- pdml example 3
-
# 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
render(Str $file) Path
The render method returns a string representation of a valid POD document.
Since 0.09
- render example 1
-
# 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
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.
Since 0.09