AI-Assisted Test Refactoring: Converting WDIO to PHPUnit at Gizra
Gizra has detailed an AI-assisted approach to refactoring Webdriver.IO (WDIO) tests into PHPUnit tests in a blog post by Áron Novák. The initiative aimed to improve test efficiency and CI pipeline performance by addressing the fragility of WDIO tests, which were prone to timing issues and slow execution. To streamline the process, the team categorized tests into simple and complex groups, allocating the simpler ones for AI-driven refactoring using Anthropic's Claude Opus model.
A Python script was developed to automate the conversion, though it required manual adjustments due to occasional misinterpretations and formatting inconsistencies. Despite these challenges, the AI-assisted process reduced refactoring time by an estimated 4-8 hours while incurring minimal API usage costs. The converted tests were finalized with minor corrections, adherence to Drupal coding standards, and successful execution within the PHPUnit test suite.
Áron concludes that AI can be a valuable tool for large-scale code changes when dealing with repetitive and uncertain tasks and suggests potential future applications, including AI-driven data quality checks in CI builds and further automation of test conversions.

