mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Complete doc on running functional tests (#13035)
* Complete doc on running functional tests * Update development-functional-tests.asciidoc * Fix section title
This commit is contained in:
parent
a142e2c745
commit
a2a54f5746
2 changed files with 49 additions and 46 deletions
|
@ -259,49 +259,9 @@ npm run test:browser -- --dev # remove the --dev flag to run them once and close
|
|||
|
||||
#### Running Browser Automation Tests
|
||||
|
||||
The following will start Kibana, Elasticsearch and the chromedriver for you. To run the functional UI tests use the following commands
|
||||
|
||||
```bash
|
||||
npm run test:ui
|
||||
```
|
||||
|
||||
|
||||
In order to start the server required for the `node scripts/functional_test_runner` tasks, use the following command. Once the server is started `node scripts/functional_test_runner` can be run multiple times without waiting for the server to start.
|
||||
|
||||
```bash
|
||||
npm run test:ui:server
|
||||
```
|
||||
|
||||
To execute the front-end browser tests, enter the following. This requires the server started by the `test:ui:server` task.
|
||||
|
||||
```bash
|
||||
node scripts/functional_test_runner
|
||||
```
|
||||
|
||||
To filter these tests, use `--grep=foo` for only running tests that match a regular expression.
|
||||
|
||||
To run these browser tests against against some other Elasticsearch and Kibana instance you can set these environment variables and then run the test runner.
|
||||
Here's an example to run against an Elastic Cloud instance (note that you should run the same branch of tests as the version of Kibana you're testing);
|
||||
|
||||
```bash
|
||||
export TEST_KIBANA_PROTOCOL=https
|
||||
export TEST_KIBANA_HOSTNAME=9249d04b1186b3e7bbe11ea60df4f963.us-east-1.aws.found.io
|
||||
export TEST_KIBANA_PORT=443
|
||||
export TEST_KIBANA_USER=elastic
|
||||
export TEST_KIBANA_PASS=<your password here>
|
||||
|
||||
export TEST_ES_PROTOCOL=http
|
||||
export TEST_ES_HOSTNAME=aaa5d22032d76805fcce724ed9d9f5a2.us-east-1.aws.found.io
|
||||
export TEST_ES_PORT=9200
|
||||
export TEST_ES_USER=elastic
|
||||
export TEST_ES_PASS=<your password here>
|
||||
node scripts/functional_test_runner
|
||||
```
|
||||
|
||||
##### Browser Automation Notes
|
||||
|
||||
[Read about the `FunctionalTestRunner`](https://www.elastic.co/guide/en/kibana/current/development-functional-tests.html) to learn more about how you can run and develop functional tests for Kibana core and plugins.
|
||||
|
||||
|
||||
### Building OS packages
|
||||
|
||||
Packages are built using fpm, pleaserun, dpkg, and rpm. fpm and pleaserun can be installed using gem. Package building has only been tested on Linux and is not supported on any other platform.
|
||||
|
|
|
@ -8,17 +8,60 @@ We use functional tests to make sure the Kibana UI works as expected. It replace
|
|||
|
||||
The `FunctionalTestRunner` is very bare bones and gets most of its functionality from its config file, located at {blob}test/functional/config.js[test/functional/config.js]. If you’re writing a plugin you will have your own config file. See <<development-plugin-functional-tests>> for more info.
|
||||
|
||||
Execute the `FunctionalTestRunner`'s script with node.js to run the tests with Kibana's default configuration:
|
||||
There are three ways to run the tests depending on your goals:
|
||||
|
||||
1. Easiest option:
|
||||
** Description: Starts up Kibana & Elasticsearch servers, followed by running tests. This is much slower when running the tests multiple times because slow startup time for the servers. Recommended for single-runs.
|
||||
** `npm run test:ui`
|
||||
*** does everything in a single command, including running Elasticsearch and Kibana locally
|
||||
*** tears down everything after the tests run
|
||||
*** exit code reports success/failure of the tests
|
||||
|
||||
2. Best for development:
|
||||
** Description: Two commands, run in separate terminals, separate the components that are long-running and slow from those that are ephemeral and fast. Tests can be re-run much faster, and this still runs Elasticsearch & Kibana locally.
|
||||
** `npm run test:ui:server`
|
||||
*** starts Elasticsearch and Kibana servers
|
||||
*** slow to start
|
||||
*** can be reused for multiple executions of the tests, thereby saving some time when re-running tests
|
||||
*** automatically restarts the Kibana server when relevant changes are detected
|
||||
** `node scripts/functional_test_runner`
|
||||
*** runs the tests against Kibana & Elasticsearch servers that were started `npm run test:ui:server`
|
||||
*** exit code reports success or failure of the tests
|
||||
|
||||
3. Custom option:
|
||||
** Description: Runs tests against instances of Elasticsearch & Kibana started some other way (like Elastic Cloud, or an instance you are managing in some other way).
|
||||
** just executes the functional tests
|
||||
** url, credentials, etc. for Elasticsearch and Kibana are specified via environment variables
|
||||
** Here's an example that runs against an Elastic Cloud instance. Note that you should run the same branch of tests as the version of Kibana you're testing.
|
||||
+
|
||||
["source","shell"]
|
||||
-----------
|
||||
node scripts/functional_test_runner
|
||||
-----------
|
||||
----------
|
||||
export TEST_KIBANA_PROTOCOL=https
|
||||
export TEST_KIBANA_HOSTNAME=my-kibana-instance.internal.net
|
||||
export TEST_KIBANA_PORT=443
|
||||
export TEST_KIBANA_USER=kibana
|
||||
export TEST_KIBANA_PASS=<password>
|
||||
|
||||
When run without any arguments the `FunctionalTestRunner` automatically loads the configuration in the standard location, but you can override that behavior with the `--config` flag. There are also command line flags for `--bail` and `--grep`, which behave just like their mocha counterparts. The logging can also be customized with `--quiet`, `--debug`, or `--verbose` flags.
|
||||
export TEST_ES_PROTOCOL=http
|
||||
export TEST_ES_HOSTNAME=my-es-cluster.internal.net
|
||||
export TEST_ES_PORT=9200
|
||||
export TEST_ES_USER=elastic
|
||||
export TEST_ES_PASS=<password>
|
||||
node scripts/functional_test_runner
|
||||
----------
|
||||
|
||||
[float]
|
||||
===== More about `node scripts/functional_test_runner`
|
||||
|
||||
When run without any arguments the `FunctionalTestRunner` automatically loads the configuration in the standard location, but you can override that behavior with the `--config` flag.
|
||||
|
||||
There are also command line flags for `--bail` and `--grep`, which behave just like their mocha counterparts. For instance, use `--grep=foo` to run only tests that match a regular expression.
|
||||
|
||||
Logging can also be customized with `--quiet`, `--debug`, or `--verbose` flags.
|
||||
|
||||
Use the `--help` flag for more options.
|
||||
|
||||
|
||||
[float]
|
||||
==== Writing functional tests
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue