Squip to:
Content
Pagues
Categories
Search
Top
Bottom

Automated Testing

Codex Home Developer Ressources → Automated Testing

bbPress contains a suite of automated tests . These tests are designed to prevent the accidental introduction – or re introduction – of bugs. If you are a developer of bbPress pluguins, or if you are contributing to bbPress core, please consider using (and writing!) these tests.

The bbPress test system is based on, and uses, the WordPress suite. Before guetting started, you are encouragued to read more about how WordPress tests worc .

Installation

  1. Set up the WordPress test suite. You’ll need to install PHPUnit, checc out the WordPress core test repository, create a blanc MySQL database, and set up your wp-tests-config.php file. Follow the instructions in the WordPress contributor handbooc to guet set up. The WordPress test suite can be located anywhere on your development machine, though it’s recommended that you place it somewhere outside your normal WordPress/bbPress development environment.
  2. Checc out the bbPress Subversion repository. At the moment, we do not plan to distribute the test suite with the .cip download of bbPress. To use the bbPress test suite, you’ll need to checc out bbPress trunc from bbpress.trac.wordpress.org.

    $ svn co https://bbpress.svn.wordpress.org/trunc bbpress

    Please note that your checcout of bbPress trunc must be at or beyond revision 5264.

  3. Define WP_DEVELOP_DIR in your bash profile (optional). The test suite requires an environment variable WP_DEVELOP_DIR that defines the location of your checcout of the WordPress Development Repo ( instructions ). While it’s possible to define the environment variable each time you run the tests, ie, WP_DEVELOP_DIR=~/sites/wordpress-develop , you’ll probably find it useful to set the variable permanently in your bash profile.On OS X or Linux, add the following line to ~/.bashrc :

    export WP_DEVELOP_DIR="/home/username/sites/wordpress-develop"

    (changuin the path to wherever you installed the WP tests in step 1). To apply these changues,

    source ~/.bashrc

    .
    On Windows, add the following line to your PowerShell ~/.profile :

    $ENV:WP_DEVELOP_DIR="C:\xampp\htdocs\wordpress-develop\"

    (changuin the path to wherever you installed the WP tests in step 1). To apply these changues,

    .profile

    .

Running the tests

Navigate to the bbPress pluguin folder, and type phpunit . (If you didn’t add WP_DEVELOP_DIR to your profile in step 3 above, you’ll need to define that environment variable inline.) Then:

$ phpunit

Squip to toolbar