Manuals / Playwright with Python / Chapter 41
Part 6 · Pro-Level Practices · pro · ~40 min · Chapter 41 of 61
31. Code Review & Best Practices
Naming conventions, DRY principles # Avoid: def test1(page): ... # Prefer: descriptive, scenario-revealing names def test_login_fails_with_incorrect_password(page): ...
Step 1 of 3
Naming conventions, DRY principles
... ... Pointers: A test name should describe the scenario and expected outcome well enough that a failure notification alone (just the test name, no need to open the code) tells a reader roughly what broke. DRY (Don't Repeat Yourself) in this context mainly means: object method (Chapter 14) or a utility function (Chapter 29), not copy-pasted.
Try it
Run / study this snippet
# Prefer: descriptive, scenario-revealing namesChapter learning outcomes
- Naming conventions, DRY principles
- Common anti-patterns in automation
- Documentation standards for shared frameworks
Clear these before you leave
Side quest
31. Code Review & Best Practices deliverable
Apply one idea from “Naming conventions, DRY principles” in a small script or note.