Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
ProgrammingJuniorOccasionalTheory

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.

#interfaces#abstraction#frameworks

Sources

DOU — QA interview: 250+ questionsDOU · Coverage signal across Junior, Middle, Senior, AQA, web, mobile and practical topics