<commit_before>[[Testing Framework Cheatsheet]]
= Testing

[partintro]
--
Elasticsearch uses jUnit for testing, it also uses randomness in the
tests, that can be set using a seed, the following is a cheatsheet of
options for running the tests for ES.

== Creating packages

To create a distribution without running the tests, simply run the
following:

-----------------------------
mvn clean package -DskipTests
-----------------------------

== Other test options

To disable and enable network transport, set the `ES_TEST_LOCAL`
environment variable.

Use network transport (default):

------------------------------------
export ES_TEST_LOCAL=false && mvn test
------------------------------------

Use local transport:

-------------------------------------
export ES_TEST_LOCAL=true && mvn test
-------------------------------------

Wait on mapping changes:

------------------------------------------------
export ES_WAIT_ON_MAPPING_CHANGE=true && mvn test
------------------------------------------------

=== Test case filtering.

- `tests.class` is a class-filtering shell-like glob pattern,
- `tests.method` is a method-filtering glob pattern.

Run a single test case (variants)

----------------------------------------------------------
mvn test -Dtests.class=org.elasticsearch.package.ClassName
mvn test "-Dtests.class=*.ClassName"
----------------------------------------------------------

Run all tests in a package and sub-packages

----------------------------------------------------<commit_msg>remove unused test env var from TESTING doc<commit_after>[[Testing Framework Cheatsheet]]
= Testing

[partintro]
--
Elasticsearch uses jUnit for testing, it also uses randomness in the
tests, that can be set using a seed, the following is a cheatsheet of
options for running the tests for ES.

== Creating packages

To create a distribution without running the tests, simply run the
following:

-----------------------------
mvn clean package -DskipTests
-----------------------------

== Other test options

To disable and enable network transport, set the `ES_TEST_LOCAL`
environment variable.

Use network transport (default):

------------------------------------
export ES_TEST_LOCAL=false && mvn test
------------------------------------

Use local transport:

-------------------------------------
export ES_TEST_LOCAL=true && mvn test
-------------------------------------

=== Test case filtering.

- `tests.class` is a class-filtering shell-like glob pattern,
- `tests.method` is a method-filtering glob pattern.

Run a single test case (variants)

----------------------------------------------------------
mvn test -Dtests.class=org.elasticsearch.package.ClassName
mvn test "-Dtests.class=*.ClassName"
----------------------------------------------------------

Run all tests in a package and sub-packages

----------------------------------------------------
{'fraction_non_alphanumeric': 0.34083824038794597, 'fraction_numerical': 0.0, 'mean_word_length': 1.380873866446826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5852694', 'n_tokens_mistral': 633, 'n_tokens_neox': 619, 'n_words': 255}