The following table outlines possible test file locations and how to invoke them:
Test runner | Test location | Runner command (working directory is {kib} root) |
---|---|---|
Jest |
|
|
Jest (integration) |
|
|
Functional |
|
|
Test runner arguments: - Where applicable, the optional arguments
--grep=regexp
will only run tests or test suites
whose descriptions matches the regular expression. - [test path]
is
the relative path to the test file.
Kibana primarily uses Jest for unit testing. Each plugin or package defines a jest.config.js
that extends a preset provided by the @kbn/test
package. Unless you intend to run all unit tests within the project, it’s most efficient to provide the Jest configuration file for the plugin or package you’re testing.
yarn jest --config src/plugins/dashboard/jest.config.js
A script is available to provide a better user experience when testing while navigating throughout the repository. To run the tests within your current working directory, use yarn test:jest
. Like the Jest CLI, you can also supply a path to determine which tests to run.
kibana/src/plugins/dashboard/server$ yarn test:jest #or
kibana/src/plugins/dashboard$ yarn test:jest server #or
kibana$ yarn test:jest src/plugins/dashboard/server
Any additional options supplied to test:jest
will be passed onto the Jest CLI with the resulting Jest command always being outputted.
kibana/src/plugins/dashboard/server$ yarn test:jest --coverage
# is equivelant to
yarn jest --coverage --verbose --config /home/tyler/elastic/kibana/src/plugins/dashboard/jest.config.js server
Check out [development-functional-tests] to learn more about how you can run and develop functional tests for {kib} core and plugins.
You can also look into the {kib-repo}tree/{branch}/scripts/README.md[Scripts README.md] to learn more about using the node scripts we provide for building {kib}, running integration tests, and starting up {kib} and {es} while you develop.
Testing IE on OS X
Note: IE11 is not supported from 7.9 onwards.
-
Download IE virtual machines for VMWare.
-
Open VMWare and go to Window > Virtual Machine Library. Unzip the virtual machine and drag the .vmx file into your Virtual Machine Library.
-
Right-click on the virtual machine you just added to your library and select “Snapshots…”, and then click the “Take” button in the modal that opens. You can roll back to this snapshot when the VM expires in 90 days.
-
In System Preferences > Sharing, change your computer name to be something simple, e.g. “computer”.
-
Run {kib} with
yarn start --host=computer.local
(substituting your computer name). -
Now you can run your VM, open the browser, and navigate to
http://computer.local:5601
to test {kib}. -
Alternatively you can use browserstack