[TYPO3-dev] TestDrivenDevelopment & Typo3

Jochen Rau jochen.rau at typoplanet.de
Fri Oct 23 10:11:10 CEST 2009


Hi Michael,

Michael Knoll wrote:
> Since it seems to be the way to go, I would like to use
> TestDrivenDevelopment for extension development.

Good choice!

> So here's my question: Is there an easy way to write tests that require
> TS configuration in order to create objects that should be tested? Are
> there any experiences? I have some ideas, but I'm not quite sure what's
> the best solution:
>
> a) Put TS in an array in the test case (no parsing required, but a lot
> of work to write all the braces)

That would be o.k.. Use a minimalistic setup, just enough to run your test.

Use DataProviders to run several setups within one test (only works with 
the latest svn revision of EXT:phpunit).

http://www.phpunit.de/manual/3.4/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers

http://forge.typo3.org/projects/show/extension-phpunit

> b) Put TS in a string into the test case and parse it (here would be my
> next question, how can I do that the easiest way?)

Nope. You will test the TS parser and not only your method (=unit).

> c) Put TS into a file in a seperate folder into the test case. The same
> question as above: How can I parse them most easily.

Same answer as above ;-)

> I suppose for FE plugins, I still have to emulate a FE session, for
> which I have already written helper classes, so that should be no problem.
>
> As I want to run my tests without even putting an instance of a plugin
> on a page, I think that using Page IDs with Typoscript in my testcode is
> a rather dirty way - isn't it?

Right. That’s really ugly ;-)

Regards
Jochen

-- 
Every nit picked is a bug fixed





More information about the TYPO3-dev mailing list