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

No edit summary
Line 180: Line 180:
def test_advanced_search(self, mozwebqa):
def test_advanced_search(self, mozwebqa):
</source>
</source>
== Assertions ==


* Tests should handle the asserts -- not the page objects.
* Tests should handle the asserts -- not the page objects.
* Tests should use Python's native [https://docs.python.org/2/reference/simple_stmts.html#the-assert-statement assert] statement.
** Note that this is a change from our previous standard of using the [https://wiki.mozilla.org/Web_Testing/Automation/UnittestZero UnittestZero] package.
* When doing equivalency assertions, put the expected value first, followed by the actual value, for example:
<source lang="python">
# Good
a = some_function()
assert 'expected result' == a
# Bad
a = some_function()
assert a == 'expected result'
</source>


= Size of patches =
= Size of patches =
Confirmed users
425

edits