Hi Aurimas, Thanks a lot for your answer. I managed to run metric tests with the old and the new testing library, it's a bit challenging to try to lower some values!
Here's my feedback for the new testing library : I didn't succes to launch tests with runtests or runtests-coverage. I created a test_config.local.php file where I define the correct path to the shop and i set $sDataBaseRestore to "dbRestore" because comments told that it's better to use this one. When i launch runtests-coverage, i have this output (same result with runtests) : ***** PHPUnit 3.7.38 by Sebastian Bergmann. Configuration read from /var/www/oxid/source/modules/mymodule/tests/phpunit.xml Time: 1.27 seconds, Memory: 9.25Mb No tests executed! Generating code coverage report in Clover XML format ... done Generating code coverage report in HTML format ... done PHP Warning: file_get_contents(/tmp//tmp_db_dump_oxidce): failed to open stream: No such file or directory in /var/www/oxid/source/modules/mymodule/tests/Library/dbRestore.php on line 351 PHP Warning: file_get_contents(/tmp//tmp_db_dump_oxidce): failed to open stream: No such file or directory in /var/www/oxid/source/modules/mymodule/tests/Library/dbRestore.php on line 351 ******** My database has no tables anymore and i have to recreate it. I searched a little and i see that the dbDump function of the dbRestore class is never called, so the dump of my database is not created and it cannot restore it. 1) Is there something I missed in the config? 2) The "No tests executed!" bothers me, it looks like i'm not asking the testing library to test something... What tests should i execute in order to run coverage tests on my module? Thanks in advance, Best regards, Nicolas Hodin www.takeitweb.fr ᐧ 2015-02-06 13:15 GMT+01:00 Aurimas Gladutis < aurimas.gladu...@oxid-esales.com>: > Hi, > > Answer 1) > coverage.inc.php is only used for code coverage, but not for metrics. > To exlude directory from metrics, you need to edit runmetrics file and add > directory to ignore: ./pdepend --ignore external_library > > Answer 2) > Current testing library is not working with 5.2 version of the shop, as > deprecated methods (getInstance()) was removed from the shop. > I would suggest to use new testing library > https://github.com/OXID-eSales/testing_library which is currently in > alpha stage, but should work fine with newer shop versions or > change all the usages of oxConfig::getInstance() to > oxRegistry::getConfig() in current testing library. > > If you will go with the new testing library option, please give us any > feedback on how easy it is to use it and what problems are still left there. > > *Aurimas Gladutis* > Software Developer > > *aurimas.gladu...@oxid-esales.com <aurimas.gladu...@oxid-esales.com>* > Fon +49 761 36889-0 > Fax +49 761 36889-29 > *www.oxid-esales.com > <http://www.oxid-esales.com?campaign=emailsignatur/oxid-esales-com?adword=OXSIG_Startseite>* > > > [image: dmexco] > > *Köln, 10.-11.09.2014, Halle 7 Stand C 011/D 010* > > > > > *Jetzt Termin vereinbaren > <http://www.oxid-esales.com/index.php?id=2622&adword=OXSIG_DMEXCO14> OXID > eSales AG *Bertoldstraße 48 > 79098 Freiburg > Deutschland > > Vorstand: Roland Fesenmayr (Vorsitzender), Andrea Seeger > Vorsitzender des Aufsichtsrats: Michael Schlenk, Sitz: Freiburg > Amtsgericht Freiburg i. Br., HRB 701648, USt-IdNr.: DE231450866 > ------------------------------ > *From:* dev-general-boun...@lists.oxidforge.org [ > dev-general-boun...@lists.oxidforge.org] on behalf of Nicolas Hodin [ > nho...@noxnet.fr] > *Sent:* Friday, February 06, 2015 9:52 AM > *To:* dev-general@lists.oxidforge.org > *Subject:* [oxid-dev-general] Module certification and unit tests > > Hello, > > In order to certifiy my new module I wanted to launch unit tests on it > to retrieve metrics. > > I installed a fresh CE eshop on a ubuntu server and it is working with > demo data.I downloaded the tests directory from the Starter package from > http://www.oxid-esales.com/en/products/downloads/knowledge.html and put > it in my module folder, so i have this tree : > > oxidroot > |__ modules > |___ mymodule > |___ classes > |___ external_library > |___ tests > > > Question 1) > When i execute runmetrics.sh in the tests folders, it works and i have two > new files metrics.txt and metrics.xml. The values are very high because i > use an external library and i can see that all classes in this library are > computed. > I tried to add these line to the file coverage.inc.php : > > PHPUnit_Util_Filter::removeDirectoryFromWhitelist(oxPATH . > '/modules/mymodule/external_library/'); > > But it doesn't work, the library is still included in metrics. How can i > blacklist this folder? > > Question 2) > When i execute runtests.sh or runcoverage.sh, i have this error : > > PHP Fatal error: Call to undefined method oxConfig::getInstance() in > /var/www/oxid/source/modules/mymodule/tests/unit/test_utils.php on line 585 > > Fatal error: Call to undefined method oxConfig::getInstance() in > /var/www/oxid/source/modules/mymodule/tests/unit/test_utils.php on line 585 > > > Maybe I'm doing something wrong, is my tests folder at the right place? > Did i forget a config file? > > > Thanks in advance for your help! > > > Best regards, > > Nicolas Hodin > www.takeitweb.fr > > _______________________________________________ > dev-general mailing list > dev-general@lists.oxidforge.org > http://dir.gmane.org/gmane.comp.php.oxid.general >
_______________________________________________ dev-general mailing list dev-general@lists.oxidforge.org http://dir.gmane.org/gmane.comp.php.oxid.general