Automatic testing method of DCS trusted management platform client and related device

Through automated testing methods, python and dogtail packages are used to test the DCS trusted management platform, which solves the problems of heavy testing workload and slow speed in the existing technology, achieves fast and efficient testing, and significantly reduces testing costs.

CN118689776APending Publication Date: 2024-09-24XIAN THERMAL POWER RES INST CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410937779.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

The existing technology lacks a mature automated testing framework, resulting in a heavy workload and slow testing speed after version updates of the DCS trusted management platform, making it impossible to effectively reduce testing costs.

Method used

Adopt automated testing methods, preset test cases and test environments, use Python's third-party packages pytest and dogtail to locate and operate elements of the graphical user interface of the trusted management platform, compare the returned results with expected results, generate test reports, and implement Automated testing.

Benefits of technology

It significantly improves the test speed and quality, saves manual testing time, reduces testing costs, and can quickly and efficiently perform automated graphical user interface testing of the trusted security management platform client.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118689776A
    Figure CN118689776A
Patent Text Reader

Abstract

The invention discloses an automatic testing method of a DCS trusted management platform client and a related device. The method comprises the following steps: presetting a test case and a test environment; according to the test case, executing the test content, and performing element positioning and element content identification on a graphical user interface of the trusted management platform, so as to operate a client page; the identification element content of the client page return result is compared with an expected result of the test case, whether the test case passes or not is judged, and a test result is recorded; judging whether all the test cases are executed or not, if yes, outputting a test report, and if not, executing the test content according to a set sequence and a next test case until all the test cases are executed, and outputting the test report. According to the method, the test cost after each version update can be greatly reduced through automatic test.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of industrial automation, and in particular to an automated testing method and related devices for a DCS trusted management platform client. Background Art

[0002] The domestic trusted DCS (distributed control system) controller integrates trusted startup, static trusted verification, dynamic trusted verification, trusted whitelist, process protection, application access control and other functions. The trusted security management platform provides a GUI (graphical user interface) with a C / S (client / server) architecture, which is convenient for users to set and delete policies for trusted startup, static trusted verification, dynamic trusted verification, trusted whitelist, process protection, application access control and other functions in the DCS controller, obtain and display the trusted status of the DCS controller, and trust function audit. The trusted management platform can simply and conveniently configure and set relevant trusted policies for the DCS controller to protect the security of the DCS controller. The trusted management platform is a platform for unified visual management of trusted devices. The trusted management platform is developed using a C / S architecture. At present, there is no mature automated testing framework for desktop applications in the C / S architecture. It is impossible to locate the test object through page elements and other methods like the B / S (browser / server) architecture, and perform automated operations such as input and click on the test object. The trusted management platform needs to be tested after each version update and deployment. The management platform has many pages and elements, and the workload is relatively large. The speed of traditional manual testing will be relatively slow. Summary of the invention

[0003] The purpose of the present invention is to provide an automated testing method and related devices for a DCS trusted management platform client to overcome the defects of the prior art. The present invention can greatly reduce the testing cost after each version update through automated testing.

[0004] In order to achieve the above object, the present invention adopts the following technical scheme: The automated testing method of the DCS trusted management platform client includes the following steps: Preset test cases and test environment; Execute the test content according to the test cases and test environment, locate the elements of the graphical user interface of the trusted management platform, identify the element content, and operate the client page; Compare the identified element content of the client page return result with the expected result of the test case, determine whether the test case passes, and record the test result; Determine whether all test cases have been executed. If so, output the test report. If not, execute the test content according to the set order, according to the next test case and test environment, until all test cases have been executed and the test report is output.

[0005] Furthermore, the preset test case specifically includes: creating a test case in a third-party package pytest of python.

[0006] Furthermore, the test content includes: Function policy state changes, configuration and removal of function policies, and verification of files with and without function policies configured; The functional strategies include trusted startup, static trusted verification, dynamic trusted verification, trusted whitelist, process protection and application access control.

[0007] Furthermore, the element positioning of the graphical user interface of the trusted management platform is specifically as follows: Use the third-party Python package dogtail to locate elements in the graphical interface of the trusted management platform.

[0008] Furthermore, the operation on the client page specifically includes input, click and double-click.

[0009] Furthermore, the identification element content of the result returned by the client page is compared with the expected result of the test case, specifically: Use assert and assume in Python's third-party package pytest for assertion verification.

[0010] Furthermore, the test report is in XML or HTML format.

[0011] The automated testing system for the DCS trusted management platform client includes: Preset module: used to preset test cases and test environment; Test module: used to execute test content according to test cases and test environment, locate elements of the graphical user interface of the trusted management platform, identify element content, and operate the client page; Comparison and recording module: used to compare the identification element content of the client page return result with the expected result of the test case, determine whether the test case passes, and record the test result; Judgment and output module: used to judge whether all test cases have been executed. If so, the test report is output. If not, the test content is executed according to the set order, according to the next test case and test environment, until all test cases are executed and the test report is output.

[0012] Furthermore, the preset test case specifically includes: creating a test case in a third-party package pytest of python.

[0013] Furthermore, the test content includes: Function policy state changes, configuration and removal of function policies, and verification of files with and without function policies configured; The functional strategies include trusted startup, static trusted verification, dynamic trusted verification, trusted whitelist, process protection and application access control.

[0014] Furthermore, the element positioning of the graphical user interface of the trusted management platform is specifically as follows: Use the third-party Python package dogtail to locate elements in the graphical interface of the trusted management platform.

[0015] Furthermore, the operation on the client page specifically includes input, click and double-click.

[0016] Furthermore, the identification element content of the result returned by the client page is compared with the expected result of the test case, specifically: Use assert and assume in Python's third-party package pytest for assertion verification.

[0017] Furthermore, the test report is in XML or HTML format.

[0018] A computer device comprises 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 automated testing method of the DCS trusted management platform client when executing the computer program.

[0019] A computer storage medium stores a computer program, which, when executed by a processor, implements the steps of the automated testing method for a DCS trusted management platform client.

[0020] Compared with the prior art, the present invention has the following beneficial technical effects: The method of the present invention executes the test content according to the preset test case and test environment, and locates the elements of the graphical user interface of the trusted management platform, identifies the element content, and thus operates the client page; compares the identified element content of the result returned by the client page with the expected result of the test case, determines whether the test case passes, and records the test result, and repeats this cycle until all test cases are completed. The method can effectively improve the test speed and test quality, save manual testing time, facilitate developers to find the places that fail in the test at the first time, and effectively deal with the problems, which can significantly reduce the test cost.

[0021] Furthermore, the method of the present invention can quickly and efficiently use Python scripts to perform effective automated testing on the graphical user interface of the trusted security management platform client and output a test report.

[0022] The system of the present invention sets a preset module, a test module, a comparison and recording module, and a judgment and output module, executes the test content according to the preset test case and test environment, and locates the elements of the graphical user interface of the trusted management platform, identifies the element content, and thus operates the client page; compares the identified element content of the result returned by the client page with the expected result of the test case, determines whether the test case passes, and records the test result, and repeats this cycle until all test cases are completed, thereby realizing automated testing and greatly reducing the testing cost after each version update. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The drawings in the specification are used to provide further understanding of the present invention and constitute a part of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0024] Figure 1 This is a flow chart of the automated testing method for the DCS trusted management platform client of the present invention. DETAILED DESCRIPTION

[0025] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0026] 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.

[0027] 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.

[0028] Embodiment 1 The present invention provides an automated testing method for a DCS trusted management platform client, comprising the following steps: Preset test cases and test environment; Execute the test content according to the test cases and test environment, locate the elements of the graphical user interface of the trusted management platform, identify the element content, and operate the client page; Compare the identified element content of the client page return result with the expected result of the test case, determine whether the test case passes, and record the test result; Determine whether all test cases have been executed. If so, output the test report. If not, execute the test content according to the set order, according to the next test case and test environment, until all test cases have been executed and the test report is output.

[0029] The present invention can greatly reduce the testing cost after each version update through automated testing.

[0030] Embodiment 2 The present invention provides an automated testing method for a DCS trusted management platform client. Figure 1 , based on the third-party package dogtail+pytest in Python.

[0031] Preset test cases and test environment. Specifically, create test cases in pytest, set test case execution conditions, prepare test data, etc.; According to the test case and test environment, the test content is executed, and the elements of the graphical user interface of the trusted management platform are located through dogtail, and the element content is identified, so as to perform input, click, double-click and other operations on the client page; the test content includes: 1) Changes in the functional policy status of trusted startup, static trusted verification, dynamic trusted verification, trusted whitelist, process protection, application access control, etc.; 2) Configuration and deletion of functional policies such as trusted startup, static trusted verification, dynamic trusted verification, trusted whitelist, process protection, and application access control; 3) Verify files on the terminal that configure or do not configure functional policies such as trusted startup, static trusted verification, dynamic trusted verification, trusted whitelist, process protection, and application access control.

[0032] Use assert and assume in pytest to verify the content of the identification element of the result returned by the client page and the expected result of the test case, verify one or more assertions, determine whether the test case passes, and record the test results; Determine whether all test cases have been executed. If so, output the test report. If not, execute the test content in the set order, according to the next test case and test environment, until all test cases are executed and output the test report. Among them, pytest-ordering is used to implement the custom test case execution order, so that all test cases are automatically executed in the set order; pytest-html is used to generate test reports in XML or HTML format. Generating test reports in XML or HTML format is a common requirement in the automated testing process because they are easy to read, share and integrate into the continuous integration process. These test reports usually contain detailed test results, such as successful, failed, skipped test cases, and possible error messages and logs.

[0033] The method of this embodiment can effectively improve the test speed and test quality, save manual testing time, and facilitate developers to find the places that fail in the test at the first time and effectively deal with the problems, which can significantly reduce the testing cost. In addition, it can quickly and efficiently use Python scripts to effectively automate the graphical user interface of the trusted security management platform client and output test reports.

[0034] Embodiment 3 The present invention provides an automated testing system for a DCS trusted management platform client, comprising: Preset module: used to preset test cases and test environment; the preset test cases are: making test cases in the third-party package pytest of python; Test module: used to execute test content according to test cases, locate elements of the graphical user interface of the trusted management platform, identify element content, and operate the client page; the test content includes: status changes of functional policies, configuration and deletion of functional policies, and verification of files with and without configured functional policies; the functional policies include trusted startup, static trusted verification, dynamic trusted verification, trusted whitelist, process protection, and application access control.

[0035] The elements of the graphical user interface of the trusted management platform are located, specifically: the elements of the graphical user interface of the trusted management platform are located by using the third-party package dogtail of Python.

[0036] Operations are performed on the client page, including input, click, and double-click. Input can be: users search for required information by entering keywords or phrases; click can be: after the user clicks the button, the system will display relevant results and automatically fill them into the input box; double-click can be: after the user double-clicks the button, the system will start an interactive function, such as opening a window, copying text, etc.

[0037] Comparison and recording module: used to compare the identification element content of the client page return result with the expected result of the test case. Specifically, assert and assume in the third-party package pytest of Python are used for assertion verification to determine whether the test case passes and record the test results. Judgment and output module: used to judge whether all test cases have been executed. If so, the test report is output. If not, the test content is executed according to the set order and the next test case until all test cases are executed and the test report is output in XML or HTML format.

[0038] The system of the present invention sets a preset module, a test module, a comparison and recording module, and a judgment and output module, executes the test content according to the preset test case and test environment, and locates the elements of the graphical user interface of the trusted management platform, identifies the element content, and thus operates the client page; compares the identified element content of the result returned by the client page with the expected result of the test case, determines whether the test case passes, and records the test result, and repeats this cycle until all test cases are completed, thereby realizing automated testing and greatly reducing the testing cost after each version update.

[0039] Embodiment 4 The present invention provides a computer device, 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 automated testing method of the DCS trusted management platform client when executing the computer program.

[0040] Embodiment 5 The present invention provides a computer storage medium, wherein the computer storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the automated testing method of the DCS trusted management platform client are implemented.

[0041] It will be appreciated by those skilled in the art 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. Furthermore, 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 comprising 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 1A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0045] Finally, it should be noted that the above-listed embodiments exist only as one or more specific forms of expression of the technical solution of the present invention. Their purpose is to clearly explain the concept, principle and application of the present invention through specific examples, and it is by no means intended to limit the protection scope of the present invention to these specific embodiments. In fact, the real value of the present invention lies in the technical ideas and innovations it proposes, rather than its form of expression or means of implementation.

[0046] For ordinary technicians in the relevant technical field, after in-depth reading and understanding of the technical solution of the present invention, they are fully capable of making various forms of changes, modifications or equivalent substitutions to the specific implementation methods of the invention based on their own professional knowledge and skills. These changes may include but are not limited to: adjusting the value range of technical parameters, optimizing algorithm processes to improve efficiency, replacing some technical components to achieve better compatibility or reduce costs, etc. As long as these changed technical solutions still substantially maintain the technical features claimed for protection by the original invention, that is, they can still achieve the core functions and effects of the present invention, then these changes should be deemed to fall within the scope of protection of the pending claims of the present invention.

[0047] In addition, with the continuous progress and development of technology, new technical means and methods continue to emerge, which also provides broad space for further improvement and perfection of the present invention. Therefore, the protection scope of the present invention should also include those reasonably foreseeable improvements and extensions based on the existing technology. As long as these improvements and extensions do not deviate from the basic principles and core concepts of the present invention, they should be regarded as equivalents of the present invention and are also protected by patent rights.

Claims

1. The automated testing method for the DCS trusted management platform client is characterized in that: The following steps are involved: Preset test cases and test environment; Execute the test content according to the test cases and test environment, locate the elements of the graphical user interface of the trusted management platform, identify the element content, and operate the client page; Compare the identified element content of the client page return result with the expected result of the test case, determine whether the test case passes, and record the test result; Determine whether all test cases have been executed. If so, output the test report. If not, execute the test content according to the set order, according to the next test case and test environment, until all test cases have been executed and the test report is output.

2. The automated testing method for the DCS trusted management platform client according to claim 1, characterized in that: The preset test cases are specifically: creating test cases in the third-party package pytest of python.

3. The automated testing method for the DCS trusted management platform client according to claim 1, characterized in that: The test contents include: Function policy state changes, configuration and removal of function policies, and verification of files with and without function policies configured; The functional strategies include trusted startup, static trusted verification, dynamic trusted verification, trusted whitelist, process protection and application access control.

4. The automated testing method for the DCS trusted management platform client according to claim 1, characterized in that: The element positioning of the graphical user interface of the trusted management platform is specifically as follows: Use the third-party Python package dogtail to locate elements in the graphical interface of the trusted management platform.

5. The automated testing method for the DCS trusted management platform client according to claim 1, characterized in that: The operations on the client page specifically include input, click and double-click.

6. The automated testing method for the DCS trusted management platform client according to claim 1, characterized in that: The content of the identification element of the result returned by the client page is compared with the expected result of the test case, specifically: Use assert and assume in Python's third-party package pytest for assertion verification.

7. The automated testing method for the DCS trusted management platform client according to claim 1, characterized in that: The test report is in XML or HTML format.

8. The automated testing system for the DCS trusted management platform client is characterized by: include: Preset module: used to preset test cases and test environment; Test module: used to execute test content according to test cases and test environment, locate elements of the graphical user interface of the trusted management platform, identify element content, and operate the client page; Comparison and recording module: used to compare the identification element content of the client page return result with the expected result of the test case, determine whether the test case passes, and record the test result; Judgment and output module: used to judge whether all test cases have been executed. If so, the test report is output. If not, the test content is executed according to the set order, according to the next test case and test environment, until all test cases are executed and the test report is output.

9. A computer 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 automated testing method for the DCS trusted management platform client according to any one of claims 1 to 7 are implemented.

10. A computer storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the automated testing method for the DCS trusted management platform client according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Pressure test method for trusted DCS trusted management platform and related equipment

    CN119883930A