|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Shell execution of phpunit tests for typo3coreHey,
yesterday evening, i had a look at the unit tests of typo3. I detected, that all unit tests extend the class "tx_phpunit_testcase" of the TYPO3 Extension phpunit [1] instead of "PHPUnit_Framework_TestCase" from PHPUnit [2]. if i know correctly, you could run this tests only with the TYPO3 Extension "phpunit" and only from the backend of one TYPO3 instance. I think thats not a very smart solution, because you couldn`t run this tests from a shell with a command like this "phpunit tests/t3lib/t3lib_div_testcase.php". In my opinion it is okay, that the TYPO3 Extension extend the class "PHPUnit_Framework_TestCase" with the method "simulateFrontendEnviroment" [3]. But is it possible to create unit tests more modular that you can run this from a shell without a backend? Some tests has a very long runtime and if you start them from a backend you could run in some timeouts. I didn`t think that is this a solution to set the php timeout to "0". The solution for this problem is to require all classes / files which you use in your unittest. For the file "t3lib_div_testcase.php" it would be "t3lib_div" and "tx_phpunit_testcase". The "problem" is that at this time no constants like "PATH_site" or something else available. Another disadvantage to this solution is the fact, that you must have installed the TYPO3 extension "phpunit". If i know correctly, with the TER / trunk on forge version of TYPO3 extension "phpunit", it is not possible to check core unit tests from the backend [4] [5]. What do you think about this topic? Have a nice day! [1] http://typo3.org/extensions/repository/view/phpunit/current/ [2] http://www.phpunit.de/ [3] http://typo3.org/extensions/repository/view/phpunit/current/info/class.tx_phpunit_testcase.php/ [4] http://forge.typo3.org/issues/show/3349 [5] http://lists.netfielders.de/pipermail/typo3-team-core/2009-January/022753.html _______________________________________________ TYPO3-dev mailing list TYPO3-dev@... http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev |
|
|
Re: Shell execution of phpunit tests for typo3coreAndy Grunwald [wmdb] wrote:
Hi Andy, thanks for bringing this up. > What do you think about this topic? I think it's vital to be able to run them from CLI, especially when considering that we very likely want to have some sort of CI server soon too. Also pre/post commit hooks come to my mind regarding this. best Ingo -- Ingo Renner TYPO3 Core Developer, Release Manager TYPO3 4.2 _______________________________________________ TYPO3-dev mailing list TYPO3-dev@... http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev |
|
|
Re: Shell execution of phpunit tests for typo3coreIngo Renner schrieb:
> Andy Grunwald [wmdb] wrote: > > Hi Andy, > > thanks for bringing this up. > >> What do you think about this topic? > > I think it's vital to be able to run them from CLI, especially when > considering that we very likely want to have some sort of CI server soon > too. Also pre/post commit hooks come to my mind regarding this. > > > best > Ingo > thanks for your reply. Your suggestions are two very big advantages! I think, that the best implementation of this is to make the class "tx_phpunit_testcase" available for the "tests/" directory. In my opinion the cli execution of this unit tests must be independent from the TYPO3 Extension "phpunit". To build a wrapper for all phpunit-commands is not the best way. In my opinion the best way is to make this tests executable for two ways: a) the shell command "phpunit UNIT-TEST-FILE" b) the backend extension "phpunit" To match this goal, the unit tests must be require this used files. If is welcome, i could try to make a patch. Another idea is to contact Oliver Klee to discuss this topic with him. And now the question: What do you think? :) _______________________________________________ TYPO3-dev mailing list TYPO3-dev@... http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev |
|
|
Re: Shell execution of phpunit tests for typo3coreAndy Grunwald [wmdb] wrote:
Hi Andy, > To match this goal, the unit tests must be require this used files. > If is welcome, i could try to make a patch. yes, please go ahead! That'd be a good example of "scratch your itch" - doing something about an issue instead of always just complaining. We really need to change that attitude from "I found some issue, I go complain" to "I found some issue, I'll fix it and help the project by doing that" all the best Ingo -- Ingo Renner TYPO3 Core Developer, Release Manager TYPO3 4.2 _______________________________________________ TYPO3-dev mailing list TYPO3-dev@... http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev |
|
|
Re: Shell execution of phpunit tests for typo3coreHi,
there have already been discussions within the phpunit extension team to provide an CLI runner for the extension. In my opinion it's a big advantage to have the extension in place instead of pure phpunit because it provides a nice thin layer for TYPO3 specific problems. If you'd like to help out with the CLI runner feel free to join the team ;) Regards, Tolleiv _______________________________________________ TYPO3-dev mailing list TYPO3-dev@... http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev |
|
|
Re: Shell execution of phpunit tests for typo3coreOn 9/18/09 2:01 AM, Andy Grunwald [wmdb] wrote:
> Hey, > > yesterday evening, i had a look at the unit tests of typo3. I detected, > that all unit tests extend the class "tx_phpunit_testcase" of the TYPO3 > Extension phpunit [1] instead of "PHPUnit_Framework_TestCase" from > PHPUnit [2]. > > if i know correctly, you could run this tests only with the TYPO3 > Extension "phpunit" and only from the backend of one TYPO3 instance. > I think thats not a very smart solution, because you couldn`t run this > tests from a shell with a command like this "phpunit > tests/t3lib/t3lib_div_testcase.php". > > In my opinion it is okay, that the TYPO3 Extension extend the class > "PHPUnit_Framework_TestCase" with the method > "simulateFrontendEnviroment" [3]. But is it possible to create unit > tests more modular that you can run this from a shell without a backend? > Some tests has a very long runtime and if you start them from a backend > you could run in some timeouts. > I didn`t think that is this a solution to set the php timeout to "0". > > The solution for this problem is to require all classes / files which > you use in your unittest. For the file "t3lib_div_testcase.php" it would > be "t3lib_div" and "tx_phpunit_testcase". > The "problem" is that at this time no constants like "PATH_site" or > something else available. > Another disadvantage to this solution is the fact, that you must have > installed the TYPO3 extension "phpunit". > > If i know correctly, with the TER / trunk on forge version of TYPO3 > extension "phpunit", it is not possible to check core unit tests from > the backend [4] [5]. > > What do you think about this topic? > > Good luck with that. We tried that a couple years back but never got the TYPO3 environment to load properly. If I remember correctly, there were also differences between running from PHP CLI and PHPUnit; something about global arrays that have been made global with the "global" keyword, not $GLOBALS[xxx]. The array seemed to not be there if running inside PHPUnit, so the environment is never correctly set up. If you guys can get it to work, more power to you! Let me know how to get it to work! The PHPUnit Trac doesn't work for me for some reason, but you should be able to find the old tickets I submitted there. Christoph _______________________________________________ TYPO3-dev mailing list TYPO3-dev@... http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev |
|
|
Re: Shell execution of phpunit tests for typo3coreOn 9/18/09 9:50 AM, Christoph Koehler wrote:
> Good luck with that. We tried that a couple years back but never got the > TYPO3 environment to load properly. If I remember correctly, there were > also differences between running from PHP CLI and PHPUnit; something > about global arrays that have been made global with the "global" > keyword, not $GLOBALS[xxx]. The array seemed to not be there if running > inside PHPUnit, so the environment is never correctly set up. > > If you guys can get it to work, more power to you! Let me know how to > get it to work! > The PHPUnit Trac doesn't work for me for some reason, but you should be > able to find the old tickets I submitted there. > > Christoph Just to follow up, here's the bug report: http://www.phpunit.de/ticket/99 Still don't understand why it's invalid, but it doesn't work :) _______________________________________________ TYPO3-dev mailing list TYPO3-dev@... http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev |
|
|
Re: Shell execution of phpunit tests for typo3coreIf I saw I right these features can now be found in the trunk of the
phpunit-extension on forge.typo3.org. Cheers, Tolleiv -- Tolleiv Nietsch www.tolleiv.de - www.aoemedia.de _______________________________________________ TYPO3-dev mailing list TYPO3-dev@... http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev |
| Free embeddable forum powered by Nabble | Forum Help |