Source code testing method suitable for electric power information system and related device
By designing a source code testing method in the power information system, determining the test data requirements and defect types, and using automation technology to analyze the test results, identifying and locate potential security problems, it solves the problems of coarse granularity, cumbersome testing process and inaccurate data in the existing technology, and improves the robustness of the source code and the security of the system.
Patent Information
- Application Number
- CN202411656530.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-07
AI Technical Summary
In the power information system source code testing, the verification granularity is coarse, the testing process is cumbersome, and the test data is inaccurate, making it difficult to fully understand the changes in the source code under different parameter combinations, which affects code security and system stability.
A source code testing method suitable for power information systems is adopted. By determining the source code test data requirements and defect types, designing test plans, executing source code tests, analyzing test results using automated technology, generating visual test reports, identifying and locating potential security issues, and providing optimization suggestions.
By reducing the verification granularity, improving testing efficiency and coverage, ensuring the robustness and security of the source code of the power information system, reducing manual intervention, and improving analysis efficiency and accuracy.
Smart Images

Figure CN119576776A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electric power information technology, and in particular to a safety function verification method and related devices applicable to an electric power information system. Background Art
[0002] The power information system refers to the information system used for the management of electric energy production, transmission, distribution and consumption, which usually covers functions such as data collection, processing, monitoring, alarm and fault handling.
[0003] Source code testing is a way of testing source code. In layman's terms, testers use some professional tools to test the software source code to find potential problems. Source code testing can help software development teams find software defects, shorten debugging cycles, and improve software quality. It can be said to be a very important part of software development.
[0004] Automated testing is a process that converts human-driven testing behavior into machine-driven testing. Usually, after designing a test case and passing the review, the tester will perform the test step by step according to the procedures described in the test case to compare the actual results with the expected results. In this process, in order to save manpower, time or hardware resources and improve testing efficiency, the concept of automated testing was introduced.
[0005] With the increasing demand for power information systems, the complexity and scale of power information systems have also expanded. However, although traditional testing methods, such as unit testing, integration testing, and system testing, can guarantee software quality to a certain extent, their efficiency and accuracy still need to be improved when facing large-scale and highly complex power information systems. In addition, problems such as code cloning and malicious code in power information systems also pose a serious threat to the security and stability of the system. In order to deploy information systems to different environments (servers, cloud platforms, server operating systems, databases, middleware, business applications), it is necessary to test the source code of the information system. The source code is tested by using professional testing methods, and its business data and test data are analyzed to ensure that the program can run normally and meet the requirements. However, the existing source code testing technology has some limitations.
[0006] The prior art has the following technical problems: 1. The granularity of test verification is relatively coarse: When testing source code, only the results at the method level are focused on, without in-depth analysis or verification of the integrity of the smaller code level, and only a small number of parameters are focused on, while other parameters that may affect code security are ignored. This makes it impossible to fully understand the changes in the source code under different parameter combinations.
[0007] 2. The testing process is cumbersome: it involves multiple types of variables (integer, floating point, complex, string, Boolean, etc.) and multiple defect types (API misuse, code injection, configuration management, code quality, privacy management, dangerous functions, password management, exception handling, library vulnerabilities, resource management, cross-site scripting, input validation, memory management, pointer problems, data types, formatted strings, etc.), which need to be tested one by one or in pairs. This requires multiple tests under different conditions, as well as data collection and analysis, which increases the complexity and time-consuming nature of the testing process.
[0008] 3. Inaccurate test data: When conducting source code testing, there may be errors in data processing and analysis, such as data entry errors, calculation errors, improper selection of statistical methods, etc. These errors may lead to inaccurate data and affect the judgment and evaluation of code quality. Summary of the invention
[0009] The purpose of the present invention is to provide a source code testing method and related devices suitable for an electric power information system, which can effectively test and verify the robustness of the source code of the electric power information system.
[0010] In order to achieve the above object, the present invention adopts the following technical solution: In a first aspect, the present invention provides a source code testing method applicable to a power information system, comprising: Determine source code test data requirements and source code scan defect types based on power information system requirements; Design a test plan to obtain a source code test plan based on the determined source code test data requirements and source code scanning defect types; According to the designed source code test plan, perform source code testing and obtain test results; Use automated technology to analyze test results and obtain test reports; analyze the performance of preset key indicators in the test report under different load conditions to identify and locate potential safety issues; Generates test recommendations with visual representations of potential security issues that have been identified and located.
[0011] A further improvement of the present invention is that the source code test data is required to include integers, floating point numbers, complex numbers, character strings and Boolean values.
[0012] Further improvements of the present invention: the source code scanning defect types include API misuse, code injection, configuration management, code quality, privacy management, dangerous functions, password management, exception handling, library vulnerabilities, resource management, cross-site scripting, input validation, memory management, pointer problems, data types and formatted strings.
[0013] A further improvement of the present invention is as follows: in the step of designing a test plan to obtain a source code test plan based on the determined source code test data requirements and source code scanning defect types, the source code test plan includes test case design and test environment construction; the test case design includes test data requirements and source code scanning defect types; the test environment construction is specifically constructed on a cloud component, server, operating system or database; the test environment construction includes test object deployment and test tool instrument installation.
[0014] A further improvement of the present invention is that in the step of using automated technology to analyze the test results and obtain a test report, the report is in the form of a table or a chart.
[0015] A further improvement of the present invention is as follows: in the step of analyzing the performance of preset key indicators under different load conditions in the test report and identifying and locating potential security issues, the potential security issues include one or more of long response time, low throughput, and the number of concurrent users reaching a limit.
[0016] A further improvement of the present invention is that in the step of generating test suggestions for visual display for identifying and locating potential security issues, the test suggestions include one or more of adjusting system configuration, optimizing code, and increasing hardware resources.
[0017] In a second aspect, the present invention provides a source code testing device applicable to a power information system, comprising: The first test module is used to determine the source code test data requirements and source code scanning defect types according to the requirements of the power information system; The second testing module is used to design a testing plan to obtain a source code testing plan according to the determined source code testing data requirements and source code scanning defect types; The third test module is used to perform source code testing according to the designed source code testing scheme and obtain test results; The test report module is used to analyze the test results using automated technology to obtain test reports; analyze the performance of preset key indicators in the test report under different load conditions to identify and locate potential safety issues; The test suggestion module is used to generate visual test suggestions for potential security issues that have been identified and located.
[0018] In a third aspect, the present invention provides an electronic device, characterized in that it includes a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the source code testing method applicable to a power information system.
[0019] In a fourth aspect, the present invention provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, it implements the source code testing method applicable to the power information system.
[0020] Compared with the prior art, the present invention has the following beneficial effects: The present invention provides a source code testing method applicable to an electric power information system, comprising: determining source code test data requirements and source code scanning defect types according to the requirements of the electric power information system; designing a test plan to obtain a source code test plan according to the determined source code test data requirements and source code scanning defect types; executing source code testing according to the designed source code test plan to obtain test results; using automated technology to analyze the test results to obtain a test report; analyzing the performance of preset key indicators in the test report under different load conditions to identify and locate potential security issues; generating visually displayed test suggestions for the identified and located potential security issues. The present invention lists the test range combinations through an orthogonal arrangement method to ensure that all code paths and defect types are fully verified, reduce the verification granularity, improve test efficiency, and improve test coverage. The present invention improves the robustness and security of the source code of the electric power information system through comprehensive testing and optimization suggestions.
[0021] The present invention introduces automated technology to analyze test results, which can perform statistical analysis on test results, reduce the space for manual intervention, and improve analysis efficiency and accuracy. The present invention visualizes the analysis results in a way that is easy to understand and communicate, promoting understanding and discussion of improvement measures for safety issues. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings: Figure 1 A schematic diagram of a flow chart of a source code testing method applicable to a power information system of the present invention; Figure 2 A schematic diagram of the structure of a source code testing system applicable to a power information system according to the present invention; Figure 3 The figure is a schematic structural diagram of an electronic device of the present invention. DETAILED DESCRIPTION
[0023] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present invention can be combined with each other without conflict.
[0024] The following detailed description is an exemplary description, which is intended to provide further detailed description of the present invention. Unless otherwise specified, all technical terms used in the present invention have the same meaning as those generally understood by those skilled in the art to which the present invention belongs. The terms used in the present invention are only for describing specific embodiments, and are not intended to limit the exemplary embodiments according to the present invention.
[0025] The present invention provides a source code technology applicable to the power information system, aiming to solve the problems existing in the prior art, such as coarse verification granularity, cumbersome test process, inaccurate test data, etc. The technology can fully verify the source code of the power information system under different parameter combinations and different defect types, thereby ensuring the robustness of the source code of the power information system and the normal operation of the system.
[0026] The embodiment of the present invention provides a source code testing method applicable to a power information system, which specifically includes the following steps: Step 1: Identify the indicator.
[0027] Determine source code test data requirements and source code scanning defect types based on the requirements of the power information system.
[0028] In a specific implementation, source code test data is required to include integers, floating point numbers, complex numbers, strings, Boolean values, etc.
[0029] In a specific implementation, source code scanning defect types include API misuse, code injection, configuration management, code quality, privacy management, dangerous functions, password management, exception handling, library vulnerabilities, resource management, cross-site scripting, input validation, memory management, pointer issues, data types, formatted strings, etc.
[0030] Step 2: Design a plan.
[0031] Design a test plan based on the determined test requirements, list the test range combinations through orthogonal arrangement method, and use the smallest test set to ensure the maximum test coverage.
[0032] In a specific implementation, the test plan mainly includes the design of test cases, the construction of the test environment, etc., wherein the construction of the test environment needs to be carried out on different cloud components, domestic servers, operating systems, databases and other platforms, mainly including the deployment of test objects and the installation of test tools and instruments. The design of test cases includes source code test data requirements and source code scanning defect types.
[0033] Step 3: Perform verification.
[0034] Perform source code testing according to the designed source code testing plan, including comprehensive testing of the source code of the information system under test.
[0035] Step 4: Analyze the results.
[0036] Introducing automated technology to analyze test results can help identify potential security vulnerabilities, optimize system configuration, and provide decision support. Reports, logs, or other relevant data can be provided by the test tool. Organize and organize this data into a format that is easy to analyze, such as a table or chart. For each key indicator, analyze its performance under different load conditions. Compare the indicator values under different conditions, and identify and locate potential security issues based on the indicator performance. Possible problems include long response time, low throughput, and the number of concurrent users reaching the limit. Find the root cause of the problem by observing relevant data, logs, and reports.
[0037] Step 5: Improve optimization.
[0038] Provide corresponding test recommendations based on problem location. This may involve adjusting system configuration, optimizing code, increasing hardware resources, etc. Recommendations should be based on data analysis and a deep understanding of the system to improve the security capabilities of the system. Visualize the analysis results in a way that is easy to understand and communicate, such as using charts, graphs, or reports. This can more clearly show the trends and problems of system program operation and promote understanding and discussion of improvement measures for security issues. After implementing optimization measures, continuously monitor the performance of the system and compare it with previous test results. This helps to evaluate the effectiveness of improvement measures and further optimize the system.
[0039] See also Figure 1 As shown, the present invention provides a source code testing method applicable to a power information system, comprising: S1. Determine the source code test data requirements and source code scanning defect types according to the requirements of the power information system; In a specific implementation, the source code test data requirements include integers, floating point numbers, complex numbers, strings, and Boolean values.
[0040] In a specific implementation, the source code test data is required to include one or more of an integer, a floating point number, a complex number, a string, and a Boolean value.
[0041] In a specific embodiment, the source code scanning defect types include API misuse, code injection, configuration management, code quality, privacy management, dangerous functions, password management, exception handling, library vulnerabilities, resource management, cross-site scripting, input validation, memory management, pointer problems, data types and formatted strings.
[0042] In a specific embodiment, the source code scanning defect types include one or more of API misuse, code injection, configuration management, code quality, privacy management, dangerous functions, password management, exception handling, library vulnerabilities, resource management, cross-site scripting, input validation, memory management, pointer problems, data types and formatted strings.
[0043] S2. Design a test plan to obtain a source code test plan based on the determined source code test data requirements and source code scanning defect types.
[0044] In a specific implementation, the source code testing solution includes test case design and test environment construction; the test case design includes test data requirements and source code scanning defect types; the test environment construction is specifically built on a cloud component, server, operating system or database; the test environment construction includes test object deployment and test tool instrument installation.
[0045] S3. Execute source code testing according to the designed source code testing plan and obtain test results; S4. Use automated technology to analyze test results and obtain test reports; analyze the performance of preset key indicators in the test report under different load conditions to identify and locate potential safety issues.
[0046] In a specific implementation, automated technology analyzes test results to help identify potential security vulnerabilities, optimize system configuration, and provide decision support; reports are in the form of tables, charts, or other relevant data. For each key indicator, analyze its performance under different load conditions. Compare the indicator values under different conditions, and identify and locate potential security issues based on the indicator performance. Possible problems include long response time, low throughput, and the number of concurrent users reaching the limit. Find the root cause of the problem by observing relevant data, logs, and reports.
[0047] S5. Generate visual test recommendations for potential security issues identified and located.
[0048] In a specific implementation, the test suggestion includes one or more of adjusting system configuration, optimizing code, and increasing hardware resources.
[0049] The present invention provides a source code testing method applicable to an electric power information system, which can fully verify the source code security of the information system. Through the source code testing technology of the present invention, a reasonable source code testing scheme is designed to fully evaluate and verify the robustness of the source code of the electric power information system. The tediousness of the testing process is reduced, potential problems can be discovered, the security capability of the system can be improved, and the stability and reliability of the electric power information system can be improved.
[0050] The present invention can effectively solve the problem of testing the source code of the power information system. Through the source code testing technology of the present invention, the robustness of the source code of the power information system can be fully evaluated and verified, and the stability and reliability of the power information system can be improved. The technology has broad application prospects and can be used for the research and development and testing of various power information systems, and is expected to bring huge economic and social benefits to the power industry.
[0051] See also Figure 2 As shown, the present invention provides a source code testing device suitable for an electric power information system, comprising: The first test module is used to determine the source code test data requirements and source code scanning defect types according to the requirements of the power information system; The second testing module is used to design a testing plan to obtain a source code testing plan according to the determined source code testing data requirements and source code scanning defect types; The third test module is used to perform source code testing according to the designed source code testing scheme and obtain test results; The test report module is used to analyze the test results using automated technology to obtain test reports; analyze the performance of preset key indicators in the test report under different load conditions to identify and locate potential safety issues; The test suggestion module is used to generate visual test suggestions for potential security issues that have been identified and located.
[0052] See also Figure 3 As shown, an embodiment of the present invention provides an electronic device 100 for implementing a source code testing method applicable to an electric power information system; the electronic device 100 includes a memory 101, at least one processor 102, a computer program 103 stored in the memory 101 and executable on the at least one processor 102, and at least one communication bus 104.
[0053] The memory 101 can be used to store the computer program 103, and the processor 102 implements the steps of a source code testing method applicable to a power information system described in the embodiment by running or executing the computer program stored in the memory 101 and calling the data stored in the memory 101. The memory 101 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data (such as audio data) created according to the use of the electronic device 100, etc. In addition, the memory 101 can include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
[0054] The at least one processor 102 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor 102 may be a microprocessor or any conventional processor, etc. The processor 102 is the control center of the electronic device 100, and uses various interfaces and lines to connect various parts of the entire electronic device 100.
[0055] The memory 101 in the electronic device 100 stores a plurality of instructions to implement a source code testing method applicable to a power information system, and the processor 102 can execute the plurality of instructions to implement: Determine source code test data requirements and source code scan defect types based on power information system requirements; Design a test plan to obtain a source code test plan based on the determined source code test data requirements and source code scanning defect types; According to the designed source code test plan, perform source code testing and obtain test results; Use automated technology to analyze test results and obtain test reports; analyze the performance of preset key indicators in the test report under different load conditions to identify and locate potential safety issues; Generates test recommendations with visual representations of potential security issues that have been identified and located.
[0056] If the module / unit integrated in the electronic device 100 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory and read-only memory (ROM, Read-Only Memory).
[0057] 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.
[0058] 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.
[0059] 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.
[0060] 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.
[0061] 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 it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A source code testing method applicable to a power information system, characterized in that: include: Determine source code test data requirements and source code scan defect types based on power information system requirements; Design a test plan to obtain a source code test plan based on the determined source code test data requirements and source code scanning defect types; According to the designed source code test plan, perform source code testing and obtain test results; Use automated technology to analyze test results and obtain test reports; Analyze the performance of preset key indicators in the test report under different load conditions to identify and locate potential safety issues; Generates test recommendations with visual representations of potential security issues that have been identified and located.
2. A source code testing method applicable to a power information system according to claim 1, characterized in that: The source code test data requirements include integers, floating point numbers, complex numbers, strings, and Boolean values.
3. A source code testing method applicable to a power information system according to claim 1, characterized in that: The source code scanning defect types include API misuse, code injection, configuration management, code quality, privacy management, dangerous functions, password management, exception handling, library vulnerabilities, resource management, cross-site scripting, input validation, memory management, pointer issues, data types and formatted strings.
4. A source code testing method applicable to a power information system according to claim 1, characterized in that: In the step of designing a test plan to obtain a source code test plan based on the determined source code test data requirements and source code scanning defect types, the source code test plan includes test case design and test environment construction; the test case design includes test data requirements and source code scanning defect types; the test environment construction is specifically constructed on a cloud component, server, operating system or database; the test environment construction includes test object deployment and test tool instrument installation.
5. A source code testing method applicable to a power information system according to claim 1, characterized in that: In the step of using automated technology to analyze the test results and obtain a test report, the report is in the form of a table or a chart.
6. A source code testing method applicable to a power information system according to claim 1, characterized in that: In the step of analyzing the performance of preset key indicators under different load conditions in the test report and identifying and locating potential security issues, the potential security issues include one or more of long response time, low throughput, and the number of concurrent users reaching the limit.
7. A source code testing method applicable to a power information system according to claim 1, characterized in that: In the step of generating visually displayed test suggestions for identifying and locating potential security issues, the test suggestions include one or more of adjusting system configuration, optimizing code, and increasing hardware resources.
8. A source code testing device suitable for an electric power information system, characterized in that: include: The first test module is used to determine the source code test data requirements and source code scanning defect types according to the requirements of the power information system; The second testing module is used to design a testing plan to obtain a source code testing plan according to the determined source code testing data requirements and source code scanning defect types; The third test module is used to perform source code testing according to the designed source code testing scheme and obtain test results; Test report module, used to analyze test results using automated technology and obtain test reports; Analyze the performance of preset key indicators in the test report under different load conditions to identify and locate potential safety issues; The test suggestion module is used to generate visual test suggestions for potential security issues that have been identified and located.
9. An electronic device, characterized in that: It comprises a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement a source code testing method applicable to a power information system as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, a source code testing method applicable to a power information system as described in any one of claims 1 to 7 is implemented.