PHPackages                             silverstripe-australia/ssautesting - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. silverstripe-australia/ssautesting

Abandoned → [symbiote/silverstripe-test-assist](/?search=symbiote%2Fsilverstripe-test-assist)Silverstripe-module[Testing &amp; Quality](/categories/testing)

silverstripe-australia/ssautesting
==================================

Some extensions to the default SS test structures to allow parametrisation in CI builds, as well as a framework for selenium testing.

4.1.2(7y ago)519.9k8[1 PRs](https://github.com/silverstripe-australia/silverstripe-ssautesting/pulls)BSD-3-ClausePHP

Since Feb 12Pushed 3y ago2 watchersCompare

[ Source](https://github.com/silverstripe-australia/silverstripe-ssautesting)[ Packagist](https://packagist.org/packages/silverstripe-australia/ssautesting)[ RSS](/packages/silverstripe-australia-ssautesting/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (3)Versions (44)Used By (0)

Symbiote Testing Extensions Module
==================================

[](#symbiote-testing-extensions-module)

Adds several helpers to the base SilverStripe testing framework to simplify hooking the testing process into CI servers such as Jenkins, by parameterising several configuration options.

Additionally, the module provides the `SymbioteSeleniumTestCase` which provides a simpler API for writing Selenium powered tests.

Command line parameters
-----------------------

[](#command-line-parameters)

To help with test execution, there's a few parameters that can be used to assist in speeding things up if you're repeatedly running tests.

- `build=0` - do not perform a dev/build during test initialisation
- `clean=0` - do not wipe out existing database state
- `flush=0` - do not perform a manifest flush during test initialisation

Selenium
--------

[](#selenium)

To run just the selenium tests, a commandline such as

```
php vendor/silverstripe/framework/cli-script.php dev/tests/module/test-assist \
  flush=1 build=1 selenium_host=127.0.0.1 browser=firefox \
  test_url=http://my.silverstripe.site/ test_type=SymbioteSeleniumTestCase SkipTests=symbioteseleniumtestcase \
  admin_user=admin admin_pass=admin

```

Note: The trailing slash in the URL is *important*!

should get you going. Note that you will *need* to have [selenium server](http://www.seleniumhq.org/download/)running for this to work. A command such as the following will start selenium server in a virtual framebuffer, meaning the windows don't launch all over your screen!

```
#!/bin/sh
/usr/bin/xvfb-run -e /var/log/selenium/xvfb-selenium.log -n 10 \
  -s "-screen 10 1024x768x8" \
  java -jar /home/path/to/programs/selenium-server-standalone-2.39.0.jar  \
  -port 4444 -log /var/log/selenium/server.log

```

However it can be useful to run the selenium server directly from the commandline to debug why a test has failed.

Diagnostic tools
----------------

[](#diagnostic-tools)

Swap from using MySQLDatabase to DevMySQLDatabase in your DB config

```
---
Name: dev_filters
---
Injector:
  RequestProcessor:
    properties:
      filters:
        - %$QueryDisplayFilter
        - %$RequestTimerFilter
```

Codeception
-----------

[](#codeception)

To hook codeception up for your project, you will need to create a codeception.yml config file at the top level of your project.

```
include:
  - mymodule/codeception
paths:
  log: path/to/logdir

```

**codeception.yml** defines the paths of modules to be included in the test runs.

Within your module, you can then create a namespaced project specific set of tests to be included in that top level path.

- mkdir modulename/codeception
- cd modulename/codeception
- ../../vendor/bin/codecept bootstrap --namespace modulenamespace
- mv codeception.yml codeception.dist.yml
- touch .gitignore

Note that 'modulenamespace' can be anything, as long as it's a valid PHP namespace string

Next, create a new `codeception.yml` file that contains *just* your local environment codeception configuration; this will typically be the local URL for developer testing, ie

```
modules:
    config:
        WebDriver:
            url: http://project.clients.sslocal
            browser: chrome

```

Update `modulename/codeception/tests/functional.suite.xml` and add a couple of modules

```
class_name: FunctionalTester
modules:
    enabled:
        - \modulename\Helper\Functional
        - WebDriver # new
        - \Symbiote\TestAssist\SilverstripeFunctional # new

```

Update `modulename/codeception/tests/_bootstrap.php` to include the SilverstripFunctional helper

```
