Unverified Commit 589f610f authored by alexpott's avatar alexpott

Issue #3038378 by vadim.hirbu, jhodgdon: README.md in core/tests is badly formatted

parent 3f4af33b
......@@ -6,9 +6,9 @@
You need the Drupal core development dependencies installed, in order to run
any tests. You can install them using Composer by running
```
composer install
```
```
composer install
```
in the Drupal root directory. These dependencies should not be installed on a
production site.
......@@ -36,8 +36,8 @@ Settings to change in this file:
### Additional setup for JavaScript tests
To run JavaScript tests based on the
\Drupal\FunctionalJavascriptTests\WebDriverTestBase base class, you will need to
install the following additional software:
\Drupal\FunctionalJavascriptTests\WebDriverTestBase base class, you will need
to install the following additional software:
* Google Chrome or Chromium browser
* chromedriver (tested with version 2.45) -- see
......@@ -49,8 +49,8 @@ install the following additional software:
The PHPUnit executable is vendor/bin/phpunit -- you will need to locate your
vendor directory (which may be outside the Drupal root).
Here are commands to run one test class, list groups, and run all the tests in a
particular group:
Here are commands to run one test class, list groups, and run all the tests in
a particular group:
```
./vendor/bin/phpunit -c /path/to/your/phpunit.xml path/to/your/class/file.php
./vendor/bin/phpunit --list-groups
......@@ -72,20 +72,32 @@ chromedriver using port 4444, and keep it running:
## Running Nightwatch tests
- Ensure your vendor directory is populated (e.g. by running `composer install`)
- If you're running PHP 7.0 or greater you will need to upgrade PHPUnit with `composer run-script drupal-phpunit-upgrade`
- Install [Node.js](https://nodejs.org/en/download/) and [yarn](https://yarnpkg.com/en/docs/install). The versions required are specificed inside core/package.json in the `engines` field
- Install [Google Chrome](https://www.google.com/chrome/browser/desktop/index.html)
- Inside the `core` folder, run `yarn install`
- Configure the nightwatch settings by copying `.env.example` to `.env` and editing as necessary.
- Ensure you have a web server running (as instructed in `.env`)
- Again inside the `core` folder, run `yarn test:nightwatch` to run the tests. By default this will output reports to `core/reports`
- Nightwatch will run tests for core, as well as contrib and custom modules and themes. It will search for tests located under folders with the pattern `**/tests/**/Nightwatch/(Tests|Commands|Assertions)`
- To run only core tests, run `yarn test:nightwatch --tag core`
- To skip running core tests, run `yarn test:nightwatch --skiptags core`
- To run a single test, run e.g. `yarn test:nightwatch tests/Drupal/Nightwatch/Tests/exampleTest.js`
Nightwatch tests, as well as custom commands, assertions and pages, can be placed in any folder with the pattern `**/tests/**/Nightwatch/(Tests|Commands|Assertions|Pages)`. For example:
* Ensure your vendor directory is populated
(e.g. by running `composer install`)
* If you're running PHP 7.0 or greater you will need to upgrade PHPUnit with
`composer run-script drupal-phpunit-upgrade`
* Install [Node.js](https://nodejs.org/en/download/) and
[yarn](https://yarnpkg.com/en/docs/install). The versions required are
specificed inside core/package.json in the `engines` field
* Install
[Google Chrome](https://www.google.com/chrome/browser/desktop/index.html)
* Inside the `core` folder, run `yarn install`
* Configure the nightwatch settings by copying `.env.example` to `.env` and
editing as necessary.
* Ensure you have a web server running (as instructed in `.env`)
* Again inside the `core` folder, run `yarn test:nightwatch` to run the tests.
By default this will output reports to `core/reports`
* Nightwatch will run tests for core, as well as contrib and custom modules and
themes. It will search for tests located under folders with the pattern
`**/tests/**/Nightwatch/(Tests|Commands|Assertions)`
* To run only core tests, run `yarn test:nightwatch --tag core`
* To skip running core tests, run `yarn test:nightwatch --skiptags core`
* To run a single test, run e.g.
`yarn test:nightwatch tests/Drupal/Nightwatch/Tests/exampleTest.js`
Nightwatch tests, as well as custom commands, assertions and pages, can be
placed in any folder with the pattern
`**/tests/**/Nightwatch/(Tests|Commands|Assertions|Pages)`. For example:
```
tests/Nightwatch/Tests
src/tests/Nightwatch/Tests
......@@ -95,13 +107,19 @@ tests/src/Nightwatch/Assertions
tests/src/Nightwatch/Pages
```
It's helpful to follow existing patterns for test placement, so for the action module they would go in `core/modules/action/tests/src/Nightwatch`.
The Nightwatch configuration, as well as global tests, commands, and assertions which span many modules/systems, are located in `core/tests/Drupal/Nightwatch`.
If your core directory is located in a subfolder (e.g. `docroot`), then you can edit the search directory in `.env` to pick up tests outside of your Drupal directory.
Tests outside of the `core` folder will run in the version of node you have installed. If you want to transpile with babel (e.g. to use `import` statements) outside of core,
then add your own babel config to the root of your project. For example, if core is located under `docroot/core`, then you could run `yarn add babel-preset-env` inside
`docroot`, then copy the babel settings from `docroot/core/package.json` into `docroot/package.json`.
It's helpful to follow existing patterns for test placement, so for the action
module they would go in `core/modules/action/tests/src/Nightwatch`.
The Nightwatch configuration, as well as global tests, commands, and assertions
which span many modules/systems, are located in `core/tests/Drupal/Nightwatch`.
If your core directory is located in a subfolder (e.g. `docroot`), then you can
edit the search directory in `.env` to pick up tests outside of your Drupal
directory. Tests outside of the `core` folder will run in the version of node
you have installed. If you want to transpile with babel (e.g. to use `import`
statements) outside of core, then add your own babel config to the root of your
project. For example, if core is located under `docroot/core`, then you could
run `yarn add babel-preset-env` inside `docroot`, then copy the babel settings
from `docroot/core/package.json` into `docroot/package.json`.
## Troubleshooting test running
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment