来自地狱的输入:从常见样本生成不常见的输入
Inputs from Hell: Generating Uncommon Inputs from Common Samples
摘要:
生成用于测试程序的结构化输入文件可以通过从语法生成它们的技术来执行,该语法用作语法正确的输入文件的规范。两个有趣的场景,然后出现有效的测试。在第一种情况下,软件工程师希望生成尽可能类似于程序常用输入的输入,以测试程序的可靠性。更有趣的是第二种情况,输入应该尽可能不同于正常使用。这对于健壮性测试和探索尚未发现的行为非常有用。为了提供这两种情况下的测试用例,我们利用一个上下文无关文法来解析一组代表程序的常见用法的样本输入文件,并确定在解析输入过程中出现的个别语法生成的概率。在基于语法的测试输入生成期间复制这些概率,我们获得接近样本的输入。反转这些概率会产生与常见输入非常不同的输入,但对于语法仍然有效。我们对三种常见的输入格式(JSON,JavaScript,CSS)的评估显示了这些方法在从两组输入中获取实例方面的有效性。
英文摘要:
Generating structured input files to test programs can be performed by techniques that produce them from a grammar that serves as the specification for syntactically correct input files. Two interesting scenarios then arise for effective testing. In the first scenario, software engineers would like to generate inputs that are as similar as possible to the inputs in common usage of the program, to test the reliability of the program. More interesting is the second scenario where inputs should be as dissimilar as possible from normal usage. This is useful for robustness testing and exploring yet uncovered behavior. To provide test cases for both scenarios, we leverage a context-free grammar to parse a set of sample input files that represent the program's common usage, and determine probabilities for individual grammar production as they occur during parsing the inputs. Replicating these probabilities during grammar-based test input generation, we obtain inputs that are close to the samples. Inverting these probabilities yields inputs that are strongly dissimilar to common inputs, yet still valid with respect to the grammar. Our evaluation on three common input formats (JSON, JavaScript, CSS) shows the effectiveness of these approaches in obtaining instances from both sets of inputs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。