一句话:提出基于形式语言的协议测试方法,扩展 fandango 规范以统一描述协议状态、语法与语义,并用 k-path 引导探索生成测试序列。
通信协议涉及多方之间的有状态交互,其实现测试具有挑战性:测试输入不是单条消息,而是语法与语义相互依赖的消息序列,其有效性取决于先前的通信和协议状态。本文提出一种系统化探索协议规范的测试方法,扩展 fandango 的规范格式,使其能在单个文件中同时描述协议状态、语法和语义。该格式将上下文无关文法与图灵完备约束以及带角色标注的非终结符相结合,用以描述多方行为和跨消息依赖;规范本身是角色中立的,可应用于协议中的任意参与方。作者将该技术应用于 DNS、SMTP、FTP、一个 REST 风格 API 以及一个 ChatGPT 交互文法。初步结果表明,该方法能够驱动与被测系统的通信,并且 k-path 引导的探索技术能快速覆盖文法结构、输入、输出以及协议状态。
Communication protocols involve stateful interactions between multiple parties, which makes systematic testing of their implementations challenging. Test inputs are not single messages, but sequences of syntactically and semantically dependent exchanges whose validity depends on prior communication and protocol state. This work proposes a protocol testing approach that systematically explores a protocol specification. We extend the specification format of fandango such that it is able to specify protocol state, syntax, and semantics within a single file. The format combines context-free grammars with Turing-complete constraints and role-annotated nonterminals to describe multi-party behavior and cross-message dependencies. Specifications are role-neutral and can be applied to any participant in the protocol. We applied our technique to dns, smtp, ftp, a rest-style api, and a ChatGPT interaction grammar. Initial results show that our approach is able to drive communication with a system under test and that the k-path-guided exploration technique quickly achieves coverage across grammar structure, inputs, outputs, and protocol state.