# How to Use Differential Testing During a Legacy Migration

DevFeed: [How to Use Differential Testing During a Legacy Migration](<https://devfeed.tech/articles/how-to-use-differential-testing-during-a-legacy-migration-20762.md>)

Original publisher: [Read original article](<https://www.freecodecamp.org/news/differential-testing-legacy-migration/>)

Author: Hugo Teijiz

Published: 2026-09-14T16:25:50Z

Content type: tutorial

Language: en

Sources: [freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More](<https://devfeed.tech/sources/freecodecamp-programming-tutorials-python-javascript-git-more.md>)

Topics: [migration](<https://devfeed.tech/topics/migration.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [TypeScript](<https://devfeed.tech/topics/typescript.md>), [Integration testing](<https://devfeed.tech/topics/integration-testing.md>), [API](<https://devfeed.tech/topics/api.md>), [observability](<https://devfeed.tech/topics/observability.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [api](<https://devfeed.tech/tags/api.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [artificial-intelligence](<https://devfeed.tech/tags/artificial-intelligence.md>), [code](<https://devfeed.tech/tags/code.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [integration](<https://devfeed.tech/tags/integration.md>), [legacy-code](<https://devfeed.tech/tags/legacy-code.md>), [legacy-modernization](<https://devfeed.tech/tags/legacy-modernization.md>), [migration](<https://devfeed.tech/tags/migration.md>), [modernization](<https://devfeed.tech/tags/modernization.md>), [observability](<https://devfeed.tech/tags/observability.md>), [software-architecture](<https://devfeed.tech/tags/software-architecture.md>), [software-testing](<https://devfeed.tech/tags/software-testing.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

## AI overview

This tutorial explains how to use differential testing during a legacy migration by running old and new implementations with identical inputs and comparing their behavior. It covers equivalence rules, output normalization, nondeterministic values, errors, side effects, automated testing, mismatch analysis, production shadow traffic, and using AI to classify divergences without allowing it to determine correctness.

## Source excerpt

The most dangerous moment in a legacy migration isn't necessarily when you start writing the new implementation. It's when the new implementation looks finished. The code compiles, the tests pass, the