Eclipse Testing with TPTP - help me?
December 10th, 2007 by Aaron
I recently came across this tutorial here about Testing with TPTP- and I’m confused. Whats the benefit of this type of testing (um… creating JAVA code for a JUnit test… right?) compared to running some PHPUnit, Selenium and AB (from apache, or something…)? What am I missing - does anyone have any other good hands-on tutorials?
APD post processing wrapper
November 17th, 2007 by Aaron
A while ago, I discovered the ‘joys’ of APD… and then moreso, the ‘joys’ of not being able to make heads or tails out of the output script. After digging deeper, I saw that the original directory already had some PHP scripts to parse the output. I ran those and wasn’t very impressed. Even more important, my boss wouldn’t be impressed. I needed to be able to make something that could be useful to integrate into a table (I finally used dojo to create a table…)
At any rate, I thought I might save anyone some time by posting the code here:
Continue reading APD post processing wrapper
Friendly reminders about testing your PHP code
August 3rd, 2007 by Aaron
I was reading on a forum the other day about some benchmarks for PHP. The guy had posted some results in ms measurements, and was getting upset about his erratic results. There were some things that he was forgetting, however.
First, not all tests are built to be accurate up to the ms. Sometimes, they are ratio based. For example, the tests you run on your development machine aren’t going to perform the same as they would on the production machine (of course, in this example I’m assuming identical hardware and configuration). There is differences in processes running, memory, etc. The important thing to note is the ratio between a mean of tests in scenario 1 and scenario 2.
Next, if we want to be super picky, the code you’re inserting to test - or the extra modules (think xdebug) you’re loading to test performance - are going to actually lower your performance a small amount. And when dealing with ms, this is measurable!
Finally, I can’t believe how many people forget this: if your development machine is not an exact copy of your production server (which most of the time, it isn’t), your tests MUST be ratio based. There are so many differences here - including even the differences in performance on internal PHP functions (think windows + perl regular expressions…)
So, in summary: DO test. DON’T take the results verbatim as proof. Run many and use means and averages. Be smart about how you’re configuring your test environment.
Test Driven Development Book Review
June 16th, 2007 by Aaron
(”the triangle”) just recently purchased a book for the library at my request, Test-Driven Development by example by Kent Beck. The current Amazon price for this book is $35. The book took me about 2 weeks of sporadic reading to finish. The first section took the first week, the remaining 2 sections and appendix flew by.
This book is an easy reader.
While it is a technical concept, the author writes in a conversational way - which is helpful when you’re learning new concepts. He also makes jokes from time to time, and relates his writing to his previous development experiences. Since the ideas were new to me, this type of writing had more of a personal test and was able to ease along that “horrible” process of learning something new.
After reading this book, I have a handle on test driven development.
I’ve heard of it before, specifically with PHPUnit and JUnit (Somehow, that makes me wanna scream like a fiddy cent lover, G-UNIT!). I had, however, never used any of those frameworks. A few open source projects I’ve come across had their testing suites online with progress indicators (ie: 90% of our tests are green in this development branch), but I never knew what they were actually talking about. After the first section of this book which is littered with examples, I was able to get a handle on the value of this. I still had questions about practical implementation, but I was actually looking forward (I KNOW!! what???) to reading the next sections for some practical advice and design patterns.
Practical Advice and Design Patterns were lacking in this book.
I was looking forward to the practical implementation - but those examples were between Python and Java - which maybe I missed something in the reading - but he seemed to switch back and forth between those two languages without a hint. That made the thought process a bit more convoluted. Additionally, the design patterns seemed more programmer-school-college-boy and not real life descriptions. For example, talking about a value or null object just didn’t seem to have alot of real world implementation in what I do… but that brings me to my next point:
This book was more valuable to native java programmers, and maybe less to languages with their roots in scripting.
I’m a PHP programmer by trade - but I use both the top down and object oriented development features. However, being a PHP programmer for so long, before they had object support, alot of the concepts of simplification, removing duplication, etc, were already notions I had deep within my programming techniques already. I noticed alot of patterns from normal java programmers being modified in this book - so as to simple down some of the object usage … and make a more testing compatible flow. The last few sections of the last part of the book were pretty much useless for me - they were very abstract theoretical thoughts on patterns. While this may be valuable for some people, I’m more of a by-example and hands on learner.
My final verdict:
How often I finish a book or article and think: “Boy, if I could just get that time back… what a waste.” This was NOT the case with Test-Driven Development by Example by Kent Beck. Two things really are notable about my experience: The first section’s examples and simpler look at the concept were extremely valuable into whetting my appetite for Test Driven Development and I’d have gained more value from a book based around PHP with the same concepts emphasized. I don’t know if I would have bought the book personally, but (”the triangle”)’s purchase of this was totally warranted (with their programming staff of about 25…).
As a side note: I plan to attempt test driven development with my website monitoring project - so watch for more real life examples and updates with PHP!
