Posted on 14/8/06 by Felix Geisendörfer
For everybody who has read my previous post on automatisation, there are good news:
After having finished the "Pragmatic Programmer", I'm reading "Practices of an Agile Developer" and I enjoy it a lot. So I've decided that, over the course of the next couple days (or weeks), I'll dedicate quite a bit of my time to explore ways to improve the way I write web applications. This includes getting into unit/integration testing, automating workflows, and also adopting better coding techniques. A lot of it will eventually speed up processes here and there, but most of it will be directed torwards higher quality (which will hopefully lead to less bugs and reduce work on "finished" projects). A lot of times I'll try to translate some of the tips out of the books I mentioned above into the world of web development, on other times you'll just see my regular php related code postings ; ).
Right now, I'm trying to get a list of good technologies to help me on my way to agility. So far I've come across a couple very nice ones for some of the things I plan to do:
Automatisation: Apache Ant
In my last post I wrote about using bash scripts to automate some of my common tasks. Daniel Hofstetter pointed out that he is using Ant for his projects, and since I respect his opinnion a lot, I went ahead and checked it out:
The official website states that "Apache Ant is a Java-based build tool. In theory, it is kind of like Make, but without Make's wrinkles.". Usally tools like make (or Ant) are being used for java/c/c++ or other compiled languages to help with the process of creating the binary files by providing ways to define a toolchain. In the (Cake)PHP world, we don't "compile" things, so I wasn't quite sure if it would be useful. But as it turns out those folks working on ant are going way beyond that. Ant ships (or can be extended) with tools to complete tasks like: Zipping, Mailing, FTP, SVN/CVS, Image editing, Unit testing, MySql, and many more. Lots of them very useful when working on web projects. I already used it to automate the deployment (strip .svn files, upload to ftp, update sql) of my latest project and I'm in the process of refactoring it to be useful for any CakePHP app. I'll write more about it when I feel like I gained enough familarity with it.
In case you are interested in it already and want to check it out by yourself:
Testing: Simple Test for PHP
For unit testing I am probably going to use the popular Simple Test testing framework. I've looked at some other ones but I've heard a lot of good things about this one so I'll give it a try. However, I am probably not going to use CakePHP's TestSuite for it. That's mostly because it has no official documentation / support and it also seems to have some problems when running from within a sub folder. I want my unit (and integrational) testing to work from the command line, so I can include it into ant's deployment task (nothing ships unless it passes the test).
If anybody has other suggestions of which testing framework to use, i'd be glad to hear them ; ).
Testing: Selenium Remote Control
Since php is not on the list of supported languages I'll not waste my time to write a hack for it, but rather learn one of the other languages it supports. Most likely that'll be ruby (but don't you worry, I'm not going to join the rails crowd at any point soon).
Testing: Selenium IDE
Selenium IDE is an extension for Mozilla Firefox that'll allow you to manually record things you do in your browser and play them back. Yes, you've heard right! It's the exact kind of neat little tool that you wanted to have years ago when you tried to get this form to work and typed in sample data by hand over and over again! Well it's 2006 and you really shouldn't be doing this any more ; ). One or two times are ok, but if you find yourself running the same kind of test for more then 3 times in a row, you might want to use this little tool instead. But anyway, that's just it's basic funcionality. What it will do as well, is to generate Selenese, Java, Ruby, Python, C# or Perl scripts for you, that you can use for Selenium Remote Control. Neat, uhm?!
... I ran out of tools to point out and have come to the end of this posting. One of the things I want to say before I quit firefox in order to bring out the trash, is that I don't know if all the tools I mentioned here, will really be the ones I end up using. I've played around with ant for the last couple of days, and I used to work with Selenium core, but other then that I might change my mind again. In case you have other programs you like for agile web development, or things one of the ones I mentioned isn't any good, just drop me a comment and I'll check it out.
Anyway, thanks for reading, I hope I have some more "productive" stuff to write about next time ; ).
--Felix Geisendörfer aka the_undefined