Automated test case generation tools help businesses to write tests and increase the safety net provided by high regression test coverage when making code changes. Test generation needs to cover as much as possible of the uncovered code while avoiding generating redundant tests for code that is already covered by an existing test-suite. In this paper we present our work on a tool for the real world application of integrating formal analysis with automatic test case generation. The test case generation is based on coverage analysis using the Java bounded model checker (JBMC). Counterexamples of the model checker can be translated into Java method calls with specific parameters. In order to avoid the generation of redundant tests, it is necessary to measure the coverage in the exact same way as JBMC generates its coverage goals. Each existing coverage measurement tool uses a slightly different instrumentation and thus a different coverage criterion. This makes integration with a test case generator based on formal analysis difficult. Therefore, we developed BlueCov as a specific runtime coverage measurement tool which uses the exact same coverage criteria as JBMC does. This approach also allows for incremental test-case generation, only generating test coverage for previously untested code, e.g., to complete existing test suites.
翻译:自动测试案例生成工具有助于企业在修改代码时编写测试并增加高回归测试范围提供的安全网。 生成测试需要尽可能覆盖未发现的代码,同时避免对现有测试系统已经覆盖的代码进行冗余测试。 在本文中,我们介绍了关于将正式分析与自动测试案例生成相结合真实世界应用工具的工作。 生成测试案例的依据是使用Java 捆绑模式检查器(JBMC)进行覆盖分析。 模型检查器的反比样本可以翻译成带有特定参数的 Java 方法调用。 为避免生成冗余测试,有必要以与JBMC 生成其覆盖目标相同的方式测量覆盖范围。 每个现有覆盖计量工具使用略微不同的仪器,因此使用不同的覆盖标准。 这使得很难与基于正式分析的测试案例生成器进行整合。 因此,我们开发了BlueCov作为使用与 JBBMC 相同的覆盖标准的具体运行时间测量工具。 这种方法还允许以渐进的测试生成方式生成测试案例,仅对先前未测试的代码产生测试范围,例如,从而完成现有的测试套件。