Monthly Archives: July 2015

Unit Tests in WordPress: Making It Work on Travis

Now that we have configured succesfully our environment to run PHP and JavaScript unit tests, it’s time to automate the testing process. Travis CI is a service that allow you to automatically run your tests remotely. If you work alone, you can also avoid using it, thought I would use it anyway for the advantages that it brings. But if you work in a team, even in a team of two, you cannot afford not to use it. Let me explain in a few words how it works. First of all, you must have your plugin or theme on Github. Travis will monitor your Github repository and when it notices that the code has been updated, it downloads the plugin and runs all the tests against the new version of the plugin. In case all the tests succeed you won’t even know. In case any of your tests fails you will be notified by email. The first advantage that I see in this system is that you don’t have to run your tests manually every time that you modify your code. That alone is a huge time saver. To add to that, the whole testing process is simplified if you work in a team. If your partner modifies the code and pushes the modification to Github, the system will run the tests without you having to lift a finger. So yes, automation has a lot of advantages.

Continue Reading