Secrets: Debugging and testing plugins

Posted December 14 2008 04:27 PM by Jukka Svahn

Some people have asked what defines plugin requirements and how can I know where it works and where it doesn’t. Do I really test my plugin on every Textpattern-, PHP- and MySQL version? Does it take a lot of time?

Shortly said no, I don’t test plugins on every system compination, that would be nuts job and take just too much time. Basically testing is just done on two different setups aka servers. But that doesn’t yet tell me where the plugin actually works and where not.

First I test the plugin on couple different server setups, using latest stable version of Textpattern. Usually those servers are fairly different, ‘cause one is XAMPP on Windows and those others are kinda real Linux installs. Those all use latest stable MySQL 5.x- and PHP 5.x-installs, plus PHP 5.2.5.

Now I basically know where it works, and that testing took about couple minutes, if everything worked fine. But I yet don’t know what it requires from setup, and I must know that to be able to write ‘official’ requirements.

That is done by looking changelogs: PHP’s and Textpattern’s. Comparing changes from used functions, methods and libraries, and determinating where it works, and more importantly stays stable and secure. That is basically why rah-plugins might work on older setups, but you might consider stableness and security. Does it fail sometimes?

But wouldn’t it be easy to fix plugins to work really old setups?

Kinda, but on other hand not. Supporting older setups usually makes the code longer, slower to run and more ugly (clean code is important). Also note that you shouldn’t be using a really old setup: it is a big security risk.

If plugins were supporting really old installs, it would make future changes and supporting newer setup versions harder and drastically make work hours longer, when even currently writing a one single plugin might take about 50 hours of non-stop work and future updates even more.

What does jQuery -requirement mean?

Ah, some people don’t yet know that Textpattern includes jQuery Javascript library. That requirement basically means that plugin requires that library to be installed to work properly. That why it is mentiond seperately is just because older Textpattern installs don’t include or newer jQuery version. If you have a older Textpattern install, you have to either update to version where there is jQuery in place or install jQuery by yourself seperately. Note that rah frontend plugins never use jQuery, only backend plugins do. The requirment is also mentioned to make it clear that a JavaScript enabled modern web browser is required.

That’s all about testing and writing plugin system requirements.

Petri wrote 14. December 2008 09:20 PM:

Nice to see that this blog shows some signs of life. I’ve just recently discovered jQuery’s power to handle images. Textpattern Resources includes pretty decent collection of all kinds of lightbox plugins, but they seem to be for mootools.js or other JS librarys. Using Textpattern’s own jQuery to create lightbox you don’t have to install other JavaScript librarys. It would be splendid if someone would be willing to spend some time to wrap that lightbox method into TXP plugin…

Gocom wrote 16. December 2008 01:01 PM:

Nice to hear that Petri :)

Well, I don’t know about those Lightbox plugins, because Textpattern doesn’t really need them, if you ask me. It just requires some stannard JavaScript (jquery plugin in this case) and then some beautiful XHTML, that will be animated with the Javascript. And now the catch…

For example, it is fairly easy task to use upm_image or smd_gallery et cetera to produce the valid extranmous XHTML and then hook your desired efect to it :) Those plugins are extremely helpful and with’em you can build anykind of a customized dream gallery or a single image lightbox thingy.

Commenting is closed for this article.