Test method for generating test script and supporting modification based on section

Through request interception analysis and personalized modification to generate test scripts, the problem of insufficient flexibility of existing automation testing tools is solved, and efficient and accurate automated testing is achieved.

CN120429232APending Publication Date: 2025-08-05BEIYIN FINANCIAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510516203.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-23
Publication Date
2025-08-05

AI Technical Summary

Technical Problem

Existing automated testing tools and methods have shortcomings in flexibility and adaptability, especially when facing complex and changing application scenarios, manual writing test scripts is inefficient and error-prone, and the scripts generated by the recording tool are poor in flexibility and maintainability, making it difficult to adapt to changes in software requirements.

Method used

Through request interception analysis, test scripts are generated and personalized, including landing analysis of requests and responses, first draft of test scripts is generated, and automated testing is achieved by manually defining and modifying parameter fields.

Benefits of technology

Improve testing efficiency, reduce human errors, ensure the accuracy and flexibility of test scripts, adapt to different test needs and scenarios, and improve the test quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120429232A_ABST
    Figure CN120429232A_ABST
Patent Text Reader

Abstract

The invention discloses a test method for generating a test script and supporting modification based on a section, and the test method comprises the steps: carrying out the interception analysis of a request, and obtaining the request and the corresponding ground; performing script generation and personalized modification based on the request and the corresponding floor to obtain a modified script; and performing automatic testing based on the modified script. The test efficiency is improved; and human errors are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software automated testing, and in particular to a testing method for generating and modifying test scripts based on aspects. Background Art

[0002] In modern software development, automated testing has become a crucial tool for ensuring software quality. Traditional testing methods often rely on manually writing test scripts, which is not only time-consuming and labor-intensive but also prone to errors. As software development agility and iteration speed continue to increase, the need for automated testing is becoming increasingly urgent. However, existing automated testing tools and methods still lack flexibility and adaptability, especially when dealing with complex and ever-changing application scenarios.

[0003] The solutions of the prior art include:

[0004] 2.1 Manual Scripting Strategy

[0005] Manually writing test scripts is a fundamental task in software testing. Testers require a thorough understanding of the software's requirements documentation, including both functional and non-functional requirements. Based on these requirements, they design detailed test cases, clearly defining the test objectives, input data, execution steps, and expected results. Based on the test requirements, they select appropriate testing tools and frameworks, and write test scripts using appropriate tools and languages (such as Python, Java, and JavaScript). During the writing process, test case execution is automated, and parameterization techniques are introduced to enhance the versatility and reusability of the scripts.

[0006] Debug test scripts in the development environment to ensure they execute correctly and produce expected results. Manage verified test scripts in a version control system. Execute tests according to the planned test plan and collect test results, including successful and failed test cases and related log information.

[0007] Based on the test results and defect repair status, continuously optimize test cases and scripts to improve test efficiency and quality.

[0008] 2.2 Script recording modification strategy

[0009] When writing test scripts, software testers often use script recording tools to streamline the process. These tools automatically record user actions within an application and generate corresponding test scripts. Testers execute the expected workflow within the application. The recording tool captures every step, including button clicks, text inputs, and drop-down menu selections. It also records application responses and state changes to ensure the test script accurately simulates user behavior. This allows testers to quickly generate test scripts that encompass the entire sequence of actions without having to manually write extensive code.

[0010] Once recorded, testers can further edit and refine the generated test script. They can add comments to explain the purpose and expected results of each step, and set checkpoints to verify that the application's state and responses meet expectations. Testers can also adjust the script's parameterization as needed, allowing them to reuse the same script in different test environments.

[0011] Testers use the playback feature provided by the script recording tool to execute the test script and observe whether the application behaves as expected. If any discrepancies or errors are found, testers can adjust the script based on the playback results or report the problem to the development team.

[0012] Disadvantages of Manually Scripting Policies

[0013] Manually writing test scripts is relatively inefficient. Testers need to write code line by line to simulate user operations, which results in a significant amount of duplication of effort when faced with numerous similar or repetitive test scenarios. Furthermore, compared to automated testing, manually writing and executing test scripts is much slower, which can extend testing cycles and impact the overall software development process. Furthermore, manually written test scripts are more prone to errors. Due to human interference, manually written scripts may contain logical errors, spelling errors, and other problems, which can affect the accuracy of test results.

[0014] Manually writing test scripts also presents the problem of high maintenance costs. When software requirements change, manually written test scripts need to be modified accordingly, which is not only time-consuming and labor-intensive, but also prone to missing test scenarios. Furthermore, manually managing multiple versions of test scripts is extremely difficult, especially when multiple testers are collaborating, making it difficult to ensure that all scripts are updated synchronously.

[0015] Disadvantages of script recording modification strategy

[0016] Recording tools may not be able to accurately capture all details of user operations, especially those involving complex logic or conditional judgments. This may result in the generated test scripts being unable to fully simulate user behavior, thus affecting the accuracy of the test. Secondly, the scripts generated by recording tools are generally inflexible and maintainable. If the interface or functionality of the application changes, testers may need to re-record the entire script, and the script recording tool may not be well integrated with the existing testing framework or CI / CD process. This means that testers may need to do extra work to ensure that the recorded scripts can work with other tools. In addition, the performance of the recording tool may also become an issue. In large applications, recording and playback operations may consume a lot of computing resources, causing the testing process to slow down. Summary of the Invention

[0017] In view of the above problems, the present invention is proposed to provide a test method for generating and modifying test scripts based on aspects, which overcomes the above problems or at least partially solves the above problems.

[0018] According to one aspect of the present invention, a test method for generating and modifying aspect-based test scripts is provided, the test method comprising:

[0019] Request interception analysis to obtain requests and corresponding implementation;

[0020] Generate and personalize the script based on the request and the corresponding implementation to obtain a modified script;

[0021] Perform automated testing based on the modified script.

[0022] Optionally, the request interception analysis, request acquisition and corresponding implementation specifically include:

[0023] When the target application service is started, you need to configure the intermediate process of the target application's request to be forwarded to the test system first;

[0024] Based on the configuration, the request is analyzed and then transparently transmitted to the target application server. After the result is returned, it is also transparently forwarded to the request side after being landed.

[0025] Optionally, the request interception analysis specifically includes:

[0026] After the target application service is started, configure the target application's request intermediate process;

[0027] All requests sent to the target application server should be forwarded to the test system first;

[0028] After receiving the request, the request is analyzed based on the pre-set configuration;

[0029] After completing the analysis of the request, the request is transparently transmitted to the target application server;

[0030] During the transparent transmission process, the original state of the request remains unchanged;

[0031] After the target server completes processing and returns the results, the returned results are processed on the spot.

[0032] Optionally, the on-site analysis of the request specifically includes: parsing the content of the request, extracting key information, and recording the timestamp of the request.

[0033] Optionally, the on-site processing of the returned result specifically includes recording the response time, checking the response status code and saving the response data.

[0034] Optionally, generating and personalizing the script based on the request and the corresponding implementation to obtain the modified script specifically includes:

[0035] Based on the requests and corresponding landing information captured in the first step, conduct in-depth analysis of the request URL, request message body, and request response information;

[0036] Extract common information based on the analysis results as common message header information, and implement interface field implementation for field information;

[0037] Testers manually define and modify relevant parameter fields based on the initial draft of the script to obtain test results;

[0038] In-depth analysis of requests and responses to generate a draft of the test script;

[0039] Testers manually define and modify parameter fields.

[0040] Optionally, the automated testing based on the modified script specifically includes:

[0041] Based on the modified script, the tester will select the corresponding script and parameter information according to the test requirements;

[0042] Testers need to configure relevant test variables and parameters;

[0043] Simulate different usage scenarios and conditions through precise configuration;

[0044] After the configuration is completed, the tester triggers the run command to start the automated testing process.

[0045] Optionally, the automated testing process specifically includes:

[0046] Execute a series of operations according to preset scripts and parameters, and monitor the response of the target service in real time;

[0047] After the test is completed, detailed test results are output, including various performance indicators, error logs and possible problem points.

[0048] The present invention provides a test method for aspect-based test script generation and modification support. The method includes: request interception and analysis to obtain requests and corresponding implementations; script generation and personalized modification based on the requests and corresponding implementations to obtain a modified script; and automated testing based on the modified script. This improves testing efficiency and reduces human error.

[0049] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0051] Figure 1 A flowchart of a test method for generating and modifying test scripts based on aspects provided by an embodiment of the present invention;

[0052] Figure 2 A flowchart of request interception analysis provided by an embodiment of the present invention;

[0053] Figure 3 A flowchart of script generation and personalized modification provided by an embodiment of the present invention;

[0054] Figure 4 This is a flowchart of the automated testing provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0055] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0056] The terms "comprises" and "comprising" and any variations thereof in the description, embodiments, claims and drawings of the present invention are intended to cover non-exclusive inclusions, for example, including a series of steps or units.

[0057] The technical solution of the present invention is further described in detail below with reference to the accompanying drawings and embodiments.

[0058] like Figure 1 As shown, a test method for generating and modifying test scripts based on aspects is provided, and the test method includes: request interception analysis to obtain requests and corresponding implementations; script generation and personalized modification based on the requests and corresponding implementations to obtain modified scripts; and automated testing based on the modified scripts.

[0059] This method is divided into three steps, including request interception analysis, script generation and personalized modification, and automated retesting.

[0060] The first step is request interception analysis. When the target application service is started, the intermediate process of the target application request needs to be forwarded to the test system first. Based on the configuration, the request is analyzed and then transmitted to the target application server. After the result is returned, it is also transmitted to the request side after landing.

[0061] The second step involves script generation and customization. Based on the request and corresponding implementation from the first step, the request URL, message body, and response information are analyzed. Common information is extracted as common message headers, and field information is mapped to interface fields to generate a preliminary draft of the test script. Based on the preliminary script, the tester manually defines and modifies relevant parameter fields.

[0062] The third step is automated testing. Based on the modified script, the tester selects the script and parameter information to be tested, configures the relevant test variables and parameters, triggers the run, and the software performs automated testing on the target service and outputs the test results.

[0063] like Figure 2 As shown, request interception analysis:

[0064] Once the target application service is started, the target application's request intermediate process needs to be configured to monitor and analyze requests. All requests sent to the target application server are first forwarded to the test system. This configuration ensures that each request is captured by the present invention for subsequent processing and analysis. Upon receiving a request, the request is analyzed based on pre-defined configurations. This includes parsing the request content, extracting key information, and recording the request timestamp.

[0065] After analyzing the request, the software transparently transmits it to the target application server. During this process, the software maintains the original state of the request, ensuring that the target server can correctly process the request. After the target server completes processing and returns the result, the software intervenes again to implement the returned result. This includes recording the response time, checking the response status code, and saving the response data. In this way, not only is the request sent, but the entire request lifecycle is tracked.

[0066] like Figure 3 As shown, script generation and personalized modification:

[0067] Based on the captured requests and corresponding landing information, we can conduct in-depth analysis of the request URL, request message body, and request return information, extract common information as common message header information, and implement interface field landing for field information. This not only improves the accuracy and reliability of the test script, but also facilitates subsequent script modification.

[0068] The generated draft test script is the foundation of automated testing. Because each test scenario is unique, testers need to manually define and modify relevant parameter fields based on the draft script. This step ensures that the test script can adapt to different testing needs, improving the flexibility and adaptability of testing. This allows testers to more precisely control the testing process, resulting in more accurate test results.

[0069] Script generation and customization are two essential steps in automated testing. Through in-depth analysis of requests and responses, the software generates a high-quality draft of the test script. Testers can manually define and modify parameter fields to better align the test script with actual testing requirements. This combination of automated generation and manual modification not only improves testing efficiency but also ensures test quality.

[0070] like Figure 4 As shown, automated testing:

[0071] After completing the customized script modification, the tester will select the appropriate script and parameter information based on the test requirements. The tester will configure the relevant test variables and parameters, which will directly affect the test execution process and results. Through precise configuration, different usage scenarios and conditions can be simulated to comprehensively evaluate the performance and stability of the target service. Once the configuration is complete, the tester triggers the run command to start the automated testing process.

[0072] After receiving the run command, the software begins automated testing of the target service. It executes a series of operations according to the pre-set script and parameters, and monitors the target service's response in real time. Upon completion, the software outputs detailed test results, including performance metrics, error logs, and possible failure points.

[0073] Beneficial effects:

[0074] Dynamically Updated Policy Library: This invention introduces a policy update mechanism based on dynamic data streams, enabling the security testing platform to collect the latest security issues, vulnerability information, and attack vectors in real time. This mechanism not only addresses the inability of traditional security testing platforms to dynamically update the policy library when relying on a free security static library, but also ensures that the policy library always contains protection measures against the latest security threats.

[0075] Improved Response Speed and Defense Capabilities: This method significantly improves the platform's response speed and defense capabilities against new security threats. Through key steps such as real-time data collection, local problem aggregation, and data analysis and processing, the system can quickly identify and respond to potential security risks.

[0076] Efficient Automation: Automated test script generation significantly improves testing efficiency and reduces human error. Real-time analysis of application traffic and dynamic script updates ensure test scripts are always consistent with the latest application status.

[0077] Flexibility: Adapts to different testing requirements or scenarios. Testers can add new test cases or adjust the parameter settings of existing test cases as needed. This flexibility makes the present invention not only suitable for generating automated test scripts, but also can meet customized testing work requirements.

[0078] The above specific implementation methods further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A test method for generating and modifying test scripts based on aspects, characterized in that: The test method includes: Request interception analysis to obtain requests and corresponding implementation; Generate and personalize the script based on the request and the corresponding implementation to obtain a modified script; Perform automated testing based on the modified script.

2. A test method for generating and modifying test scripts based on aspects according to claim 1, characterized in that: The request interception analysis, request acquisition and corresponding implementation specifically include: When the target application service is started, you need to configure the intermediate process of the target application's request to be forwarded to the test system first; Based on the configuration, the request is analyzed and then transparently transmitted to the target application server. After the result is returned, it is also transparently forwarded to the request side after being landed.

3. A test method for generating and modifying test scripts based on aspects according to claim 1, characterized in that: The request interception analysis specifically includes: After the target application service is started, configure the target application's request intermediate process; All requests sent to the target application server should be forwarded to the test system first; After receiving the request, the request is analyzed based on the pre-set configuration; After completing the analysis of the request, the request is transparently transmitted to the target application server; During the transparent transmission process, the original state of the request remains unchanged; After the target server completes processing and returns the results, the returned results are processed on the spot.

4. A test method for generating and modifying test scripts based on aspects according to claim 3, characterized in that: The on-site analysis of the request specifically includes: parsing the content of the request, extracting key information and recording the timestamp of the request.

5. A test method for generating and modifying test scripts based on aspects according to claim 3, characterized in that: The on-site processing of the returned results specifically includes recording the response time, checking the response status code and saving the response data.

6. A test method for generating and modifying test scripts based on aspects according to claim 1, characterized in that: Generating and personalizing the script based on the request and the corresponding implementation to obtain the modified script specifically includes: Based on the requests and corresponding landing information captured in the first step, conduct in-depth analysis of the request URL, request message body, and request response information; Extract common information based on the analysis results as common message header information, and implement interface field implementation for field information; Testers manually define and modify relevant parameter fields based on the initial draft of the script to obtain test results; In-depth analysis of requests and responses to generate a draft of the test script; Testers manually define and modify parameter fields.

7. A test method for generating and modifying test scripts based on aspects according to claim 1, characterized in that: The automated testing based on the modified script specifically includes: Based on the modified script, the tester will select the corresponding script and parameter information according to the test requirements; Testers need to configure relevant test variables and parameters; Simulate different usage scenarios and conditions through precise configuration; After the configuration is completed, the tester triggers the run command to start the automated testing process.

8. A test method for generating and modifying test scripts based on aspects according to claim 7, characterized in that: The automated testing process specifically includes: Execute a series of operations according to preset scripts and parameters, and monitor the response of the target service in real time; After the test is completed, detailed test results are output, including various performance indicators, error logs and possible problem points.