If you have created the build using civibuild
, then simply run phpunit4
:
me@localhost:~/buildkit/build/dcase/sites/all/modules/civicrm/ext/civicase$ phpunit4
PHPUnit 4.8.21 by Sebastian Bergmann and contributors.
...................................................
Time: 16.86 seconds, Memory: 52.25Mb
OK (51 tests, 381 assertions)
If you have created the build by other means, you may need to provide some configuration details that help with executing the tests, such as
- Credentials for an administrative CMS user (
ADMIN_USER
,ADMIN_PASS
,ADMIN_EMAIL
) - Credentials for a non-administrative CMS user (
DEMO_USER
,DEMO_PASS
,DEMO_EMAIL
) - Credentials for an empty test database (
TEST_DB_DSN
)
To initialize the configuration file, run cv vars:fill
:
me@localhost:~/buildkit/build/dcase/sites/all/modules/civicrm/ext/civicase$ cv vars:fill
Site: /home/me/buildkit/build/dcase/sites/default/civicrm.settings.php
These fields were missing. Setting defaults:
{
"ADMIN_EMAIL" => "[email protected]",
"ADMIN_PASS" => "t0ps3cr3t",
"ADMIN_USER" => "admin",
"TEST_DB_DSN" => "mysql://dbUser:dbPass@dbHost/dbName?new_link=true"
}
Please edit /home/me/.cv.json
Then edit that file:
me@localhost:~/buildkit/build/dcase/sites/all/modules/civicrm/ext/civicase$ vi ~/.cv.json
Now run the tests
me@localhost:~/buildkit/build/dcase/sites/all/modules/civicrm/ext/civicase$ phpunit4
PHPUnit 4.8.21 by Sebastian Bergmann and contributors.
...................................................
Time: 16.86 seconds, Memory: 52.25Mb
OK (51 tests, 381 assertions)
This test suite is based on BackstopJS plugin. Backstop JS uses pupetter and headless chrome to create reference screenshots and use them to compare new screenshots and raise any incosistency in the visuals of the page (if introduced while developing something)
Documentation available here
A Drupal site with pre-configured CiviCRM, Shoreditch, CiviCase, and any other dependencies. See how
- Clean URLs enabled
- The user name for admin should be
admin
- Install node package depedencies using . (Skip this step if already installed)
npm install
- Create a
test/backstop/site-config.json
file with the following content.{ "url": "your_local_url", "drush_alias": "", // set a drush alias if using vagrant "root": "absolute_path_to_site" }
- Create the reference screenshots
gulp backstopjs:reference
- Create the test screenshots and compare
gulp backstopjs:test
BackstopJS supports taking multiple screenshot at once. Change the value of asyncCaptureLimit
in backstop.tpl.json to decide how many screenshots you want to take in parallel
Note: Please be aware that BackstopJS performance is heavily dependent on the specs of the machine it runs on, so make sure to choose a value that the tool can handle on your machine (otherwise you will encounter random timeout errors)
This backstop test suite relies on session cookies to be present in the backstop_data/cookies/admin.json
file. The file is automatically generated by the gulp
task by using the drush uli
command.