Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #315 from wunderio/feature/testing-doc-update-2019-01
Browse files Browse the repository at this point in the history
Add lando codeception documentation.
  • Loading branch information
tharna committed Jan 2, 2019
2 parents 8608101 + cd09e4e commit 34864ef
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@ Testing instructions
Tests can be found under drupal/tests folder.
Test are run using Codeception.


Running tests in Lando
------------------
To get started, follow these steps:

1. Make sure .lando.yml includes entry:
```
compose:
- compose.yml
```
And compose.yml includes entry:
```
version: '2'
services:
chrome:
image: selenium/standalone-chrome
volumes:
- /dev/shm:/dev/shm
ports:
- "4444:4444"
```

2. From drupal (not web) directory Run tests

`lando codeception run`

Running tests in Vagrant
------------------
To get started, follow these steps:
1. Uncomment or add selenium role in environment(s) that you will run tests on:

Expand Down Expand Up @@ -30,17 +58,26 @@ To get started, follow these steps:

Writing tests
------------------
To add your own tests, cd to web directory and
To add your own tests, cd to drupal directory and

Lando
```
lando codeception generate:cest acceptance MyFirstTestCest
```

`../vendor/bin/codecept -c ../codeception.yml generate:cest acceptance MyFirstTestCest`
Vagrant
```
vagrant ssh
cd /vagrant/drupal
./vendor/bin/codecept generate:cest acceptance MyFirstTestCest
```


There are four test suites available out of the box:
There are three test suites available out of the box:

* Acceptance - For testing site with real browser (Chrome or Firefox)
* Functional - For testing backend interactions that might use browser (PhpBrowser), but does not depend on JS.
* Unit - For Unit testing custom code methods.
* Visual - For visual regression testing.


Tests are written in simple OOP way that is easy to write and read. Example:
Expand Down

0 comments on commit 34864ef

Please sign in to comment.