Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-26 21:11:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-26 21:11:43 +0300
commitbc75527dca77b2b72331ac6cbd5928d5b8c0c419 (patch)
tree000196faadb05f6e2ff60c08865b1a09506e5522 /doc/development
parentc82ca12a1c5a359325cb45aaf01b483d1fa0efcb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development')
-rw-r--r--doc/development/fe_guide/development_process.md2
-rw-r--r--doc/development/testing_guide/best_practices.md26
2 files changed, 27 insertions, 1 deletions
diff --git a/doc/development/fe_guide/development_process.md b/doc/development/fe_guide/development_process.md
index ff36b8b5c6a..2b64534e7c9 100644
--- a/doc/development/fe_guide/development_process.md
+++ b/doc/development/fe_guide/development_process.md
@@ -4,7 +4,7 @@ You can find more about the organization of the frontend team in the [handbook](
## Development Checklist
-The idea is to remind us about specific topics during the time we build a new feature or start something. This is a common practice in other industries (like pilots) that also use standardised checklists to reduce problems early on.
+The idea is to remind us about specific topics during the time we build a new feature or start something. This is a common practice in other industries (like pilots) that also use standardized checklists to reduce problems early on.
Copy the content over to your issue or merge request and if something doesn't apply simply remove it from your current list.
diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md
index 8a1ee74a7fc..d9e7f0e6535 100644
--- a/doc/development/testing_guide/best_practices.md
+++ b/doc/development/testing_guide/best_practices.md
@@ -94,6 +94,32 @@ let(:project) { create(:project) }
let_it_be(:project) { create(:project) }
```
+A common cause of a large number of created factories is [factory cascades](https://github.com/test-prof/test-prof/blob/master/docs/profilers/factory_prof.md#factory-flamegraph), which result when factories create and recreate associations.
+They can be identified by a noticeable difference between `total time` and `top-level time` numbers:
+
+```shell
+ total top-level total time time per call top-level time name
+
+ 208 0 9.5812s 0.0461s 0.0000s namespace
+ 208 76 37.4214s 0.1799s 13.8749s project
+```
+
+In order to reuse a single factory for all implicit parent associations,
+[`FactoryDefault`](https://github.com/test-prof/test-prof/blob/master/docs/recipes/factory_default.md)
+can be used:
+
+```ruby
+ let_it_be(:namespace) { create_default(:namespace) }
+ let_it_be(:project) { create_default(:project) }
+```
+
+In this case, the `total time` and `top-level time` numbers match more closely:
+
+```shell
+ 31 30 4.6378s 0.1496s 4.5366s project
+ 8 8 0.0477s 0.0477s 0.0477s namespace
+```
+
### General guidelines
- Use a single, top-level `RSpec.describe ClassName` block.