AI-driven automatic test system and intelligent optimization method based on VISA and SCPI

By constructing an AI-driven automated testing system based on VISA and SCPI, the problems of low script development efficiency, reliance on experience for parameter configuration, and low efficiency of multi-instrument collaboration in existing testing systems have been solved. The system achieves automatic conversion of natural language into test scripts and real-time anomaly detection, thereby improving testing efficiency and accuracy.

CN121478645APending Publication Date: 2026-02-06CHINA METROLOGY TECH DEV GRP CO LTD

Patent Information

Application Number
CN202511548158.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-28
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

Existing testing systems based on VISA and SCPI suffer from problems such as low script development efficiency, reliance on experience for parameter configuration, delayed exception handling, and low efficiency of multi-instrument collaboration. Furthermore, AI has not been deeply integrated with VISA/SCPI in the testing field, lacking a closed-loop AI-driven process throughout the entire process.

Method used

By deeply integrating artificial intelligence technology with VISA and SCPI protocols, an intelligent closed-loop testing system is constructed, encompassing natural language requirement input, test execution, parameter optimization, anomaly handling, and multi-instrument collaboration. This system includes natural language requirement parsing, test script generation, real-time data acquisition, multimodal anomaly detection, and multi-instrument collaborative task scheduling.

Benefits of technology

It enables automatic conversion from natural language to test scripts, real-time anomaly detection and root cause localization, significantly improving testing efficiency and accuracy, and optimizing the utilization of multi-instrument resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121478645A_ABST
    Figure CN121478645A_ABST
Patent Text Reader

Abstract

The invention provides an AI-driven automatic test system and intelligent optimization method based on VISA and SCPI. The method comprises the steps that a natural language test requirement input by a user is acquired, the requirement is analyzed, and a test script conforming to the SCPI specification is generated; issuing the test script to the test instrument cluster through the virtual instrument software architecture interface, executing the test script, and collecting test data in real time; performing multi-modal fusion analysis on the basis of the collected test data to detect anomalies in the test process, and dynamically adjusting test parameters or test scripts according to an anomaly diagnosis result; performing cooperative task scheduling optimization on a plurality of instruments in the test instrument cluster based on the adjustment result; according to the method, a large language model is combined with an SCPI command knowledge graph to realize automatic conversion from a natural language to a test script, and test parameters and multi-instrument scheduling are dynamically optimized in combination with reinforcement learning, and the test efficiency and precision are remarkably improved through real-time anomaly detection and root cause positioning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automated testing technology, and in particular to an AI-driven automated testing system and intelligent optimization method based on VISA and SCPI. Background Technology

[0002] As electronic devices become increasingly complex, the demand for automation and intelligence in the test and measurement field is becoming more and more urgent; currently, test systems based on VISA and SCPI have the following limitations: 1. Low script development efficiency: Test scripts need to be written manually, which depends on engineers' in-depth understanding of SCPI instruction sets (such as MEASure:VOLTage, CONFigure:CURRent) and instrument models. Instruction differences between instruments from different brands (such as Keysight and Tektronix) result in poor script reusability and development cycles that can take several days to several weeks.

[0003] 2. Parameter configuration relies on experience: Test parameters (such as sampling rate and trigger threshold) need to be set manually, which can easily lead to "overtesting" (parameter redundancy leads to low efficiency) or "undertesting" (insufficient parameters lead to missed detection). For example, in RF signal testing, a manually set sampling rate may not be able to capture transient interference.

[0004] 3. Delayed anomaly handling: Traditional systems can only determine "result qualified / unqualified" and cannot identify anomalies in the testing process in real time (such as loose instrument interfaces or signal interference). Root cause location requires manual post-event analysis, which may lead to test failure or misjudgment.

[0005] 4. Low efficiency of multi-instrument collaboration: When multiple instruments (such as oscilloscopes, power supplies, and spectrum analyzers) are tested collaboratively, resource scheduling relies on manual planning, which can easily lead to idle instruments or process blockages, especially in batch production testing, which restricts production capacity.

[0006] In existing technologies, the application of AI in the testing field is mostly focused on post-data analysis, and has not been deeply integrated with the instruction control layer and instrument communication layer of VISA / SCPI. It has not yet formed a complete AI-driven closed loop of "requirement analysis → script generation → parameter optimization → exception handling → resource scheduling". Summary of the Invention

[0007] This invention provides an AI-driven automated testing system and intelligent optimization method based on VISA and SCPI. By deeply integrating artificial intelligence technology with VISA and SCPI protocols, it constructs an intelligent closed-loop testing system that integrates natural language requirement input, test execution, parameter optimization, anomaly handling, and multi-instrument collaboration. This solves the problem of traditional testing methods that rely solely on manually writing SCPI scripts, manually configuring parameters, and post-event anomaly analysis.

[0008] Specifically, this invention provides an AI-driven automated testing and intelligent optimization method based on VISA and SCPI, including: Step S1: Obtain the user's input natural language testing requirements, analyze the requirements based on artificial intelligence technology, and generate test scripts that conform to SCPI specifications; Step S2: Send the test script to the test instrument cluster through the virtual instrument software architecture interface, execute the test script, and collect test data in real time. Step S3: Perform multimodal fusion analysis based on the collected test data to detect anomalies during the test process, and dynamically adjust test parameters or test scripts according to the anomaly diagnosis results; Step S4: Based on the adjustment results, optimize the collaborative task scheduling of multiple instruments in the test instrument cluster.

[0009] Preferably, step 1 includes: parsing natural language testing requirements using a pre-trained large language model to generate its semantic representation vector; combining the SCPI command knowledge graph to match and reason about the semantic representation vector to generate an initial test script; performing logical optimization and instruction merging on the initial test script, and adding an exception handling mechanism to form the final test script.

[0010] Preferably, step 2 includes: establishing communication connections with test instruments from different manufacturers and with different bus types based on the VISA standard; converting SCPI commands in the test script into specific instructions that match the target instrument model; executing the instructions and collecting test data, instrument status data, and environmental data in real time; and storing the collected data in a time-series database.

[0011] Preferably, step 3 includes: fusing test data, instrument status data, and environmental data to generate a unified multimodal feature vector; using a time-series anomaly detection model to analyze the multimodal feature vector and identify test anomalies; combining SCPI command execution logs and instrument fault knowledge graphs to deduce the root cause of the anomaly; and generating adjustment instructions for test parameters or scripts based on the root cause.

[0012] Preferably, in step 3, dynamically adjusting the test parameters or test script includes: receiving adjustment instructions and determining the test parameters or script segments that need to be adjusted; generating an optimized parameter set based on historical test data using a multi-objective optimization algorithm; updating the corresponding parameters or instruction sequences in the test script; and re-issuing the updated script or parameters for execution via the VISA interface.

[0013] Preferably, step 4 includes: obtaining the priority constraints of all test tasks and the real-time load status of instrument resources; allocating appropriate instrument resources to test tasks based on optimization algorithms and optimizing their execution order; monitoring instrument load and performing dynamic task migration or queuing to balance cluster load.

[0014] Preferably, it also includes: analyzing test results and process data, automatically generating a test report containing optimization suggestions, and storing the test data in a knowledge base for AI model iteration.

[0015] Preferably, the matching and reasoning of semantic representation vectors in conjunction with the SCPI command knowledge graph includes: calculating the similarity between the semantic representation vector and the embedding vector of the instrument command node in the knowledge graph; dynamically constructing a retrieval strategy using a reinforcement learning algorithm to retrieve the relevant SCPI command set from the knowledge graph; and filtering and prioritizing the retrieved command set according to the similarity score and the constraints of the test scenario.

[0016] Preferably, the correlation between the semantic representation vector and the instrument commands in the SCPI command knowledge graph with the RDF triple structure is calculated by cosine similarity; the test scenario parameters are dynamically integrated in the state space using the DQN algorithm to retrieve and filter the set of SCPI commands that match the test requirements; the command set is filtered and prioritized according to the preset similarity threshold and instrument type constraints; wherein, the SCPI command knowledge graph is constructed using the RDF triple structure; and the reinforcement learning algorithm is the deep Q-network algorithm.

[0017] Preferably, logical optimization of the initial test script includes: constructing the initial SCPI command sequence into a directed acyclic graph to represent the dependencies between commands; and performing topological sorting based on the directed acyclic graph to optimize the execution order of commands. Before the final test script is generated, the following steps are also taken: using a machine learning classification model to verify the syntax and logic correctness of the optimized script; using a multi-agent collaborative framework to verify different parts of the script in parallel, and dynamically adjusting the script generation strategy based on the verification results.

[0018] This invention provides an AI-driven automated testing system based on VISA and SCPI for implementing the method provided by this invention, comprising: a natural language processing module for receiving and parsing natural language testing requirements; a script generation and optimization module for generating and optimizing SCPI test scripts based on the parsing results; a communication control module for interacting with a cluster of testing instruments through a VISA interface, issuing instructions and collecting data; an AI optimization and decision-making center for performing multimodal anomaly detection, root cause analysis, and dynamic adjustment decisions; and a task scheduling module for optimizing and managing the task allocation and execution of the cluster of testing instruments.

[0019] This invention provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements an AI-driven automated testing system and intelligent optimization method based on VISA and SCPI.

[0020] The working principle and beneficial effects of this invention are as follows: This invention provides an AI-driven automated testing and intelligent optimization method based on VISA and SCPI, comprising: Step S1: Obtain the user's input natural language testing requirements, analyze the requirements based on artificial intelligence technology, and generate test scripts that conform to SCPI specifications; Step S2: Send the test script to the test instrument cluster through the virtual instrument software architecture interface, execute the test script, and collect test data in real time. Step S3: Perform multimodal fusion analysis based on the collected test data to detect anomalies during the test process, and dynamically adjust test parameters or test scripts according to the anomaly diagnosis results; Step S4: Optimize the collaborative task scheduling of multiple instruments in the test instrument cluster.

[0021] This invention deeply integrates artificial intelligence technology with the VISA and SCPI protocols to construct an intelligent closed-loop testing system that encompasses natural language requirement input, test execution, parameter optimization, anomaly handling, and multi-instrument collaboration. This solves the problem of traditional testing methods that rely solely on manually written SCPI scripts, manual parameter configuration, and post-event anomaly analysis. Furthermore, this invention employs a large language model combined with an SCPI command knowledge graph to achieve automatic conversion from natural language to test scripts. Combined with reinforcement learning for dynamic optimization of test parameters and multi-instrument scheduling, real-time anomaly detection and root cause localization significantly improve testing efficiency and accuracy.

[0022] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings.

[0023] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0024] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a schematic diagram of the structure of the present invention. Detailed Implementation

[0025] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.

[0026] according to Figure 1 As shown, this invention provides an AI-driven automated testing system and intelligent optimization method based on VISA and SCPI. By deeply integrating artificial intelligence technology with VISA and SCPI protocols, it constructs an intelligent closed-loop testing system that integrates natural language requirement input, test execution, parameter optimization, anomaly handling, and multi-instrument collaboration. This solves the problem of traditional testing methods that rely solely on manually writing SCPI scripts, manually configuring parameters, and post-event anomaly analysis.

[0027] Specifically, embodiments of the present invention provide an AI-driven automated testing system and intelligent optimization method based on VISA and SCPI, including: Step S1: Obtain the user's input natural language testing requirements, analyze the requirements based on artificial intelligence technology, and generate test scripts that conform to SCPI specifications; Step S2: Send the test script to the test instrument cluster through the virtual instrument software architecture interface, execute the test script, and collect test data in real time. Step S3: Perform multimodal fusion analysis based on the collected test data to detect anomalies during the test process, and dynamically adjust test parameters or test scripts according to the anomaly diagnosis results; Step S4: Based on the adjustment results, optimize the collaborative task scheduling of multiple instruments in the test instrument cluster.

[0028] This invention provides an AI-driven automated testing system and intelligent optimization method based on VISA and SCPI, the method comprising: The system acquires natural language testing requirements input by the user, parses them using a large language model finely tuned by the SCPI command knowledge graph, and generates and verifies test scripts that conform to SCPI specifications. The knowledge graph is used to construct a mapping relationship between instrument model, function, SCPI commands, and parameters. The test script is sent to the test instrument cluster via the VISA interface, the script is executed, and the VISA reading function is used to collect test data (such as waveforms and spectrum) and instrument status data (such as status registers and error queues) in real time. The system performs multimodal fusion on the collected time-series and state data (e.g., aligning waveform data with instrument status words and inputting them into a one-dimensional CNN network to extract features), identifies test anomalies using a pre-trained anomaly detection model (such as an isolated forest), and locates the root cause of the anomaly based on a preset rule base and historical data, triggering a dynamic adjustment strategy: if it is parameter drift, the test parameters are adjusted through a reinforcement learning agent; if it is a script logic error, the initial state is fed back for re-parse and the script is corrected; if it is an instrument hardware failure, an event signal is sent to the scheduler. The system receives hardware failure event signals from instruments and performs collaborative scheduling optimization of tasks in the test instrument cluster based on an improved ant colony algorithm. The optimization goal is to minimize the total test time and balance the load of each instrument. The scheduler monitors the task queue length and CPU utilization of each instrument in real time. If the load balance exceeds the threshold, the scheduling algorithm is rerun to generate a new task allocation scheme.

[0029] In this invention, by acquiring the user's input natural language testing requirements, a pre-trained language model is used to parse the semantics and generate a test script conforming to the SCPI specification. Then, through the virtual instrument software architecture interface, the generated test script is distributed to the test instrument cluster for execution and real-time data acquisition. Further, based on the real-time acquired test data, multimodal fusion analysis is used to extract time series and state features and perform anomaly detection. If an anomaly is detected, test parameters are dynamically adjusted or the test script is modified according to the anomaly type and a preset threshold. Next, based on the adjustment results, the task allocation of the test instrument cluster is optimized using a collaborative task scheduling algorithm to obtain a balanced task execution sequence. Finally, the optimal task allocation is further optimized. The optimized task execution sequence monitors the instrument's operating status in real time to determine whether it meets preset performance indicators. If the performance indicators are not met, the task scheduling is readjusted based on the monitoring data to determine a new task allocation scheme. This invention uses a large language model combined with SCPI command knowledge graph to achieve automatic conversion from natural language to test scripts. It combines reinforcement learning to dynamically optimize test parameters and multi-instrument scheduling, and real-time anomaly detection and root cause localization significantly improve test efficiency and accuracy. It realizes automatic generation and verification from natural language to test scripts, achieves closed-loop optimization of the test process through data-driven anomaly detection and root cause localization, and improves the overall utilization rate and test efficiency of the instrument cluster by using intelligent scheduling algorithms.

[0030] In one embodiment, step 1 includes: parsing natural language test requirements using a pre-trained large language model to generate its semantic representation vector; combining the SCPI command knowledge graph to match and reason about the semantic representation vector to generate an initial test script; performing logical optimization and instruction merging on the initial test script, and adding an exception handling mechanism to form the final test script.

[0031] Specifically: The user's natural language testing requirements are input into a large language model, which outputs a semantic representation vector representing the user's intent. Next, an SCPI command knowledge graph is pre-constructed, with nodes including instrument model, SCPI commands, and parameters, and edges defining the logical order and relationships between commands. A graph embedding algorithm is used to encode the command nodes in the graph into vectors. The cosine similarity between the semantic representation vector and all command node vectors in the graph is calculated, and command nodes with similarity exceeding a preset threshold are selected as matching results. The execution sequence of commands is derived based on the matched command nodes and their relationships in the graph, constructing an initial test script. Subsequently, a rule-based optimizer is used to structurally optimize the script. Optimization rules include, but are not limited to: placing the reset command *RST at the beginning of the script; aggregating all configuration commands for the same instrument before executing the read command to reduce instrument state switching overhead; and selecting appropriate templates from a predefined exception handling template library based on the specific content of the testing service and inserting them after key nodes in the optimized script to form the final, robust test script.

[0032] In this embodiment, natural language testing requirements are obtained through a pre-trained large language model, yielding semantic parsing results. Based on these results, an embedding layer is used to generate semantic representation vectors. Node and edge information is obtained from the SCPI command knowledge graph and combined with the semantic representation vectors to calculate similarity. If the similarity calculation result exceeds a preset threshold, a matching node is identified, resulting in a matching inference path. Using this matching inference path, a command sequence is constructed to generate an initial test script. For the initial test script, a rule-based optimizer is used to adjust the order, resulting in an optimized script. Based on the optimized script, consecutive instructions are merged to obtain a merged script.

[0033] In this embodiment, the business content is analyzed through an exception handling template. This process uses a pre-trained large language model to parse natural language test requirements to generate semantic representation vectors. Error capture code is added to the merged script to form the final test script. This achieves automatic conversion from natural language to reliable and efficient test scripts.

[0034] In one embodiment, step S2 includes: establishing communication connections with test instruments from different manufacturers and with different bus types based on the VISA standard; converting SCPI commands in the test script into specific instructions that match the target instrument model; executing the instructions and collecting test data, instrument status data, and environmental data in real time; and storing the collected data in a time-series database.

[0035] More specifically, based on the instrument resource address defined in the system configuration file, the VISA library function is called to establish a communication session with the target test instrument; to ensure script compatibility, an identification command can optionally be sent, and the return value can be parsed to confirm that the instrument model matches the expectation; The standard SCPI script generated and / or converted in step S1 is directly sent to the instrument via the viWrite function of VISA; for each sent query command, the viRead function is immediately called to synchronously read the instrument's return data. Simultaneously, during script execution, a separate monitoring thread is started to asynchronously read the instrument's status byte register and error queue at fixed time intervals to obtain instrument status data. Each data point is assigned a high-precision timestamp, and the test data, instrument status codes, and environmental data from external sensors are linked together to form a structured data object. This data object is then written in real-time to a measurement point in the time-series database relevant to this test task for subsequent analysis.

[0036] In this embodiment, the communication connection of the test instrument is configured according to the VISA standard, supporting multiple manufacturers and bus types; a preset communication protocol library is used to load manufacturer-compatible parameters, and the business content is analyzed, wherein the business content involves at least establishing communication with the test instrument according to the VISA standard; Furthermore, the connection verification result is identified through the bus adaptation module. If the connection verification result shows successful bus adaptation, model matching information is obtained. The SCPI command sequence is extracted from the model matching information and mapped to a dedicated instruction set using command conversion rules. If the dedicated instruction set is complete, it is executed through the instruction execution interface. During instruction execution, the test data stream is processed in real time, and instrument status data is separated from it. Anomalies in status monitoring are determined based on the instrument status data. If no anomalies are found, environmental recording parameters are recorded. The test data stream and instrument status data are fused using the environmental recording parameters to obtain a fused data packet, which is then imported into a time-series storage structure. Real-time processing logs are indexed in the time-series storage structure.

[0037] In this invention, user natural language requirements are converted into scripts conforming to the SCPI standard through a finely tuned large language model; the execution of scripts and data collection are uniformly controlled by a heterogeneous test instrument cluster through a VISA interface; real-time monitoring and dynamic parameter adjustment of the testing process are realized based on a time-series feature extraction and anomaly detection model; and a scheduling algorithm is used to optimize cluster task allocation, ultimately forming a closed-loop intelligent test optimization system, which significantly improves the intelligence level and execution efficiency of automated testing.

[0038] In one embodiment, step 3 includes: fusing test data, instrument status data, and environmental data to generate a unified multimodal feature vector; using a time-series anomaly detection model to analyze the multimodal feature vector and identify test anomalies; combining SCPI command execution logs and instrument fault knowledge graphs to deduce the root cause of the anomaly; and generating adjustment instructions for test parameters or scripts based on the root cause.

[0039] More specifically, the real-time data stream of this test task is obtained from the time series database; the test data is sliced ​​using a sliding window, and the time domain features and frequency domain features of each window are extracted. The extracted features are then concatenated with the instrument status code and environmental data at the synchronization time to form a unified multimodal feature vector. The above feature vector sequence is input into a pre-trained unsupervised anomaly detection model. The model adopts an LSTM-based autoencoder structure, and its training data consists of a large amount of historical normal test data. Furthermore, based on the model, the reconstruction error of each time window is calculated. The larger the error, the greater the difference from the normal mode. When the reconstruction error continuously exceeds the threshold obtained from the statistics of historical normal data, it is determined that a test anomaly has occurred at that time point, and an alarm is triggered.

[0040] Establish a fault mode and solution lookup table, which defines common fault modes, possible causes, and troubleshooting strategies; After executing the adjustment command, the system continues to monitor the subsequent data flow. If the reconstruction error returns to normal and remains stable, the anomaly is determined to be resolved and the test continues. If the anomaly persists, the system attempts to apply the next strategy in the lookup table or reports to the system administrator, thus forming a closed-loop optimization system of detection -> diagnosis -> adjustment -> verification.

[0041] In this embodiment, test data, instrument status data, and environmental data are acquired. Through data cleaning and standardization, a unified-format multimodal dataset is generated. A feature fusion algorithm integrates the multimodal dataset into multimodal feature vectors. A long short-term memory network is used to perform time-series analysis on the multimodal feature vectors to obtain anomaly detection results. If the anomaly detection results exceed a preset threshold, the root cause of the anomaly is inferred by combining the SCPI command execution log and a pre-established instrument fault knowledge graph. Based on the inferred root cause, corresponding test parameter adjustment rules are obtained, and parameter adjustment instructions are generated. The test script is updated using the parameter adjustment instructions to obtain an optimized test configuration. The test is re-executed using the optimized test configuration to generate new test data, and this process is repeated to verify whether the anomaly has been eliminated.

[0042] In one embodiment, step 3, dynamically adjusting test parameters or test scripts, includes: receiving adjustment instructions and determining the test parameters or script segments that need to be adjusted; generating an optimized parameter set based on historical test data using a multi-objective optimization algorithm to update the corresponding parameters or instruction sequences in the test script; and re-issuing the updated script or parameters for execution via the VISA interface.

[0043] More specifically, in step 3, the dynamic adjustment of test parameters or test scripts includes: receiving adjustment instructions from the user interface or upper-level scheduling system, wherein the instructions are structured data (such as JSON format) and contain at least the fields target_parameter (target parameter name), adjustment_range (adjustment range), and optimization_goal (optimization goal, such as "minimize test duration"); based on the target_parameter, querying the most recent N (e.g., 100) relevant test records from a historical test database (such as a MySQL relational database), and extracting the historical values ​​of the target parameter and their corresponding key performance indicators, wherein the key performance indicators include at least the test pass rate and test time; Using the historical data as the initial sample, the NSGA-II algorithm in the multi-objective optimization algorithm is used for optimization, which includes at least: optimization variables of objective parameters, setting of minimizing test time and maximizing test pass rate of objective function, including algorithm parameters such as population size setting, number of iterations, crossover probability, and mutation probability; Next, the Pareto optimal solution set calculated by the algorithm is obtained, and an optimal solution is selected from it according to the optimization_goal; Based on the parameter values ​​in the selected optimal solution, the corresponding parameters in the test script are updated using the script template engine to generate the adjusted script content; The generated standard SCPI command is sent to the target instrument using the write() function of the VISA library; Check the status code returned by the instrument; if the status code is not 0 (indicating a transmission error), select the parameter value used in the most recent successful test from the historical database as the backup parameter, update the script again, and re-transmit; After the parameters are successfully sent, the subsequent test process is executed, and real-time running data (such as actual test time and measured values) is collected and sent back to the historical database. Calculate the deviation between the time taken in this test and the historical average time taken; if the deviation exceeds the preset threshold, a new adjustment instruction is automatically generated to trigger the next round of parameter optimization process until the deviation is lower than the threshold or the maximum number of iterations is reached.

[0044] In this embodiment, the test parameters and test script fragments to be processed are obtained through the received adjustment instructions, thereby determining the adjustment range and target object. Based on the obtained test parameters and test script fragments, relevant records are extracted from historical data, and an optimized parameter combination is generated using a multi-objective optimization algorithm. Then, the instruction sequence in the test script is updated for the generated parameter combination to obtain the adjusted script content. The adjusted script content and parameter combination are sent to the target device through the VISA interface, and the sending status information is obtained. If the sending status information shows an anomaly, a backup parameter combination is extracted from historical data, the script content is updated, and the script is resent to determine whether the sending operation is complete. Furthermore, according to the execution flow after sending, real-time running data is collected and compared with historical data to determine the applicability of parameter adjustment. If the deviation between real-time running data and historical data exceeds a preset threshold, a new adjustment instruction is generated through data analysis, triggering a new round of parameter optimization process.

[0045] In one embodiment, step 4 includes: obtaining the priority constraints of all test tasks and the real-time load status of instrument resources; allocating appropriate instrument resources to test tasks based on optimization algorithms and optimizing their execution order; monitoring instrument load and performing dynamic task migration or queuing to balance cluster load.

[0046] More specifically, the priority identifiers and resource constraints of all test tasks to be executed are obtained from the task management module. Furthermore, the real-time load status of each instrument in the cluster is obtained from the resource management module. The load status is a weighted average of the instrument's CPU utilization, memory usage, and current task queue length. Based on the above information, an initial task execution list is constructed and initially sorted by priority from high to low. A genetic algorithm is used to allocate appropriate instrument resources to the tasks and obtain an optimized resource allocation scheme. This scheme is iterated, and if it is found that the estimated load of an instrument, calculated based on the historical average execution time of newly allocated tasks, continuously exceeds a safety threshold for a certain period of time, a dynamic migration mechanism is triggered. Low-priority tasks in the waiting queue of this instrument are migrated to other similar instruments in the cluster whose current load is below 50%. The cluster load data after migration is obtained. If a load difference still exists... When there is a 25% load imbalance, the task queuing strategy is adjusted, the lowest priority task is put into a "suspended" state and no resources are allocated to it. The cluster load distribution is continuously monitored through the real-time monitoring dashboard. If the load of a certain instrument continues to be higher than the threshold, the above task queuing adjustment process is restarted to generate a new task execution order. Based on the final determined order, the task status database and instrument resource status database are updated to generate a real-time load distribution map of the cluster.

[0047] In this embodiment, the priority level and constraints of test tasks are obtained from the system. Combined with real-time load data of instrument resources, an initial task sorting list is constructed to obtain a preliminary task execution order. Based on the preliminary task execution order, a genetic algorithm is used to match test tasks and instrument resources. For tasks with higher priority, instrument resources with lower loads are allocated first to determine an optimized resource allocation scheme. If the real-time load of an instrument resource exceeds a preset threshold in the optimized resource allocation scheme, a dynamic migration mechanism is triggered to transfer some tasks to instrument resources with lower loads, and the load balance status after migration is determined. The load balance status data after migration is obtained. For instrument resources with uneven loads, the task queuing strategy is adjusted, and low-priority tasks are temporarily suspended to obtain an adjusted task execution plan. By monitoring the load changes of instrument resources in real time, the distribution of cluster load is analyzed. If the load of an instrument resource continues to be higher than a preset threshold, the task queuing adjustment is restarted to determine a new task execution order. Based on the new task execution order, the allocation status of test tasks and the load records of instrument resources are updated to generate real-time updated cluster load distribution data, completing the dynamic optimization of task execution.

[0048] In one embodiment, test results and process data are analyzed to automatically generate a test report containing optimization suggestions, and the test data is stored in a knowledge base for AI model iteration.

[0049] More specifically, key indicators such as peak power, average error, and test duration are extracted from the original test logs, and structured parsing is performed using regular expressions to obtain preliminary analysis results. By integrating the instrument operation, parameter settings, and pass / fail status records at each step of the integrated testing process, a complete test process execution sequence is reconstructed. Core performance nodes in the test process, such as signal calibration and power measurement, are identified, and the corresponding data for these nodes are checked for abnormal fluctuations. If anomalies are found, the maximum value, minimum value, variance, number of times the upper limit of the specification is exceeded, number of times the lower limit of the specification is exceeded, slope, and deviation from the historical mean of the seven features of the abnormal node are input into a pre-trained random forest classification model. This model is trained using historical data to identify the types of anomalies that exist during use. Based on the anomaly categories output by the model, a predefined "anomaly category-optimization suggestion" mapping table stored in the YAML configuration file is queried, and a targeted optimization plan is automatically generated. If the generated optimization plan involves adjusting the AI ​​model itself (such as discovering new anomaly patterns), the most recent 1,000 test data are extracted from the SQL table of the knowledge base, and the random forest model is incrementally trained to update the model parameters. Finally, the complete data, analysis results, optimization schemes, and updated model configurations from this test, including parameters, results, process sequences, etc., are integrated and linked to generate a structured test report in JSON format. This report is then stored in the corresponding data table in the knowledge base to complete the update.

[0050] In this embodiment, key indicators are extracted from the test data, and a structured analysis method is used to obtain preliminary analysis results. Based on the preliminary analysis results, the process records are integrated to obtain complete test process information and identify the core links in the test. If there are abnormal fluctuations in the core links, deviation detection is performed by comparing historical data to determine whether there are potential problems. Based on the deviation detection results, the abnormal fluctuations are classified using a random forest algorithm to obtain specific abnormality categories. Through the pre-established mapping relationship between abnormality categories and improvement suggestions, targeted optimization schemes are automatically generated to determine the direction of improvement. If the optimization scheme involves model adjustment, relevant data is extracted from the knowledge base to update the model parameters and obtain the optimized model configuration. By associating and integrating the optimized model configuration with the test summary, the final stored data is generated, and the knowledge base update operation is completed.

[0051] The present invention also provides the following technical solutions for further optimization, specifically including: Combining the SCPI command knowledge graph, the matching and reasoning of semantic representation vectors includes: calculating the similarity between the semantic representation vector and the embedding vector of the instrument command node in the knowledge graph; dynamically constructing a retrieval strategy using reinforcement learning algorithms to retrieve the relevant SCPI command set from the knowledge graph; and filtering and prioritizing the retrieved command set according to the similarity score and the constraints of the test scenario.

[0052] Furthermore, the correlation between the semantic representation vector and the instrument commands in the SCPI command knowledge graph with the RDF triple structure is calculated using cosine similarity; the test scenario parameters are dynamically integrated using the state space of the DQN algorithm to retrieve and filter the set of SCPI commands that match the test requirements; the command set is filtered and prioritized according to the preset similarity threshold and instrument type constraints; the SCPI command knowledge graph is constructed using the RDF triple structure; and the reinforcement learning algorithm is the deep Q-network algorithm.

[0053] The logical optimization of the initial test script includes: constructing the initial SCPI command sequence into a directed acyclic graph to represent the dependencies between commands; and performing topological sorting based on the directed acyclic graph to optimize the execution order of commands. Before the final test script is generated, the following steps are also taken: using a machine learning classification model to verify the syntax and logic correctness of the optimized script; using a multi-agent collaborative framework to verify different parts of the script in parallel, and dynamically adjusting the script generation strategy based on the verification results.

[0054] In this embodiment, a BERT-based Chinese word segmentation model is used to segment the natural language test requirement text, obtaining the segmentation results. A dependency parser is then used to perform syntactic analysis on the segmentation results to obtain a syntactic structure tree. Based on the syntactic structure tree, context embeddings are extracted from a pre-trained language model to generate an initial semantic representation vector. If the dimension of the initial semantic representation vector is not high enough (e.g., 768 dimensions), a linear transformation is used to adjust the vector dimension, resulting in a 768-dimensional semantic representation vector. For the 768-dimensional semantic representation vector, a cosine similarity algorithm is used to calculate the semantic relevance between vectors and determine semantic consistency. Based on the semantic consistency results, semantic classification labels for the test requirement text are obtained, and the classification results are determined. Based on the classification results, a corresponding test case set is generated, resulting in structured test requirements.

[0055] For example, in practical use, processing the user-input natural language testing requirement text "Develop a chat application that supports multiple languages" first involves segmenting the text using a BERT-based Chinese word segmentation model (such as BERT-wwm-ext). The input text is processed by BERT's tokenizer, which breaks the text down into tokens. For example, "develop" is divided into "open" and "send," generating corresponding token ID sequences, such as [101, SCPI command knowledge graph 2458, SCPI command knowledge graph 1355, SCPI command knowledge graph 103]. Each token is used to generate a 768-dimensional vector through BERT's embedding layer. Combining positional encoding and segmentation encoding, an initial input representation is formed. The BERT model uses a 12-layer Transformer encoder with approximately 110M parameters, capturing inter-word relationships through a self-attention mechanism and outputting a context embedding vector. Next, a dependency parser (such as DDParser) is used to analyze the syntactic structure, identifying "development" as the predicate in a subject-predicate relationship and "chat application" as the object, generating a dependency tree. Edge weights are calculated based on syntactic distance; for example, the dependency path length from "development" to "application" is 2. The dependency analysis results are used to enhance semantic representation. Combined with the 768-dimensional vector output by BERT, a weighted average pooling method is used to generate the sentence's semantic vector (with weights set to 0.8 and 0.2 corresponding to the subject and object, respectively). For the requirement of multilingual support, vectors of the keyword "multilingual" are extracted (approximately 0.95 cosine similarity is related to "language"), and a pre-trained language model (such as XLM-RoBERTa) is used to further generate cross-language context embeddings with approximately 270M parameters, outputting a 768-dimensional vector representing the sentence's semantic features. Finally, the vector is matched with a predefined requirement template using cosine similarity, confirming the requirement category as "feature development" with a confidence level of 0.92. This process is achieved through an automated pipeline, with word segmentation, syntactic analysis, and vector generation all performed by pre-trained models and algorithms, ensuring logical rigor and contextual consistency.

[0056] The process begins by obtaining a test requirement description, parsing the input text using natural language processing (NLP) to extract key semantic information, and generating a semantic representation vector. The SCPI knowledge graph is then queried using an RDF triple structure to obtain a set of SCPI commands and test scenarios related to the semantic representation vector. Cosine similarity is used to calculate the similarity between the semantic representation vector and the semantic vectors of each command in the SCPI command set, resulting in a preliminary matching set of SCPI commands. If the number of preliminarily matched SCPI commands exceeds a preset threshold, the DQN algorithm model, using dynamic parameters of the test scenarios as the state space, is used to optimize the matching results and determine the optimal subset of SCPI commands. Based on the optimized subset of SCPI commands, the associated set of test scenarios is retrieved to obtain the test scenario parameters that match the test requirement description. The final set of SCPI commands and test scenarios is generated through the mapping relationship between the test scenario parameters and the SCPI command subset. If the matching degree between the final set of SCPI commands and the set of test scenarios is lower than a preset threshold, the process returns to step two, re-queries the SCPI knowledge graph to obtain a new set of SCPI commands and test scenarios, and repeats the subsequent steps until the matching degree reaches the preset threshold, yielding the final matching result.

[0057] If the cosine similarity of the semantic representation vector exceeds a preset threshold, feature vectors are extracted from the semantic representation vectors and combined with test scenario parameters to generate a feature-weighted vector. Based on the feature-weighted vector and instrument type classification, a pre-established instrument type database is queried to obtain a matching SCPI command set. From the obtained SCPI command set, an action space definition is used to extract a subset of actions related to the test scenario parameters, resulting in a candidate command set. For the candidate command set, a priority score is calculated for each command based on command priority, generating a priority ranking table. Based on the priority ranking table, a subset of commands that meet the requirements for dynamic parameter adjustment is selected to obtain an optimized command sequence. By optimizing the command sequence and combining it with test scenario parameters, the adaptability of the command sequence is verified to obtain the final SCPI command sequence. If the adaptability verification of the final SCPI command sequence passes, the final SCPI command sequence is output; if it fails, the process returns to the feature-weighted vector generation step, readjusts the feature weights, and generates a new feature-weighted vector.

[0058] The process begins by acquiring the initial SCPI command sequence and test requirements. A directed acyclic graph (DAG) is constructed to represent the dependencies between commands, and the logical relationships are determined. Based on the DAG, a topological sorting algorithm is used to generate a reorganization scheme for the initial command sequence, resulting in a structured command set. Time-series data of command execution is extracted from the structured command set and analyzed using a long short-term memory (LSTM) network model to predict the execution time of each command. Based on the predicted execution time, a reward function is constructed to quantify the execution efficiency of each command, generating an efficiency evaluation result. If the efficiency evaluation result is lower than a preset threshold, the command execution order is adjusted based on the reward function to generate an optimized command sequence. An executable SCPI test script is generated using the optimized command sequence, and its logical consistency is verified to obtain the final test script. Finally, the final test script is validated using a simulated execution environment to determine whether its execution efficiency meets the test requirements, and the validation results are output.

[0059] The XGBoost model is used to classify and validate SCPI scripts, determining their syntactic correctness and logical integrity to obtain validation results. A multi-agent collaborative framework extracts syntactic errors and logical defects from the validation results and assigns them to corresponding agents for processing. Based on the assignment results, the syntactic errors and logical defects are transmitted to the repair agent via a message passing interface to generate a repaired SCPI script. A rule engine performs secondary validation on the repaired SCPI script to determine if it meets syntactic and logical requirements, resulting in a validated script. The collaborative framework optimizes the validated script, allocating execution order to generate an optimized test script. A scheduling algorithm allocates resources and determines execution priority for the optimized test script, resulting in the final test script. The final test script is distributed to the test environment via a message passing interface, completing the script generation process.

[0060] The process involves obtaining the execution results of the test script, analyzing the task completion time and resource consumption data, and determining the task execution efficiency. Based on the task execution efficiency, the multi-agent collaborative state is updated, generating a state vector reflecting the current collaborative state. The Q-value table is updated using the state vector, and a reinforcement learning method is used to adjust the reward values ​​of each state-action pair in the Q-value table to obtain an optimized Q-value table. If the reward value of a certain state-action pair in the optimized Q-value table is higher than a preset threshold, the action parameters corresponding to that state are adjusted using the DQN algorithm to generate updated DQN model parameters. Time series data is obtained, input into a pre-established prediction model, and the task completion trend is analyzed to obtain the prediction results of task priorities. Based on the predicted results of task priorities and the updated DQN model parameters, the task allocation order is adjusted to generate a dynamic task allocation scheme. Using the dynamic task allocation scheme, computing resources are reallocated, the execution plan of the test script is updated, and a new task execution efficiency is obtained.

[0061] This invention also provides an AI-driven automated testing system based on VISA and SCPI for implementing the aforementioned VISA and SCPI-based AI-driven automated testing and intelligent optimization method, comprising: a natural language processing module for receiving and parsing natural language testing requirements; a script generation and optimization module for generating and optimizing SCPI test scripts based on the parsing results; a communication control module for interacting with the test instrument cluster through the VISA interface, issuing instructions and collecting data; an AI optimization and decision-making center for performing multimodal anomaly detection, root cause analysis, and dynamic adjustment decisions; and a task scheduling module for optimizing and managing the task allocation and execution of the test instrument cluster.

[0062] The present invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the aforementioned AI-driven automated testing system and intelligent optimization method based on VISA and SCPI.

[0063] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. An AI-driven automated testing and intelligent optimization method based on VISA and SCPI, characterized in that, include: Step S1: Obtain the natural language test requirements input by the user, parse the requirements, and generate test scripts that conform to the SCPI specification; Step S2: Send the test script to the test instrument cluster through the virtual instrument software architecture interface, execute the test script, and collect test data in real time. Step S3: Perform multimodal fusion analysis based on the collected test data to detect anomalies during the test process, and dynamically adjust test parameters or test scripts according to the anomaly diagnosis results; Step S4: Based on the adjustment results, optimize the collaborative task scheduling of multiple instruments in the test instrument cluster.

2. The AI-driven automated testing and intelligent optimization method based on VISA and SCPI as described in claim 1, characterized in that, Step 1 includes: The natural language testing requirements are analyzed using a pre-trained large language model, and their semantic representation vectors are generated. By combining the SCPI command knowledge graph, semantic representation vectors are matched and reasoned to generate an initial test script; The initial test script is logically optimized and instructions are merged, and an exception handling mechanism is added to form the final test script.

3. The AI-driven automated testing and intelligent optimization method based on VISA and SCPI as described in claim 1, characterized in that, Step 2 includes: Establish communication connections with test instruments from different manufacturers and with different bus types based on the VISA standard; Convert the SCPI commands in the test script into specific instructions that match the target instrument model; Execute commands and collect test data, instrument status data, and environmental data in real time; The collected data is stored in a time-series database.

4. The AI-driven automated testing and intelligent optimization method based on VISA and SCPI as described in claim 1, characterized in that, Step 3 includes: By integrating test data, instrument status data, and environmental data, a unified multimodal feature vector is generated; A time-series anomaly detection model is used to analyze multimodal feature vectors and identify test anomalies; By combining SCPI command execution logs with instrument malfunction knowledge graphs, the root cause of the anomaly can be deduced. Generate adjustment instructions for test parameters or scripts based on the root cause.

5. The AI-driven automated testing and intelligent optimization method based on VISA and SCPI as described in claim 1, characterized in that, Step 3, dynamically adjusting test parameters or test scripts includes: Receive adjustment instructions and determine the test parameters or script fragments that need to be adjusted; Based on historical test data, an optimized parameter set is generated using a multi-objective optimization algorithm; Update the corresponding parameters or instruction sequences in the test script; The updated script or parameters are reissued and executed via the VISA interface.

6. The AI-driven automated testing and intelligent optimization method based on VISA and SCPI as described in claim 1, characterized in that, Step 4 includes: Obtain the priority constraints of all test tasks and the real-time load status of instrument resources; Based on optimization algorithms, appropriate instrument resources are allocated to test tasks, and their execution order is optimized. Monitor instrument load and dynamically migrate or queue tasks to balance cluster load.

7. The AI-driven automated testing and intelligent optimization method based on VISA and SCPI as described in claim 1, characterized in that, include: Analyze test results and process data, automatically generate a test report containing optimization suggestions, and store the test data in a knowledge base for AI model iteration.

8. The AI-driven automated testing and intelligent optimization method based on VISA and SCPI as described in claim 2, characterized in that, Combining the SCPI command knowledge graph, the matching and reasoning of semantic representation vectors includes: Calculate the similarity between the semantic representation vector and the embedding vector of the instrument command node in the knowledge graph; Reinforcement learning algorithms are used to dynamically construct retrieval strategies and retrieve relevant SCPI command sets from the knowledge graph; Based on similarity scores and the constraints of the test scenario, the retrieved command set is filtered and prioritized.

9. The AI-driven automated testing and intelligent optimization method based on VISA and SCPI as described in claim 8, characterized in that, The correlation between semantic representation vectors and instrument commands in the SCPI command knowledge graph with RDF triple structure is calculated using cosine similarity. The test scenario parameters are dynamically integrated using the state space of the DQN algorithm to retrieve and filter the set of SCPI commands that match the test requirements. The command set is filtered and prioritized based on preset similarity thresholds and instrument type constraints. The SCPI command knowledge graph is constructed using an RDF triple structure. The reinforcement learning algorithm is a deep Q-network algorithm.

10. The AI-driven automated testing and intelligent optimization method based on VISA and SCPI as described in claim 8, characterized in that, Logic optimization of the initial test script includes: The initial SCPI command sequence is constructed as a directed acyclic graph to represent the dependencies between commands; topological sorting is performed based on the directed acyclic graph to optimize the execution order of commands. Before the final test script is formed, the following steps are also included: The optimized script is validated for syntactic and logical correctness using a machine learning classification model. Different segments of the script are validated in parallel using a multi-agent collaborative framework, and the script generation strategy is dynamically adjusted based on the validation results.

Citation Information

Patent Citations

  • Test system and test method

    CN112305396A

  • Chip packaging test system and method

    CN118782487A

  • Oscilloscope control system and method based on natural language

    CN120508231A

  • Method and system for generating code for a mobile communication tester

    US20250130926A1

  • System and method for planning and executing test of electronic device

    US20250307095A1

Cited By

  • Software exception handling method, exception handling system and storage medium

    CN121996466A