Skip to content

[Docs]: Component testing "best practices" or "pitfalls" #31361

Open
@sand4rt

Description

@sand4rt

Page(s)

Page: https://playwright.dev/docs/next/test-components#update

I think these topics would be useful to mention:

  • Determine what to test
  • Determine what not to test (implementation details)
  • How to name tests
  • Use the appropriate locator
  • Emphasise emulation over mocking
  • Avoid nesting / describe blocks
  • Avoid unnecessary abstractions (Test isolation)
  • Ensure your test can fail

@dgozman do you have other topics/changes in mind?

Description

Suggestion from @dgozman to include a "best practices" or "pitfalls" section for component testing: #31339 (comment). I've created a ticket to track this so I don't forget.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions