Trusted DCS controller trusted function regression test method and related equipment
By binding the code relationship between test cases and trusted functions in the test case management system, and automatically generating a regression test case set using the code change extraction tool, the problem of the regression test of trusted DCS controllers is easily encountered, and more efficient test coverage and resource management are achieved.
Patent Information
- Application Number
- CN202510110975.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-04-08
AI Technical Summary
The prior art regression testing of trusted DCS controllers is prone to the risk of less detection and leakage, resulting in wasting test resources, delayed project time and over-planned costs.
A trusted DCS controller trusted function regression testing method is adopted. The test case management system binds the code relationship between test cases and trusted functions, and uses the code change extraction tool to automatically extract the method name of the code change, generate and push the corresponding regression test case set to ensure comprehensive test coverage.
It effectively solves the risk of less leak detection during regression testing, reduces the waste of test resources, and reduces project time and cost.
Smart Images

Figure CN119782188A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of testing methods, and in particular relates to a trusted function regression testing method for a trusted DCS controller and related equipment. Background Art
[0002] DCS controllers are widely used in industrial production, manufacturing and processing, including chemical, pharmaceutical, food, pulp and paper industries, etc. They play an important role in monitoring and controlling the production process, process optimization, safety and reliability.
[0003] The trusted DCS controller integrates trusted startup, static trusted verification, dynamic trusted verification, trusted whitelist, process protection, application access control and other functions to protect the security of the trusted DCS controller system.
[0004] Since the trusted DCS controller integrates the above functions, every time the R&D engineer fixes individual bugs, the test engineer needs to do regression testing. At this time, the regression test scope of the test engineer depends particularly on his personal experience and on-the-spot performance. If the estimated scope is smaller than the required test scope, it will lead to risks such as under-testing and missed testing. If the estimated scope is larger than the required test scope, it will cause a waste of test resources, prolong the project time, and generate over-plan costs. Summary of the invention
[0005] The object of the present invention is to provide a trusted function regression test method, system, device and storage medium for a trusted DCS controller, so as to solve the technical problem that the prior art regression test of a trusted DCS controller is prone to under-testing and missed-testing.
[0006] In order to achieve the above object, the present invention adopts the following technical scheme: A trusted function regression test method for a trusted DCS controller comprises the following steps: Generate and execute regression test case sets in the test case management system based on the trusted functional modules of regression testing; Determine whether the regression test case set has been executed, if not, continue to execute; if so, generate a regression test report; The step of generating a regression test case set in a test case management system based on a trusted function module of regression testing includes: Deploy trusted functional modules for regression testing; Extract the method names of code changes in the trusted functional modules for regression testing; Determine the regression test cases corresponding to all the changed method names in the test case management system, wherein the test case management system records a plurality of regression test cases and the method names corresponding to the plurality of regression test cases respectively; Based on the regression test cases corresponding to the method names of all code changes, a regression test case set is generated in the test case management system.
[0007] Furthermore, the trusted functional module of the regression test is deployed on a trusted DCS controller.
[0008] Furthermore, the method names changed in the trusted function module of the regression test are extracted using a code change extraction tool.
[0009] Furthermore, the changed method name is obtained by extracting the trusted function source code of the trusted function module of the regression test through a code extraction tool.
[0010] Furthermore, the functions of the code change extraction tool include: Parse the code change document and extract the method name of the code change; Automatically access the database of the test case management system, and obtain the regression test case number containing the changed method name according to the method name of the code change; According to the regression test case numbers, all regression test cases that need to be regression tested are found from the test case management system, and a regression test case set is automatically generated in the test case management system.
[0011] Furthermore, according to the regression test case number, all regression test cases that need to be regression tested are found from the test case management system, and after the regression test case set is automatically generated in the test case management system, it also includes: pushing the regression test case set to the device corresponding to the test engineer.
[0012] Furthermore, based on the trusted functional module of regression testing, the process of executing the regression test case set includes: Accept and process the tested function instructions of the regression test case, and execute the regression test case in the test case management system.
[0013] In a second aspect, the present invention provides a trusted function regression test system for a trusted DCS controller, comprising a generation execution module and a judgment module, wherein: Generate execution module: Generate and execute regression test case set in the test case management system based on the trusted function module of regression test; Judgment module: used to judge whether the regression test case set has been executed. If not, continue to execute; if so, generate a regression test report; The steps of generating a regression test case set in the test case management system for the trusted function module based on regression testing are as follows: Deploy trusted functional modules for regression testing; Extract the changed method names in the trusted function modules for regression testing; Determine the regression test cases corresponding to all the changed method names in the test case management system, wherein the test case management system records a plurality of regression test cases and the method names corresponding to the plurality of regression test cases respectively; Based on the regression test cases corresponding to the method names of all code changes, a regression test case set is generated in the test case management system.
[0014] According to a third aspect, a terminal device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0015] In a fourth aspect, a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0016] Compared with the prior art, the present invention has the following beneficial technical effects: The present invention provides a trusted function regression test method for a trusted DCS controller. The test case management system is used to bind the code relationship between the test case and the trusted function. Whenever the trusted function has a code change, the test case system will automatically push the regression test method of the test case that needs to be regressed. The method is that when the test engineer executes the test case, the trusted function code line or method name corresponding to the test case is collected, and the code line or method name corresponding to the test case is entered into the test case management system. Whenever the R&D engineer modifies the corresponding code or method, the changed code line or method name is extracted using the corresponding tool. The test case management system automatically pushes the test case that needs regression testing to the test engineer according to the code line or method name. After executing the pushed test case, a regression test report is output; the risk of under-testing and under-testing in the regression test of the test engineer is solved, the test resources are reduced, and the project time is reduced.
[0017] Preferably, squish coco is used to monitor the trusted function module, which can provide a detailed code coverage report and advanced analysis capabilities. Through squish coco, the trusted function code lines or method names corresponding to the test cases can be collected.
[0018] Preferably, the regression test case set is generated based on a code change extraction tool, which can parse the code change document, extract the changed file name and method name, form a mapping relationship, and generate a case set that needs to be regression tested in the test case management system. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1This is a flow chart of a trusted function regression test method for a trusted DCS controller in an embodiment of the present invention; Figure 2 A process diagram for generating a regression test case set in an embodiment of the present invention; Figure 3 It is a schematic diagram of a complete trusted function testing method in an embodiment of the present invention. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0021] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0023] The DCS controller is a key device in the DCS system responsible for data processing and control command generation. It receives real-time data from field sensors and other equipment, performs calculations and judgments based on preset control strategies, and then generates corresponding control instructions, which are sent to the actuators through the communication network to achieve automated control of industrial processes.
[0024] Trusted DCS controllers not only have the control, monitoring and data processing functions of traditional DCS controllers, but also place special emphasis on the security and trustworthiness of the system. Through a series of security mechanisms and strategies, it ensures that the control system can operate stably in the face of various potential threats and prevents security issues such as data leakage, tampering and illegal access.
[0025] Squish coco is a code coverage analysis tool that provides a complete code coverage solution for multiple programming languages and platforms, and can provide detailed code coverage reports and advanced analysis capabilities.
[0026] Code change tools are an integral part of the software development process, helping developers to efficiently manage and execute changes in the code.
[0027] The present invention is further described in detail below in conjunction with the accompanying drawings: like Figure 1 As shown, a trusted function regression test method for a trusted DCS controller includes the following steps: Step 1: Generate and execute a regression test case set in a test case management system based on the trusted functional module of the regression test; Among them, the trusted function module of regression test and the trusted function module are deployed on the trusted DCS controller.
[0028] like Figure 2 As shown in the figure, the regression test case set is generated based on the trusted functional module of the regression test. The specific generation steps are: Deploy trusted functional modules for regression testing; Extract the changed method names in the trusted function modules for regression testing; Determine the regression test cases corresponding to all changed method names in the test case management system; All regression test cases generate regression test case sets in the test case management system.
[0029] In the above steps, the generation of regression test case sets depends on the code change extraction tool. The more detailed steps are: Use code extraction tools to extract method name information of trusted function source code in trusted function modules of regression testing; According to the code change document, obtain the changed code line information and method name information; According to the code line or method name, find the related test cases from the test case management system and generate a regression test set.
[0030] After the regression test case set is generated, the regression test case set in the test case management system can be directly called for subsequent regression testing.
[0031] a) Parse the code change document and extract the changed file name and method name; b) automatically accessing the database of the test case management system, using the method name determined in step 3a), obtaining the test case containing the method name; c) The code change tool finds the target regression test case set that needs regression testing this time from the test case management system based on the method name obtained in step 3b), automatically generates the test case set that needs regression testing in the test case management system, and pushes the test case set that needs regression testing this time to the test engineer.
[0032] Step 2: Determine whether the regression test case set has been executed. If not, continue to execute; if so, generate a regression test report.
[0033] Specifically, the process of executing the regression test case set in the test case management system is as follows: Generate regression test case sets in the test case management system using code change extraction tools; Accept and process the tested functional instructions of regression test cases, and execute regression test cases in the test case management system.
[0034] The criterion for judging whether the regression test case set has been executed is whether all the regression test cases in the regression test case set have been executed.
[0035] In another embodiment of the present invention, a complete trusted function testing method is provided, such as Figure 3 As shown: Step 1: Deploy a trusted function module on the DCS controller; Step 2: Write test cases for the controller's trusted functions according to the requirements document and trusted function manual document; Step 3: Use squish coco to monitor the trusted function module on the DCS controller, which then becomes the transformed trusted function module. The transformed function module provides the following functions: a) Receive and process the test requests in the test cases; b) squish coco will color the method names of trusted function modules according to the executed test requests; "Coloring" the method names of "trusted function modules" can be understood as squish coco being able to track and record whether these specific methods are called and executed during the test execution. The results of this tracking are usually presented in some form, such as generating a code coverage report, which will clearly indicate which methods are executed (i.e. "colored") and which methods are not executed (i.e. "uncolored").
[0036] It should be noted that this "coloring" does not directly modify or mark the method name, but is achieved through code coverage analysis technology. In actual operation, developers or testers can view the code coverage report to understand the effectiveness of the test, including which methods of trusted functional modules have been fully tested and which ones need further test cases to cover.
[0037] Step 4: The test engineer executes the test case in step 2 on the modified functional module. When executing the test case, squish coco will color the methods of the trusted functional module according to the executed test instructions, thereby collecting the colored method names corresponding to this test case; Step 5: The test engineer enters the method name corresponding to the test case into the test case management system; Step 6: When the R&D engineer submits a new trusted function installation package to add new functions or modify defects, the test engineer deploys squish coco and the new installation package of the trusted function module that needs regression testing on the DCS controller device, which is called the trusted function module for regression testing. The trusted function module for regression testing is deployed on the DCS controller; Step 7: According to the code change document provided by R&D, use the code change tool to extract the changed method names in the new trusted function installation package. The code change tool has the following functions: a) Parse the code change document and extract the changed file name and method name; b) automatically access the database of the test case management system, and use the method name determined in step 3a) to obtain the test case containing the method name; c) The code change tool finds the target regression test case set that needs regression testing this time from the test case management system based on the method name obtained in step 3b), automatically generates the test case set that needs regression testing in the test case management system, and pushes the test case set that needs regression testing this time to the test engineer; Step 8: The test engineer executes the regression test case set pushed in step 7 c) on the trusted function module of the regression test in step 6; Step 9: After executing all pushed regression test case sets, generate a regression test report.
[0038] In another embodiment of the present invention, a complete trusted function testing method is provided, which specifically includes the following steps: Step 1: Squish Coco colors the methods in the trusted function module according to the executed test instructions, collects the colored method names corresponding to the test cases, enters the method names corresponding to the test cases into the test case management system, and obtains the test case set; Use squish coco to monitor the trusted function module on the DCS controller. In the field of software communication, monitoring refers to the process of receiving, analyzing and processing the signals, data or information in the communication process in real time or non-real time through specific technical means or equipment. This process mainly relies on technical means such as network monitoring, signal interception, and data capture to achieve monitoring and control of communication content.
[0039] The general steps for code coverage analysis using Squish coco are as follows: Install Squish coco: Configure project: Configure Squish coco in the test project, including specifying the source code path, setting compiler options, etc. Build the project: Use Squish coco's CoverageScanner tool to build the project and generate the detected executable file or library; Run test: execute the test script or test set, Squish coco will track and record the code execution; Analyze reports: Use the CoverageBrowser tool to analyze the generated coverage report, find untested code sections, and optimize them if needed.
[0040] Step 2: Use a code change tool to collect method names corresponding to regression test cases, and enter the method names corresponding to the regression test cases into a test case management system to obtain a regression test case set; Step 3: The test engineer issues a command to view and execute the test case, outputs the test report, and after the test case is executed, starts to execute the regression test case command. The test case management system pushes the test case that needs regression testing to the test engineer. After the pushed regression test case is executed, the regression test report is output, and then the complete test report is output. (The complete test report includes the test report and the regression test report) The present invention also provides a trusted function regression test system for a trusted DCS controller, comprising a setting module, an execution module and a judgment module, wherein: Setting module: used to deploy trusted functional modules for regression testing; Execution module: Based on the trusted functional module of regression testing, it generates and executes regression test case sets in the test case management system; Judgment module: used to determine whether the regression test case set has been executed. If not, continue to execute; if so, generate a regression test report.
[0041] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0042] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0043] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0044] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0045] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit its protection scope. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the field should understand that after reading the present invention, those skilled in the art can still make various changes, modifications or equivalent substitutions to the specific implementation methods of the invention, but these changes, modifications or equivalent substitutions are all within the protection scope of the pending claims of the invention.
Claims
1. A trusted function regression test method for a trusted DCS controller, characterized in that: The following steps are involved: Generate and execute regression test case sets in the test case management system based on the trusted functional modules of regression testing; Determine whether the regression test case set has been executed, and if not, continue to execute; If yes, generate a regression test report; The step of generating a regression test case set in a test case management system based on a trusted function module of regression testing includes: Deploy trusted functional modules for regression testing; Extract the method names of code changes in the trusted functional modules for regression testing; Determine the regression test cases corresponding to all the changed method names in the test case management system, wherein the test case management system records a plurality of regression test cases and the method names corresponding to the plurality of regression test cases respectively; Based on the regression test cases corresponding to the method names of all code changes, a regression test case set is generated in the test case management system.
2. A trusted function regression testing method for a trusted DCS controller according to claim 1, characterized in that: The trusted function module of the regression test is deployed on a trusted DCS controller.
3. A trusted function regression testing method for a trusted DCS controller according to claim 1, characterized in that: The method names changed in the trusted function module of the regression test are extracted using a code change extraction tool.
4. A trusted function regression testing method for a trusted DCS controller according to claim 3, characterized in that: The changed method name is obtained from the source code of the trusted function module of the regression test through a code extraction tool.
5. A trusted function regression testing method for a trusted DCS controller according to claim 3, characterized in that: The functions of the code change extraction tool include: Parse the code change document and extract the method name of the code change; Automatically access the database of the test case management system, and obtain the regression test case number containing the changed method name according to the method name of the code change; According to the regression test case numbers, all regression test cases that need to be regression tested are found from the test case management system, and a regression test case set is automatically generated in the test case management system.
6. A trusted function regression testing method for a trusted DCS controller according to claim 5, characterized in that: According to the regression test case number, after finding all regression test cases that need to be regression tested from the test case management system and automatically generating a regression test case set in the test case management system, it also includes: pushing the regression test case set to the device corresponding to the test engineer.
7. A trusted function regression testing method for a trusted DCS controller according to claim 1, characterized in that: Based on the trusted functional module of regression testing, the process of executing the regression test case set includes: Accept and process the tested function instructions of the regression test case, and execute the regression test case in the test case management system.
8. A trusted function regression test system for a trusted DCS controller, characterized in that: It includes a generation execution module and a judgment module, wherein: Generate execution module: Generate and execute regression test case set in the test case management system based on the trusted function module of regression test; Judgment module: used to judge whether the regression test case set has been executed. If not, continue to execute; if so, generate a regression test report; The steps of generating a regression test case set in the test case management system for the trusted function module based on regression testing are as follows: Deploy trusted functional modules for regression testing; Extract the changed method names in the trusted function modules for regression testing; Determine the regression test cases corresponding to all the changed method names in the test case management system, wherein the test case management system records a plurality of regression test cases and the method names corresponding to the plurality of regression test cases respectively; Based on the regression test cases corresponding to the method names of all code changes, a regression test case set is generated in the test case management system.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and system of regression testing
CN103176895A
Regression test method and device for test case
CN110781077A
Trusted DCS controller trusted function test method, electronic equipment and storage medium
CN117970907A
Method for Performing a Regression Test after Modifying Source Code File
GB2508643A