Python-based electronic disk automatic test system

Through the Python-based electronic disk automation testing system, the problems of manual operation are solved in traditional software testing are time-consuming and flexible, and an efficient and accurate test process is achieved, which simplifies operations and enhances the flexibility of the test system.

CN119166533APending Publication Date: 2024-12-20SICHUAN WEIXIN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Manual operation in traditional software testing processes is time-consuming and easy to cause human errors. Test efficiency and accuracy are difficult to guarantee, and the testing environment and platform are limited, and the flexibility is poor, making it difficult to cope with rapidly changing testing needs.

Method used

Design an automated test system for electronic disks based on Python, including test selection module, test execution module, storage module and exception processing module. Through Python's subprocess library and Win32 API, test tools are called to automatically test processes and monitor and handle exceptions.

Benefits of technology

It reduces labor costs, improves testing efficiency, enhances testing flexibility and accuracy, simplifies operational processes, and ensures the completeness and accuracy of testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166533A_ABST
    Figure CN119166533A_ABST
Patent Text Reader

Abstract

The invention discloses a Python-based electronic disk automatic test system, which comprises a test selection module, a test execution module, a storage module and an exception handling module, and is characterized in that the test selection module is used for selecting a test tool, an electronic disk and a disk symbol which need to be tested; the test execution module is used for acquiring a window handle and a key ID, and configuring corresponding parameters according to the acquired key ID; the storage module is used for storing screenshots and test log files; and the exception handling module is used for monitoring the running state of the system and discovering and handling exceptions. The system has the advantages that the electronic disk is comprehensively tested through the test selection module, the test execution module, the storage module and the exception handling module, the labor cost is reduced, the test efficiency is improved, meanwhile, the system is achieved based on Python, flexibility is high, extension and maintenance are easy, and the exception handling module can guarantee test integrity and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic disk testing, in particular to an electronic disk automatic testing system based on Python. Background Art

[0002] In the traditional software testing process, manual operations consume a lot of time. Not only is the testing speed slow, but it is also prone to human errors, making it difficult to ensure the efficiency and accuracy of software testing. At the same time, it is also limited by the testing environment and platform. The testing process is not flexible enough and difficult to cope with rapidly changing testing needs. Summary of the invention

[0003] The purpose of the present invention is to overcome the shortcomings of the prior art and provide an electronic disk automatic testing system based on Python.

[0004] The object of the present invention is achieved by the following technical scheme: an electronic disk automatic testing system based on Python, comprising a test selection module, a test execution module, a storage module and an exception handling module, The test selection module is used to select the test tool, electronic disk and disk symbol to be tested; The test execution module is used to obtain the window handle and key ID, and configure the corresponding parameters according to the obtained key ID; The storage module is used to save screenshots and test log files; The exception handling module is used to monitor the system operation status and detect and handle abnormal situations.

[0005] Preferably, the test steps of the test execution module are: S1: Load the test items selected by the user and the specified disk symbols, and initialize the logging module; S2: According to the test object selected by the user, the corresponding executable file in the root directory is called through the Python subprocess library to open the corresponding test tool; S3: Use Python's Win32 API to obtain the handle of the open test tool window and the key IDs of each control; S4: Configure corresponding parameters according to the acquired button ID; S5: Start the test and wait for the test to end and record the test results and screenshots.

[0006] Preferably, the log recording module is used to record detailed information during the test, including the start time, end time and test results.

[0007] Preferably, before obtaining the window handle, the exception handling module detects whether the window is open, and the steps are as follows: A1: Check the existence of the window periodically through loop detection. If the window cannot be detected, an error log is recorded, indicating that the window opening failed. A2: The system notifies the user that the window is not open, and the user opens the window manually.

[0008] Preferably, when the window handle acquisition fails, the exception handling module processes the following steps: B1: Record the error log of failure in obtaining window handle; B2: The system retries to obtain the window handle; B3: If the window handle acquisition fails for multiple consecutive times, the system exits the current operation and prompts the user to manually intervene or restart the test.

[0009] Preferably, in step B1, the error log includes time, software name and number of attempts.

[0010] Preferably, in step B2, the system retries three times, with an interval of 1 second between each retries.

[0011] The present invention has the following advantages: the present invention performs a comprehensive test on the electronic disk through a test selection module, a test execution module, a storage module and an exception handling module, thereby reducing labor costs and improving test efficiency. At the same time, it is implemented based on Python, has strong flexibility, is easy to expand and maintain, and the exception handling module can ensure test integrity and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 It is a structural diagram of the test system structure; Figure 2 It is a structural diagram of the system testing process; In the figure, 1-test selection module, 2-test execution module, 3-storage module, 4-exception handling module. DETAILED DESCRIPTION

[0013] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions 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 part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0014] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0015] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

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

[0017] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, or the positions or positional relationships in which the product of the invention is usually placed when in use, or the positions or positional relationships commonly understood by those skilled in the art, which are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.

[0018] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0019] In this embodiment, if Figure 1 and Figure 2 As shown, the electronic disk automatic testing system based on Python includes a test selection module 1, a test execution module 2, a storage module 3 and an exception handling module 4. The test selection module 1 is used to select the test tool, electronic disk and disk symbol to be tested; The test execution module 2 is used to obtain the window handle and the key ID, and configure the corresponding parameters according to the obtained key ID; Storage module 3 is used to save screenshots and test log files; The exception handling module 4 is used to monitor the system operation status, discover and handle abnormal situations. Through the test selection module 1, the test execution module 2, the storage module 3 and the exception handling module 4, the electronic disk is fully tested, which reduces the labor cost and improves the test efficiency. At the same time, it is based on Python implementation, which is flexible, easy to expand and maintain, and the exception handling module 4 can ensure the integrity and accuracy of the test. In this embodiment, the test tools include AS SSD Benchmark, BurnInTest, DiskInfo, DiskMark, H2testw and IOmeter.

[0020] Furthermore, the test steps of the test execution module 2 are: S1: Load the test items selected by the user and the specified disk symbols, and initialize the log recording module; further, the log recording module is used to record detailed information during the test, including the start time, end time and test results.

[0021] S2: According to the test object selected by the user, the corresponding executable file in the root directory is called through the Python subprocess library to open the corresponding test tool; S3: Use Python's Win32 API to obtain the handle of the open test tool window and the key IDs of each control; S4: Configure corresponding parameters according to the acquired button ID; S5: Start the test and wait for the test to end to record the test results and screenshots. Specifically, users only need to run a packaged executable file to use all test tools without having to install and configure each test software separately, which greatly simplifies the operation process. Use Python's Win32 API to obtain the handle of the open test tool window and the key ID of each control. The handle can be used to obtain relevant information of the window, including title, class name, position and size; the key ID can be used for subsequent parameter configuration, such as setting the test mode, selecting the disk and adjusting the test parameters.

[0022] In this embodiment, before obtaining the window handle, the exception handling module 4 detects whether the window is open, and the steps are as follows: A1: Check the existence of the window periodically through loop detection. If the window cannot be detected, an error log is recorded, indicating that the window opening failed. A2: The system notifies the user that the window is not open, and the user manually opens the window. Specifically, the system checks whether the window exists every 100 milliseconds. If the window cannot be detected within 5 seconds, the window opening is considered to have failed, and an error log is recorded.

[0023] Furthermore, when the window handle acquisition fails, the exception handling module 4 performs the following processing steps: B1: Record an error log of failure to obtain a window handle; preferably, the error log includes information on time, software name, and number of attempts.

[0024] B2: The system retries to obtain the window handle; specifically, the system retries three times with an interval of 1 second between each retries.

[0025] B3: If the window handle fails to be obtained multiple times in a row, the system exits the current operation and prompts the user to manually intervene or restart the test. Specifically, during the exception handling process, the system records all exception information in detail, including time, exception type, and attempted operation. When the system detects an exception that cannot be automatically handled, it will provide detailed error information and recommended operation steps to the user through pop-up windows or emails.

[0026] Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments, or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. Python-based electronic disk automatic testing system, characterized by: It includes a test selection module (1), a test execution module (2), a storage module (3) and an exception handling module (4), The test selection module (1) is used to select the test tool, electronic disk and disk symbol to be tested; The test execution module (2) is used to obtain the window handle and the key ID, and configure corresponding parameters according to the obtained key ID; The storage module (3) is used to store screenshots and test log files; The exception handling module (4) is used to monitor the system operation status and detect and handle abnormal situations.

2. The Python-based electronic disk automatic testing system according to claim 1, characterized in that: The test steps of the test execution module (2) are: S1: Load the test items selected by the user and the specified disk symbols, and initialize the logging module; S2: According to the test object selected by the user, the corresponding executable file in the root directory is called through the Python subprocess library to open the corresponding test tool; S3: Use Python's Win32 API to obtain the handle of the open test tool window and the key IDs of each control; S4: Configure corresponding parameters according to the acquired button ID; S5: Start the test and wait for the test to end and record the test results and screenshots.

3. The Python-based electronic disk automatic testing system according to claim 2, characterized in that: The log recording module is used to record detailed information during the test, including the start time, end time and test results.

4. The Python-based electronic disk automatic testing system according to claim 3 is characterized in that: Before obtaining the window handle, the exception handling module (4) detects whether the window is open, and the steps are as follows: A1: Check the existence of the window periodically through loop detection. If the window cannot be detected, an error log is recorded, indicating that the window opening failed. A2: The system notifies the user that the window is not open, and the user opens the window manually.

5. The Python-based electronic disk automatic testing system according to claim 4, characterized in that: When the window handle acquisition fails, the exception handling module (4) performs the following processing steps: B1: Record the error log of failure in obtaining window handle; B2: The system retries to obtain the window handle; B3: If the window handle acquisition fails for multiple consecutive times, the system exits the current operation and prompts the user to manually intervene or restart the test.

6. The Python-based electronic disk automatic testing system according to claim 5, characterized in that: In step B1, the error log includes time, software name and number of attempts.

7. The Python-based electronic disk automatic testing system according to claim 6, characterized in that: In step B2, the system retries three times, with an interval of 1 second between each retries.