Search

CN-122019292-A - Method for generating functional logic test case, test method and equipment

CN122019292ACN 122019292 ACN122019292 ACN 122019292ACN-122019292-A

Abstract

The application provides a method for generating functional logic test cases, a test method and equipment, wherein the method automatically generates a directed conversion chart containing conversion relations among different hardware power states and a test matrix containing specific information of each software logic function by analyzing a requirement document of the equipment, tightly couples the hardware power states and the software logic functions in the process of generating parameter difference information, automatically identifies functional parameter changes under different hardware power states and the software logic functions by traversing all possible state conversion paths through the directed conversion chart, thereby generating basic test cases corresponding to different functions under each power state, further adjusts boundary parameters and conversion relations on the basis, generates boundary test cases and abnormal test cases, and automatically generates test cases capable of realizing full scene coverage so as to be convenient for high-efficiency full-automatic test of functional logic under the multi-power state of the equipment.

Inventors

  • YE LIN
  • YANG SHENG
  • ZHU ZHUANGHUI
  • TANG YAJIE
  • TANG XIAOXUN

Assignees

  • 上海七十迈数字科技有限公司

Dates

Publication Date
20260512
Application Date
20260123

Claims (10)

  1. 1. A method for generating a functional logic test case in a multi-power state of equipment is characterized by comprising the following steps: Acquiring a requirement document of equipment; analyzing the demand document to obtain an analysis result, wherein the analysis result comprises power state and conversion information, function description information and parameter information; constructing a directed conversion graph and a test matrix about the power states of the equipment according to the analysis result, wherein the directed conversion graph comprises state nodes for representing different power states and state conversion edges for representing conversion relations among the different power states, and the test matrix comprises parameter values and verification points of each function to be tested of the equipment in the different power states; acquiring all possible state transition paths among different power supply states of the equipment according to the directed transition diagram; According to the test matrix and the state transition path, determining parameter difference information of a function to be tested of the equipment in different power supply states, applying a preset generation rule, and assembling according to the parameter difference information to obtain a basic test case; generating boundary parameters corresponding to the parameter values, and adjusting the parameter values in the basic test cases according to the boundary parameters to obtain corresponding boundary test cases; And adjusting the conversion relation of the power supply state in the basic test cases to obtain the corresponding abnormal test cases.
  2. 2. The method of claim 1, wherein parsing the demand document to obtain a parsing result, the parsing result including power state and conversion information, function description information, and parameter information, comprises: Matching candidate paragraphs in the requirement document through regular expressions; searching technical terms related to the power supply state in the candidate paragraphs by using preset keywords in a keyword library; And acquiring power state and conversion information, function description information and parameter information according to the context content of the technical term.
  3. 3. The method of claim 1, wherein obtaining all possible state transition paths between different power states of a device according to the directed transition diagram comprises: And traversing the directed conversion graph by adopting a depth-first search algorithm and a breadth-first search algorithm to generate all possible conversion paths.
  4. 4. The method according to claim 1, wherein determining parameter difference information of a function to be tested of the device in different power states according to the test matrix and the state transition path, applying a preset generation rule, and assembling according to the parameter difference information to obtain a basic test case, comprises: according to the test matrix and the state transition path, a parameter difference table delta [ F, si, sj ] of the function to be tested is established and is used for recording and recording parameter difference information when the function F to be tested is switched from the power state Si to the power state Sj; And applying a preset generation rule, and assembling according to the parameter difference information to obtain a basic test case.
  5. 5. A method for testing functional logic of a device in a multi-power state, the method comprising: Generating test cases of functions to be tested by adopting the method according to any one of claims 1 to 4, wherein the test cases comprise basic test cases, boundary test cases and abnormal test cases; And executing the test case to obtain a test result about the function to be tested.
  6. 6. The method of claim 5, wherein executing the test case comprises: and the test case execution engine executes the test case through the HIL interface control equipment.
  7. 7. The method of claim 5, wherein executing the test case to obtain test results for the function under test comprises: Executing the test case, and acquiring state data in the test case execution process; Performing anomaly detection on the equipment state data to obtain an anomaly detection result; And generating a test result report comprising state data and an abnormal detection result.
  8. 8. The method of claim 5, wherein executing the test case and obtaining device state data during execution of the test case comprises: Executing the test case, and acquiring state data of a device end, a cloud end and an application program end in the process of executing the test case; After the test case execution is completed, the method further comprises the following steps: Comparing the consistency of the state data of the equipment end, the cloud end and the application program end, and acquiring a consistency detection result; generating a test result report including status data, anomaly detection results, including: and generating a test result report comprising state data, abnormal detection results and consistency detection results.
  9. 9. A computing device comprising a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein the computer program instructions, when executed by the processor, trigger the device to perform the method of any one of claims 1 to 8.
  10. 10. A computer readable medium having stored thereon computer program instructions executable by a processor to implement the method of any of claims 1 to 8.

Description

Method for generating functional logic test case, test method and equipment Technical Field The present application relates to the field of information technologies, and in particular, to a method and a test method for generating a functional logic test case in a multi-power state of an apparatus, and an apparatus. Background Along with the rapid development of the internet of things technology, more and more intelligent devices have multiple power supply working modes, such as a state of being powered by an external power supply, a state of being powered by an internal battery of the device, a state of being powered by the external power supply and simultaneously being charged by the battery, a state of being powered by the internal battery of the device and being insufficient in battery power, and the like. Under these different power states, there tends to be significant differences in the functional logic of the smart device. When the intelligent device is subjected to functional logic test, the existing state machine test tool is difficult to adapt to the coupling relation between the hardware power state and the software logic function mainly aiming at the conversion between the software states, so that test cases covering different functional logics under all power states are difficult to be completely generated. However, the manual simulation method can theoretically complete the test, but has the problems of long test preparation time, easy omission of part of test scenes and difficult accurate control of test time sequence. Therefore, a solution for high-coverage automatic testing of different functional logics in a multi-power state of an intelligent device is still lacking in the prior art. Disclosure of Invention The application aims to provide a method for generating a functional logic test case, a test method and equipment. In order to achieve the above object, the present application provides a method for generating a functional logic test case in a multi-power state of a device, the method comprising: Acquiring a requirement document of equipment; analyzing the demand document to obtain an analysis result, wherein the analysis result comprises power state and conversion information, function description information and parameter information; constructing a directed conversion graph and a test matrix about the power states of the equipment according to the analysis result, wherein the directed conversion graph comprises state nodes for representing different power states and state conversion edges for representing conversion relations among the different power states, and the test matrix comprises parameter values and verification points of each function to be tested of the equipment in the different power states; acquiring all possible state transition paths among different power supply states of the equipment according to the directed transition diagram; According to the test matrix and the state transition path, determining parameter difference information of a function to be tested of the equipment in different power supply states, applying a preset generation rule, and assembling according to the parameter difference information to obtain a basic test case; generating boundary parameters corresponding to the parameter values, and adjusting the parameter values in the basic test cases according to the boundary parameters to obtain corresponding boundary test cases; And adjusting the conversion relation of the power supply state in the basic test cases to obtain the corresponding abnormal test cases. Further, analyzing the requirement document to obtain an analysis result, wherein the analysis result comprises power state and conversion information, function description information and parameter information, and the analysis result comprises: Matching candidate paragraphs in the requirement document through regular expressions; searching technical terms related to the power supply state in the candidate paragraphs by using preset keywords in a keyword library; And acquiring power state and conversion information, function description information and parameter information according to the context content of the technical term. Further, according to the directed transition diagram, all possible state transition paths between different power states of the device are acquired, including: And traversing the directed conversion graph by adopting a depth-first search algorithm and a breadth-first search algorithm to generate all possible conversion paths. Further, according to the test matrix and the state transition path, determining parameter difference information of a function to be tested of the device in different power states, applying a preset generation rule, and assembling according to the parameter difference information to obtain a basic test case, wherein the method comprises the following steps: according to the test matrix and the state transition path, a parameter difference tabl