See Also: Home Links Personal Site Blogroll  FriendFeed CV

Tags:

OSDC : Testing Non Perl Applications With TAP

This talk at OSDC 2006 by Leif Eriksen began with a discussion about the benefits of testing, things that are pretty obvious and commonly practised, but he suggested there was an alternative motivation for people to perform testing, ie not just to test for the sake of it, but to test to improve the quality of the work so the developer takes more pride in the robust outcome. A subtle difference but very true.

He also talked about the need to mitigate risk when making software changes (he referred to them as behaviour changes) and that we should always strive to identify the minimum amount of change required to meet the need, should know how to recognise that the change was correct, and be able to know that the change we made has affected nothing else. All critical things that should be considered before each change, and feed into the actual tests themselves.

Next topic concerned breaking dependencies, ie isolating the s/w component you are changing so that you can test it alone without outside interference from other libraries or resources which might affect or mask the correct (or incorrect) behaviour of the change. Where the dependency is some data or service he suggested use of mock objects, drop in replacements that mirror the interface of the thing being isolated but returning only static/dummy data.

This is an interesting approach, something I hadn't consciously considered, there are modules like Test::MockObject on CPAN to assist with this.

Leif went on to discuss TAP (test anything protocol) which is used on many platforms, is well established and is actually used to feed into Test::Harness itself. TAP implementations are available for many languages and the rest of Leif's talk demonstrated how one can call tests in another language from a conventional Perl *.t test file.

You might want to do this in an environment where you are mostly developing with Perl but also have some library in other language (e.g C) which is used in some way. Rather than doing a system call to the testing harness for that other language you build a stub test script for that language including the TAP library for that language and Perl can then communicate with that alien test script using the TAP protocol communicating via IPC::System::Simple

Very cool.


See Also: OSDC 2006 | Web Development | Notes Index