-
Notifications
You must be signed in to change notification settings - Fork 4
Running Nextcloud tests
Michiel de Jong edited this page Nov 22, 2023
·
2 revisions
In general, when developing a Nextcloud (or ownCloud) app always use https://github.com/pondersource/dev-stock as your development environment. This will save you and your colleagues a lot of duplicate effort.
Depending on how you created the app when you started you can probably run make composer and then make test.
You can open your local clone of https://github.com/nextcloud/server in VSCode and click 'reopen in dev container'.
Then once you see the devcontainer@5bc8697121e0:/var/www/html$ prompt you can run ./autotest.sh sqlite lib/Authentication/TwoFactorAuth/ManagerTest.php. It will complain that it can't connect to XDebug and it will be slow but it works.
- Open server in gitpod.
- install
sudo apt install sqlite3 - install
sudo apt install php-cli php-json php-mbstring php-xml php-pcov php-xdebug php-curl php-zip php-gd php-sqlite3 - install composer deps:
cd build/integration && composer install - go back to server directory and run:
gitpod /workspace/server (mrv/tfa-configuring) $ ./autotest.sh sqlite lib/Authentication/TwoFactorAuth/ManagerTest.php
Using PHP executable /usr/bin/php
Using database oc_autotest
Setup environment for sqlite testing on local storage ...
Updated 0 paths from the index
Installing ....
Nextcloud was successfully installed
Testing with sqlite ...
/workspace/server/build/integration/vendor/bin/phpunit --configuration phpunit-autotest.xml --coverage-clover autotest-clover-sqlite.xml --coverage-html coverage-html-sqlite --log-junit autotest-results-sqlite.xml lib/Authentication/TwoFactorAuth/ManagerTest.php
PHPUnit 9.6.13 by Sebastian Bergmann and contributors.
Runtime: PHP 8.1.2-1ubuntu2.14 with PCOV 1.0.11
Configuration: phpunit-autotest.xml
....................... 23 / 23 (100%)
Time: 00:02.964, Memory: 36.00 MB
OK (23 tests, 72 assertions)
Generating code coverage report in Clover XML format ... done [00:54.872]
Generating code coverage report in HTML format ... done [00:12.908]
Check out for instance https://github.com/cs3org/ocm-test-suite