作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2007, Vol. 33 ›› Issue (02): 44-46. doi: 10.3969/j.issn.1000-3428.2007.02.015

• 软件技术与数据库 • 上一篇    下一篇

基于状态模式的面向对象的类测试技术研究

龚红仿,童小娇   

  1. (长沙理工大学数学与计算科学学院,长沙 410076)
  • 收稿日期:1900-01-01 修回日期:1900-01-01 出版日期:2007-01-20 发布日期:2007-01-20

Research on Object-oriented Class Test Technology Based on State Mode

GONG Hongfang, TONG Xiaojiao   

  1. (College of Math. & Computer Science, Changsha Univ. of Science & Tech., Changsha 410076)
  • Received:1900-01-01 Revised:1900-01-01 Online:2007-01-20 Published:2007-01-20

摘要: 类的状态测试是面向对象软件测试的重要内容,类的单元测试归结为测试类的数据成员和成员函数。该文提出了基于类的状态模式测试用例生成方法,从类的状态常量、状态变量以及成员函数等方面测试类的一致性与完整性,指出只有满足类的状态常量的约束条件与状态变量的前置条件和后置条件的测试数据,才能充分检验类的状态模式中存在的不一致、不完整性错误。

关键词: 类测试, 状态模式, 测试用例生成

Abstract: The state test of class is an important component part of object-oriented software test. Class unit test comes down to test the data member and member function. An approach of test cases generation based-on the class state model is proposed, and test consistency and integrality of classes form state constant, state variable and member function. A result is gained that only the test data which satisfies the restraint conditions of state constant and the pre-condition and post-condition of state variable fully test inconsistency and imperfect in tested classes.

Key words: Class test, State mode, Test case generation