Terminal interface function detection method and system
By generating optimal test cases through genetic algorithms and conducting multi-task synchronous testing, combined with intelligent customer service feedback, the problems of poor universality and low automation of terminal interface function testing equipment have been solved, achieving efficient and automated terminal interface testing and improving testing efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-14
- Publication Date
- 2026-03-20
AI Technical Summary
Existing terminal interface function testing equipment suffers from poor versatility, low automation, and low fault handling efficiency. It cannot adapt to the interface characteristics and testing requirements of different terminal models, resulting in high testing costs, low efficiency, and delayed fault handling.
The system uses a genetic algorithm to generate optimal test cases, combined with multi-channel, multi-task synchronous testing and intelligent customer service feedback, to automatically detect and provide fault diagnosis solutions, including parameter configuration, hardware interface self-test, multi-task synchronous testing, and intelligent fault analysis.
It enables flexible adaptation to different models of terminal equipment, improves detection efficiency and accuracy, reduces manual intervention, provides intelligent fault diagnosis and solutions, and enhances the automation and practicality of the detection system.
Smart Images

Figure CN121705092A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to terminal equipment interface function testing technology, and more particularly to an interface function testing method and system suitable for power industry terminals. Background Technology
[0002] During the operation and maintenance of the power system, various terminals of the China Southern Power Grid, such as energy controllers, concentrators, dedicated transformer acquisition terminals, distribution transformer monitoring and metering terminals, power load management terminals, and intelligent measurement terminals, bear key functions such as data transmission and command interaction through their interfaces. Existing terminal interface function testing equipment has the following defects:
[0003] 1. Poor versatility: Existing automated testing systems lack analytical and adaptive capabilities, and cannot flexibly adjust testing strategies according to the interface characteristics and testing requirements of different terminals, making it difficult to achieve efficient and accurate testing; different terminal models (such as Type I concentrators and Type II special transformer terminals) have large differences in interface types and layouts, requiring dedicated testing equipment, resulting in high testing costs and low efficiency;
[0004] 2. Low level of automation: Test cases need to be selected and executed manually, which depends on the operator's experience and is prone to missed detections or misjudgments; the operation is complicated and time-consuming, which greatly wastes human resources;
[0005] 3. Delayed troubleshooting: The analysis of test results can only determine whether the function is normal, but cannot locate the cause of the fault by combining the environment and historical data. In addition, there is a lack of real-time customer service support, and the problem resolution cycle is long.
[0006] Therefore, there is an urgent need for a terminal interface function testing solution that is highly versatile, automated, and equipped with intelligent customer service. Summary of the Invention
[0007] This invention aims to solve the problems of poor versatility, low automation, and low fault handling efficiency of existing terminal interface function testing equipment, and provides a testing method and system that can be adapted to multiple terminal models, automatically perform testing, and have intelligent feedback functions.
[0008] The technical solution of this invention is:
[0009] This invention provides a method for detecting terminal interface functions, comprising:
[0010] S1. Generate parameter configuration based on the type of terminal under test, including terminal address, communication parameters, number and type of interfaces under test; generate optimal test cases using a genetic algorithm, wherein the optimal test cases are selected from the test case pool to cover multiple interfaces;
[0011] S2. Automatically switch hardware interfaces and perform interface self-tests based on the optimal test cases. If the self-test is successful, open the corresponding interface to execute the test.
[0012] S3. Perform multi-channel, multi-task synchronous testing, switching between management and data channels;
[0013] S4. Generate a test report based on the original test results, working environment, historical fault records and preset standard data, and output the most likely cause of the fault and the solution.
[0014] Furthermore, the use of genetic algorithms to generate optimal test cases as described in S1 includes:
[0015] S11. Parameter setting steps: Set the genetic algorithm parameters, including population size, number of generations, crossover probability, and mutation probability; monitor the convergence through a multi-generation window, and stop evolution when the relative improvement of the best fitness of the multi-generation window Δf_window is less than the convergence threshold δ;
[0016] S12. Population initialization steps: For each test interface of the terminal under test, select a test case from the test case pool of each interface to build a test case group, and build an initialization test case group with the same size as the population; wherein, the test case pool combines the original test case library, the historical excellent test case library and randomly generated test cases;
[0017] S13, Individual Gene Encoding Steps: Encode each step of each test case into a gene sequence, and select relevant factors in the test cases that affect the execution time, execution strategy and execution results as genes for encoding;
[0018] S14. Fitness evaluation steps: Run the test cases in all test case groups to obtain the number of global interfaces covered by each test case group, defect coverage, and test duration, and obtain the fitness value of each test case group.
[0019] S15. Iterative evolution steps: Perform selection, crossover, and mutation operations sequentially on all current test case groups, and iteratively evolve by repeating the above operations until the preset number of evolution generations is reached or the convergence condition is met, thereby generating the current test case group.
[0020] Sort the test cases by fitness, select the test case group with the highest fitness as the global optimal test case group, and select the top s test cases. Add each test case to the historical excellent test case library of the corresponding interface for the initialization of the next generation.
[0021] Furthermore, S11 includes:
[0022] S111. Set the genetic algorithm parameters, including population size, number of generations, crossover probability, and mutation probability; among them, the crossover probability Pc(t) and mutation probability Pm(t) are adaptively adjusted based on the number of generations.
[0023] Pc(t)=Pc_start-(Pc_start-Pc_end)*(t / T);
[0024] Pm(t)=Pm_start+(Pm_end-Pm_start)*(t / T);
[0025] Where Pc_start represents the initial crossover probability, Pc_end represents the final crossover probability, Pm_start represents the initial mutation probability, Pm_end represents the final mutation probability, t represents the current generation number, and T represents the total number of generations.
[0026] S112. Monitor the convergence by calculating the multi-generation window. When the relative improvement of the best fitness of the multi-generation window Δf_window is less than the convergence threshold δ, the evolution stops.
[0027] Δf_window=|[f(t)-f(tn)] / (|f(tn)|+ε)|
[0028] Where n represents the observation window size, f(t) represents the best fitness of the current generation, f(tn) represents the best fitness within n generations, and ε is a constant.
[0029] Furthermore, in the S12 population initialization step, the proportion of the original test case library gradually decreases as the system runs, the proportion of the historical excellent test case library gradually increases, and the proportion of randomly generated test cases is fixed; for example, the proportion of the original test case library gradually decreases from 90% at the beginning of the system's operation to 50%, the proportion of the historical excellent test case library gradually increases from 0% to 40%, and the remaining randomly generated test cases have a fixed proportion of 10%.
[0030] Furthermore, in the S14 fitness evaluation step, when the number of interfaces or defect coverage is less than the corresponding threshold, or the test duration is greater than the corresponding threshold, the current test case group is directly eliminated. The fitness value of each test case group is obtained using the following formula.
[0031] fitness = base + w1 * (number of interfaces - n1) / n1 + w2 * (defect coverage - n2) / n2 + w3 * (t set -test duration) / t set Where w1, w2, and w3 represent the weights of the number of interfaces, defect coverage, and test duration; n1 is the interface number threshold, representing the minimum number of interfaces covered, n1 = total number of interfaces × 0.8; n2 is the defect coverage threshold, representing the minimum defect coverage, n2 = number of known defects × 0.7; t set t represents the test duration threshold, indicating the maximum test duration. set = Historical average duration × 1.5;
[0032] Furthermore, in the S15 iterative evolution step,
[0033] The selection operation uses a tournament selection method to select a parent test case group from all current test case groups (100 groups) with a high fitness value and a preset proportion (50%).
[0034] The crossover operation performs a single-point crossover on the parent generation test case group with the crossover probability Pc(t) of the current generation, and exchanges test cases at a randomly selected interface.
[0035] The mutation operation is performed on the test case group after the crossover operation with the mutation probability Pm(t) of the current generation, and randomly selects any test case in the test case group to replace it with another test case in the corresponding interface test case pool.
[0036] When the size of the historical excellent test case library exceeds a set threshold, the worst test case group is eliminated based on fitness.
[0037] Furthermore, S2 includes: after generating the optimal test cases, outputting interface definitions through a hardware circuit switching device to adapt to various types of interfaces of the terminal under test; performing self-tests on the peripherals corresponding to the interfaces used in the optimal test case group; if the self-test is qualified, opening the corresponding interface to execute subsequent tests; if it is unqualified, issuing a warning and stopping the test.
[0038] Furthermore, the multi-channel, multi-task synchronous test described in S3 includes:
[0039] S31. Identify test cases that can be executed in parallel and add them to the parallel execution queue; at the same time, identify test cases that need to be executed serially and put them into the serial execution queue.
[0040] S32. Obtain and execute multiple test cases simultaneously from the parallel execution queue to achieve synchronous testing of multiple tasks; after the parallel execution queue is completed, execute the subsequent test cases from the serial execution queue.
[0041] Furthermore, in S3,
[0042] The switching between the management channel and the data channel includes initializing the communication channel through the management channel according to the test requirements, then switching it to the data channel for test use, and automatically switching between the management channel and the data channel during the test process;
[0043] During meter reading tests, corresponding virtual meters are generated according to test requirements to provide communication functions, enabling the entire test process, from channel initialization to data reading, to be completed independently, forming a closed-loop test system.
[0044] Furthermore, S4 includes:
[0045] S41. Acquire multiple data sets, including raw test results D, working environment E, historical fault records H, and preset standard data S;
[0046] S42. Combine the original test result D with the working environment E, and compare it with the preset standard data S and historical fault records H to generate the test result M = f(D, E, H, S), where f is a comprehensive multi-dimensional statistical and evaluation (such as transmission rate stability and signal strength fluctuation).
[0047] S43. Generate a detailed inspection report R based on the inspection results and timestamps, R = {M, D, E, timestamp}; if a problem is detected, locate the cause of the fault and provide a solution, and store the inspection results and diagnostic information in the historical database H' to support subsequent analysis, H' = H ∪ {R}, where H represents the historical fault record database before the update.
[0048] Furthermore, it also includes S5, embedded intelligent customer service, triggering abnormal responses through standardized API interfaces, and returning user feedback on the solution to optimize the test case library, specifically;
[0049] S51. When the test result is abnormal, the intelligent customer service will intervene and push the abnormality details and preset solutions to the user.
[0050] S52. If the intelligent customer service cannot resolve the above-mentioned exception, the exception log will be synchronized to the human customer service platform through the API interface to realize the switching between intelligent customer service and human customer service.
[0051] S53. Feedback from users on the solution is sent back to the system via API interface for optimization of the test case library.
[0052] A terminal interface function detection system, the system being configured to execute the aforementioned detection method.
[0053] Compared with the prior art, the present invention has the following beneficial effects:
[0054] 1. High versatility: By integrating multiple interfaces, it achieves flexible adaptation to different models of terminal devices, covering multiple interface types such as wireless communication, serial communication and Ethernet, reducing investment in dedicated equipment;
[0055] 2. High degree of automation: The detection process is built with Python, and the parameter dynamic adjustment and test case generation and execution are realized by combining scripting language, which greatly reduces manual intervention; the genetic algorithm is introduced to optimize the test case generation, ensuring coverage of diverse interface types and defect scenarios, and providing fault diagnosis and solutions through intelligent response mechanism.
[0056] This invention significantly improves detection efficiency and accuracy, enhances the system's versatility and practicality, provides efficient and reliable technical support for the maintenance of terminal equipment in the power industry, and demonstrates its comprehensive application value in complex business scenarios.
[0057] Other features and advantages of the present invention will be described in detail in the following detailed description section. Attached Figure Description
[0058] The above and other objects, features and advantages of the present invention will become more apparent from the more detailed description of exemplary embodiments of the invention in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments of the invention.
[0059] Figure 1 A flowchart of the terminal interface function detection method of the present invention is shown.
[0060] Figure 2 A flowchart illustrating the embedding of intelligent customer service during terminal interface function detection according to an embodiment of the present invention is shown. Detailed Implementation
[0061] Preferred embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While preferred embodiments of the invention are shown in the drawings, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0062] Example 1
[0063] Figure 1 A flowchart of the terminal interface function detection method of the present invention is shown.
[0064] like Figure 1 As shown, the present invention provides a terminal interface function detection method, including:
[0065] S1. Generate parameter configuration based on the type of terminal under test, including terminal address, communication parameters, number and type of interfaces under test; generate optimal test cases using a genetic algorithm, wherein the optimal test cases are selected from the test case pool to cover multiple interfaces;
[0066] Specifically, the generation of optimal test cases using a genetic algorithm includes:
[0067] S11. Parameter setting steps: Set the genetic algorithm parameters, including population size, number of generations, crossover probability, and mutation probability; monitor the convergence through a multi-generation window, and stop evolution when the relative improvement of the best fitness of the multi-generation window Δf_window is less than the convergence threshold δ;
[0068] In one example, the genetic algorithm parameters are set as follows: population size is set to 100; the maximum number of generations is 100; crossover probability and mutation probability are set; among them, the crossover probability Pc(t) and mutation probability Pm(t) are adaptively adjusted based on the number of generations.
[0069] Pc(t)=Pc_start-(Pc_start-Pc_end)*(t / T);
[0070] Pm(t)=Pm_start+(Pm_end-Pm_start)*(t / T);
[0071] Where Pc_start represents the initial crossover probability, Pc_end represents the final crossover probability, Pm_start represents the initial mutation probability, Pm_end represents the final mutation probability, t represents the current generation number, and T represents the total number of generations. For example, the initial crossover probability Pc_start = 0.9, the final crossover probability Pc_end = 0.8; the initial mutation probability Pm_start = 0.1, and the final mutation probability Pm_end = 0.15.
[0072] Convergence is monitored by calculating the relative improvement of the best fitness across multiple generations of windows, Δf_window. The stopping condition is {Δf_window < δ}, where δ is the convergence threshold, for example, δ = 0.01, or 1%.
[0073] Δf_window=|[f(t)-f(tn)] / (|f(tn)|+ε)|
[0074] Where n represents the observation window size (n = 20), f(t) represents the best fitness in the current generation, f(tn) represents the best fitness in n generations, and ε = 1 / e -6 To avoid the risk of being reduced to zero.
[0075] By calculating the overall change in fitness over a sufficiently long period (e.g., 20 generations), the unavoidable short-term random fluctuations during evolution can be "smoothed out," thus accurately capturing whether the algorithm has truly fallen into a long-term stagnation state.
[0076] S12. Population initialization steps: For each test interface of the terminal under test, select a test case from the test case pool of each interface to build a test case group, and build 100 initialization test case groups with the same size as the population; wherein, the test case pool combines the original test case library, the historical excellent test case library and randomly generated test cases;
[0077] In one example, as the system runs, the proportion of the original test case library gradually decreases, the proportion of the historical excellent test case library gradually increases, and the proportion of randomly generated test cases remains constant. For example, the proportion of the original test case library gradually decreases from 90% at the beginning of the system's operation to 50%. For each globally optimal test case group generated during system operation, the proportion increases by 1%, the proportion of the historical excellent test case library gradually increases from 0% to 40%, and the remaining randomly generated test cases have a fixed proportion of 10%.
[0078] S13, Individual Gene Encoding Steps: Encode each step of each test case into a gene sequence, and select relevant factors in the test cases that affect the execution time, execution strategy and execution results as genes for encoding;
[0079] In one example, each test case is encoded genetically, including the communication channel (0-3), operation content (0-11), parameter data, delay data (0, 1), and expected value. The specific encoding specifications are as follows:
[0080] The S13.1 communication channels include: wireless public network, Ethernet, RS485, and RS232, each encoded with 0-3 (2-bit binary encoding);
[0081] The S13.2 operations include: setting an object attribute, reading an object attribute, reading a record-type object attribute, operating on an object method, source setting, source reading, waiting, switching baud rates, proxy reading of several object attributes from several servers, AT commands, Bluetooth table check communication, and proxy transparent forwarding commands, all encoded using 0-11 (4-bit binary encoding).
[0082] S13.3 Parameter Data: Many parameters in the 698 specification are "composite parameters," containing multiple attributes (data types). During processing, for numerical parameters, normalization is used for relatively uniformly distributed data: X_normalized = (X - X_min) / (X_max - X_min) scales all features to a uniform interval [0, 1]. Z-score standardization is used: X_standardized = (X - μ) / σ to handle data with outliers. μ and σ are calculated based on the original test case library: μ = (ΣX) / N, σ = sqrt(Σ(X - μ)^2 / (N - 1), where N is the total number of data points. For data with a large range, a logarithmic transformation X_log = log(X) is used, followed by normalization to control the numerical range. State parameters (such as switches)... State: One-Hot encoding is used, represented by three dimensions: State 1 [1, 0, 0], State 2 [0, 1, 0], State 3 [0, 0, 1]. String parameters are represented using a bag-of-words model, with word segmentation, vocabulary construction, and frequency counting for each word to form a vector. Time-type parameters are converted to timestamps and then normalized. Finally, the parameters are concatenated into a vector according to their format. Principal Component Analysis (PCA) is then used based on the complexity of the actual parameters, employing the PCA class from Python's scikit-learn library for dimensionality reduction. The PCA model is trained based on the encoded vectors of all parameter data in the original test case library, with a variance retention threshold of 95%. After training, the dimensionality reduction encoding of parameter data for all individuals is fixed. 95% of the variance information is retained, and all attribute codes are concatenated into a one-dimensional vector in a fixed order.
[0083] S13.4 Delay: 0-1000s (normalized to [0, 1]);
[0084] S13.5 Expected Value: The code for the expected value, the same as the parameter data.
[0085] Through the above encoding, each test case is represented as a fixed-length feature vector, serving as an individual in the genetic algorithm.
[0086] S14. Fitness evaluation steps: Run the test cases in all test case groups to obtain the number of global interfaces covered by each test case group, defect coverage, and test duration, and obtain the fitness value of each test case group.
[0087] In one example, when the number of interfaces or defect coverage is less than the corresponding threshold, or the test duration is greater than the corresponding threshold, the current test case group is directly eliminated. The fitness value of each test case group is obtained using the following formula.
[0088] fitness = base + w1 * (number of interfaces - n1) / n1 + w2 * (defect coverage - n2) / n2 + w3 * (t set - test duration) / t set ; where, w1, w2, and w3 represent the weights of the number of interfaces, defect coverage, and test duration; n1 is the threshold of the number of interfaces, representing the minimum number of interfaces to be covered, n1 = total number of interfaces × 0.8; n2 is the threshold of defect coverage, representing the minimum defect coverage, n2 = number of known defects × 0.7; t set is the threshold of test duration, representing the maximum test duration, tset = historical average duration × 1.5;
[0089] For example, interface coverage and defect coverage are given higher weights, and the weight of test duration is relatively lower, with a weight distribution of w1 = 0.4, w2 = 0.4, and w3 = 0.2. Threshold setting: Based on common and reasonable values in engineering practice: n1 = total number of interfaces × 0.8, which is the minimum number of interfaces to be covered, n2 = number of known defects × 0.7, which is the minimum defect coverage, t = historical average duration × 1.5, which is the maximum test duration. When the number of interfaces < n1 or defect coverage < n2 or test duration > t, it is directly eliminated. On the basis of meeting the constraints, additional points can be obtained, and the shorter the time, the more rewards, the more interfaces, the more rewards, and the more defect coverage, the more rewards.
[0090] S15. Iterative evolution step:依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件,生成当代100组测试用例组;依次对当前所有测试用例组执行选择操作、交叉操作和变异操作,迭代进化重复所述操作,直到达到预设的进化代数或满足收敛条件, Generate 100 groups of test case groups for the current generation;
[0091] Sort by fitness, select the test case group with the highest fitness as 1 group of globally optimal test case groups, and select the top 10 groups of test case groups. Add each test case to the historical excellent case library of the corresponding interface for the initialization of the next generation.
[0092] In an example, for the selection operation, use the tournament selection method to select 50% of the test case groups with high fitness values from the current 100 groups of test case groups as the parent test case groups;
[0093] For the crossover operation, perform single-point crossover on the parent test case groups with the crossover probability Pc(t) of the current generation, and exchange test cases at a randomly selected interface;
[0094] For the mutation operation, perform the mutation operation on the test case groups after the crossover operation with the mutation probability Pm(t) of the current generation. Randomly select any test case in the test case group and replace it with another case in the test case pool of the corresponding interface;
[0095] When the historical pool of excellent test cases exceeds 200, the worst test case group is eliminated based on fitness.
[0096] S2. Automatically switch hardware interfaces and perform interface self-tests based on the optimal test cases. If the self-test is successful, open the corresponding interface to execute the test.
[0097] Specifically, this includes generating optimal test cases, then using a hardware circuit switching device to output interface definitions to adapt to various types of interfaces on the terminal under test; performing self-tests on the peripherals corresponding to the interfaces used in the optimal test case group; if the self-test is successful, opening the corresponding interface to execute subsequent tests; if it fails, issuing a warning and stopping the test.
[0098] The peripherals include RS485 and RS232 communication conversion modules, infrared devices, Bluetooth modules, USB controllers, CAN communication modules, platform control boards (for remote signaling, pulse, gate nodes, and alarms), remote control input interfaces, carrier modules, and standard power sources.
[0099] S3. Perform multi-channel, multi-task synchronous testing, switching between management and data channels;
[0100] Specifically, this includes: identifying test cases that can be executed in parallel and adding them to the parallel execution queue; simultaneously, identifying test cases that need to be executed serially and placing them in the serial execution queue; simultaneously retrieving and executing multiple test cases from the parallel execution queue to achieve synchronous testing of multiple tasks; and executing the subsequent test cases in the serial execution queue after the parallel execution queue is completed.
[0101] The switching between the management channel and the data channel includes initializing the communication channel through the management channel according to the test requirements, then switching it to the data channel for test use, and automatically switching between the management channel and the data channel during the test process;
[0102] During meter reading tests, corresponding virtual meters are generated according to test requirements to provide communication functions, enabling the entire test process, from channel initialization to data reading, to be completed independently, forming a closed-loop test system.
[0103] S4. Generate a test report based on the original test results, working environment, historical fault records and preset standard data, and output the most likely cause of the fault and the solution.
[0104] Specifically, the process includes: S41, acquiring multiple data sets, including the original test result D, the working environment E, historical fault records H, and preset standard data S; S42, combining the original test result D with the working environment E, comparing it with the preset standard data S and historical fault records H, and generating a test result M = f(D, E, H, S), where f is a comprehensive multi-dimensional statistical and evaluation (such as transmission rate stability and signal strength fluctuations); S43, generating a detailed test report R based on the test result and timestamp, R = {M, D, E, timestamp}; if a problem is detected, locating the cause of the fault and providing a solution, storing the test result and diagnostic information in a historical database H' to support subsequent analysis, H' = H ∪ {R}, where H represents the historical fault record database before the update.
[0105] S5 embeds intelligent customer service, triggers abnormal responses through standardized API interfaces, and returns user feedback on solutions to optimize the test case library.
[0106] Specifically, Figure 2 A flowchart illustrating the embedding of intelligent customer service during terminal interface function detection according to an embodiment of the present invention is shown. Figure 2 As shown, the process includes: S51, when the detection result is abnormal, triggering the intelligent customer service to intervene and push the abnormality details and preset solutions to the user; S52, if the intelligent customer service cannot resolve the abnormality, then synchronizing the abnormality log to the human customer service platform through the API interface to achieve switching between intelligent customer service and human customer service; S53, sending the user's feedback on the solution back to the system through the API interface for optimization of the detection test case library.
[0107] Example 2
[0108] A terminal interface function detection system, the system being configured to execute the aforementioned detection method.
[0109] The detection system of this invention is applied to terminal products such as energy controllers, Type I concentrators, Type II concentrators, Type I special transformers, Type II special transformers, Type III special transformers, and smart energy units; it is suitable for scenarios such as batch production testing, pre-test inspection, and operation and maintenance debugging of terminal equipment in the power industry, and has high practical value and promotion significance.
[0110] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments.
Claims
1. A method for detecting terminal interface functions, characterized in that, include: S1. Generate parameter configuration based on the type of terminal under test, including terminal address, communication parameters, number and type of interfaces under test; generate optimal test cases using a genetic algorithm, wherein the optimal test cases are selected from the test case pool to cover multiple interfaces; S2. Automatically switch hardware interfaces and perform interface self-tests based on the optimal test cases. If the self-test is successful, open the corresponding interface to execute the test. S3. Perform multi-channel, multi-task synchronous testing, switching between management and data channels; S4. Generate a test report based on the original test results, working environment, historical fault records and preset standard data, and output the most likely cause of the fault and the solution.
2. The terminal interface function detection method as described in claim 1, characterized in that... In S1, the generation of optimal test cases using a genetic algorithm includes: S11. Parameter setting steps: Set the genetic algorithm parameters, including population size, number of generations, crossover probability, and mutation probability; monitor the convergence through a multi-generation window, and stop evolution when the relative improvement of the best fitness of the multi-generation window Δf_window is less than the convergence threshold δ; S12. Population initialization steps: For each test interface of the terminal under test, select a test case from the test case pool of each interface to build a test case group, and build an initialization test case group with the same size as the population; wherein, the test case pool combines the original test case library, the historical excellent test case library and randomly generated test cases; S13, Individual Gene Encoding Steps: Encode each step of each test case into a gene sequence, and select relevant factors in the test cases that affect the execution time, execution strategy and execution results as genes for encoding; S14. Fitness evaluation steps: Run the test cases in all test case groups to obtain the number of global interfaces covered by each test case group, defect coverage, and test duration, and obtain the fitness value of each test case group. S15. Iterative evolution steps: Perform selection, crossover, and mutation operations sequentially on all current test case groups, and iteratively evolve by repeating the above operations until the preset number of evolution generations is reached or the convergence condition is met, thereby generating the current test case group. Sort the test cases by fitness, select the test case group with the highest fitness as the global optimal test case group, and select the top s test cases. Add each test case to the historical excellent test case library of the corresponding interface for the initialization of the next generation.
3. The terminal interface function detection method as described in claim 2, characterized in that... S11 includes: S111. Set the genetic algorithm parameters, including population size, number of generations, crossover probability, and mutation probability; among them, the crossover probability Pc(t) and mutation probability Pm(t) are adaptively adjusted based on the number of generations. Pc(t)=Pc_start-(Pc_start-Pc_end)*(t / T); Pm(t)=Pm_start+(Pm_end-Pm_start)*(t / T); Where Pc_start represents the initial crossover probability, Pc_end represents the final crossover probability, Pm_start represents the initial mutation probability, Pm_end represents the final mutation probability, t represents the current generation number, and T represents the total number of generations. S112. Monitor the convergence by calculating the multi-generation window. When the relative improvement of the best fitness of the multi-generation window Δf_window is less than the convergence threshold δ, the evolution stops. Δf_window=|[f(t)-f(tn)] / (|f(tn)|+ε)| Where n represents the observation window size, f(t) represents the best fitness of the current generation, f(tn) represents the best fitness within n generations, and ε is a constant.
4. The terminal interface function detection method as described in claim 2, characterized in that, In the S12 population initialization step, the proportion of the original test case library gradually decreases as the system runs, the proportion of the historical excellent test case library gradually increases, and the proportion of randomly generated test cases is fixed. For example, the proportion of the original test case library gradually decreases from 90% at the beginning of the system's operation to 50%, the proportion of the historical excellent test case library gradually increases from 0% to 40%, and the remaining randomly generated test cases have a fixed proportion of 10%. In the S14 fitness evaluation step, when the number of interfaces or defect coverage is less than the corresponding threshold, or the test duration is greater than the corresponding threshold, the current test case group is directly eliminated. The fitness value of each test case group is obtained using the following formula. fitness = base + w1 * (number of interfaces - n1) / n1 + w2 * (defect coverage - n2) / n2 + w3 * (t set -test duration) / t set Where w1, w2, and w3 represent the weights of the number of interfaces, defect coverage, and test duration; n1 is the interface number threshold, representing the minimum number of interfaces covered, n1 = total number of interfaces × 0.8; n2 is the defect coverage threshold, representing the minimum defect coverage, n2 = number of known defects × 0.7; t set t represents the test duration threshold, indicating the maximum test duration. set = Historical average duration × 1.5; In the S15 iterative evolution steps The selection operation uses a tournament selection method to select a parent test case group from all current test case groups (100 groups) with a high fitness value and a preset proportion (50%). The crossover operation performs a single-point crossover on the parent generation test case group with the crossover probability Pc(t) of the current generation, and exchanges test cases at a randomly selected interface. The mutation operation is performed on the test case group after the crossover operation with the mutation probability Pm(t) of the current generation, and randomly selects any test case in the test case group to replace it with another test case in the corresponding interface test case pool. When the size of the historical excellent test case library exceeds a set threshold, the worst test case group is eliminated based on fitness.
5. The terminal interface function detection method as described in claim 1, characterized in that S2 include: After generating the optimal test cases, the output interface definition is switched through the hardware circuit to adapt to the various types of interfaces of the terminal under test. Perform self-tests on the peripherals corresponding to the interfaces used in the optimal test case group; If the self-test passes, the corresponding interface will be opened to perform subsequent tests; if it fails, a warning will be issued and the test will be stopped.
6. The terminal interface function detection method as described in claim 1, characterized in that... In S3, the execution of multi-channel multi-task synchronous test includes: S31. Identify test cases that can be executed in parallel and add them to the parallel execution queue; at the same time, identify test cases that need to be executed serially and put them into the serial execution queue. S32. Obtain and execute multiple test cases simultaneously from the parallel execution queue to achieve synchronous testing of multiple tasks; after the parallel execution queue is completed, execute the subsequent test cases from the serial execution queue.
7. The terminal interface function detection method as described in claim 1, characterized in that... In S3 The switching between the management channel and the data channel includes initializing the communication channel through the management channel according to the test requirements, then switching it to the data channel for test use, and automatically switching between the management channel and the data channel during the test process; During meter reading tests, corresponding virtual meters are generated according to test requirements to provide communication functions, enabling the entire test process, from channel initialization to data reading, to be completed independently, forming a closed-loop test system.
8. The terminal interface function detection method as described in claim 1, characterized in that S4 include: S41. Acquire multiple data sets, including raw test results D, working environment E, historical fault records H, and preset standard data S; S42. Combine the original test result D with the working environment E, and compare it with the preset standard data S and historical fault records H to generate the test result M = f(D, E, H, S), where f is a comprehensive multi-dimensional statistical and evaluation (such as transmission rate stability and signal strength fluctuation). S43. Generate a detailed inspection report R based on the inspection results and timestamps, R = {M, D, E, timestamp}; if a problem is detected, locate the cause of the fault and provide a solution, and store the inspection results and diagnostic information in the historical database H' to support subsequent analysis, H' = H ∪ {R}, where H represents the historical fault record database before the update.
9. The terminal interface function detection method as described in claim 1, characterized in that... It also includes S5, embedded intelligent customer service, which triggers abnormal responses through standardized API interfaces and returns user feedback on the solution to optimize the test case library, specifically; S51. When the test result is abnormal, the intelligent customer service will intervene and push the abnormality details and preset solutions to the user. S52. If the intelligent customer service cannot resolve the above-mentioned exception, the exception log will be synchronized to the human customer service platform through the API interface to realize the switching between intelligent customer service and human customer service. S53. Feedback from users on the solution is sent back to the system via API interface for optimization of the test case library.
10. A terminal interface function detection system, characterized in that, The system is configured to perform the detection method as described in any one of claims 1-9.