Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
12638940
Commit
12638940
authored
Apr 05, 2021
by
Sanad Liaquat
Committed by
Marcia Ramos
Apr 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add docs for using let vs instance variable in e2e tests
parent
9a26c9ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
doc/development/testing_guide/end_to_end/best_practices.md
doc/development/testing_guide/end_to_end/best_practices.md
+9
-0
No files found.
doc/development/testing_guide/end_to_end/best_practices.md
View file @
12638940
...
...
@@ -223,6 +223,15 @@ 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.
## `let` variables vs instance variables
By default, follow the
[
testing best practices
](
../best_practices.md#subject-and-let-variables
)
when using
`let`
or instance variables. However, in end-to-end tests, set-ups such as creating resources are expensive.
If you use
`let`
to store a resource, it will be created for each example separately.
If the resource can be shared among multiple examples, use an instance variable in the
`before(:all)`
block instead of
`let`
to save run time.
When the variable cannot be shared by multiple examples, use
`let`
.
## Limit the use of the UI in `before(:context)` and `after` hooks
Limit the use of
`before(:context)`
hooks to perform setup tasks with only API calls,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment