Main > Programming > Libraries >

Test::Unit::TestCase 0.14

Test::Unit::TestCase 0.14

Sponsored Links

Test::Unit::TestCase 0.14 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.044 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 869
Date added: 2007-06-13
Publisher: Christian Lemburg

Test::Unit::TestCase 0.14 description

Test::Unit::TestCase is a unit testing framework base class.

SYNOPSIS

package FooBar;
use base qw(Test::Unit::TestCase);

sub new {
my $self = shift()->SUPER::new(@_);
# your state for fixture here
return $self;
}

sub set_up {
# provide fixture
}
sub tear_down {
# clean up after test
}
sub test_foo {
# test the foo feature
}
sub test_bar {
# test the bar feature
}

(Taken from the JUnit TestCase class documentation)

A test case defines the "fixture" (resources need for testing) to run multiple tests. To define a test case:

implement a subclass of TestCase
define instance variables that store the state of the fixture
initialize the fixture state by overriding set_up()
clean-up after a test by overriding tear_down().

Each test runs in its own fixture so there can be no side effects among test runs. Here is an example:

package MathTest;
use base qw(Test::Unit::TestCase);

sub new {
my $self = shift()->SUPER::new(@_);
$self->{value_1} = 0;
$self->{value_2} = 0;
return $self;
}

sub set_up {
my $self = shift;
$self->{value_1} = 2;
$self->{value_2} = 3;
}

For each test implement a method which interacts with the fixture. Verify the expected results with assertions specified by calling $self->assert() with a boolean value.

sub test_add {
my $self = shift;
my $result = $self->{value_1} + $self->{value_2};
$self->assert($result == 5);
}

Once the methods are defined you can run them. The normal way to do this uses reflection to implement run_test. It dynamically finds and invokes a method. For this the name of the test case has to correspond to the test method to be run. The tests to be run can be collected into a TestSuite. The framework provides different test runners, which can run a test suite and collect the results. A test runner either expects a method suite() as the entry point to get a test to run or it will extract the suite automatically.

If you do not like the rather verbose backtrace that appears when a test fails, you can use the quell_backtrace() method. You will get any message provided, but not the backtrace.

Test::Unit::TestCase 0.14 Screenshot

Advertisements

Test::Unit::TestCase 0.14 Keywords

Bookmark Test::Unit::TestCase 0.14

Hyperlink code:
Link for forum:

Test::Unit::TestCase 0.14 Copyright

WareSeeker periodically updates pricing and software information of Test::Unit::TestCase 0.14 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Test::Unit::TestCase 0.14 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
Test::Unit::TestSuite is a unit testing framework base class. Free Download
Test::Unit::TestRunner is a unit testing framework helper class. Free Download
Test::Unit::tests::AllTests is a unit testing framework self tests. Free Download
Test::Unit::InnerClass is a unit testing framework helper class. Free Download
Test::Unit::Tutorial is a Perl module that contains a tutorial on unit testing. Free Download
Test::Unit::GTestRunner is a Unit testing framework helper class Free Download
QUnitTester is a Qt4 binary unit tester. Free Download
Test::Unit is the main PerlUnit testing framework. Free Download