Contact Us

What is a Testcase - especially in CakePHP?

Posted on 9/6/09 by Tim Koschützki

Hey folks,

it's amazing how many people on the public CakePHP irc channel don't know what a test case is. This has to stop. To clear up some confusion, let's have a look at it.

What is a Test Case? A Possible Definition

This is what wikipedia has to say about a testcase:

A test case in software engineering is a set of conditions or variables under which a tester will determine whether an application or software system is working correctly or not. The mechanism for determining whether a software program or system has passed or failed such a test is known as a test oracle. In some settings, an oracle could be a requirement or use case, while in others it could be a heuristic. It may take many test cases to determine that a software program or system is functioning correctly. Test cases are often referred to as test scripts, particularly when written. Written test cases are usually collected into test suites.

So is this me testing stuff in my browser?

Yes and no. The definition does not necessarily imply that a testcase has anything to do with Unit Testing, or other testing approaches.

You testing your menu bar's javascript in several browsers in different resolutions can also be considered to be a testcase (or many for that matter) according to the definition. However, most of the time a testcase is meant to be a written test. When it comes to CakePHP, it's mainly a Unit Test.

Where can I learn about test cases?

There are a ton of resources on the web for tests. If you are looking for material for CakePHP, try out these:

  1. The Article "Introduction to Unit Testing Part 1" written by yours truly
  2. The CakePHP CookBook Chapter on Testing
  3. Your First Testcase
  4. Mark Story's Unit Testing Talk Slide for CakeFest Argentinia December 2009
  5. My slides for the Unit Testing Talk for CakeFest Orlando February 2008

Lets get a discussion started to clear up confusion.

-- Tim Koschuetzki aka DarkAngelBGE


You can skip to the end and add a comment.

thetravelguy said on Jun 13, 2009:

Would just like to say there are certainly a lot of interesting things being said here i will definately get back in a short while to participate actively.

Inside said on Jun 17, 2009:

Tests are something that many people miss while learning cake, i think it should be more encouraged.
Btw, the slides talk link in point 4 has a wrong date.


Tim Koschützki said on Jun 18, 2009:

Thanks Inside for the heads up. :)

Peter Goodman said on Jun 22, 2009:

I would also suggest "The Art of Testivus".

Karternak said on Nov 27, 2009:

I slowly recommend posting unconsciously link a few to your>cheap generic cialis at superb a the maximum rate of bitter end of ea job title you unmistakably make a few to your blog. This strong will slowly give you even any more broad generic cialis a few to your site. #4 - write articles:one of for the best ways a few to silent become an generic cialis expert on your significant work is a few to write out articles on the i. And key on superb a unconsciously link a few to your generic cialis in the resources box..

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.