summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanad Liaquat <sliaquat@gitlab.com>2019-09-05 04:14:11 +0000
committerSanad Liaquat <sliaquat@gitlab.com>2019-09-05 04:14:11 +0000
commita15a69cf8ff4584dc6a1ba4d7692f12fbe92673f (patch)
treed561605a01ea0a5f05444a25062dd09fb22e331e
parent4b4404d2c85a58ba658a56636795dae4be7b2c23 (diff)
parent3ba3597501aa27d49be7ed4b52eff06a318a357b (diff)
downloadgitlab-ce-a15a69cf8ff4584dc6a1ba4d7692f12fbe92673f.tar.gz
Merge branch 'docs-qa-prefer-multiple-files' into 'master'
Split tests across files for the sake of parallelization See merge request gitlab-org/gitlab-ce!32686
-rw-r--r--doc/development/testing_guide/end_to_end/best_practices.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/development/testing_guide/end_to_end/best_practices.md b/doc/development/testing_guide/end_to_end/best_practices.md
index 89500ef9a90..2200069ecfd 100644
--- a/doc/development/testing_guide/end_to_end/best_practices.md
+++ b/doc/development/testing_guide/end_to_end/best_practices.md
@@ -1,5 +1,7 @@
# Best practices when writing end-to-end tests
+## Avoid using a GUI when it's not required
+
The majority of the end-to-end tests require some state to be built in the application for the tests to happen.
A good example is a user being logged in as a pre-condition for testing the feature.
@@ -36,3 +38,18 @@ Finally, interacting with the application only by its GUI generates a higher rat
- When depending only on the GUI to create the application's state and tests fail due to front-end issues, we can't rely on the test failures rate, and we generate a higher rate of test flakiness.
Now that we are aware of all of it, [let's go create some tests](quick_start_guide.md).
+
+## Prefer to split tests across multiple files
+
+Our framework includes a couple of parallelization mechanisms that work by executing spec files in parallel.
+
+However, because tests are parallelized by spec *file* and not by test/example, we can't achieve greater parallelization if a new test is added to an existing file.
+
+Nonetheless, there could be other reasons to add a new test to an existing file.
+
+For example, if tests share state that is expensive to set up it might be more efficient to perform that setup once even if it means the tests that use the setup can't be parallelized.
+
+In summary:
+
+- **Do**: Split tests across separate files, unless the tests share expensive setup.
+- **Don't**: Put new tests in an existing file without considering the impact on parallelization.