# ckunte.net

## Testing code

Years ago, enamored by the theoretical purity of HTML, I wrote a couple of WordPress plugins, viz., extract-blockquote-info and smallcaps. Using Dunstan Orchard’s javascript, the blockquote plugin did neat things — like extracting cite and title details from the blockquote element to display attribution and source link below the quote; while small-caps searched and replaced all capitalized words into small caps on the fly.

Plugins like these were obviously never meant for mainstream users, and those that do care about such are often capable of tending to keep them working, if need be. As for me, it has been many years since I stopped using WordPress for my own use. And so as I had no rig to test these version after version locally, I thought these were ideal candidates for automated virtual testing.

GitHub offers Travis CI as a service, and so I put that to use. Being a novice to code testing, I used the instructions kindly shared by Bryan Petty as a scaffold to begin. The nice thing about it is that it looks for the plugin from WordPress plugin directory and tests it for the latest version, and fallback versions of choice. So, even though on the official WordPress directory it says compatibility of each of these plugins has “not enough data”, these plugins appear to pass tests for a set of WordPress and PHP versions. I’ve updated the repos with build status badges. These would auto-update in future when tests are either requested manually (by clicking on Test service from within Settings → Webhooks & services → Travis CI), or upon every new push to the repository.

Another area I was interested was testing my unruly scripts for various versions of python (2.x), and so, I spent the afternoon running tests both offline using pylint, which I really like, before unleashing Travis CI over my repositories. Here’s a simple config. file (.travis.yml) using nose for running tests.

language: python
python:
- 2.6
- 2.7
script:
- nosetests