Posted on 16/11/06 by Felix Geisendörfer
The authors of this post have marked it as deprecated. This means the information displayed is most likely outdated, inaccurate, boring or a combination of all three.
Policy: We never delete deprecated posts, but they are not listed in our categories or show up in the search anymore.
Ok I just realized that I've been following a bad pattern on two of my little side projects. The pattern of not releasing before everything is as 'perfect' and feature complete as it can be. Those projects are the CakeTaster test suite and also my Svn/Ftp Deployment Task for bake.
I guess the reason for that is that my blog has turned into my #1 resource for marketing myself since I've started it in January. This causes me to feel hesitant about publishing things that are unfinished, might have bad bugs in them and could make myself look like a poor programmer. Well, the truth is, the poorest programmer of all is the ones that doesn't release. Because what good am I doing to the world when tinkering for for month on things people are in bad need for today, just to make myself look like all code I ever write is perfect the first time. None at all. Therefor I just took 20 minutes, cleaned up the current code of the CakeTaster test suite and decided to release it.
Download: You can download the 0.1 experimental release of CakeTaster here.
Install: Installing the testsuite is simply a matter of unzipping the zip file and copying it over your existing application code. But just to be sure you should take a look in the folder before in order to make sure you don't accidentally overwrite an own controller.
Usage: There is only one kind of testing available right now, the functional testing of Controllers. There are already two sample tests inside the zip file, they will end up resting in /app/tests/functional and should serve as a good example of what a ControllerTest looks like. But just in case you are too lazy to download the package, here is one of the tests:
class PostsControllerTest extends ControllerTestCase
$response = $this->get('/posts/index');
$vars = $this->viewVars;
$this->assertTrue(!empty($vars['posts']), 'Posts array is not empty');
$this->assertTrue(true, 'True === True');
As you can see $this->get invokes a call to a given url, there is also a post functional as well as a parameter for arguments which I haven't tested so far. The class itself extends the UnitTestCase of SimpleTest and therefor supports all kinds of asserts that SimpleTest does. The get/post function will always contain the view rendered by the Controller, and $this->viewVars will contain, uhm, the view vars ; ).
In order to run the tests you have to browse to /tests. It should give a little interface allowing to filter for test names as well as to expand/collapse certain tests.
And for those of you who want to see what they are getting into before doing so, here comes a little screen shot:
Alright, I would love to hear any kind of feedback on the suite. I know it's not even close to being done but the basics are there. So if you find a bug, want to make a suggestion or something like this, let me know in the comments.
--Felix Geisendörfer aka the_undefined
You can skip to the end and add a comment.
This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.