CN100334821C - Testing method for limitting status machine of communication system - Google Patents

Testing method for limitting status machine of communication system Download PDF

Info

Publication number
CN100334821C
CN100334821C CNB200410026932XA CN200410026932A CN100334821C CN 100334821 C CN100334821 C CN 100334821C CN B200410026932X A CNB200410026932X A CN B200410026932XA CN 200410026932 A CN200410026932 A CN 200410026932A CN 100334821 C CN100334821 C CN 100334821C
Authority
CN
China
Prior art keywords
test
data
state machine
finite state
testing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CNB200410026932XA
Other languages
Chinese (zh)
Other versions
CN1564489A (en
Inventor
孙云韬
黎云华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CNB200410026932XA priority Critical patent/CN100334821C/en
Publication of CN1564489A publication Critical patent/CN1564489A/en
Application granted granted Critical
Publication of CN100334821C publication Critical patent/CN100334821C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The present invention relates to a test method of a finite state machine of a communication system. Particularly to a test method of a finite state machine of a communication system, which can be used among different platforms, and test data has favorable structure, readability and extensibility. The method comprises the following steps: (a) determining a value model of data to be tested in a test instance by the XML format; (b) designing the test flow of the test instance according to specific protocol specification requirements; (c) filling test data in the XML data structure determined according to steps (a) and (b) to generate an XML file; (d) reading test data from the XML file by using a test program to test the finite state machine.

Description

A kind of method of testing of communication system finite state machine
[technical field]
The present invention relates to a kind of method of testing of communication system finite state machine, relate in particular to a kind of automatic test approach of communication system finite state machine.
[background technology]
Often will set up finite state machine (FSM:Finite Status Machine) model in communication system is described and realizes.Finite state machine is by an input set, an output set, a state set, an initial condition and one group of five-tuple that mapping function is formed.Mapping function is according to the purpose state and the output of input signal and current state decision systems, and mapping function is finished once-through operation, and promptly a state transition has also taken place in system.
Finite state machine is driving with message, and constantly migration will be tested also with regard to more complicated automatically to its carrying out in a plurality of states.At present many at the automatic testing software of function, such as Cunit, CppUnit, JUnit.But the automatic test approach to finite state machine is considerably less.
Some relevant testing tools are also arranged at present, what have mixes test data and test code, just cumbersome for the maintenance of test data or test code like this, often need both are made amendment simultaneously, it is readable and maintainability is also poor.
In addition, the method for testing that also has has been separated test data with test code, but test data is kept in the file of binary system or text or user-defined format.The problem of this test data maximum is the structuring that lacks data, causes there is not readability, and the user is not easy to understand, safeguard also very difficult later on, cumbersome when interpolation or deletion test data, also lack autgmentability, the user can't customize the own content measurement of understanding easily.Such data deficiency versatility can only be exclusively used in this method of testing, can not be shared by other method of testing.And these data files can only be used in single platform, can't cross over platform, if cross-platform transplanting, data file will be made again.
[summary of the invention]
The technical problem to be solved in the present invention provides a kind of can cross-platformly the use, and test data possesses good structuring, readability, the method for testing of the communication system finite state machine of extensibility.
For solving the problems of the technologies described above, the invention provides a kind of method of testing of communication system finite state machine, it is characterized in that it comprises the steps:
(a) determine the value model of the testing data of this finite state machine test case with the XML form;
(b) design the testing process of this test case according to the certain protocol code requirement;
(c), generate test case XML file to inserting test data in the determined XML data structure according to step (a) with (b); With
(d) use test program read test data from this XML file are tested this finite state machine.
Wherein, step (d) comprises step:
(d1) use test program input data under the initial condition in the read test data and this state from this XML file send to this finite state machine;
(d2) this finite state machine is carried out corresponding program after initial condition is received this input data excitation, reports its execution result under initial condition to this test program simultaneously;
(d3) this test program according to the execution result of receiving be kept in the XML file default data relatively, if incorrect, then EOT and reporting errors;
(d4) if relatively more correct, then this test program reads next state and input data from the XML file, sends to finite state machine;
(d5) circulation repeating step (d2) is to step (d4), and the test data in the XML file all test finishes, and this EOT is also reported test result.
Wherein, in the value model of the test data of step (a), comprise the plurality of data group of a series of states of the initial condition of this finite state machine and other migration.Each data set is included in the new state of input data, dateout and desire migration under this state in this value model.
In addition, in step (a), can be the message of the test data in the XML file and the Naming conventions that argument structure is determined label, make message corresponding related with its corresponding parameters result.Naming conventions according to this label is that the test data name of being preserved can be distinguished label in header file.Concretely, be that state, message and input, output parameter name in the test data of being preserved can be distinguished label in header file according to the Naming conventions of this label.After name can be distinguished label, scan this header file, generate test data structure automatically according to this Naming conventions.After generating test data structure automatically, the data structure that can further add the data with existing that does not meet this Naming conventions.
In addition, the testing process that designs this test case according to the certain protocol code requirement in step (b) is the particular state migration according to certain protocol code requirement defined, determines the testing process of input, dateout and its state transition under each state to be measured, each state to be measured.
The present invention adopts the XML form to preserve test data, realizes separating of test data and test code.In the XML file, preserve the initial condition of tested finite state machine and a series of states that other can move.In each state, preserve the new state of input data, dateout and migration under this state.Because XML can store data and about the information of data implication, test program can not have the each several part of two free burial ground for the destitute determination information and represents what meaning, can also the self-defined meaningful label of distinguishing, for specific tested finite state machine is created any label that needs, be all test datas that need preserve like this, such as state, message, structure, parameter is all got a significant title, just need not explain and directly to understand its implication that therefore data generate and safeguard very convenient later on.In addition, the test data of XML form has good structural, in conjunction with customized label, can carry out neatly that testing process makes up and the foundation of data value model.And the XML standard is cross-platform, strides medium, can be read by different platforms, after a test data generates, can be reused by the multiple test program of a plurality of platforms, when limited state machine needed cross-platform transplanting, its test was just very convenient like this.
[description of drawings]
The present invention is described in detail below in conjunction with drawings and Examples:
Fig. 1 is the data value Model Design of communication system finite state machine method of testing test case of the present invention and the step schematic diagram that flow process makes up.
Fig. 2 is at the testing process schematic diagram of communication system finite state machine method of testing of the present invention.
[embodiment]
Main thought of the present invention is that test data and test program are separated, and preserves test data by the XML form, and realizes that by this XML data file test drives.
The automatic test approach of the communication system finite state machine of present embodiment mainly comprises the steps:
The first step: specified data value model, formulate the XML data hierarchy, the bookmark name of definition XML document.
Second step: the probe file, generate test data structure automatically according to Naming conventions, message and parameter are described, resolve into basic data type, comprise nest relation etc.
The 3rd step: requiring design test case and making up flow process according to agreement, standard.
The 4th step: according to testing scheme, in corresponding XML data structure, insert test data, generate a concrete test case.
The 5th step: test program reads the input data under initial condition and this state from the XML file, issue tested state machine.
The 6th step: tested state machine is carried out corresponding program after initial condition is received the excitation of input data, simultaneously situations such as the input data of receiving under test program report initial condition, dateout, state transition.
The 7th step: test program compares according to the pre-designed correct data of receiving report data and be kept among the XML.If more incorrect, reporting errors then, this EOT.
The 8th step: if test program is more correct, then from XML, read next state and input data, issue tested state machine, continue test.
The 9th step: circulation repeats the 5th and went on foot for the 8th step, and the test data in XML all test finishes final report (FR) test result, this EOT.
Wherein, four steps of the above-mentioned first step to the are mainly realization and preserve test data and generate test case by the XML form.The 5th step to the 9th step tests the communication system finite state machine for realizing that by this XML data file test drives.Should be noted that those of ordinary skill in the art should be understood that the whole bag of tricks of preserving test data by the XML form; in the present embodiment about the description of preserving test data by the XML form and generating test case only for illustrating the present invention, design of the present invention and protection range should not only limit to the description of present embodiment.
Below in conjunction with Fig. 1 once the data value Model Design and the structure flow process of present embodiment test case are described.As shown in Figure 1, the formation of this XML file test case mainly comprises the steps:
Step 10: data value model and the hierarchical structure of determining XML document.Because XML can oneself formulate data hierarchy, thus in the present embodiment the input data under original state, this state, dateout, the new state of moving to as a group.Can comprise several such data sets in the XML file.Should be noted that; the data value model of present embodiment and hierarchical structure only are explanation the present invention; other are suitable for data value model of the present invention and hierarchical structure and should be those skilled in the art and be familiar with, thus do not repeat them here, but should be within protection scope of the present invention.
Step 20: the bookmark name definition of formulating XML document.Because XML supports Unicode, so use the label of Chinese, play an easily label of identification respectively for state, message, data, see that like this label just knows which kind of data what wherein comprise be.
Step 30: according to Naming conventions, message, state, input, output parameter in the name header file.In order to realize the automatic extraction and the generation of data structure information, so the message in the header file, input, output parameter preferably meet certain Naming conventions.In test data, the description that the most complicated is exactly constitutes message/parameter-definition and structure, and in a finite state machine, the quantity of these descriptors is again very large.For fear of these loaded down with trivial details work, realize the automatic configuration information that extracts, so require in the header file definition, certain rules is followed in the title definition of the concrete argument structure of I/O message and correspondence.All with EV_ beginning, argument structure starts with T_ such as message definition, and the title of underscore back is the same, represents that they are corresponding.Such as message EV_ThisIsASample, its corresponding parameters structure can be T_ThisIsASample.
Step 40: the probe file generates test data structure automatically according to Naming conventions.After specific Naming conventions name,, just can find all message and corresponding parameters structure thereof by the traversal of test program to header file.For each argument structure, resolve into basic data type again, such as CHAR, BOOL, BYTE, WORD, DWORD etc. at last according to label and the structure of the XML of predefined, generate the descriptor of all parameters automatically, to each field in these data structures, can comprise whether field name, field type, field length, field value, field value need correct judgment and correctness determination methods or the like.The user is just passable as long as fill out concrete test case data inside, has so just improved efficient widely.
Step 50:, can manually add the descriptor of setting up them for old data that existed and the data structure that does not meet Naming conventions.When writing test case, energy can be concentrated on like this on flow process structure and the data value Model Design, need not be concerned about the nested layer by layer of message/parameter-definition clear and definite already in the software and structure formation, field.Be understandable that this step is not to be necessary step of the present invention.
Step 60: require design test case and flow process according to agreement, standard make up, and comprise which state of needs survey, input, dateout and state transition etc. that each state is corresponding down.Be understandable that,, can design a plurality of different test cases for same finite state machine.
Step 70: according to testing scheme, in corresponding XML data structure, insert test data, generate a concrete test case.
Main test process of the present invention is: test program reads the input data under the initial condition from the XML file, issue tested finite state machine.Finite state machine is after receiving the excitation of input data under this state, carry out corresponding handling procedure, external dateout and carry out state transition, report the execution result of oneself simultaneously to test program, be included in and receive what input data excitation under what state, externally what data of output are moved to which new state etc.When test program receives the report data that tested finite state machine sends over, just and the comparison of the correct data under this state that has designed in advance of preserving in the XML file.If relatively more correct, promptly satisfy pre-provisioning request, then according to present new state, continue to read the input data under this state, send to the tested finite state machine that is in next new state.If more incorrect, then finish test, reporting errors.By the Continuous Drive of independent XML test data of separating, can realize tested finite state machine like this according to the test case that designs, output automatically, automated state migration is reported automatically.The present invention can be according to the different designs and the combination of test data among the XML, and the test finite state machine is under different conditions, and whether the state transition when receiving different input stimulus is correct, and whether also can test dateout correct.
In addition, finite state machine is in order to reach the purpose that can test automatically, in design, need reserve or possess external test report interface, such as under each state, can send out message report at what state to test program, receive any input stimulus, externally export any data, state is how to move etc., test program just can be according to the report information of receiving, compare with the correct data that design that are kept in the test file, whether checking satisfies pre-provisioning request, judges whether tested finite state machine moves correctly.
Below in conjunction with embodiment shown in Figure 2, illustrate the present invention under the XML test data drives, realize the automatic test method of finite state machine.Should be noted that: the state transition of finite state machine is Protean, is stipulated by concrete standard and agreement.Different test cases, different test data combinations has different results.Only 2 last migrations successively to state 8 are that example describes to embodiment shown in Figure 2 from initial condition 1 to state with state.
Step 101: rest on initial condition 1 after tested state machine moves, test program is from the XML file.Read the input data under initial condition 1 and this state, issue tested state machine.
Step 102: tested state machine is carried out corresponding program after initial condition 1 is received 1 excitation of input data, external dateout 1, and move to state 2.Input data 1 and the dateout of receiving for 1 time to test program report initial condition 1 and move to situation such as state 2 simultaneously.
Step 103: test program according to the initial condition 1 received, input data 1, dateout 1, move to state 2 these group data and be kept among the XML pre-designed correct data relatively.
Step 104: if test program is more incorrect, promptly do not satisfy predetermined requirement, reporting errors then, this EOT.
Step 105: if test program is more correct, satisfy pre-provisioning request, then moved to state 2 according to tested state machine, the input data 2 from the XML file under the reading state 2 are issued tested state machine, continue test.
Step 106: tested state machine is after state 2 is received input data 2 excitation in the 5th step, carry out corresponding program, external dateout 2, and this moves to state 3, and input data 2 and the dateout 2 received for 2 times to the test program report condition and move to situation such as state 3.
Step 107: test program according to the state 2 received, input data 2, dateout 2, move to state 3 these group data and be kept among the XML pre-designed correct data relatively.If more incorrect, reporting errors then, this EOT.
Step 108: if test program is more correct, moved to state 3 according to tested state machine, the input data 3 under the XML file reading state 3 are issued tested state machine, continue test.Following process is identical, and according to the content and the order of test case, test is moved to state 7 up to tested state machine successively.
Step 109: tested state machine is moved to last state state 8 after state 7 is received the excitation of input data 7, and input data 7, the dateout 7 received for 7 times to the test program report condition and move to situation such as state 8.
Step 110: test program according to the state 7 received, input data 7, dateout 7, move to state 8 these group data and be kept among the XML pre-designed correct data relatively.If more incorrect, reporting errors then, this EOT.
Step 111: if relatively more correct, and all test datas among the XML all test finish, then the report test is correct, this EOT.
Therefore, the method for the invention can overcome effectively that test data does not have structuring in the prior art, and is readable poor, difficult in maintenance, is unfavorable for expansion, and the shortage versatility can't be reused, also shortcoming that can't be cross-platform.The inventive method can not be confined to the predefined label of a cover when creating test data, can create any label that needs for specific tested finite state machine, and with expression data best, the readability of data file has just improved greatly like this.Strengthened the flexibility to the method for testing of communication system finite state machine, feasible generation and maintenance to test data is more convenient for.XML crosses over platform and medium in addition, can be used in different operating system and application program, so just helps the cross-platform transplanting of finite state machine.XML is a standard public and that extensively supported, thus select for use the XML store test data that the fail safe of extensive compatibility and the selection of utility are provided, and avoided the problem that adopts proprietary technology to occur.
Need to prove; above-mentioned explanation only is the detailed description to preferred embodiment of the present invention; narration only is explanation realizability of the present invention and outstanding effect thereof; concrete feature can not be used as the restriction to technical scheme of the present invention, and protection scope of the present invention should be as the criterion with appended claims of the present invention.

Claims (8)

1. the method for testing of a communication system finite state machine is characterized in that it comprises the steps:
(a) determine the value model of the testing data of this finite state machine test case with the XML form;
(b), determine the testing process of input, dateout and its state transition under each state to be measured, each state to be measured according to the state transition of protocol specification requirement defined to be tested;
(c), generate test case XML file to inserting test data in the determined XML data structure according to step (a) with (b);
(d) use test program read test data from this XML file are tested this finite state machine;
Wherein, step (d) specifically comprises:
(d1) use test program input data under the initial condition in the read test data and this state from this XML file send to this finite state machine;
(d2) this finite state machine is carried out corresponding program after initial condition is received this input data excitation, reports its execution result under initial condition to this test program simultaneously;
(d3) this test program according to the execution result of receiving be kept in the XML file default data relatively, if incorrect, then EOT and reporting errors;
(d4) if relatively more correct, then this test program reads next state and input data from the XML file, sends to finite state machine;
(d5) circulation repeating step (d2) is to step (d4), and the test data in the XML file all test finishes, and this EOT is also reported test result.
2. the method for testing of communication system finite state machine according to claim 1 is characterized in that in the value model of the test data of step (a), comprises the plurality of data group of a series of states of the initial condition of this finite state machine and other migration.
3. as the method for testing of communication system finite state machine as described in the claim 2, it is characterized in that each data set in this value model is included in the new state of input data, dateout and desire migration under this state.
4. as the method for testing of claim 2 communication system finite state machine, it is characterized in that in step (a) further determining the Naming conventions of its XML label for the message of test data and argument structure, make message corresponding related with its corresponding parameters structure.
5. as the method for testing of communication system finite state machine as described in the claim 4, it is characterized in that the Naming conventions according to this label is that the test data name of being preserved can be distinguished label in header file.
6. as the method for testing of communication system finite state machine as described in the claim 5, it is characterized in that Naming conventions according to this label is that state, message and input, output parameter name in the test data of being preserved can be distinguished label in header file.
7. as the method for testing of communication system finite state machine as described in the claim 6, it is characterized in that name scans this header file after can distinguishing label, generates test data structure automatically according to this Naming conventions.
8. as the method for testing of communication system finite state machine as described in the claim 7, after it is characterized in that generating test data structure automatically, further add the data structure of the data with existing that does not meet this Naming conventions.
CNB200410026932XA 2004-04-19 2004-04-19 Testing method for limitting status machine of communication system Expired - Fee Related CN100334821C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB200410026932XA CN100334821C (en) 2004-04-19 2004-04-19 Testing method for limitting status machine of communication system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB200410026932XA CN100334821C (en) 2004-04-19 2004-04-19 Testing method for limitting status machine of communication system

Publications (2)

Publication Number Publication Date
CN1564489A CN1564489A (en) 2005-01-12
CN100334821C true CN100334821C (en) 2007-08-29

Family

ID=34480800

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB200410026932XA Expired - Fee Related CN100334821C (en) 2004-04-19 2004-04-19 Testing method for limitting status machine of communication system

Country Status (1)

Country Link
CN (1) CN100334821C (en)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100432954C (en) * 2005-09-23 2008-11-12 中兴通讯股份有限公司 Inlaid system detection method and system
CN100347993C (en) * 2005-09-27 2007-11-07 清华大学 Protocol interoperation characteristic test generating method based on communication multi-port finite state machine
CN100479393C (en) * 2006-06-13 2009-04-15 华为技术有限公司 Method for realizing executor test
CN101079890B (en) * 2007-07-04 2011-03-30 杭州华三通信技术有限公司 A method and device for generating characteristic code and identifying status machine
CN101159760B (en) * 2007-10-24 2011-09-21 中兴通讯股份有限公司 Method and system for implementing communication protocol based on XML data interchange file
CN101674205B (en) * 2009-08-27 2011-11-09 福建星网锐捷网络有限公司 Method and device for generating network communication protocol test sequence based on finite-state machine
CN102109984B (en) * 2009-12-28 2014-02-19 北京大学 Method and system for processing state machine
CN101915894B (en) * 2010-07-22 2012-05-30 北京交大资产经营有限公司 Method for testing real-time finite-sate machine in digital logic device
CN103324573A (en) * 2013-07-02 2013-09-25 北京邮电大学 PEACH platform extension method for GUI-based protocol state machine modeling
CN108062276A (en) * 2017-12-19 2018-05-22 北京小度信息科技有限公司 The generation method and device of test case and the generation method and device of test report
CN109491919B (en) * 2018-11-28 2021-10-26 中电科西北集团有限公司 Software testing method and testing platform
CN112231222B (en) * 2020-10-27 2024-04-09 南京林洋电力科技有限公司 Automatic test method and system for object-oriented communication protocol
CN113900423B (en) * 2021-08-31 2023-07-14 北京空间飞行器总体设计部 Mars dormancy awakening function verification method based on FSM

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6282681B1 (en) * 1995-03-06 2001-08-28 Motorola, Inc. Method and apparatus for testing finite state machine (FSM) conformance utilizing unique input/output sequence (UIO) sets
WO2002087136A2 (en) * 2001-04-25 2002-10-31 Infotone Communications Corporation Adaptive multi-protocol communications system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6282681B1 (en) * 1995-03-06 2001-08-28 Motorola, Inc. Method and apparatus for testing finite state machine (FSM) conformance utilizing unique input/output sequence (UIO) sets
WO2002087136A2 (en) * 2001-04-25 2002-10-31 Infotone Communications Corporation Adaptive multi-protocol communications system

Also Published As

Publication number Publication date
CN1564489A (en) 2005-01-12

Similar Documents

Publication Publication Date Title
CN100334821C (en) Testing method for limitting status machine of communication system
US6339836B1 (en) Automated design partitioning
US6912692B1 (en) Copying a sequence of commands to a macro
US6678875B2 (en) Self-contained embedded test design environment and environment setup utility
CA2137492C (en) System for and method of providing delta-versioning of the contents of pcte file objects
CN104657140B (en) Code generating method and device
CN108399130A (en) Automatically generate the method, apparatus, equipment and readable storage medium storing program for executing of test cases
CN103268226B (en) A kind of test script file generates method and device
US20020083422A1 (en) Free-standing macros
CN102402430B (en) One utilizes script to generate random test example method and system
CN103500139B (en) A kind of communication software integrated test system and method for testing
CN105808428A (en) Method for performing unified performance test on distributed file system
CN104699613B (en) A kind of spacecraft-testing demand automatic creation system and its method
CN101330412B (en) Automatization test approach and system based on topological discovery
CN101867501A (en) Method and system for automatically testing consistence of SNMP (Simple Network Management Protocol) interface information model
CN111399828B (en) Model-driven logic device modeling method and terminal
CN100437513C (en) Method and system for implementing automatic testing
CN113343615B (en) Prototype verification method and encoding device based on FPGA
CN101202739A (en) Device for processing ASN.1 message OO
CN110968509A (en) Method and system for batch customizing of variables
CN103913672B (en) A kind of satellite low frequency interface automatization test system
CN113326026B (en) Method and terminal for generating micro-service business process interface
CN105808748A (en) MIB (Management Information Base) version contrast method and device
CN113612671B (en) Binding configuration method of bus adapter and channel, mapping manager and connection system
CN115828804A (en) Method for modifying RTL source code file and electronic equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20070829

Termination date: 20140419