From 63b748cbaa4b0236115da9e4476244cb1a44bf2e Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 9 Jan 2014 12:35:29 +0100 Subject: [PATCH] Added info about running unit tests with autotest.sh - Fixes #3 - Added minimum phpunit version - Added info about autotest.sh for the core app --- developer_manual/core/index.rst | 19 ++++++++++++++----- developer_manual/core/unit-testing.rst | 26 +++++++++++++++++++++----- developer_manual/devenv/index.rst | 4 ++-- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/developer_manual/core/index.rst b/developer_manual/core/index.rst index 09ac93afc..a44efd4b5 100644 --- a/developer_manual/core/index.rst +++ b/developer_manual/core/index.rst @@ -3,17 +3,26 @@ ================= Core Developement ================= -.. toctree:: - :hidden: - :maxdepth: 1 - configfile +.. toctree:: + :maxdepth: 1 + :hidden: + translation - theming unit-testing + theming + configfile ocs-share-api +Intro +----- + +Please make sure you have set up a development environment: + +* :ref:`devenv` + Core related docs +----------------- * :doc:`translation` * :doc:`unit-testing` diff --git a/developer_manual/core/unit-testing.rst b/developer_manual/core/unit-testing.rst index 9f9577ff7..29b870bf8 100644 --- a/developer_manual/core/unit-testing.rst +++ b/developer_manual/core/unit-testing.rst @@ -4,7 +4,9 @@ Unit-Testing Getting PHPUnit --------------- -Owncloud uses PHPUnit for tests. To install it, either get it via your packagemanager:: +ownCloud uses PHPUnit >= 3.7 for unit testing. + +To install it, either get it via your packagemanager:: sudo apt-get install phpunit @@ -15,8 +17,8 @@ or install it via PEAR:: After the installation the ''phpunit'' command is available. -Writing unittests ------------------ +Writing unit tests +------------------ To get started, do the following: - Create a directory called ``tests`` in the top level of your application @@ -63,9 +65,9 @@ In :file:`/srv/http/owncloud/apps/myapp/` you run the test with:: For more resources on PHPUnit visit: http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html -Bootstrapping Owncloud +Bootstrapping ownCloud ---------------------- -If you use Owncloud functions or classes in your code, you'll need to make them available to your test by bootstrapping Owncloud. +If you use ownCloud functions or classes in your code, you'll need to make them available to your test by bootstrapping ownCloud. To do this, you'll need to provide the ``--bootstrap`` argument when running PHPUnit @@ -86,6 +88,20 @@ adjust your php.ini and file rights. su -c "chmod a+rx data/" su -c "chmod a+w data/owncloud.log" +Running unit tests for the ownCloud core project +------------------------------------------------ +The core project provides a script that runs all the core unit tests using different database backends like sqlite, mysql, oracle:: + + ./autotest.sh + +To run tests only for sqlite:: + + ./autotest.sh sqlite + +To run a specific test suite (note that the test file path is relative to the "tests" directory):: + + ./autotest sqlite lib/share/share.php + Further Reading --------------- - http://googletesting.blogspot.de/2008/08/by-miko-hevery-so-you-decided-to.html diff --git a/developer_manual/devenv/index.rst b/developer_manual/devenv/index.rst index d5e81bccf..b1b5cdd68 100644 --- a/developer_manual/devenv/index.rst +++ b/developer_manual/devenv/index.rst @@ -82,8 +82,8 @@ Open http://localhost/owncloud (or the corresponding URL) in your web browser to Start developing ~~~~~~~~~~~~~~~~ -* :doc:`App Development` -* :doc:`Core Development` +* :doc:`App Development<../app/index>` +* :doc:`Core Development<../core/index>` .. _debugmode: