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
dbbd1004
Commit
dbbd1004
authored
Jul 28, 2020
by
Tiffany Rea
Committed by
Dan Davison
Jul 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update testing best practice doc
parent
663a98f6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
doc/development/testing_guide/end_to_end/best_practices.md
doc/development/testing_guide/end_to_end/best_practices.md
+27
-0
No files found.
doc/development/testing_guide/end_to_end/best_practices.md
View file @
dbbd1004
...
@@ -55,6 +55,33 @@ Project::Issues::Index.perform do |index|
...
@@ -55,6 +55,33 @@ Project::Issues::Index.perform do |index|
end
end
```
```
## Prefer `aggregate_failures` when there are back-to-back expectations
In cases where there must be multiple (back-to-back) expectations within a test case, it is preferable to use
`aggregate_failures`
.
This allows you to group a set of expectations and see all the failures altogether, rather than having the test being aborted on the first failure.
For example:
```
ruby
#=> Good
Page
::
Search
::
Results
.
perform
do
|
search
|
search
.
switch_to_code
aggregate_failures
'testing search results'
do
expect
(
search
).
to
have_file_in_project
(
template
[
:file_name
],
project
.
name
)
expect
(
search
).
to
have_file_with_content
(
template
[
:file_name
],
content
[
0
..
33
])
end
end
#=> Bad
Page
::
Search
::
Results
.
perform
do
|
search
|
search
.
switch_to_code
expect
(
search
).
to
have_file_in_project
(
template
[
:file_name
],
project
.
name
)
expect
(
search
).
to
have_file_with_content
(
template
[
:file_name
],
content
[
0
..
33
])
end
```
## Prefer to split tests across multiple files
## Prefer to split tests across multiple files
Our framework includes a couple of parallelization mechanisms that work by executing spec files in parallel.
Our framework includes a couple of parallelization mechanisms that work by executing spec files in parallel.
...
...
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