> On Wed, Oct 22, 2008 at 1:47 PM, Defranco <[EMAIL PROTECTED]> wrote:
>
> Regarding controller testing using Test Suite on 1.2.RC3:
> ....

Defranco,

Sadly I don't know the answer to your question, but I'd encourage you to
have a go with SVN head (nightly) as this does appear to fix some quirks of
testing ( i think you are part of the thread at *http://tinyurl.com/66sujk )
* I did read the libs earlier today and I suspect you could hack the core to
stop this deletion, at least in the very short term.  Did you investigate
the callbacks at all (2nd set of code at
http://book.cakephp.org/view/366/Testing-controllers ) -  that might allow
you to pause before the drops? (PS If you do find an answer please share!)

But I thought I'd hijack the thread somewhat and add some words of
encouragement for those who are using testing (and those who develop it -
thanks!) and this pops up in their searching ...

After many traumas, false starts etc, I have my app models testing with SVN
head at about 96% coverage. I'm using a mix of hand crafted fixtures and
imported (copied) tables. I moved on to controller testing yesterday and
haven't got very far as yet, but I think it will take time.

Certainly the ease with which you can do model testing is a huge motivator
for the "fat model" approach often touted on here, I've pushed as much as I
can back there which can only be a good thing.

For controllers, as many may well know:

- Things like redirects in the actual controller break things very easily.
  (there are various threads relating to this, eg *http://tinyurl.com/6ns7tg
*

- fixturize is nice, but I've had problems transferring large amounts of
records (at least I think that is what it is doing, I might be wrong?). Also
my old legacy DB with a timestamp breaks it

- a force downloaded file via headers (CSV) via a controlller method throws
up problems (similar to redirect i suppose)

Right now, the only thing I can really do with controller testing is get the
index and check that; I'm not complaining too much, that proves my setup is
right - I'm sure I will figure out more in the coming days.

Debuggable's blog piece is useful - esp. the comments - I posted some
outline model code there (me = "aitch") *http://tinyurl.com/6pq26c*

The bakery article is now well out of date unfortunately; the book is not
bad but lacks a lot of up to date details if you are on the bleeding edge.

I've read a lot of the src to try and establish what is going on. Also the
inbuilt test cases of course have useful nuggets to learn from. I think that
is often the best bet, but as I think has been alluded to on this list and
elsewhere the testing is in a state of flux and somewhat immature compared
to the rest of the package.

I'd encourage others to persevere as it does function well but it takes some
effort; however it is very rewarding when it works and gives terrific
confidence levels. It is interesting when done properly as it really
encourages you to write test-friendly code which must be a good thing.
Superb if you work in an environment where you are looking to "hand off"
your code / site to someone else for ongoing maintenance.

When I get some time and fully understand it, and the code settles down a
bit (maybe 1.2 actual release) I *will* write something comprehensive up.

H


On Wed, Oct 22, 2008 at 1:47 PM, Defranco <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> Regarding controller testing using Test Suite on 1.2.RC3:
>
> How do I test resulting data after I run testAction and
> fixturize=true? The problem is that all all tables are dropped after
> testAction routine.
>
> For example if I run a simple testAction:
>
> $this->testAction(      "/mycontroller/index",
>                                        array(  'fixturize' => true));
>
>
> fixturize=true will make it to create all tables before running
> index(), but it will drop all tables after testAction... how do I test
> resulting data if the tables are all dropped?
>
> Is possible to make testAction to fixturize data but do not drop it so
> I can test resulting data saved on tables?
>
> kind regards
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to