[go: nahoru, domu]

Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 1.53 KB

TESTING.md

File metadata and controls

33 lines (25 loc) · 1.53 KB

Testing

Running tests

All tests should be easily executed with simple:

make test

from root directory. However, you will not be able to execute integration tests out of the box, as they are modifying local instance. For those, you will have to explicitely export env variable:

export TRAVIS=1

to be able to run them. Again – make sure you are running test server and watch out as those tests can create havoc with your instance.

Once you have all requirements satisified and you want to run test over and over again, it all boils down to calling:

phpunit -c phpunit.xml

from root directory. You can target specific tests with --filter etc., but this is all regular PHP unit testing, just type phpunit -h for more details.

If you are missing PHPUnit, you can follow their official guide, but you should get binary with somwething like this:

wget -O phpunit https://phar.phpunit.de/phpunit-7.phar
chmod +x phpunit
./phpunit --version

Writing tests

As by standard definition, unit tests are not modifying external resources and should not touch database. If possible, you should try testing with unit tests, and if it not – add yourself to integration tests.

Other than that, you are good to go – there are already some unit and integration tests in tests/ directory, and you can always take a look at Nextcloud unit testing official documentation.