When would a test framework use an interface instead of an abstract base class?
Answer
An interface defines a capability that unrelated implementations can provide; an abstract class can share state and partial implementation. Prefer the smallest contract needed and composition when shared inheritance would couple tests to framework internals.
Strong answer includes
- contract versus shared implementation
- multiple implementations
- composition awareness
Practical example
A framework defines an IBrowserDriver interface so the same test logic can run against a Selenium driver, a Playwright driver and a mock driver in unit tests, whereas an abstract BaseTest class is used only to share setup/teardown code that every concrete test genuinely needs.