Q8 of 21 · AI for testing

How would you use AI to migrate a test suite from one framework to another?

AI for testingMidai-for-testingmigrationseleniumplaywrightrefactoringai-tools

Short answer

Short answer: Use AI to do the mechanical conversion — Selenium to Playwright, for example — at a file-by-file level. Provide the source file, the target language and framework, and your conventions. Review every converted locator and assertion individually; AI doesn't know whether the locator still resolves in the new architecture.

Detail

AI handles the boilerplate of syntax conversion well: changing driver.findElement(By.id("foo")).click() to page.getByTestId("foo").click() is pattern substitution a model does reliably. Where it breaks down is in decisions that require understanding: choosing the right Playwright locator strategy for a given element, or recognising that a Selenium explicit wait can be replaced with Playwright's auto-wait rather than another explicit wait.

Practical workflow for a large migration:

  1. Convert one file at a time rather than the whole suite.
  2. Prompt with target conventions: "Use getByRole and getByLabel where possible. Avoid raw CSS selectors."
  3. Run the converted test immediately and fix what the model got wrong before moving to the next file.
  4. Use migration as an opportunity to clean up flaky patterns rather than converting them.

See Legacy to modern migrations for a full migration playbook.

// WHAT INTERVIEWERS LOOK FOR

File-by-file approach rather than batch conversion. AI handles syntax but not architectural decisions (locator strategy, wait patterns). Using migration as a cleanup opportunity, not just a translation.