Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

NetTuts.com:
Automatic Testing for TDD with PHP
Aug 24, 2012 @ 14:09:04

If you practice the TDD (test-driven development) methodology in your work, you know that sometimes switching back and forth between a terminal and your IDE can be distracting. In this new tutorial from NetTuts.com, they show you how to streamline things a bit with a simple Ruby script.

Traditional test-driven development can, at times, be cumbersome. You have to stop writing code in order to run your tests. Luckily, there are solutions, which provide the ability to automatically run your tests as you code. In this tutorial, you will learn how to use a Ruby gem, called watchr, to monitor your code and automatically run the appropriate tests whenever you save your work.

The IDE doesn't matter in this case because the "watchr" tool keeps an eye on when things change in the watched directory and automatically fires off a script when it sees an update. They include the few short lines of Ruby to make it all happen and even have the "notify-send" command built in to give you a popup about the pass/fail status.

tagged: automatic testing tdd ruby watchr popup execute

Link:

AppBackr Blog:
Automated PHP unit testing for lazy coders
Aug 02, 2011 @ 15:41:59

In a recent post from the AppBackr blog they share a solution they've found for running unit tests automatically for lazy coders using a combination of PHPUnit, Watchr and Growl notifications (OS X-only, obviously).

Now you could run [your] tests manually after each change by typing 'phpunit ', but we were looking for something a little more comfortable. We want to decrease the transactional cost of running the tests as much as possible to make the lives of our engineers more pleasant. Making testing easy is the only way the engineers will run the tests frequently.

Instead they opted for Watchr, a tool that keeps an eye on a list of files looking for a change. When one happens, a process is fired off - in this case a PHPUnit run. To make it even easier to see feedback, they integrated it with Growl to show pass or fail results. He includes the source for his Watchr script to help you get started.

tagged: unittest watchr growl notification yii framework

Link:

Olek Janiszewski's Blog:
Autotest-like PHPUnit runner for a Zend Framework application
Aug 30, 2010 @ 18:25:43

On the Continuous Development blog there's a new post showing how Olek Janiszewski came up with a solution to integrate PHPUnit and the Zend Framework via the watchr Ruby gem.

Whenever working on a Ruby project, I'd run autotest with test_notifier to get immediate feedback on my code. Unfortunately, I don't know a similar utility integrated with Zend Framework and PHPUnit. [...] My solution is not as well designed and portable as test_notifier, and it doesn't play as nicely with my Zend application as autotest does with RSpec and Rails. It’s more of a quick hack to cover my needs 80% of the time.

The watchr gem changes to the correct directory and runs the usual PHPUnit command (to run all tests) and then captures the output to display back to the client. You end up with messages like these: success, warning and fatal errors.

tagged: phpunit unittest zendframework testing ruby gem watchr

Link:


Trending Topics: