[TYPO3-core] Add more unit tests to patches

Andy Grunwald [wmdb] andreas.grunwald at wmdb.de
Fri May 18 10:31:01 CEST 2012


A *BIG* +1 for this.

I really like this step, because it will raise the code quality.
And many many people are complaining about that. Lets fight the regressions!

But i see three different problems there:
1. The contribution rate will be decrease a little bit, because many 
people don`t know anything about unit tests, how to write them, what 
they are good for, and so on. They "just" want to fix this bug (in my 
opinion, a unit test is required to fix a bug). One solution to work 
agianst this problem is that a group of people will write unit tests for 
pending patches which are not unit testes at the moment. At first point, 
this will create a huge amount of work, because we have so many pending 
patches there. On the other hand this is a really good training for 
someone who don`t know how to write unit tests.

2. This commitment must be official (discussed). This idea can only be 
successful if all (core) developers agree on this. Otherwise all others 
will merge stuff without unit tests and you are the only one. That is 
not really useful :(. After this the new "rule" (?) must be official 
announced (via buzz.typo3.org or an offical news).

3. Make all available tests green. The are some unit tests available 
(have a look at Philipps post for a correct number). But not all of them 
went green. The base must be a green bar feeling over all the core.
Only with this status it is possible to say "this feature will break 
something". This must be the first task. If you got help for this, drop 
me a message and i will contribute to this. Perhaps a skype meeting with 
all volunteers would be useful.

But i think all of this "problems" are "solvable".
So, lets tackle this stuff!
Andy

Am 16.05.2012 20:35, schrieb Christian Kuhn:
> Hey there.
>
>
> We recently had again some serious regressions in our stable releases.
>
> We talked about that during the latest team meeting and came to the
> conclusion that - next to other things - unit testing can be a tool that
> helps us avoiding regressions.
>
> It would be great if we could add tests to patches, especially if:
> - They are bugfixes and targeted to be backported to stable branches
> - The code itself is unit testable at all (there are situations in the
> core where it is hardly possible without bigger refactorings)
> - The code that is changed proofed to be fragile
> - The patch fixes a regression
>
> In some areas of the core I'd go so far to say that unit tests are
> mandatory. This is especially true for those central static classes like
> t3lib_div. For me, I'll not merge a patch in t3lib_div & friends that
> doesn't come with a test (if possible).
>
> I just went through some patches and found several of them to be easily
> unit testable. I voted them down and asked for tests now.
>
>  From my experience I can say that writing unit tests often improves the
> code quality, makes code more easy to maintain and avoids bugs when
> writing and refactoring things.
>
> At the moment, we have already plenty of tests in the core and they can
> be used as examples on how to solve own problems. There are examples for
> nifty mocking, for callbacks, for accessible proxies and so on. We also
> have some guys with a high addiction to tests, so please ask if you are
> unsure on how to solve things.
>
>
> Regards
> Christian
>
>
> [1]
> http://forge.typo3.org/projects/typo3v60/wiki/2nd_Release_Team_Meeting_TYPO3_60
>



More information about the TYPO3-team-core mailing list