PofoliaShared via Pofolia

Proceedings of the ACM on Programming Languages· 2026Q1

Code–Test Co-translation: Towards Practical and Effective Program Migration in the Wild

Xitao Li, Xiaofei Xie, Jianmin Wu, Ting Liu et al.

Short summary

CoTTrans, a novel framework, improves code migration by jointly translating programs and their test suites, achieving a translation correctness score of 0.675 (up from 0.360) on DeepSeek-V3 by using a new Test Case Consistency (TCC) metric.

AI-generated from the title and abstract; the full text is not read.

Key points

  • Introduces the Code–Test Co-Translation (CTCT) problem, requiring joint translation of programs and their test suites.
  • Proposes CoTTrans, a framework addressing CTCT challenges like measuring test consistency and handling complex features.
  • Develops a novel Test Case Consistency (TCC) metric to evaluate syntactic and semantic alignment between source and translated tests.
  • CoTTrans improves translation correctness from 0.360 to 0.675 on DeepSeek-V3, significantly outperforming prior methods on BigCodeBench.

AI-generated from the title and abstract; the full text is not read.

Abstract

Program migration, which involves translating software systems from one programming language to another, is essential for modernizing legacy systems and improving maintainability. Recent large language models (LLMs) have demonstrated strong performance in code translation; however, existing methods and benchmarks still exhibit key limitations. (1) They primarily focus on simple, self-contained snippets that fail to capture the complexity of real-world programs, and (2) they often assume that target-language test cases are readily available for evaluation and feedback, an unrealistic assumption given the difficulty of manually creating equivalent tests across languages. In this paper, we argue for a more practical setting, termed the Code–Test Co-Translation (CTCT) problem, where both the program and its associated test suite should be jointly translated to preserve semantic and functional consistency. Through an empirical study on real-world programs, we identify two major challenges in CTCT: (1) the difficulty of measuring test-case consistency in the absence of ground truth, and (2) the ineffectiveness of existing iterative translation–repair strategies, which suffer from state degradation and poor initialization traps when handling complex, real-world features. To address these issues, we propose CoTTrans, a state-quality–aware iterative translation–repair framework guided by a novel Test Case Consistency (TCC) metric. TCC quantifies both syntactic and semantic consistency between source and translated tests, enabling fine-grained feedback that drives LLM-based refinement. CoTTrans further integrates TCC with test pass rates to assess state quality and triggers adaptive backtracking when low-quality states are detected during the translation. Evaluated on the BigCodeBench dataset, CoTTrans improves the translation correctness score from 0.360 to 0.675 on DeepSeek-V3, substantially outperforming existing methods, while TCC demonstrates superior effectiveness in measuring test consistency compared with existing metrics. These results show that CoTTrans enhances translation stability and accuracy, establishing a practical foundation for reliable code–test co-evolution in real-world program migration.

The authors' abstract, as published at the source. Proceedings of the ACM on Programming Languages, 2026 · DOI ↗

TakeawaysPremium
Ask the paperFree account

Continue with a free account

Ask the paper: 3 free questions a day about this paper; save it, get its citation, new summaries every day for your field. Takeaways are Premium.

Continue free on the web

Sign in with Google or Apple; no card needed. You come back to this paper.

On your phone:

Field: Software

SoftwareComputer Science