Method, system, device, medium and product for automatic generation of dcs test cases
Patent Information
- Application Number
- CN202610796842.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-04
- Publication Date
- 2026-08-21
AI Technical Summary
[0003]本申请要解决的技术问题是为了克服现有技术中核电DCS设备控制测试用例人工编制效率低、一致性差的缺陷,提供一种DCS测试用例的自动生成方法、系统、设备、介质及产品
本申请通过对DCS系统设计文件(如控制逻辑图、画面文件等)进行结构化处理形成标准数据表,并结合根据接口规范和系统说明预先编写的含固定文本、可变文本及指示文本的测试用例模板,利用软件自动完成数据匹配、变量替换及条件判断来生成设备控制测试用例,从而显著提高了核电仪控领域DCS测试用例的生成效率和标准化程度,减少了人工编写的工作量与主观错误,确保了测试用例与系统设计文件的一致性,便于测试的快速迭代与维护,提升了DCS系统测试的质量与可靠性。
Smart Images

Figure CN122614732A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of nuclear power instrumentation and control technology, and in particular to a method, system, equipment, medium and product for automatically generating DCS test cases. Background Technology
[0002] Currently, in the testing activities of industrial control systems (such as distributed control systems, DCS), test cases, as the core operational procedures for verifying design inputs and system functions, directly affect testing efficiency and product reliability due to their quality. For a long time, test cases for equipment control have been manually written by testers based on design documents. However, with the expansion of system scale and the increasing complexity of control logic, the number of test items for the device under test has surged. Coupled with the diverse types of input signals and high coupling of control logic, the traditional manual writing method faces significant bottlenecks: on the one hand, the process of writing test cases is tedious and lengthy, requiring a significant amount of time and human resources; on the other hand, limited by differences in personnel experience and cognitive biases, manually written test cases exhibit significant differences in format standardization, content completeness, and logical consistency, easily leading to scenario omissions or logical errors, making it difficult to meet the needs of systematic testing. Summary of the Invention
[0003] The technical problem to be solved by this application is to overcome the shortcomings of low efficiency and poor consistency in the manual compilation of test cases for nuclear power DCS equipment control in the prior art, and to provide a method, system, equipment, medium and product for automatic generation of DCS test cases.
[0004] This application solves the above-mentioned technical problems through the following technical solution: This application provides a method for automatically generating DCS test cases, the method comprising: Obtain the design documents of the DCS system; the design documents shall include at least the control logic diagram, screen design documents, device interface specifications, and system specification documents. The control logic diagram and the screen design file are structured to form a structured data table. The data table includes a main data table and sub-data tables. The main data table is used to store the list information of the devices in the DCS system, the interface information of each device, and the locking information of each device. The sub-data tables are used to store the configuration information of each device in the DCS system. Based on the file format requirements of the DCS test execution tool, and in conjunction with the device interface specifications and the system documentation, a test case template is prepared; the test case template includes fixed text, variable text, and instruction text. The test case generation software matches each data entry in the data table with the test case template, replaces the variable text, and performs conditional judgments based on the instruction text to automatically generate device control test cases for the DCS system.
[0005] In this solution, standard data tables are formed by structuring DCS system design documents (such as control logic diagrams and screen files). Combined with test case templates containing fixed text, variable text, and instruction text pre-written according to interface specifications and system descriptions, the software automatically completes data matching, variable substitution, and condition judgment to generate equipment control test cases. This significantly improves the efficiency and standardization of DCS test case generation in the nuclear power instrumentation and control field, reduces the workload of manual writing and subjective errors, ensures the consistency between test cases and system design documents, facilitates rapid iteration and maintenance of tests, and improves the quality and reliability of DCS system testing.
[0006] Optionally, the step of structuring the control logic diagram and the screen design file to form a structured data table includes: Extract the list information of the devices in the DCS system from the control logic diagram, and fill the list information into the master data table; The interface information of each device in the DCS system is extracted from the control logic diagram and filled into the master data table; the interface information is used to indicate whether an interface exists for each device in the DCS system. The configuration information of each device in the DCS system is extracted from the control logic diagram and filled into the sub-data table; the configuration information is used to characterize the underlying control logic parameters and action rules of each device. The locking information of each device in the DCS system is extracted from the screen design file, and the locking information is filled into the master data table to form the data table.
[0007] This solution achieves systematic and structured extraction and categorized storage of key information from multiple source design documents of the DCS system by explicitly extracting device list information, interface information, and configuration information from the control logic diagram, as well as device locking information from the screen design file, and then filling them into the master data table or sub-data table. This ensures the accuracy and completeness of core data such as the generated device list, interface attributes, control logic parameters, functional associations, and locking status, providing standardized and well-organized data support for the automatic matching of subsequent test case templates and test case generation, and further improving the automation level of DCS test case generation and the reliability of data basis.
[0008] Optionally, before the step of writing test case templates according to the file format requirements of the DCS test execution tool, in conjunction with the device interface specification and the system documentation, the automatic generation method further includes: Based on the control logic diagram and the screen design file, the device attributes of each device in the DCS system are determined. The device attributes include at least the device's control logic type, process function, and control interface configuration characteristics. Based on the device attributes, the devices in the DCS system are classified into at least one device type.
[0009] In this solution, before writing test case templates, the device attributes (including control logic type, process function, and control interface configuration characteristics) of each device are determined based on the control logic diagram and screen design file. Based on these attributes, the devices are classified into different device types, realizing the classification and organization of diverse devices in the DCS system. This allows for the subsequent writing of more targeted test case templates for different device types, avoiding the compatibility issues of general templates, further improving the matching degree between the generated test cases and the actual functions of the devices, while reducing the workload of developing redundant templates and improving the accuracy and overall efficiency of test case generation.
[0010] Optionally, the step of writing test case templates according to the file format requirements of the DCS test execution tool, combined with the device interface specification and the system documentation, includes: For each device type, the device input signal, device output signal, and device alarm signal corresponding to each device type are determined according to the device interface specification; According to the system specification document, the test items are determined; the test items shall at least cover one or more of the following: local remote switching test, alarm test, manual control test, forced manual switching test, automatic command test, automatic load carrying test after power failure, emergency command test, and emergency command bypass test; Based on the file format requirements of the DCS test execution tool, the device input signals, device output signals, device alarm signals, and test items corresponding to each device type, the test case template is written. Each of the aforementioned device types corresponds to at least one of the aforementioned test case templates.
[0011] This solution clarifies the corresponding input, output, and alarm signals for each device type based on the device interface specifications. It also determines test items covering multiple dimensions, including local / remote switching, alarms, manual / automatic control, power failure recovery, and emergency operations, according to the system documentation. Furthermore, it develops corresponding test case templates based on the file format requirements of the DCS test execution tool. This achieves precise adaptation of the test case templates to the device type and comprehensive coverage of the test content. It ensures that the generated test cases conform to the format specifications of the test tool for direct execution, while also guaranteeing targeted verification of key functions and signal interactions for different device types. This improves the applicability and completeness of the test cases and reduces test omissions or format incompatibility issues caused by template generalization.
[0012] Optionally, the step of automatically generating device control test cases for the DCS system by matching each data entry in the data table with the test case template using test case generation software, replacing the variable text, and performing conditional judgments based on the instruction text includes: Invoke the test case generation software; Based on the test cases, the software can read any one piece of data from the data table; The test case template is invoked for matching based on the device type corresponding to the data; Replace the variable text in the test case template based on the data; Based on the instruction text and the data in the test case template, a conditional judgment is made to determine whether to retain, skip, or replace the text content in the test case template corresponding to the instruction text. Generate the device control test cases for the DCS system corresponding to the data.
[0013] In this solution, the test case generation software reads data from a structured data table, calls the appropriate test case template according to the corresponding device type, automatically completes variable text replacement, and dynamically determines whether to retain, skip, or replace the template text based on the indicated text. This achieves automated and accurate generation of DCS device control test cases. It avoids the tediousness and subjective errors of manually writing test cases one by one, ensuring that each test case is completely matched with the actual data and type of the device. Furthermore, it flexibly adapts to the differentiated test scenarios of different devices through conditional judgment, ensuring the relevance and completeness of the generated test cases, while improving the efficiency, consistency, and maintainability of test case generation.
[0014] Optionally, the step of automatically generating device control test cases for the DCS system by matching each data entry in the data table with the test case template using test case generation software, replacing the variable text, and performing conditional judgments based on the instruction text, further includes: Based on the test case generation software, each data item in the data table is traversed to match each data item with the corresponding test case template. Generate device control test cases for the DCS system that correspond one-to-one with each of the data entries.
[0015] In this solution, the test case generation software automatically traverses each data entry in the data table and matches it one by one with the test case template of the corresponding device type. This enables the batch and fully automated generation of device control test cases for all devices in the DCS system, and ensures that each generated test case corresponds one-to-one with the corresponding device data. This avoids the inefficiency and errors of manual processing and ensures that test cases cover all devices without omission.
[0016] This application also provides an automatic generation system for DCS test cases, the automatic generation system including: a file acquisition module, a data structuring module, a template writing module and a test case generation module; The file acquisition module is used to acquire the design files of the DCS system; the design files include at least a control logic diagram, a screen design file, a device interface specification, and a system description file. The data structuring module is used to perform structuring processing on the control logic diagram and the screen design file to form a structured data table. The data table includes a main data table and sub-data tables. The main data table is used to store the list information of the devices in the DCS system, the interface information of each device, and the locking information of each device. The sub-data tables are used to store the configuration information of each device in the DCS system. The template writing module is used to write test case templates according to the file format requirements of the DCS test execution tool, combined with the device interface specifications and the system specification documents; the test case templates include fixed text, variable text, and instruction text; The test case generation module is used to match each piece of data in the data table with the test case template using test case generation software, replace the variable text, and perform conditional judgments based on the instruction text to automatically generate device control test cases for the DCS system.
[0017] Optionally, the data structuring module specifically includes: a list information extraction submodule, an interface information extraction submodule, a configuration information extraction submodule, and a locking information extraction submodule; The list information extraction submodule is used to extract the list information of the devices in the DCS system from the control logic diagram and fill the list information into the master data table; The interface information extraction submodule is used to extract the interface information of each device in the DCS system from the control logic diagram and fill the interface information into the master data table; the interface information is used to indicate whether an interface exists for each device in the DCS system; The configuration information extraction submodule is used to extract the configuration information of each device in the DCS system from the control logic diagram and fill the configuration information into the sub-data table; the configuration information is used to characterize the underlying control logic parameters and action rules of each device. The locking information extraction submodule is used to extract the locking information of each device in the DCS system from the screen design file, and fill the locking information into the master data table to form the data table.
[0018] Optionally, the automatic generation system further includes: a device attribute determination module and a device type classification module; The device attribute determination module is used to determine the device attributes of each device in the DCS system based on the control logic diagram and the screen design file. The device attributes include at least the device's control logic type, process function, and control interface configuration characteristics. The device type classification module is used to classify the devices in the DCS system based on the device attributes to obtain at least one device type.
[0019] Optionally, the template writing module specifically includes: a signal determination submodule, a test item determination submodule, and a template writing submodule; The signal determination submodule is used to determine, for each device type, the corresponding device input signal, device output signal, and device alarm signal according to the device interface specification. The test item determination submodule is used to determine the test items according to the system specification document; the test items shall at least cover one or more of the following: local remote switching test, alarm test, manual control test, forced manual switching test, automatic command test, automatic load carrying test after power failure, emergency command test, and emergency command bypass test; The template writing submodule is used to write the test case template based on the file format requirements of the DCS test execution tool, the device input signals, the device output signals, the device alarm signals, and the test items corresponding to each device type. Each of the aforementioned device types corresponds to at least one of the aforementioned test case templates.
[0020] Optionally, the test case generation module specifically includes: a software calling submodule, a data reading submodule, a template matching submodule, a text replacement submodule, a condition judgment submodule, and a test case generation submodule; The software calling submodule is used to call the test case generation software; The data reading submodule is used to read any one piece of data from the data table based on the test case generation software; The template matching submodule is used to call the test case template for matching according to the device type corresponding to the data; The text replacement submodule is used to replace the variable text in the test case template based on the data; The condition judgment submodule is used to make condition judgments based on the instruction text in the test case template and the data to determine whether to retain, skip or replace the text content in the test case template corresponding to the instruction text. The test case generation submodule is used to generate the device control test cases of the DCS system corresponding to the data.
[0021] Optionally, the template matching submodule is further configured to, based on the test case generation software, traverse each piece of data in the data table, so that each piece of data is matched with the corresponding test case template; The test case generation submodule is also used to generate test cases for the device control of the DCS system that correspond one-to-one with each piece of data.
[0022] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and used to run on the processor, wherein the processor executes the computer program to implement the above-described method for automatically generating DCS test cases.
[0023] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method for automatically generating DCS test cases.
[0024] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the method for automatically generating DCS test cases as described above.
[0025] Based on common knowledge in the field, the above-mentioned preferred conditions can be combined arbitrarily to obtain various preferred embodiments of this application.
[0026] The positive and progressive effects of this application are as follows: This application structures DCS system design documents (such as control logic diagrams and screen files) into standard data tables through structuring. Combined with test case templates containing fixed text, variable text, and instruction text pre-written according to interface specifications and system descriptions, the software automatically performs data matching, variable substitution, and conditional judgment to generate equipment control test cases. This significantly improves the efficiency and standardization of DCS test case generation in the nuclear power instrumentation and control field, reduces the workload of manual writing and subjective errors, ensures the consistency between test cases and system design documents, facilitates rapid iteration and maintenance of tests, and improves the quality and reliability of DCS system testing. Attached Figure Description
[0027] Figure 1 This is a flowchart illustrating an automatic generation method for DCS test cases provided in Embodiment 1 of this application; Figure 2 This is a schematic diagram of the format of the main data table in a data table provided in Embodiment 1 of this application; Figure 3 This is a schematic diagram of the format of a sub-data table in a data table provided in Embodiment 1 of this application; Figure 4 This is a schematic diagram of a DCS test case template provided in Embodiment 1 of this application; Figure 5 This is a schematic diagram of the layered software architecture design of a DCS test case generation software provided in Embodiment 1 of this application; Figure 6 This is a schematic diagram of the user interface of a DCS test case generation software provided in Embodiment 1 of this application; Figure 7 This is a flowchart illustrating the logical judgment of an instruction text provided in Embodiment 1 of this application; Figure 8 This is a schematic diagram of a DCS test case automatic generation system provided in Embodiment 2 of this application; Figure 9 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of this application. Detailed Implementation
[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0029] It should be noted that if this embodiment involves directional indicators (such as up, down, left, right, front, back, etc.), the directional indicators are only used to explain the relative positional relationship and movement of the components in a specific posture. If the specific posture changes, the directional indicators will also change accordingly.
[0030] Furthermore, if this embodiment involves descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.
[0031] Example 1
[0032] Please see Figures 1 to 7 This embodiment provides a method for automatically generating DCS test cases. Figure 1 This document presents a flowchart illustrating an automatic generation method for DCS test cases as provided in Embodiment 1 of this application. While this specification provides the method steps as shown in the embodiments or flowcharts, more or fewer steps may be included based on conventional or non-inventive methods. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible execution order. In actual system or server product execution, the methods can be executed sequentially according to the embodiments or accompanying drawings, or in parallel (e.g., in a parallel processor or multi-threaded processing environment). Specifically, as shown... Figure 1 As shown, the automatic generation method includes: S101: Obtain the design documents of the DCS system; the design documents shall include at least the control logic diagram, screen design documents, equipment interface specifications, and system specification documents; S102: Perform structured processing on the control logic diagram and screen design file to form a structured data table; the data table includes a main data table and sub-data tables. The main data table is used to store the list information of devices in the DCS system, the interface information of each device, and the locking information of each device. The sub-data tables are used to store the configuration information of each device in the DCS system. S103: Based on the file format requirements of the DCS test execution tool, and in conjunction with the device interface specifications and system documentation, write test case templates; the test case templates include fixed text, variable text, and instruction text; S104: Using test case generation software, each piece of data in the data table is matched with the test case template, variable text is replaced, and conditional judgments are made based on the instruction text to automatically generate equipment control test cases for the DCS system.
[0033] By structuring DCS system design documents (such as control logic diagrams and screen files) to form standard data tables, and combining them with test case templates containing fixed text, variable text, and instruction text pre-written according to interface specifications and system descriptions, the software automatically completes data matching, variable substitution, and condition judgment to generate equipment control test cases. This significantly improves the efficiency and standardization of DCS test case generation in the nuclear power instrumentation and control field, reduces the workload of manual writing and subjective errors, ensures the consistency between test cases and system design documents, facilitates rapid iteration and maintenance of tests, and improves the quality and reliability of DCS system testing.
[0034] Among them, the control logic diagram refers to the drawing or electronic file that describes the implementation of control strategies and algorithms in DCS. Its content defines in detail the processing relationship between analog and digital signals, proportional-integral-derivative (PID) control loop, interlocking protection conditions, sequential control logic, and operation rules of various functional blocks. It usually exists in the form of digital engineering drawings (CAD drawings), portable document format (PDF document), or logic diagrams specific to DCS manufacturers.
[0035] The screen design document focuses on the human-machine interface of the operator station (HMI). It specifies the layout of the monitoring screens and operation panels that the operator can see in the process industry scenario, including the position and display rules of dynamic flowcharts, trend curves, alarm lists, and elements such as buttons and indicator lights. Its form can be screen screenshot descriptions, configuration description tables, or engineering file definitions.
[0036] The device interface specification (often also known as the I / O list or signal interface table) is the bridge connecting field physical devices and the DCS system. It systematically lists the signal type, range, engineering units, alarm limits, and mapping relationship between internal DCS points and external terminals for each device tag.
[0037] The system specification document is a comprehensive description of the entire DCS system architecture and functions. It covers the system's functional scope, controller allocation strategy, operating mode switching logic, device interlocking conditions, and general naming rules, providing necessary contextual information for understanding the system's operational background and formulating test rules. These four types of documents work together, providing a complete data source for subsequent automated test case generation from four dimensions: control algorithm, human-computer interaction, physical connection, and system architecture.
[0038] Furthermore, the master data table and the sub-data tables in the data table are associated with each device in the DCS system through the device tag number.
[0039] In this embodiment, the step of structuring the control logic diagram and screen design file to form a structured data table includes: extracting the list information of devices in the DCS system from the control logic diagram and filling the list information into the main data table; extracting the interface information of each device in the DCS system from the control logic diagram and filling the interface information into the main data table; the interface information is used to indicate whether the interface of each device in the DCS system exists; extracting the configuration information of each device in the DCS system from the control logic diagram and filling the configuration information into the sub-data table; the configuration information is used to indicate the underlying control logic parameters and action rules of each device; and extracting the locking information of each device in the DCS system from the screen design file and filling the locking information into the main data table to form the data table.
[0040] By explicitly extracting device list information, interface information, and configuration information from the control logic diagram, and extracting device locking information from the screen design file, and then specifically filling these into the master data table or sub-data table, the system achieves systematic and structured extraction and classified storage of key information from multi-source design files of the DCS system. This ensures the accuracy and completeness of core data such as the generated device list, interface attributes, control logic parameters, functional associations, and locking status. It provides standardized and well-organized data support for the automatic matching of subsequent test case templates and test case generation, further improving the automation level of DCS test case generation and the reliability of data basis.
[0041] Specifically, Figure 2This is a schematic diagram of the format of a master data table provided in Embodiment 1 of this application. In this solution, information from the control logic diagram and screen design file is identified, classified, and extracted according to the requirements of the data table. The extraction rule is to extract data information according to the field type and requirements of the established data table. For example, it is necessary to extract the list information of devices in the DCS system from the control logic diagram and fill the list information into the master data table. The information format of the list information is text, and the fields are: device tag number, failure location, device interface number, automatic mode, manual command 1, manual command 2, and remarks. This information is filled into the master data table, such as... Figure 2 As shown.
[0042] Furthermore, the interface information of each device in the DCS system is extracted from the control logic diagram, and this interface information is filled into the master data table. The extracted interface information is formatted as 0 and 1 (1 represents the existence of the interface, 0 represents its non-existence), and the fields are: PERM, AUT1, AUT2, EMG1, EMG2, MRE, DAUT1, and PCM control. This information is then filled into the master data table, such as... Figure 2 As shown. For example, in the AUT1 field of the master data table, the presence of AUT1 interface information on the relevant device is identified from the control logic diagram, and then the information is filled into the cell, with the data format being 0 or 1.
[0043] Extract the configuration information of each device in the DCS system from the control logic diagram and fill the configuration information into the sub-data table. Figure 3 This is a schematic diagram illustrating the format of a sub-data table in a data table provided in Embodiment 1 of this application; the configuration information is in text format, and the fields are: branch judgment, delay, label name, intermediate point positioning information, drive value, recovery value, and quality requirements. This information is filled into the sub-data table, such as... Figure 3 As shown.
[0044] Extract the locking information of each device in the DCS system from the screen design file and fill the locking information into the master data table to form a data table. Specifically, for PDF or CAD format drawings, it is usually necessary to manually or semi-automatically identify the annotations and dynamic attribute descriptions of interactive elements such as buttons and switches based on the screen component number lookup table. The core of the extraction is to capture which device, under what conditions, and what form of locking occurs, and to abstract these natural language or graphical descriptions into key elements such as "whether it is locked", "locking type", and "locking condition description".
[0045] Subsequently, the extracted locking information is filled into the master data table. In the structural design of the master data table, a dedicated locking information field is reserved for each device, such as columns for "locked", "lock type" and "lock condition description", thereby solidifying the operation constraint rules that were originally scattered in the screen file.
[0046] In this solution, only the drawing and text information in the control logic diagram and screen design file needs to be converted into structured data information and presented in Excel format. For the specific data structure, please refer to the data table (e.g., ...). Figure 2 and Figure 3 Fields in a database generally meet the requirements of the first normal form.
[0047] In this embodiment, before the step of writing test case templates according to the file format requirements of the DCS test execution tool, combined with the device interface specifications and system description documents, the automatic generation method further includes: determining the device attributes of each device in the DCS system based on the control logic diagram and screen design documents. The device attributes include at least the device's control logic type, process function, and control interface configuration characteristics; classifying the devices in the DCS system based on the device attributes to obtain at least one device type.
[0048] Before writing test case templates, the device attributes (including control logic type, process function, and control interface configuration characteristics) of each device are determined based on the control logic diagram and screen design documents. Based on these attributes, the devices are classified into different types, which realizes the classification and organization of diverse devices in the DCS system. This allows for the subsequent writing of more targeted test case templates for the characteristics of different device types, avoiding the compatibility problem of general templates. This further improves the matching degree between the generated test cases and the actual functions of the devices, while reducing the workload of developing redundant templates and improving the accuracy and overall efficiency of test case generation.
[0049] Specifically, based on the acquired control logic diagrams and screen design documents, each device is analyzed to determine its inherent device attributes. These attributes at least cover the device's control logic type and control interface configuration characteristics. Specifically, the control logic type defines whether the device is a digital switch control type or an analog control type; this information is primarily extracted from the control logic diagram. The control interface configuration characteristics detail the combination of functional interfaces such as local / remote switching, manual / automatic switching, emergency command access, and interlocking protection, requiring a comprehensive assessment of both the control logic diagram and the screen operation button configuration.
[0050] Based on this, all devices in the DCS system are categorized according to the determined device attributes, thus forming at least one device type. This categorization process follows the principle of "devices of the same type have the same test logic," meaning that devices with similar control logic structures and interface configuration characteristics are classified into the same device type. For example, devices can be categorized into types such as "switching power equipment" and "analog regulating equipment," and each device can be assigned a corresponding type identifier. This categorization result will be written into a structured data table, enabling the software to accurately call the matching template based on the device type field in the subsequent test case template writing and generation phase.
[0051] In this embodiment, the steps of writing test case templates according to the file format requirements of the DCS test execution tool, combined with the device interface specifications and system documentation, include: for each device type, determining the corresponding device input signals, device output signals, and device alarm signals according to the device interface specifications; determining the test items according to the system documentation; the test items should at least cover one or more of the following: local / remote switching test, alarm test, manual control test, forced manual switching test, automatic command test, automatic load carrying test after power failure, emergency command test, and emergency command bypass test; and writing test case templates based on the file format requirements of the DCS test execution tool, the corresponding device input signals, device output signals, device alarm signals, and test items for each device type; each device type corresponds to at least one test case template.
[0052] By defining the corresponding input, output, and alarm signals for each device type in accordance with the device interface specifications, and determining test items covering multiple dimensions such as local / remote switching, alarms, manual / automatic control, power failure recovery, and emergency operations based on the system documentation, and then writing corresponding test case templates based on the file format requirements of the DCS test execution tool, the test case templates are accurately adapted to the device type and the test content is fully covered. This ensures that the generated test cases conform to the format specifications of the test tool for direct execution, and also ensures that the key functions and signal interactions of different device types can be specifically verified. This improves the applicability and completeness of the test cases and reduces test omissions or format incompatibility issues caused by template generalization.
[0053] Figure 4This is a schematic diagram of a DCS test case template provided in Embodiment 1 of this application. Specifically, firstly, for each classified device type, the device input signals, device output signals, and device alarm signals corresponding to that type of device are determined in detail according to the device interface specification; secondly, the complete test items to be executed are identified according to the system specification document. These items should at least cover one or more of the following: local / remote switching test, alarm test, manual control test, forced manual switching test, automatic command test, automatic load-carrying test after power failure, emergency command test, and emergency command bypass test; finally, based on the file format required by the DCS test execution tool, the test case template is compiled in combination with the above signal information and test items. During the template writing process, content that changes due to changes in input data is replaced with specific characters to form variable text. At the same time, for devices that may have different test contents and scopes, instruction text is used to logically guide the test case generation software used subsequently, thereby forming a template as follows. Figure 4 The structured test case template shown ensures that each device type has at least one dedicated template that meets the tool's format requirements.
[0054] The following is a specific example to illustrate how to write a test case template: Assuming a device is classified as a Motor Operated Valve (MOV), the MOV device interface specification stipulates that the device input signal format is: Open Feedback -OPN, Close Feedback -CLSD; the device output signal format is: Open Command -COPN, Close Command -CCLS; the device alarm signal format is: Overload -TOL; and the system specification document stipulates that this type of device has alarm functionality (i.e., alarm test) and manual control functionality (i.e., manual control test). Therefore, the test case template for all devices of this type is shown in Table 1 below: Table 1
[0055] For different devices, simply replace the device tag number to obtain multiple standard, uniformly formatted test cases.
[0056] In this embodiment, the steps of automatically generating device control test cases for the DCS system by matching each piece of data in the data table with a test case template using test case generation software, replacing variable text, and performing conditional judgments based on instruction text include: calling the test case generation software; reading any piece of data from the data table based on the test case generation software; calling the test case template for matching according to the device type corresponding to the data; replacing variable text in the test case template based on the data; performing conditional judgments based on the instruction text in the test case template and the data to determine whether to retain, skip, or replace the text content corresponding to the instruction text in the test case template; and generating device control test cases for the DCS system corresponding to the data.
[0057] The test case generation software reads data from structured data tables, calls the appropriate test case template according to the corresponding device type, automatically completes variable text replacement, and dynamically determines whether to retain, skip, or replace the template text based on the indicated text. This achieves automated and accurate generation of DCS device control test cases. It avoids the tediousness and subjective errors of manually writing test cases one by one, ensuring that each test case is completely matched with the actual data and type of the device. It also flexibly adapts to the differentiated test scenarios of different devices through conditional judgment, ensuring the relevance and completeness of the generated test cases, while improving the efficiency, consistency, and maintainability of test case generation.
[0058] Specifically, the test cases are formatted as natural language text and stored in spreadsheet format.
[0059] The test cases include initial conditions, triggering conditions, control command output, screen legend status, soft controller status, device screen, and device code. During the test case generation process, fixed text remains unchanged, while variable text is replaced according to the content in the data table. Instruction text is used for condition judgment during the generation process, and instruction text is deleted after the test cases are generated.
[0060] Furthermore, the test case generation software employs a layered architecture, specifically a three-tiered architecture consisting of a Graphical User Interface Layer (GUI), a business logic layer, and a data access layer. Figure 5 As shown, Figure 5This is a schematic diagram of the layered software architecture design of a DCS test case generation software provided in Embodiment 1 of this application. The architecture is clearly divided into three core layers from top to bottom: the GUI interaction layer, the business logic layer, and the data access layer. The topmost GUI interaction layer serves as the front-end interface for user interaction with the software, mainly responsible for the visual presentation of information and the reception of operation commands. It integrates a main interface module to provide the core operation view, a file management module for handling data table import, template loading, and result export, and a progress display module for real-time feedback on the background running status, thereby significantly reducing the user's operating threshold and improving the experience. The middle business logic layer is the core of the entire software. It receives instructions from the GUI layer and schedules underlying resources. It includes five key functional modules: a template engine for managing and parsing test case templates for various devices; a batch processing module for iterating through large amounts of device data; a character replacement module for automated generation, responsible for identifying and replacing specific characters and variable text in the template; an instruction execution module for driving the test process or calling relevant control interfaces; and a conflict detection module that automatically checks the content of each cell in the test case after it is generated to see if there are two lines of identical characters in one cell. If so, it records the conflict in the log without further processing. The lowest data access layer focuses on interaction with the storage medium. It mainly uses an Excel reader to obtain the original device data and configuration parameters from external Excel files and uses an Excel writer to output the generated DCS test cases to a file according to the required format.
[0061] like Figure 6 As shown, Figure 6 This is a schematic diagram of the user interface of a DCS test case generation software provided in Embodiment 1 of this application. The interface visualizes the software functions through an intuitive layout: at the top are drag / select areas for "template files" and "data files", corresponding to the input of test case templates and device structured data, respectively; the middle provides an export path setting to specify the storage location of the generated files; the bottom is equipped with an execution status display window for real-time feedback on the generation progress; users only need to complete the file import and path configuration, and click the "Generate Report" button in the center to trigger the template matching and character replacement logic in the background with one click, thereby transforming the complex automated generation process into a simple and easy-to-use graphical operation experience.
[0062] Specifically, the test case generation software functions by calling a test case template based on the device type, and filling the master data table and sub-data table information associated with the device into the test case template, ultimately generating a test case. In this application, the test case generation software is a direct test case generation tool. The test case generation software reads in the following data: a data table and a test case template. The data processing method is as follows: read a piece of data from the data table, call the corresponding test case template based on the device type of that piece of data, fill the data into the test case template, generate a test case, and repeat the process until test cases have been generated for every piece of data in the data table. The test cases are then placed in an Excel file and generated in a specified folder.
[0063] The test case generation software performs data matching as follows: first, it calls the corresponding test case template based on the device type of the selected data in the data table; then, it retrieves the specific data from the data table based on the text instructions in the test case template. For example, when the characters "device tag number" are detected, the aforementioned characters in the template are replaced with the specific data in the data table.
[0064] Figure 7 This is a flowchart illustrating the logical judgment of an instruction text provided in Embodiment 1 of this application, such as... Figure 7 As shown, it describes the judgment and processing mechanism when encountering instruction text during the test case generation process: First, the instruction text is located through "character recognition", and then the "condition judgment" stage is entered; if the judgment result is "NO", the "text replacement" operation is executed; if the judgment result is "YES", then one of the three processing methods of "delete content", "skip this step" or "replace content" will be further selected according to the specific scenario, so as to realize the automated processing of variable text and logical branches in the template.
[0065] In this embodiment, the steps of automatically generating device control test cases for the DCS system by matching each piece of data in the data table with the test case template, replacing variable text, and making conditional judgments based on the instruction text through test case generation software, further include: traversing each piece of data in the data table based on the test case generation software, so that each piece of data is matched with the corresponding test case template; and generating device control test cases for the DCS system that correspond one-to-one with each piece of data.
[0066] By automatically traversing each data entry in the data table using test case generation software and matching it one by one with the corresponding test case template for the device type, batch and fully automated generation of device control test cases for all devices in the DCS system is achieved. This ensures that each generated test case corresponds one-to-one with the corresponding device data, avoiding the inefficiency and errors of manual processing and ensuring that test cases cover all devices without omission.
[0067] Example 2
[0068] Corresponding to the aforementioned embodiments of the automatic generation method for DCS test cases, this application also provides embodiments of an automatic generation system for DCS test cases.
[0069] Figure 8 This is a schematic diagram of the modules of an automatic generation system for DCS test cases provided in Embodiment 2 of this application. The automatic generation system includes: a file acquisition module 1, a data structuring module 2, a template writing module 3, and a test case generation module 4. File acquisition module 1 is used to acquire the design files of the DCS system; the design files include at least the control logic diagram, screen design files, equipment interface specifications, and system description files. Data structuring module 2 is used to perform structuring processing on control logic diagrams and screen design files to form structured data tables. The data tables include a main data table and sub-data tables. The main data table is used to store the list information of devices in the DCS system, the interface information of each device, and the locking information of each device. The sub-data tables are used to store the configuration information of each device in the DCS system. Template writing module 3 is used to write test case templates according to the file format requirements of the DCS test execution tool, combined with the device interface specifications and system documentation; the test case templates include fixed text, variable text, and instruction text; Test case generation module 4 is used to match each piece of data in the data table with the test case template through the test case generation software, replace variable text, and perform condition judgments based on the instruction text to automatically generate equipment control test cases for the DCS system.
[0070] In this embodiment, the data structuring module specifically includes: a list information extraction submodule, an interface information extraction submodule, a configuration information extraction submodule, and a locking information extraction submodule; The list information extraction submodule is used to extract the list information of devices in the DCS system from the control logic diagram and fill the list information into the main data table; The interface information extraction submodule is used to extract the interface information of each device in the DCS system from the control logic diagram and fill the interface information into the master data table; the interface information is used to indicate whether the interface of each device in the DCS system exists. The configuration information extraction submodule is used to extract the configuration information of each device in the DCS system from the control logic diagram and fill the configuration information into the sub-data table; the configuration information is used to characterize the underlying control logic parameters and action rules of each device. The locking information extraction submodule is used to extract the locking information of each device in the DCS system from the screen design file and fill the locking information into the main data table to form a data table.
[0071] In this embodiment, the automatic generation system further includes: a device attribute determination module and a device type classification module; The equipment attribute determination module is used to determine the equipment attributes of each device in the DCS system based on the control logic diagram and screen design file. The equipment attributes include at least the control logic type, process function and control interface configuration characteristics of the device. The device type classification module is used to classify devices in the DCS system based on device attributes to obtain at least one device type.
[0072] In this embodiment, the template writing module specifically includes: a signal determination submodule, a test item determination submodule, and a template writing submodule; The signal determination submodule is used to determine the device input signals, device output signals and device alarm signals corresponding to each device type according to the device interface specifications. The test item determination submodule is used to determine the test items based on the system specification document; the test items shall at least cover one or more of the following: local / remote switching test, alarm test, manual control test, forced manual switching test, automatic command test, automatic load carrying test after power failure, emergency command test, and emergency command bypass test; The template writing submodule is used to write test case templates based on the file format requirements of the DCS test execution tool, the device input signals, device output signals, device alarm signals and test items corresponding to each device type; Each device type has at least one corresponding test case template.
[0073] In this embodiment, the test case generation module specifically includes: a software calling submodule, a data reading submodule, a template matching submodule, a text replacement submodule, a condition judgment submodule, and a test case generation submodule; The software call submodule is used to call the test case generation software; The data reading submodule is used to generate software that can read any data from a data table based on test cases; The template matching submodule is used to call test case templates for matching based on the device type corresponding to the data. The text replacement submodule is used to replace variable text in test case templates based on data. The condition judgment submodule is used to make conditional judgments based on the instruction text and data in the test case template to determine whether to retain, skip, or replace the text content in the test case template that corresponds to the instruction text. The test case generation submodule is used to generate device control test cases for the DCS system corresponding to the data.
[0074] In this embodiment, the template matching submodule is also used to traverse each piece of data in the data table based on the test case generation software, so that each piece of data is matched with the corresponding test case template; The test case generation submodule is also used to generate device control test cases for the DCS system that correspond one-to-one with each piece of data.
[0075] For the system embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this application according to actual needs.
[0076] Example 3
[0077] Figure 9 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of this application. The electronic device includes a memory, a processor, and a computer program stored in the memory and used to run on the processor. When the processor executes the computer program, it implements the automatic generation method of DCS test cases described in any of the above embodiments. Figure 9 The electronic device 90 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0078] like Figure 9 As shown, the electronic device 90 can be manifested as a general-purpose computing device, such as a server device. The components of the electronic device 90 may include, but are not limited to: at least one processor 91, at least one memory 92, and a bus 93 connecting different system components (including memory 92 and processor 91).
[0079] Bus 93 includes a data bus, an address bus, and a control bus.
[0080] The memory 92 may include volatile memory, such as random access memory (RAM) 921 and / or cache memory 922, and may further include read-only memory (ROM) 923.
[0081] The memory 92 may also include a program tool 925 (or utility) having a set (at least one) program module 924, such program module 924 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0082] The processor 91 executes various functional applications and data processing by running computer programs stored in the memory 92, such as the automatic generation method for DCS test cases provided in any of the above embodiments.
[0083] Electronic device 90 can also communicate with one or more external devices 94 (e.g., keyboard, pointing device, etc.). This communication can be performed through input / output (I / O) interface 95. Furthermore, electronic device 90 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public network, such as the Internet) via network adapter 96. As shown, network adapter 96 communicates with other modules of electronic device 90 via bus 93. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with electronic device 90, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems.
[0084] It should be noted that although several units / modules or sub-units / modules of the electronic device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided and embodied by multiple units / modules.
[0085] Example 4
[0086] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the automatic generation method for DCS test cases provided in any of the above embodiments.
[0087] The readable storage medium may be more specifically adopted, including but not limited to: portable disk, hard disk, random access memory, read-only memory, erasable programmable read-only memory, optical storage device, magnetic storage device, or any suitable combination thereof.
[0088] Example 5
[0089] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the automatic generation method for DCS test cases as described in any of the above claims.
[0090] The program code for executing the computer program product of this application can be written in any combination of one or more programming languages. The program code can be executed entirely on the user device, partially on the user device, as a standalone software package, partially on the user device and partially on a remote device, or entirely on a remote device.
[0091] While specific embodiments of this application have been described above, those skilled in the art should understand that these are merely illustrative examples, and the scope of protection of this application is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principles and essence of this application, but all such changes and modifications fall within the scope of protection of this application.
Claims
1. A method for automatically generating DCS test cases, characterized in that, The automatic generation method includes: Obtain the design documents of the DCS system; the design documents shall include at least the control logic diagram, screen design documents, device interface specifications, and system specification documents. The control logic diagram and the screen design file are structured to form a structured data table. The data table includes a main data table and sub-data tables. The main data table is used to store the list information of the devices in the DCS system, the interface information of each device, and the locking information of each device. The sub-data tables are used to store the configuration information of each device in the DCS system. Based on the file format requirements of the DCS test execution tool, and in conjunction with the device interface specifications and the system documentation, a test case template is prepared; the test case template includes fixed text, variable text, and instruction text. The test case generation software matches each data entry in the data table with the test case template, replaces the variable text, and performs conditional judgments based on the instruction text to automatically generate device control test cases for the DCS system.
2. The method for automatically generating DCS test cases as described in claim 1, characterized in that, The step of structuring the control logic diagram and the screen design file to form a structured data table includes: Extract the list information of the devices in the DCS system from the control logic diagram, and fill the list information into the master data table; The interface information of each device in the DCS system is extracted from the control logic diagram and filled into the master data table; the interface information is used to indicate whether an interface exists for each device in the DCS system. The configuration information of each device in the DCS system is extracted from the control logic diagram and filled into the sub-data table; the configuration information is used to characterize the underlying control logic parameters and action rules of each device. The locking information of each device in the DCS system is extracted from the screen design file, and the locking information is filled into the master data table to form the data table.
3. The method for automatically generating DCS test cases as described in claim 1, characterized in that, Before the step of writing test case templates according to the file format requirements of the DCS test execution tool, combined with the device interface specifications and the system documentation, the automatic generation method further includes: Based on the control logic diagram and the screen design file, the device attributes of each device in the DCS system are determined. The device attributes include at least the device's control logic type, process function, and control interface configuration characteristics. Based on the device attributes, the devices in the DCS system are classified into at least one device type.
4. The method for automatically generating DCS test cases as described in claim 3, characterized in that, The step of writing test case templates according to the file format requirements of the DCS test execution tool, combined with the device interface specifications and the system documentation, includes: For each device type, the device input signal, device output signal, and device alarm signal corresponding to each device type are determined according to the device interface specification; According to the system specification document, the test items are determined; the test items shall at least cover one or more of the following: local remote switching test, alarm test, manual control test, forced manual switching test, automatic command test, automatic load carrying test after power failure, emergency command test, and emergency command bypass test; Based on the file format requirements of the DCS test execution tool, the device input signals, device output signals, device alarm signals, and test items corresponding to each device type, the test case template is written. Each of the aforementioned device types corresponds to at least one of the aforementioned test case templates.
5. The method for automatically generating DCS test cases as described in claim 4, characterized in that, The steps of automatically generating device control test cases for the DCS system using test case generation software, which involves matching each data entry in the data table with the test case template, replacing the variable text, and performing conditional judgments based on the instruction text, include: Invoke the test case generation software; Based on the test cases, the software can read any one piece of data from the data table; The test case template is invoked for matching based on the device type corresponding to the data; Replace the variable text in the test case template based on the data; Based on the instruction text and the data in the test case template, a conditional judgment is made to determine whether to retain, skip, or replace the text content in the test case template corresponding to the instruction text. Generate the device control test cases for the DCS system corresponding to the data.
6. The method for automatically generating DCS test cases as described in claim 5, characterized in that, The step of automatically generating device control test cases for the DCS system by matching each data entry in the data table with the test case template using test case generation software, replacing the variable text, and performing conditional judgments based on the instruction text, further includes: Based on the test case generation software, each data item in the data table is traversed to match each data item with the corresponding test case template. Generate device control test cases for the DCS system that correspond one-to-one with each of the data entries.
7. An automatic test case generation system for DCS, characterized in that, The automatic generation system includes: a file acquisition module, a data structuring module, a template writing module, and a test case generation module; The file acquisition module is used to acquire the design files of the DCS system; the design files include at least a control logic diagram, a screen design file, a device interface specification, and a system description file. The data structuring module is used to perform structuring processing on the control logic diagram and the screen design file to form a structured data table. The data table includes a main data table and sub-data tables. The main data table is used to store the list information of the devices in the DCS system, the interface information of each device, and the locking information of each device. The sub-data tables are used to store the configuration information of each device in the DCS system. The template writing module is used to write test case templates according to the file format requirements of the DCS test execution tool, combined with the device interface specifications and the system specification documents; the test case templates include fixed text, variable text, and instruction text; The test case generation module is used to match each piece of data in the data table with the test case template using test case generation software, replace the variable text, and perform conditional judgments based on the instruction text to automatically generate device control test cases for the DCS system.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and for running on the processor, characterized in that, When the processor executes the computer program, it implements the automatic generation method for DCS test cases according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the automatic generation method for DCS test cases according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the method for automatically generating DCS test cases as described in any one of claims 1 to 6.