Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I do unit testing in Perl? [closed]

I have been doing some OO Perl programming and I was wondering: which is the best way to perform unit tests?

So far I have been using the Test::Simple module to perform tests, but it feels insufficient for what I want.

Can you point me to some nice modules for that?

like image 780
mandel Avatar asked Feb 02 '09 09:02

mandel


People also ask

How do I write a unit test case in Perl?

use strict; use warnings; use Test::More; package Foo { do 'script_one.pl'; }; is Foo::print_name, 'foo', 'prints the right name'; This way you can mock dependencies more easily and you get some more control.

Is unit testing end to end?

While both add value to the development process, they are different in many ways. End-to-end testing is a testing process in which the tester tests a software application from the user's perspective. Unit testing is a testing process where the developer verifies that individual units of source code work correctly.

How do I enable unit testing?

Turn live unit testing from the Test menu by choosing Test > Live Unit Testing > Start.

Can we skip unit testing?

skip=true to skip the entire unit test. By default, when building project, Maven will run the entire unit tests automatically. If any unit tests is failed, it will force Maven to abort the building process. In real life, you may STILL need to build your project even some of the cases are failed.


1 Answers

I'd add my vote to picking up Test::More before going any further in Perl testing. The Perl testing community is fairly well united around the Test Anything Protocol, and you'll want to play around with Test::More to understand how it works and how tools like prove and Test::Harness::Archive can help automate and distribute testing.

If you want to just "jump right in", I think Test::Class provides xTest facilities with a TAP backend. I haven't used it at all (I'm a Test::More person myself), but it's very highly rated.

like image 191
Gaurav Avatar answered Sep 27 '22 21:09

Gaurav