QA/Execution/Web Testing/Docs/Automation/StyleGuide: Difference between revisions

Jump to navigation Jump to search
Line 188: Line 188:
* When doing equivalency assertions, put the expected value first, followed by the actual value, for example:
* When doing equivalency assertions, put the expected value first, followed by the actual value, for example:
<source lang="python">
<source lang="python">
# Good
assert 'expected' == 'actual'  # good
a = some_function()
assert 'actual' == 'expected'  # bad
assert 'expected result' == a
</source>
 
* When doing negative equivalency, use != and put the unexpected value first, followed by the actual value, for example:
# Bad
<source lang="python">
a = some_function()
assert 'unexpected' != 'actual'  # good
assert a == 'expected result'
assert 'actual' != 'unexpected' # bad
</source>
</source>


Confirmed users
2,197

edits

Navigation menu