| Wireless Sensor Networks(WSNs) are widespread concerned by academia and industry due to the great application prospect and commercial value. Systems based on WSNs have wide application prospect in military, environmental, medical and other commercial area. The routing protocol of WSNs network layer defines the communication rules for nodes in network, is an important factor in the network design. For systems based on WSNs, one of the core issues is how to ensure the implementation of routing protocol meet the design specification.To solve this problem, the method how to test the implementation of routing protocol meet the design specification is researched in this paper from the perspective of testing. The huge cost of software testing stage makes how to automate the software testing process become a problem need to be solved, and the key to solving this problem is the automatic generation of test cases. How to choose the limited test cases in the infinite enter or state space of program to meet specific test requirement is directly related to the efficiency of the testing. Model-based testing uses the formal method to generate test cases from the model which describe the expected behavior of systems, and judge the correctness of systems by the result of test execution.Consider the real-time requirement of WSNs routing protocol, the test cases generation method for routing protocol based on timed automata is researched in this paper from the perspective of real-time. Proposed the method of establish time automata model for routing protocol by using tool UPPAAL and then generate test traces satisfy certain coverage criterion by using tool UPPAAL CoVer. Illustrate the effectiveness of the method by modeling and test traces generating for a wireless meter reading routing protocol WM2 RP used in industry. In order to transform the generated test traces to the executable test cases, an auxiliary tool named ATCGT has been further developed. Finally, set up a test environment of WM2 RP and use the generated test cases to test the specific implementation of the protocol.The main contributions of this paper are:(1) Proposed the method of modeling and test traces generation of WSNs routing protocol: establish time automata model of the protocol by using tool UPPAAL at first and then generate test traces by using tool UPPAAL CoVer.(2) Using the proposed method to model and generate test traces for a wireless meter reading routing protocol WM2 RP used in industry.(3) In order to transform the generated test traces to the executable test cases, an auxiliary tool ATCGT is developed.(4) Set up a test environment of WM2 RP and use the generated test cases to test the specific implementation of the protocol. |