Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 29.545.938 Times

Test::Unit::TestCase 0.14

  Date Added: February 07, 2010  |  Visits: 803

Test::Unit::TestCase

Report Broken Link
Printer Friendly Version


Product Homepage
Download (72 downloads)



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..

Requirements: No special requirements
Platforms: Linux
Keyword: Base Fixture Libraries Programming Sub Test Testcase Testing Testunittestcase Unit Testing Unit Testing Framework Value
Users rating: 0/10

License: Freeware Size: 45.06 KB
USER REVIEWS
More Reviews or Write Review


TEST::UNIT::TESTCASE RELATED
Libraries  -  Test::Usage 0.07
Test::Usage is a different approach to testing: selective, quieter, colorful. SYNOPSIS Lets say we are building module Foo.pm. To exercise it, we write a usage examples module, Foo_T.pm, which may eventually look something like this: package...
16.38 KB  
Libraries  -  Test::Struct 0.01
Test::Struct is a Perl extension for testing for structural equivelence. SYNOPSIS use Test::Struct; deep_eq($hairy_struct,$expected,Hairy structural test); is($x,$y); # and everything else Test::More has to offer! Test::Struct is used for...
5.12 KB  
Libraries  -  Regular Statement String 2.5.7
Regular Statement String (RSS) provides several libraries in C, Java, and COM to implement and demonstrate the key-value development method using well-designed "strings" (RSS) as the media. Regular Statement String also shows a way to write...
337.92 KB  
Libraries  -  PSA::Test::Builder 0.49_01
PSA::Test::Builder is a backend for building test libraries. SYNOPSIS package My::Test::Module; use PSA::Test::Builder; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(ok); my $Test = Test::Builder->new; $Test->output(my_logfile);...
112.64 KB  
Libraries  -  Test::Stochastic 0.03
Test::Stochastic is a Perl module to check probabilities of randomized methods. SYNOPSIS use Test::Stochastic qw(stochastic_ok); stochastic_ok sub { ...random sub...}, {a => 0.4, b => 0.6}; stochastic_ok {a => 0.4, b => 0.6}, sub { ...random...
4.1 KB  
Libraries  -  classes::Test 0.942
classes::Test are functions to help with classes pragma testing. SYNOPSIS can_new can_set_get has_decl has_class_const has_mixins has_mixins_hash is_classes MyClass; is_classes main; is_throwable X::Mine; is_classes_exc X::Mine;...
163.84 KB  
Libraries  -  Games::LMSolve::Base 0.8.1
Games::LMSolve::Base is a base class for puzzle solvers. SYNOPSIS package MyPuzzle::Solver; use Games::LMSolve::Base; @ISA = qw(Games::LMSolve::Base); # Override these methods: sub input_board { ... } sub pack_state { ... } sub...
21.5 KB  
Libraries  -  Test::Simple 0.70
Test::Simple is a Perl module with basic utilities for writing tests. SYNOPSIS use Test::Simple tests => 1; ok( $foo eq $bar, foo is bar ); ** If you are unfamiliar with testing read Test::Tutorial first! ** This is an extremely simple,...
77.82 KB  
Programming  -  Abbot 1.0.0 RC5
Abbot helps you test your Java UI. Abbot framework comprises Abbot, which lets you programmatically drive UI components, and Costello (built on Abbot) which allows you to easily launch, explore and control an application. The framework may be used...
5.7 MB  
Libraries  -  Math::BaseArith 1.00
Math::BaseArith is a Perl extension for mixed-base number representation (like APL encode/decode). SYNOPSIS use Math::BaseArith; encode( value, base_list ); decode( representation_list, base_list ); The inspiration for this module is a...
6.14 KB  
NEW DOWNLOADS IN PROGRAMMING, LIBRARIES
Programming  -  FLEX-db Digital Asset Manager 3.0.9
FLEX-db - an enterprise Digital Asset Manager (DAM). It ingests and links metadata with files, creates thumbnails, and processes files using business rules. FLEX-db has a JSP client, Java app server for file input and output and an EJB metadata...
21.57 MB  
Programming  -  Libicom 0.9.0
The libicom library is a character based dynamicly linked library for Linux. It is used to remotely control the Icom IC-R8500 wide band receiver via an RS232 link. All call and return parameters to the control functions are character string based....
20.48 KB  
Programming  -  dotdesktop 0.3
Dotdesktop library provides ability to parse desktop entry file and access the information in a convenient way. Desktop entry file format is defined by freedesktop.org, it is used to describe information about an application such as the name and...
327.68 KB  
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  libyasl 0.2
Libyasl is a C++ class library to easily realize TCP/UDP/Multicast clientsand servers in IPv4 and IPv6 environments under GNU/Linux systems.
143.36 KB  
Libraries  -  EuGTK 4.8.9
Makes it easy to develop good- looking, fast, cross-platform programs that run on Linux, OS X, and Windows. Euphoria is a very fast interpreted/compiled language with straight-forward syntax. EuGTK allows programming in a clean, object-oriented...
10.68 MB  
Libraries  -  Linux User Group Library Manager 1.0
The LUG Library Manager is a project to help Linux User Groups start their own library. A LUG library is helpful to the community at large because it increases access to information, and gives everyone the opportunity to become more knowledgeable.
5.35 KB  
Libraries  -  Module::MakefilePL::Parse 0.12
Module::MakefilePL::Parse is a Perl module to parse required modules from Makefile.PL. SYNOPSIS use Module::MakefilePL::Parse; open $fh, Makefile.PL; $parser = Module::MakefilePL::Parse->new( join("", ) ); $info = $parser->required;...
8.19 KB  
Libraries  -  sqlpp 0.06
sqlpp Perl package is a SQL preprocessor. sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL, in particular) syntax specificities. In addition to the standard #define/#ifdef/#else/#endif cohort, provides also...
10.24 KB  
Libraries  -  App::SimpleScan::Substitution::Line 2.02
App::SimpleScan::Substitution::Line is a line with optional fixed variable values. SYNOPSIS my $line = App::SimpleScan::Substitution::Line->new(" this "); # Use only this value when substituting " ". $line->fix(substituite =>...
54.27 KB