摘要
编写SQL语句是测试数据库管理系统的一个重要部分。自动生成SQL语句可以有效减少测试人员的工作量,而目前没有直接生成SQL语句的自动化工具。通过模拟产生式的直接推导过程,根据SQL文法,给出生成符合该文法的SQL语句,用作测试用例的方法;研究从表示文法的BNF文件生成SQL测试用例集合的自动化过程。这个过程包括几个阶段:将SQL文法的每一个非终结符转换成一个对应的解析函数,所有解析函数的集合构成规则库;遍历文法的产生式自动生成SQL测试用例;使用权值数组结合随机数,加大生成测试用例的灵活性;使用非终结符的最大调用次数来终止SQL测试用例的生成。通过介绍的工具原型,可以得到符合SQL语法的SQL测试用例。
Compiling SQL sentences is an import part for test database management system. Automatic generation of SQL sentences can effectively reduce the workload of the tester. There is almost no automatic tool supporting the direct generation of SQL sentences at present. By simulating the direct derivation process of generative formals the SQL sentences which are generated in accordance with the grammar based on SQL grammars are presented, this is used as, the approach for test cases. In the paper we study on the automatic progress from BNF files which are the representation of the grammar to generating SQL test case sets. The process has several stages: Each non-terminals of SQL grammar is converted to a corresponding parse function and the set of all these parse functions forms the rules library. The generative formals of the grammar are traversed to generate SQL test cases automatically. The use of weight arrays in conjunction with stochastic numbers increases the flexibility of test cases generation. Maximum calling times of the non-terminals are employed to terminate the generation of SQL test cases. Through the tool prototype introduced, the SQL test cases in conformity with SQL grammar can be derived.
出处
《计算机应用与软件》
CSCD
北大核心
2012年第8期185-189,199,共6页
Computer Applications and Software