r/ChatGPTCoding • • Mar 19 '25

Discussion How Airbnb migrated 3,500 React component test files with LLMs in just 6 weeks

This blog post from Airbnb describes how they used LLMs to migrate 3,500 React component test files from Enzyme to React Testing Library (RTL) in just 6 weeks instead of the originally estimated 1.5 years of manual work.

Accelerating Large-Scale Test Migration with LLMs

Their approach is pretty interesting:

  1. Breaking the migration into discrete, automated steps

  2. Using retry loops with dynamic prompting

  3. Increasing context by including related files and examples in prompts

  4. Implementing a "sample, tune, sweep" methodology

They say they achieved 75% migration success in just 4 hours, and reached 97% after 4 days of prompt refinement, significantly reducing both time and cost while maintaining test integrity.

112 Upvotes

26 comments sorted by

49

u/[deleted] Mar 19 '25

I think these are the actual use cases for LLMs rather than development.

While they do help with some heavy lifting in the coding process it will, for years, be small percentual increases in productivity, while testing is a field with the potential for orders of magnitude better productivity than manual testing

2

u/quantum1eeps Mar 19 '25

I have started Cline running the pytest with coverage and attempting >100% on non skipped files. It really works to be sure each function has some tests. Usually it leads to questions about how the logic really should work. the work I’m outputting has a certain comprehensiveness to it I’m unwilling to do on my own. And all you need to do is present a live edge case bug and it’ll augment the suite. And update all related docs. It’s getting kinda nuts

1

u/denkleberry Mar 20 '25

I wonder how well it would work on legacy code.

1

u/Rojeitor Mar 20 '25

Yes. We're a .NET shop and used dependency injection before it was even a thing. We use a library that was from Microsoft called Unity Container that was eventually open sourced but now it's dead. For whatever reasons we used a lot of property/setter injection that relies on some attributes, that the now standard Microsoft DI doesn't support. This migration has been stopped for ages because of the manual tedious work it takes to refactor properties into construction injection. We've already did some testing with agent IDE did a PoC on few files and results seem promising.

11

u/[deleted] Mar 19 '25

[removed] — view removed comment

5

u/[deleted] Mar 19 '25

Nice! I need to learn how to do this

1

u/LiteSoul Mar 20 '25

Out of curiosity, why did you migrate from Flutter to React?

13

u/thedragonturtle Mar 19 '25

Yeah, this kind of thing is where LLMs can shine. Especially if you hand craft some example migrations and then provide these as context to complete the others.

1

u/wwwillchen Mar 19 '25

agreed. I think the other thing here is that Airbnb has a pretty sizable codebase if they have thousands of test files. If you only have a handful of test files it's probably not worth it to spend a week writing a migration tool. Although, I'm impressed how far they got in 4 hours!

0

u/raul3820 Mar 19 '25

Rewrites in rust

4

u/satansxlittlexhelper Mar 20 '25

I think the awesome thing about this is that it makes pie-in-the-sky developer fantasies achievable. No PM would ever allow a team to manually do this. It’s perennially one or two devs years of work. But six weeks? That’s an XXL t-shirt.

3

u/ScriptedBot Mar 19 '25

I think there were some discussions on migrating or re-implementing legacy mainframe code bases to modern languages using LLMs. Hailing from the banking and finacial services sector, I find that quite promising.

2

u/the_itchy_beard Mar 20 '25

I misread that as Airbus, and was like "aight, here we go again. Another plane crash in the making."

1

u/Abject-Kitchen3198 Mar 20 '25

I realized it's not Airbus at this comment

1

u/jml5791 Mar 19 '25

can someone ELl5 this

1

u/denkleberry Mar 20 '25

Ever heard of chatgpt?

1

u/lambdawaves Mar 19 '25

Funny. When I ask it to move tests, it drops a third of them.

1

u/Anxious_Noise_8805 Mar 20 '25

You have to make a checklist first in markdown format and then it should move each item and check it off when it’s done.

1

u/lambdawaves Mar 20 '25

I guess I should be making the list by hand (or `grep | column` or something) cuz I've definitely asked Cursor to produce a checklist from files and it also misses things.

I also find that when processing a checklist, if it struggles hard to get it done, the agent mode could just decide to delete a bunch of stuff to "fix" the issue and mark the task as done. lol.

1

u/[deleted] Apr 22 '25

[removed] — view removed comment

1

u/AutoModerator Apr 22 '25

Sorry, your submission has been removed due to inadequate account karma.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/Abject-Kitchen3198 Mar 20 '25

Isn't this something that would be achievable with some text processing and parsing, with consistent and repeatable results?

2

u/Evilkoikoi Mar 21 '25

Yeah these kind of migrations have always been largely automated. The tools already exist and a big company like that has the resources to make their own. Then you get to the last few % and those are the hard cases that take forever. Maybe LLM helped with the hard cases.

1

u/[deleted] Apr 22 '25

[removed] — view removed comment

1

u/AutoModerator Apr 22 '25

Sorry, your submission has been removed due to inadequate account karma.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.