You're welcome.  What you're running into is a limitation of the
Testing Framework CakePHP 1.x decided to use -- SimpleTest.  CakePHP
2.0 will be using the PHP defacto standard PHPUnit as their testing
framework from now on.

PHPUnit is more in line of what a similar RoR test framework will give
you.  RoR is a great framework, I actually came to CakePHP from a
heavy Ruby on Rails background.   I have my personal gripes with RoR,
but that's nothing new, nothing is perfect.  However the issue with
webtesting will persist through even in Ruby on Rails.  This is
because the idea of web testing testing your app from point to point
(from a browser), fixture's don't really make sense in that scope.
Sure you can do things like seed data and rake is a great tool for
doing just that but you'd be doing the same thing you'd be doing to
get it working in CakePHP.... spoofing your app to run on a test
database rather than production based on some request.

WebTesting in RubyOnRails is often done with Selenium (http://
seleniumhq.org/).  You can install a really cool Firefox plugin that
will actually write your testcase for you as you click, edit forms,
etc...  With PHPUnit (CakePHP 2.0) You'll be able to do the same thing
with their Selenium extention (http://www.phpunit.de/manual/3.1/en/
selenium.html)

I'm not trying to discourage you from picking up Ruby on Rails, just
stating your "problem" will persist regardless as the issue is
conceptual more than actual.

Hope that helps,
Nick

On Sep 16, 12:57 am, Joshua Muheim <psybea...@gmail.com> wrote:
> WOW, thank you so much for your very informative answer, Nick! I
> nearly gave up all hope already.
>
> I absolutely agree with everything you write. I just don't understand
> why the CakePHP developers don't seem to see it "our" way? Why didn't
> they tweak SimpleTest so it fits our need with the separate
> staging-database? I really am no very experienced PHP programmer, and
> I guess it would take me quite a long time to do the modifications you
> suggested... and it would be quite buggy, too.
>
> Well, in a few days I will have a talk to my boss and I will suggest
> him to switch from CakePHP to Ruby On Rails... RoR just seems a whole
> lot better to me, although I didn't work with it for two years or so
> now... CakePHP misses so many useful nice-to-haves and even some big
> must-haves.
>
> Again, thank you for your great answer, Nick!
>
>
>
> On Wed, Sep 15, 2010 at 6:06 PM, nurvzy <nur...@gmail.com> wrote:
> > Fixtures in WebTestCase?
>
> >http://book.cakephp.org/view/1219/Web-testing-Testing-views#About-Cak...
>
> > Short answer: Nope.
>
> > Long answer: Eventhough you can't use fixtures, you can still make
> > your app use a secondary database instead of your production one.
> > This is not a CakePHP solution, rather than a manipulation of
> > SimpleTest.  The idea of a web test case is to test your app as a
> > whole.  It basically simulates a browser that you can make calls on
> > your app, submit forms, click links, etc...  The idea is to test the
> > app in a real browser and as such it uses the real database as your
> > app doesn't know any better.... unless you make your app smarter.
>
> > I highly suggest you read through the documentation at SimpleTest as
> > well as poke your head into the actual source.  By doing so you'll
> > notice you can directly access the browser being used by the
> > WebTestCase with getBrowser(). With that, if you look into what you
> > can do on the browser (http://simpletest.sourceforge.net/en/
> > browser_documentation.html) you can add additional headers to each
> > request.   Your app then can look at the request before doing
> > anything, if your specified test header is present, switch the default
> > database constructor to use a test database instead of your production
> > one and you're free to run as many webtests as you please.
>
> > What I do, and most of the companies/clients I've worked for, is have
> > three environments, development, staging, and production.  Each have
> > their own separate database they connect to and are maintained through
> > various migrations/source control.  Staging is for all purposes
> > identical to production, except for the fact it's connected to a
> > different non-live database (and is usually closed to the public).  As
> > such it is safe to run web tests on staging as it doesn't affect the
> > live database.  The idea being, if there is a problem you'll discover
> > it first on the staging site before it gets pushed over to your
> > production site.
>
> > Hope that helps,
> > Nick
>
> > On Sep 14, 3:43 am, psybear83 <psybea...@gmail.com> wrote:
> >> Dear CakePHP community
>
> >> I'm asking this question (or related ones) for quite a short while
> >> now, and I still didn't get a clear answer. So I ask one more single
> >> time:
>
> >> Is there a way to use fixtures with web tests (CakeWebTestCase, not
> >> CakeTestCase!), or not?
>
> >> I'd like to create useful web tests that test my application like a
> >> bunch of real users would, andit would be really, really useful to
> >> have fixtures available for these tests like one has with unit tests.
> >> But I didn't find an article or something like that yet... maybe I was
> >> just blind (I really hope this is the case).
>
> >> Thanks a lot for help
> >> Josh
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to