 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Padraic Brady's Blog: The Mockery An Independent Mock Object and Stub Framework for PHP5
by Chris Cornutt March 06, 2009 @ 10:28:58
Noting the lack of a good, independent library for creating Mock Objects for unit testing PHP scripts, Padraic Brady (with assistance from Travis Swicegood) has come up with a standalone Mock Object and Stub framework - Mockery.
It's not tailored specifically to any one testing framework, rather it's an entirely separate framework with a discrete API. The idea is that you can use this framework within PHPUnit, or SimpleTest, or anything else really, without being forced to rely on the built-in support (if any) that test framework provides. Mockery was designed specifically to implement a form of Domain Specific Language (DSL). It makes extensive use of a fluent interface mixed with methods to approximate plain English.
He includes an overview of what Mock Objects and Stubs are and how to set them up with the Mockery tool. He finishes things off with a look at the Mockery and Mock Object Expectation APIs. You can grab this first release either as a PEAR package or from its github page.
voice your opinion now!
mockery php5 stub testing unittest object simpletest phpunit standalone
Developer Tutorials Blog: Testing email routines in web applications
by Chris Cornutt July 17, 2008 @ 08:49:16
On the Developer Tutorials blog, there's a recent example of how to validate a common task of many signup forms - if the email sent is actually received.
For any web developer that's ever had to build a signup routine, email is the necessary evil that takes pride of place among hated activities. Sure, a simple call to the language's mail library will send a message through, but the moment the boss wants a HTML email, or users need attachments, everything starts to get tricky.
They try to solve the mail return issue (it tells if the message has gone to the queue, not been delivered) with a little testing and Fakemail. The software looks for emails based on the configuration given and pulls them out to a local directory. Your script can then look here and check the validity of the message before its sent.
This even allows for integration with things like Phing, SimpleTest and Selenium.
voice your opinion now!
test unittest selenium simpletest phing email fakemail
Debuggable Blog: How To Execute Only Specific Test Methods in CakePHP Unit Tests
by Chris Cornutt June 19, 2008 @ 12:52:45
On the Debuggable blog today, Tim Koschutki shows how you can run just the tests you want on your CakePHP application without having to worry about sorting their results out manually.
Most of us familiar with unit testing with CakePHP and SimpleTest know that SimpleTest always executes all methods starting with the string "test". This can be problematic sometimes. At this point you have two options: create a new testcase, put an "x" before every other test name or use the following tip.
His tip puts another layer on top of the usual testing and uses the getTests method to define with of the tests need to be run. If it's defined, SimpleTest will only execute those.
voice your opinion now!
simpletest unittest cakephp framework gettests method
PHP in Action Blog: Testing a Zend Framework action controller with View Helpers
by Chris Cornutt June 11, 2008 @ 07:56:11
On the PHP in Action blog, there's a new post about a method for testing a controller as a part of a Zend Framework application with its own view helpers.
I came across a Zend Framework (ZF) example I wanted to refactor. You really have to have unit test coverage to refactor effectively, and since there were no tests, I started trying to find out how to test it. There didn't seem to be a wealth of information available on the web, so I've tried to figure it out by myself.
He walks through the testing process he followed - making some new default objects (for SimpleTest) and, using the flash messenger view helper, makes some mock classes to simulate sending the flash messages in an application.
voice your opinion now!
zendframwork simpletest unittest controller view helper
Debuggable Blog: Unit Testing in CakePHP Part 1 - Introduction to Unit Testing
by Chris Cornutt May 07, 2008 @ 10:23:29
On the Debuggable blog, Tim Koschutki has posted the first part of a series looking at unit testing the CakePHP framework. This first article introduces you to the idea of unit testing to help lay the foundation for what's to come.
So you want to read up on Unit Testing in CakePHP? That is great, testing can be such a help in finding bugs. [...] Surprisingly, many people do not know yet what unit testing is. In this first part of a whole series you can get a good grasp of what it is and is not.
He goes over the basic concepts behind the testing - setting up test cases, comparing results, automating them and how they related to code coverage. He gets into more detail with a list of the assert functions (like assertNotEqual or assertClone) and some examples using the simpletest unit testing software. He wraps it up by listing some of the benefits of unit testing, the limitations of it, TDD and what Mock objects are.
voice your opinion now!
cakephp framework unittest simpletest introduction
PHP in Action Blog: Tips for web testing
by Chris Cornutt February 13, 2008 @ 08:09:46
On the PHP in Action Blog, there's a this post that shares some tips for testing your web applications with some simple tests.
I just started listing the techniques I've learned when writing tests to exercise the web interface of a PHP application. This is from my experience and my personal preferences; it's not the final word or necessarily right for everyone.
He suggests:
- Use SimpleTest's Web tester if you can
- Test the web output using regular expressions
- Use element IDs or names to test links, forms and fields
- Log HTTP requests in the application
voice your opinion now!
web testing unittest simpletest regularexpression http request
|
Community Events
Don't see your event here? Let us know!
|