一句话:提出 DBGRILLER,通过变异现有数据库状态并用程序分析过滤,生成有效测试数据库以提升分支覆盖并暴露缺陷。
数据库支持的应用需要同时设计用户输入和数据库状态才能充分测试,但有效数据库状态需满足由应用语义决定的复杂约束,且数据库状态空间巨大(可达数十到数百张表),涉及数据库操作的测试运行也很慢,因此无效状态会浪费测试资源。本文提出 DBGRILLER,它向已有数据库状态中策略性地注入小幅变异来生成候选状态,并把被测应用的一部分转换为独立有效性检查器;同时利用程序分析识别一种新的 branch-projected DB view,用于过滤那些不太可能增加分支覆盖的数据库状态。作者在 9 个流行的开源数据库应用上评估,结果表明 DBGRILLER 能有效提升现有测试的分支覆盖,并暴露此前未知的缺陷。
Database-backed applications are widely used. To effectively test these applications, one needs to design not only user inputs but also database states, which imposes unique challenges. First, valid database states have to satisfy complicated constraints determined by application semantics, and hence are difficult to synthesize. Second, the state space of a database is huge, as an application can contain tens to hundreds of tables with up to tens of fields per table. Making things worse, each test involving database operations takes significant time to run. Consequently, unhelpful database states and running tests on them can severely waste testing resources. We propose DBGRILLER, a tool that generates database states to facilitate thorough testing of database-backed applications. To effectively generate valid database states, DBGRILLER strategically injects minor mutation into existing database states and transforms part of the application-under-test into a stand-alone validity checker. To tackle the huge database state space and save testing time, DBGRILLER uses program analysis to identify a novel branch-projected DB view that can be used to filter out database states that are unlikely to increase the testing branch coverage. Our evaluation on 9 popular open-source database applications shows that DBGRILLER can effectively increase branch coverage of existing tests and expose previously unknown bugs.