Gergely Brautigam wrote:
One last question then I swear I will shut up :)

Why use perl for testing? Of course all others languages are used for testing 
this
> and that.. What excels perl to be used for testing. Obviusly it has powerfull regex, > and datahandling capabilities... But besides that.. Why would anyone want to use perl? :)

Something that hasn't been explicitly pointed out yet is that Perl uses TAP, the Test Anything Protocol. In most other testing systems the test script also determines whether the test passes or fails and it also displays that fact. This means the thing you're testing is tied to the testing system.

TAP instead follows the Unix philosophy of pipes. A harness (usually Test::Harness) runs a series of programs which output TAP, a simple textual protocol.

1..3
ok 1
ok 2
not ok 3

That is, "I'm going to run 3 tests. The first one passed. The second one passed. The third one failed." The harness parses this and displays the results.

This separation means you have maximum flexibility in how you write your tests. You're not locked down to one set of test functions, you can import piles and piles from CPAN and even write your own. You can even get XUnit style test methods (see Test::Class).

With Test::Harness 3 you can define special behaviors for various test files.
The power of this is that the test scripts can be written in anything, doesn't have to be Perl. There are TAP libraries in several languages and because the basic protocol is so simple they're simple to implement. I've seem places write TAP tests in C, shell, PHP and Java in the same test suite. Even running their .html files as "tests" by instructing the harness to run them through an HTML syntax validator.

The downside is there's no pretty GUIs for TAP, but the potential exists. It's a simple matter of programing. The upside is that when a TAP GUI is created it will work with all existing TAP tests.


--
191. Our Humvees cannot be assembled into a giant battle-robot.
    -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army
           http://skippyslist.com/list/

Reply via email to