Trail of Bits Blog
Follow
Mutation testing comes to DAML
The company has released Mewt, an open-source mutation-testing engine that identifies gaps in test suites, and has now expanded it to support DAML, the language used for Canton Network applications. Mewt reads DAML, generates mutants, and runs them through existing test suites to count the number of surviving mutants. This count indicates how much the test suite checks, providing a more accurate measure of test effectiveness than traditional test coverage reports. Test coverage reports can be misleading, as they only indicate whether code was executed, not whether the tests would fail if the code stopped working as intended. Mutation testing, on the other hand, grades tests by sabotaging the code and checking if the tests fail, providing a more comprehensive measure of test effectiveness. Mewt's support for DAML includes two new mutations that target authorization primitives, which are common sources of bugs in DAML contracts. The tool can be easily integrated into existing workflows, and its output provides a clear indication of which tests are missing and need to be written. By using Mewt, developers can ensure that their tests are comprehensive and effective, reducing the risk of bugs and errors in their code. The company plans to continue improving Mewt, including adding more mutations and improving its ability to detect equivalent mutants, which are changes that do not affect the behavior of the code. Overall, Mewt provides a powerful tool for developers to improve the quality and effectiveness of their tests, and its support for DAML is an important step in ensuring the reliability and security of Canton Network applications. The use of Mewt can help developers to identify and fix bugs early in the development process, reducing the overall cost and time required to deliver high-quality software.