摘要
为实现白盒测试的源文件信息提取,提出了通过Lex和Yacc对使用上下文无关文法定义的语言进行词法和语法分析,构建独立的信息提取模块的思想。在函数信息提取部分提出了块和级的概念,用语句结构和语句链表结构将函数定义信息表示出来。在类信息提取部分通过识别出类声明中的成员变量和成员函数的声明信息,建立成员链表结构;识别类声明信息,建立类结构。然后将这些结构信息存入数据库,以供后续模块使用,充分做到了模块独立性和可重用性。这样只需要设计不同的信息提取模块,就可以将目前已经实现的面向C/C++语言的软件测试工具WBoxTool推广应用到其它面向上下文无关文法的语言。
Lex and Yacc are used to analyze the Lexis and grammar of the languages defined by context-free grammars, and an independent information extracting module is built to extract the information of source files for white-box testing. The whole grammar system for a tested language accorded with the criterion of Yacc is built, and the system is logically divided into two primary parts, class grammar and function grammar. Sentence structure and sentence linked list structure express the function definition using block and level when they extract function information. The structure information is put into the database to be used for other modules, thus the modules are completely independent. In this way, only need to design different information extraction modules, various context-free grammar languages for white-box testing can be realized.
出处
《计算机工程》
EI
CAS
CSCD
北大核心
2006年第4期49-51,54,共4页
Computer Engineering
基金
国家"863"计划基金资助项目(2003AAIZ2610)
关键词
白盒测试
上下文无关文法
函数
类
成员链表
White-box testing
Context-free grammar
Function
Class
Member linked list