News Archive
PhpRiot Newsletter
Your Email Address:

More information

Test with Frisk!

Note: This article was originally published at Planet PHP on 18 October 2010.
Planet PHP

For a while now, I've had a renewed interesting testing applications - unit, functional, performance, etc - and have been learning all I can about the software you can use to run these tests. Obviously, one of the mainstays of the PHP world is PHPUnit for unit testing. There's a few others out there that are good for other kinds of testing - too many to name (and lots that aren't written in PHP).

Lately, though, I've been looking more at testing the frontend of applications and their flow. I started looking around at the current testing tools and found some I wanted to use, but I wanted more to know how they worked. So, as an exercise, I started on Frisk, a light-weight simple testing framework that has some of the basics of functionally testing, nothing fancy though. Oh, and of course it's open sourced so you can take a look at the work behind it too.

It's not a complete testing tool, but it does work. I've thrown together a simple example of how I've used it to test two things on the site - the homepage content and the result of a login:


When this file is dropped in the "tests" directory and the "frisk" executable is run, it'll execute these tests and check the results of those requests. The "ji-enygma.localhost" is a reference to my local instance. The results are spit back out as a PHP array that reports the results of each part of the test (pass/fail) split out by test function name and action/assert result:

  1. Start!
  2. A
  3. =====================
  4. ending status: Array
  5. (
  6. A A [JoindinTest] = Array
  7. A A A A (
  8. A A A A A A [testHomepageContent] = Array
  9. A A A A A A A A (
  10. A A A A A A A A A A [ActionGet] = Array
  11. "/

Truncated by Planet PHP, read more at the original (another 11843 bytes)