diff options
author | Matthieu Aubry <matt@piwik.org> | 2013-10-30 02:57:18 +0400 |
---|---|---|
committer | Matthieu Aubry <matt@piwik.org> | 2013-10-30 02:57:18 +0400 |
commit | 5c0ff108a970c4029f32457f1fddc63689c09a11 (patch) | |
tree | 2a65d8f78366acdb172722ce3eafcccf3c5c8c68 /tests/README.md | |
parent | a718df3793c15f6f3c510bf777a62b46ce02b195 (diff) |
Update README.md
Diffstat (limited to 'tests/README.md')
-rw-r--r-- | tests/README.md | 121 |
1 files changed, 57 insertions, 64 deletions
diff --git a/tests/README.md b/tests/README.md index 9a85cdb676..dec862ca79 100644 --- a/tests/README.md +++ b/tests/README.md @@ -26,7 +26,7 @@ $ git clone https://github.com/piwik/piwik.git Next install Composer which will lets you download the libraries used in Piwik: ``` $ curl -sS https://getcomposer.org/installer | php -$php composer.phar install +$ php composer.phar install ``` To execute the tests: @@ -63,58 +63,21 @@ To execute the tests: `SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)` -4. Run the tests (see the next section to run tests in the browser) +4. Run the tests - $ cd /path/to/piwik/tests/PHPUnit - $ phpunit --group Core + $ cd /path/to/piwik/tests/PHPUnit + $ phpunit --group Core $ phpunit --group Plugins $ phpunit --group Integration There are three main groups of tests: Core, Plugins and Integration For example run `phpunit --group Core` - to run all Core Piwik tests. You may also combine groups like - `phpunit --group Core,Plugins` - + to run all Core Piwik tests. + 5. Write more tests :) See ["Writing Unit tests with PHPUnit"](http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html) -### PHP 5.5: also update PHPUnit to latest - -See [PHPUnit update](http://phpunit.de/manual/current/en/installation.html) or try this command: - $ sudo pear install -a phpunit/PHPUnit - -### Troubleshooting failing tests - -If you get any of these errors: - * `RuntimeException: Unable to create the cache directory ( piwik/tmp/templates_c/66/77).` - * or `fopen( piwik/tmp/latest/testgz.txt): failed to open stream: No such file or directory` - * or `Exception: Error while creating the file: piwik/tmp/latest/LATEST` - * or `PHP Warning: file_put_contents( piwik/tmp/logs/piwik.test.log): failed to open stream: Permission denied in [..]` - -On your dev server, give your user permissions to write to the directory: - - $ sudo chmod 777 -R piwik/tmp/ - -### Troubleshooting SLOW tests - -If the tests are running incredibly slow on your machine, maybe you are running mysql DB on an ext4 partition? -Here is the tip that will save you hours of research: if you use Mysql on ext4 partition, -make sure you add "nobarrier" option to /etc/fstab to disable some super slow IO feature. - -Change from: - `UUID=83237e54-445f-8b83-180f06459d46 / ext4 errors=remount-ro 0 1` -to this: - `UUID=83237e54-445f-8b83-180f06459d46 / ext4 errors=remount-ro,nobarrier 0 1` - -### Using latest GIT version -On ubuntu to use the latest GIT: - -``` -sudo add-apt-repository ppa:git-core/ppa -sudo apt-get update -sudo apt-get upgrade -``` ## Integration Tests @@ -134,49 +97,79 @@ If changes are expected due to the code changes you make, simply copy the file f expected/, and test will then pass. Copying files is done easily using Meld (ALT+LEFT). Otherwise, if you didn't expect to modify the API outputs, it might be that your changes are breaking some features unexpectedly. +### Scheduled Reports Tests + +As part of our integration tests we generate the scheduled reports (in HTML, PDF & SMS). +Some of these scheduled reports contain PNG graphs. Depending on the system under test, generated images can differ. +Therefore, PNG graphs are only tested and compared against "expected" graphs, if the system under test has the same characteristics as the integration server. +The characteristics of the integration server are described in `IntegrationTestCase::canImagesBeIncludedInScheduledReports()` ## JavaScript Tests -piwik.js is unit tested and you can run tests via piwik/tests/javascript/ +piwik.js is unit tested and you can run the Javascript tests at: /piwik/tests/javascript/ ## Testing Data -You can import test data over several days in Piwik. +See [tests/README.testing-data.md](https://github.com/piwik/piwik/blob/master/tests/README.testing-data.md) to import testing data in Piwik. -See [tests/README.testing-data.md](https://github.com/piwik/piwik/blob/master/tests/README.testing-data.md) +## UI Screenshots Tests -## Scheduled Reports Tests +See [tests/README.screenshots.md](https://github.com/piwik/piwik/blob/master/tests/README.screenshots.md) -Piwik scheduled reports (HTML, PDF & SMS) are part of the integration test suite. They follow the same principles described in the INTEGRATION TESTS section of this document. +## VisualPHPUnit -Piwik scheduled reports can contain PNG graphs when the user specifies it. Depending on the system under test, generated images differ slightly. -Therefore, PNG graphs are only tested if the system under test has the same characteristics as the integration server. -The characteristics of the integration server are described in `IntegrationTestCase::canImagesBeIncludedInScheduledReports()` +See [tests/README.visualphpunit.md](https://github.com/piwik/piwik/blob/master/tests/README.visualphpunit.md) if you prefer to run phpunit tests using a visual interface. +## Profiling -(*) to analyse and/or generate the expected files, you can either +See [tests/README.xhprof.md](https://github.com/piwik/piwik/blob/master/tests/README.xhprof.md) for help on how to profile Piwik with XHProf. - - set up the vagrant piwik vm (which is used by the integration server) or - - retrieve the files from the [builds artifacts](http://builds-artifacts.piwik.org/) +## Benchmarks -## UI Screenshots Tests +See [tests/PHPUnit/Benchmarks/README.txt](https://github.com/piwik/piwik/blob/master/tests/PHPUnit/Benchmarks/README.txt) to learn about running Benchmark tests. -See [tests/README.screenshots.md](https://github.com/piwik/piwik/blob/master/tests/README.screenshots.md) +## Build artifacts -## VisualPHPUnit +You can retrieve the files generated during the build (the build artifacts) at [builds-artifacts.piwik.org](http://builds-artifacts.piwik.org/) + +## Troubleshooting +### PHP 5.5: also update PHPUnit to latest + +See [PHPUnit update](http://phpunit.de/manual/current/en/installation.html) or try this command: -Piwik comes with a modified copy of VisualPHPUnit (see https://github.com/NSinopoli/VisualPHPUnit) -which you can use to run PHPUnit tests in your browser. + $ sudo pear install -a phpunit/PHPUnit -See [tests/README.visualphpunit.md](https://github.com/piwik/piwik/blob/master/tests/README.visualphpunit.md) +### Troubleshooting failing tests -## Profiling with XHProf +If you get any of these errors: + * `RuntimeException: Unable to create the cache directory ( piwik/tmp/templates_c/66/77).` + * or `fopen( piwik/tmp/latest/testgz.txt): failed to open stream: No such file or directory` + * or `Exception: Error while creating the file: piwik/tmp/latest/LATEST` + * or `PHP Warning: file_put_contents( piwik/tmp/logs/piwik.test.log): failed to open stream: Permission denied in [..]` -See [tests/README.xhprof.md](https://github.com/piwik/piwik/blob/master/tests/README.xhprof.md) +On your dev server, give your user permissions to write to the directory: -## Benchmarks + $ sudo chmod 777 -R piwik/tmp/ + +### Troubleshooting SLOW tests + +If the tests are running incredibly slow on your machine, maybe you are running mysql DB on an ext4 partition? +Here is the tip that will save you hours of research: if you use Mysql on ext4 partition, +make sure you add "nobarrier" option to /etc/fstab to disable some super slow IO feature. + +Change from: + `UUID=83237e54-445f-8b83-180f06459d46 / ext4 errors=remount-ro 0 1` +to this: + `UUID=83237e54-445f-8b83-180f06459d46 / ext4 errors=remount-ro,nobarrier 0 1` + +### Using latest GIT version +On ubuntu to use the latest GIT: -See [tests/PHPUnit/Benchmarks/README.txt](https://github.com/piwik/piwik/blob/master/tests/PHPUnit/Benchmarks/README.txt) +``` +sudo add-apt-repository ppa:git-core/ppa +sudo apt-get update +sudo apt-get upgrade +``` ## Participate |