With the Enzyme test framework no longer supporting React 18, migrating to React Testing Library (RTL) became imperative.
At Slack, our hybrid approach integrated an Abstract Syntax Tree (AST) method and a Large Language Model (LLM) using Anthropic's AI model, Claude 2.1. Despite initial hurdles, we achieved an 80% conversion success rate.
Key innovations included AST conversions and annotations, DOM tree collection, stringent control mechanisms, and packaging all information into a cohesive pipeline with LLM call and feedback steps. This resulted in a 64% adoption rate and a 22% time-saving in test case conversion.
This success underscores the value of AI in large-scale code migrations and establishes a robust, innovative approach for similar challenges.
Speaker
![](https://qconsf.com/sites/qcon_sf/files/styles/medium/public/pictures/2024-07/S.Gorbachov.jpeg?itok=oQea77Fp)
Sergii Gorbachov
Senior Software Engineer @Slack
Sergii Gorbachov is a Senior Software Engineer at Slack, based in Vancouver, Canada. As part of the DevXp pillar, he focuses on developing AI-driven tools to automate and streamline development processes. His recent projects include leveraging large language models (LLMs) for code migrations and automating test authorship. Outside of work, Sergii enjoys hiking, running, and biking in the stunning landscapes of British Columbia.