用符号执行自动生成测试,验证COBOL转Java的代码等价性。
Automated Testing of COBOL to Java Transformation
- 通过符号执行生成COBOL单元测试,模拟外部调用并转为JUnit测试。
- 在工业级场景下成功验证了数千个程序的语义等价性,发现并修复缺陷。
- 适用于需要高可靠性迁移老旧系统的金融、政府等领域开发者。
大型语言模型(LLM)驱动的生成式AI技术已使将企业级遗留代码从COBOL翻译为Java或Python成为可能。尽管自动转换结果令人鼓舞,但生成的代码仍无法保证正确性,需人工验证,过程耗时且费力。本文分享了为IBM Watsonx Code Assistant for Z(WCA4Z)开发测试框架的经验,该工具专用于COBOL到Java的转换。框架通过符号执行自动生成COBOL的单元测试,模拟外部调用并转换为JUnit测试,以验证翻译后Java代码与原COBOL程序的功能等价性。结果不仅有助于发现和修复差异,还可反馈优化AI模型。该方法已在工业环境中验证,有效支持大规模代码迁移。
原文摘要 · Abstract (English)
Recent advances in Large Language Model (LLM) based Generative AI techniques have made it feasible to translate enterprise-level code from legacy languages such as COBOL to modern languages such as Java or Python. While the results of LLM-based automatic transformation are encouraging, the resulting code cannot be trusted to correctly translate the original code, making manual validation of translated Java code from COBOL a necessary but time-consuming and labor-intensive process. In this paper, we share our experience of developing a testing framework for IBM Watsonx Code Assistant for Z (WCA4Z) [5], an industrial tool designed for COBOL to Java translation. The framework automates the process of testing the functional equivalence of the translated Java code against the original COBOL programs in an industry context. Our framework uses symbolic execution to generate unit tests for COBOL, mocking external calls and transforming them into JUnit tests to validate semantic equivalence with translated Java. The results not only help identify and repair any detected discrepancies but also provide feedback to improve the AI model.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。