Notation test point generation method and device and electronic equipment

By acquiring incremental code information and generating an annotation list, the annotation information is automatically identified and parsed, solving the problem of low efficiency in generating annotation test points in traditional software testing, and achieving efficient and comprehensive annotation test point generation.

CN121478656APending Publication Date: 2026-02-06AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511694742.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-18
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

Traditional software testing methods face challenges when dealing with annotations, such as the strong dependence of test points on understanding requirements and the difficulty in quickly and effectively obtaining them. This is especially true when there are large-scale code changes and diverse annotation types, resulting in low efficiency in test point generation.

Method used

By acquiring incremental code information, identifying annotation information and generating an annotation list, and determining a test point list, including upper and lower boundaries of type, upper and lower boundaries of business meaning, and positive and negative equivalence classes, the system automatically identifies and parses annotation information in incremental code, generating test points that efficiently cover annotation parameter boundaries and positive and negative equivalence classes.

Benefits of technology

It enables efficient generation of test points that fully cover annotation parameter boundaries and positive and negative equivalence classes, reducing test data preparation time, improving test efficiency and coverage, and ensuring the comprehensiveness and effectiveness of the tests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121478656A_ABST
    Figure CN121478656A_ABST
Patent Text Reader

Abstract

The invention discloses an annotation test point generation method and device and electronic equipment. The method comprises the following steps: acquiring incremental code information; annotation information in the incremental code information is recognized, an annotation list is generated according to the annotation information, and the annotation list at least comprises annotation names and parameter names and parameter types of the annotation information; a test point sorting list is determined according to the annotation list, annotation test points are generated according to the test point sorting list, and the test point sorting list is used for reflecting the upper and lower boundaries of the type of the annotation information, the upper and lower boundaries of the business meaning and the positive and negative equivalence classes. According to the method and the device, the technical problems that the annotation logic can be tested through a reflection mechanism and an interceptor mechanism due to the fact that related technologies focus on the execution stage of the annotation test, but the test point generation efficiency is low in the test preparation stage, especially in the face of large-scale code change and diversified annotation types are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software testing technology, and more specifically, to a method, apparatus, and electronic device for generating annotation test points. Background Technology

[0002] In software development, framework annotations are widely used in code to guide the compiler, framework, or runtime environment on how to handle specific classes, methods, or properties. The use of annotations significantly improves code readability and maintainability, while also making software functionality implementation more flexible and efficient. However, with the widespread adoption of annotations in software projects, the complexity and importance of annotation testing are becoming increasingly prominent.

[0003] Traditional software testing methodologies often face two main challenges when dealing with annotations. First, test points are highly dependent on a deep understanding of requirements. The indirectness and flexibility of annotations mean that testers must have a thorough understanding of their meaning and how they affect program behavior. This often requires frequent and in-depth communication with developers, increasing project time costs and communication complexity. Second, test points are difficult to obtain quickly and effectively. Annotations may be scattered throughout the code, and their parameters and rules may change with project requirements. Testers struggle to quickly and accurately identify critical test points, leading to insufficient test coverage and inefficiency.

[0004] In related technologies, test points are typically built using documentation or annotations provided by developers, or by using reflection and interceptor mechanisms to execute annotation logic. However, these methods do not address the pain points in the test preparation phase, such as test data preparation and test point identification. Especially for large-scale project code, manually analyzing annotations line by line and identifying test points is not only time-consuming and labor-intensive, but also prone to omissions and errors.

[0005] There is currently no effective solution to the above problems. Summary of the Invention

[0006] This application provides a method, apparatus, and electronic device for generating annotation test points, which at least solves the technical problem of low test point generation efficiency in the test preparation stage, especially when facing large-scale code changes and diverse annotation types, since related technologies focus on the execution stage of annotation testing and can test annotation logic through reflection and interceptor mechanisms.

[0007] According to one aspect of the embodiments of this application, an annotation test point generation method is provided, comprising: obtaining incremental code information, wherein the incremental code information is code change information extracted from a version control system or code repository; identifying annotation information in the incremental code information and generating an annotation list based on the annotation information, wherein the annotation list includes at least an annotation name, parameter name and parameter type of the annotation information; determining a test point sorting list based on the annotation list and generating annotation test points based on the test point sorting list, wherein the test point sorting list is used to reflect the upper and lower boundaries of the annotation information type, the upper and lower boundaries of the business meaning, and positive and negative equivalence classes.

[0008] Optionally, the method further includes: obtaining production-ready code files and production-ready code files; identifying incremental code information in the production-ready code files and production-ready code files, wherein the incremental code information includes at least one of the following: newly added code and optimized code; determining the name of the code file where the incremental code information is located; and generating an incremental code list based on the code file name and the incremental code information.

[0009] Optionally, identifying annotation information in incremental code information and generating an annotation list based on the annotation information includes: identifying annotation instances in the incremental code list; determining the annotation name and corresponding annotation information of the annotation instance, wherein the annotation information includes the parameter name and parameter type of the annotation instance; mapping the annotation information to the corresponding code block in the incremental code list, and generating an annotation list based on the annotation name, parameter name, and parameter type.

[0010] Optionally, the method further includes: identifying the target parameter type to obtain an identification result, wherein the target parameter type is the parameter type corresponding to the target annotation instance in the annotation list, and the target annotation instance is any annotation instance in the annotation list; if the identification result indicates that there is no annotation type in the target parameter type, identifying annotation instances in other code areas of the incremental code list; if the identification result indicates that there is an annotation type in the target parameter type, updating the annotation list according to the annotation type.

[0011] Optionally, the method further includes: when the annotation type is appearing for the first time, determining the target annotation information corresponding to the annotation type and updating the annotation list based on the target annotation information; when the annotation type is not appearing for the first time, querying the incremental code list, and if the incremental code list contains target annotation information corresponding to the annotation type, updating the annotation list based on the target annotation information; and if the incremental code list does not contain target annotation information corresponding to the annotation type, determining that the incremental code list has a defect, and optimizing the incremental code list based on the target annotation information.

[0012] Optionally, the test point list is determined based on the annotation list, including: determining the upper and lower bounds of the type corresponding to the annotation information based on the parameter type; determining the upper bound of the business meaning, the lower bound of the business meaning, the positive equivalence class, and the negative equivalence class corresponding to the annotation information based on the preset rule set provided by the business requirements of the annotation information; and determining the test point list based on the parameter name, parameter type, upper bound of the type, lower bound of the type, upper bound of the business meaning, lower bound of the business meaning, positive equivalence class, and negative equivalence class.

[0013] Optionally, the annotation test points include positive test points and negative test points. Positive test points are generated based on the test point list, including: generating the first positive test point based on the lower boundary of the type and the positive equivalence class; generating the second positive test point based on the upper boundary of the type and the positive equivalence class; generating the third positive test point based on the lower boundary of the business meaning and the positive equivalence class; generating the fourth positive test point based on the upper boundary of the business meaning and the positive equivalence class; and generating the fifth positive test point based on the positive equivalence class.

[0014] Optionally, reverse test points can be generated based on the test point list, including generating reverse test points based on the fifth forward test point and the reverse equivalence class.

[0015] According to another aspect of the embodiments of this application, an annotation test point generation apparatus is also provided, comprising: an acquisition module, configured to acquire incremental code information, wherein the incremental code information is code change information extracted from a version control system or code repository; an identification module, configured to identify annotation information in the incremental code information and generate an annotation list based on the annotation information, wherein the annotation list includes at least an annotation name, parameter name of the annotation information, and parameter type; and a generation module, configured to determine a test point sorting list based on the annotation list and generate annotation test points based on the test point sorting list, wherein the test point sorting list is used to reflect the upper and lower boundaries of the annotation information type, the upper and lower boundaries of the business meaning, and positive and negative equivalence classes.

[0016] According to another aspect of the embodiments of this application, an electronic device is also provided, including: a memory and a processor, wherein the memory is used to store program instructions; and the processor is connected to the memory and used to execute the above-described annotation test point generation method.

[0017] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-described annotation test point generation method by running the computer program.

[0018] According to another aspect of the embodiments of this application, a computer program product is also provided, including computer instructions that, when executed by a processor, implement the above-described annotation test point generation method.

[0019] In this embodiment, incremental code information is obtained, which is code change information extracted from a version control system or code repository; annotation information in the incremental code information is identified, and an annotation list is generated based on the annotation information, wherein the annotation list includes at least the annotation name, the parameter name of the annotation information, and the parameter type; a test point list is determined based on the annotation list, and annotation test points are generated based on the test point list, wherein the test point list is used to reflect the upper and lower boundaries of the annotation information type, the upper and lower boundaries of the business meaning, and positive and negative equivalence classes, thereby achieving the purpose of automatically identifying and parsing annotation information in incremental code. This achieves the technical effect of efficiently generating test points that fully cover the annotation parameter boundaries and positive and negative equivalence classes, and solves the technical problem of low test point generation efficiency in the test preparation stage, especially when facing large-scale code changes and diverse annotation types, because related technologies focus on the execution stage of annotation testing. Attached Figure Description

[0020] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a hardware structure diagram of a computer terminal for implementing an annotation test point generation method according to an embodiment of this application; Figure 2 This is a flowchart of an annotation test point generation method according to an embodiment of this application; Figure 3 This is a schematic diagram of an incremental code information aggregation process according to an embodiment of this application; Figure 4 This is a schematic diagram of an annotation information summarization process according to an embodiment of this application; Figure 5 This is a schematic diagram of a test point sorting list generation process according to an embodiment of this application; Figure 6 This is a structural diagram of an annotation test point generation device according to an embodiment of this application. Detailed Implementation

[0021] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0023] First, some nouns or terms that appear in the explanation of the embodiments of this application shall be interpreted as follows: A framework is a predefined structure or system for building and extending software applications. A framework provides a complete solution, including codebases, library files, toolsets, conventions, and programming guidelines, designed to help developers quickly build high-quality applications. A framework can be viewed as a semi-finished software product; it specifies the overall structure and some behaviors of the software system, providing developers with a reusable design template.

[0024] Annotations are special tags used in programming to add metadata to code. This metadata can be read and processed at compile time, load time, or runtime to provide additional information or behavior. In programming languages ​​such as [example languages ​​would be inserted here], they can be used on code elements such as classes, methods, fields, and parameters to provide additional information about these elements, such as author, version, date, and purpose. Furthermore, annotations can be used in conjunction with specific tools or frameworks to achieve specific functionalities.

[0025] Incremental code: In the software development process, the code that is added or modified relative to the previous version or baseline.

[0026] To address the problem of difficulty in effectively obtaining annotation test points in related technologies, this application provides a method for generating annotation test points, which can be run on... Figure 1 The computer terminal shown is described below.

[0027] The annotation test point generation method provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal for implementing an annotation test point generation method is shown. Figure 1As shown, the computer terminal 10 may include one or more processors (shown as 102a, 102b, ..., 102n in the figure) (the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission module 106 for communication functions connected via wired and / or wireless networks. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0028] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10. As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0029] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the annotation test point generation method in this embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the above-mentioned annotation test point generation method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0030] The transmission module 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission module 106 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission module 106 may be a radio frequency (RF) module, used for wireless communication with the Internet.

[0031] The display can be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10.

[0032] It should be noted here that, in some optional embodiments, the above... Figure 1 The computer terminal shown may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that... Figure 1 This is only one instance of a specific particular instance, and is intended to illustrate the types of components that may exist in the aforementioned computer terminal.

[0033] In the above operating environment, this application provides an embodiment of a method for generating annotation test points. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0034] Figure 2 This is a flowchart of an annotation test point generation method according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps: Step S202: Obtain incremental code information, wherein the incremental code information is code change information extracted from the version control system or code repository.

[0035] Step S204: Identify the annotation information in the incremental code information and generate an annotation list based on the annotation information. The annotation list includes at least the annotation name, the parameter name of the annotation information, and the parameter type.

[0036] Step S206: Determine the test point list based on the annotation list, and generate annotation test points based on the test point list. The test point list is used to reflect the upper and lower boundaries of the annotation information type, the upper and lower boundaries of the business meaning, and the positive and negative equivalence classes.

[0037] Through steps S202 to S206 above, the goal of automatically identifying and parsing annotation information in incremental code is achieved. This enables the efficient generation of test points that comprehensively cover annotation parameter boundaries and positive and negative equivalence classes. Furthermore, it solves the technical problem of low test point generation efficiency in the test preparation phase, especially when facing large-scale code changes and diverse annotation types, because related technologies focus on the execution phase of annotation testing. While annotation logic can be tested through reflection and interceptor mechanisms, this is particularly relevant when dealing with large-scale code changes and diverse annotation types. The following is a detailed explanation.

[0038] In step S202 above, the main responsibility is to obtain incremental code information. For example, obtaining the latest code change information from the version control system or code repository. This usually involves comparing the differences between the current version of the code and previous versions, including added, deleted, or modified code snippets, in order to identify the code change points that need attention and provide a clear scope for subsequent annotation information identification.

[0039] Furthermore, incremental code information can be integrated to form an incremental code list, and the overall process is as follows: Figure 3 As shown, the process includes: acquiring production-ready and production-ready code files; identifying incremental code information in the production-ready and production-ready code files, wherein the incremental code information includes at least one of the following: newly added code and optimized code; determining the name of the code file containing the incremental code information; and generating an incremental code list based on the code file name and the incremental code information. The specific process analysis is as follows: 1. Obtain the code files that have been deployed and the code files that are yet to be deployed.

[0040] First, focus on the code files already deployed in the project (i.e., production code) and the code files under development that will soon be deployed to the production environment (i.e., code awaiting production). Utilize version control systems such as Git and SVN to clearly distinguish and access these code files, laying the foundation for change analysis.

[0041] 2. Identify new and optimized code.

[0042] Obtain incremental code information and record detailed changes, including the number and specific content of added, deleted, or modified lines, especially annotation changes. This involves checking for new code in both production and upcoming code files, and checking for optimized code (updated, deleted, or modified sections) in code files with the same name in both production and upcoming code files. Subsequently, determine the names of the code files containing the new and optimized code to indicate the specific code files from which the changes will be implemented.

[0043] 3. Generate an incremental code list.

[0044] Finally, all the above information is integrated to form a detailed list of incremental code. This list not only includes the specific location of the changed code (such as file name and line number), but also clearly defines the type of change (addition or optimization), providing a clear roadmap for subsequent in-depth extraction of annotation information.

[0045] It should be noted that when there are multiple different code modification blocks in a file with the same name, the line number range of each code block needs to be identified and recorded separately, and then they should be separated by commas and summarized into an incremental code list.

[0046] For example, suppose there is a project where changes occur in the code files: UserService, ProductService, and OrderService. UserService is a newly added code file with 500 lines; ProductService is an optimized code file with only lines 10-50 changed; and OrderService is also an optimized code file with changes in four parts: lines 1-355, 500-600, 800-890, and 1200-1500.

[0047] Subsequently, lines 500 of the newly added code file UserService were included as incremental code in the incremental code list. Lines 10-50 of the optimized code file ProductService were also included as incremental code in the incremental code list, as were lines 1-355, 200-600, 800-890, and 1200-1500 of the optimized code file OrderService. These were separated by commas and included in the incremental code list. The resulting incremental code list is shown in Table 1. Table 1 Incremental Code List

[0048] In step S204 above, the main task is to identify the acquired incremental code information and integrate the parsed annotation information into a structured annotation list. This annotation list contains annotation details in all the changed code, providing necessary data support for the generation of subsequent test points.

[0049] Optionally, identifying annotation information in incremental code information and generating an annotation list based on the annotation information includes: identifying annotation instances in the incremental code list; determining the annotation name and corresponding annotation information of the annotation instance, wherein the annotation information includes the parameter name and parameter type of the annotation instance; mapping the annotation information to the corresponding code block in the incremental code list, and generating an annotation list based on the annotation name, parameter name, and parameter type.

[0050] In this embodiment, the process of identifying annotation information in incremental code information and generating an annotation list based on this information is one of the core steps in the entire automated test point generation method. The overall process is as follows: Figure 4 As shown, the process includes the following: 1. Identify annotation instances.

[0051] First, each code region in the generated incremental code list is thoroughly scanned to identify all annotation instances contained within, and the usage conditions and activation methods of these annotation instances are recorded. For example, code analysis tools or algorithms are used to accurately identify all code elements such as classes, methods, and variables that are annotated.

[0052] 2. Determine the annotation name and corresponding annotation information for the annotation instance.

[0053] For each identified annotation instance, the system first checks if a corresponding annotation definition field exists in the code region. If not, it continues scanning the next code region; if it exists, it parses the annotation name and its parameter information, including parameter name and parameter type, as well as any possible default values ​​or other configuration options.

[0054] 3. Annotation information mapping.

[0055] The extracted annotation information is matched one by one with the code blocks in the incremental code list to ensure that subsequent test point generation can directly locate specific lines of code. This annotation mapping essentially establishes a clear clue between the incremental code and the annotation list, informing the testing tool of the annotation types associated with the code change, as well as detailed information about the annotation parameters. This makes test point generation more targeted and reduces invalid test attempts.

[0056] 4. Generate an annotation list.

[0057] Finally, all collected annotation information, including annotation name, parameter name, parameter type, and corresponding code location, is integrated into a structured annotation list. This list displays an overview of the usage of all annotations in the changed code, as well as a detailed description of each annotation and its parameters, providing a direct data source for subsequent test point analysis.

[0058] Furthermore, the process of generating the annotation list also includes determining whether there is an annotation type among the parameter types, and updating the annotation list or incremental code list according to the annotation type.

[0059] Optionally, updating the annotation list based on the annotation type includes: identifying the target parameter type to obtain an identification result, wherein the target parameter type is the parameter type corresponding to the target annotation instance in the annotation list, and the target annotation instance is any annotation instance in the annotation list; if the identification result indicates that there is no annotation type in the target parameter type, identifying annotation instances in other code areas of the incremental code list; if the identification result indicates that there is an annotation type in the target parameter type, updating the annotation list based on the annotation type.

[0060] Specifically, the parameter types of each annotation instance in the annotation list are first carefully examined to determine if nested annotation types exist. Taking the target parameter type of the target annotation instance (any annotation instance in the annotation list) as an example, if the target parameter type does not contain nested annotation types, the scan continues in other code areas of the incremental code list to ensure that all code sections involving annotations are covered.

[0061] If the target parameter type contains nested annotation types, the annotation list can be updated based on the occurrence of the annotation type (first occurrence or not). This includes: if the annotation type is the first occurrence, determining the target annotation information corresponding to the annotation type and updating the annotation list based on the target annotation information; if the annotation type is not the first occurrence, querying the incremental code list, and if the incremental code list contains target annotation information corresponding to the annotation type, updating the annotation list based on the target annotation information.

[0062] In other words, when an annotation type is newly defined or newly appearing, the system automatically retrieves the target annotation information related to that annotation type, including its definition, parameter structure, expected behavior, etc., and adds it to the annotation list. This approach fills the gaps in the annotation list, ensuring that test point generation can achieve comprehensive coverage even when facing entirely new annotation types, without being limited by historical data. When an annotation type has appeared in previous changes, the system prioritizes scanning the incremental code list to query the corresponding annotation definition, i.e., the corresponding target annotation information, and adds the existing annotation definition to the annotation list, until all code blocks in the incremental code list have been scanned to obtain a complete annotation list.

[0063] Optionally, updating the incremental code list based on the annotation type includes: if there is no target annotation information corresponding to the annotation type in the incremental code list, determining that the incremental code list has a defect, and optimizing the incremental code list based on the target annotation information.

[0064] Specifically, if the incremental code list does not contain target annotation information corresponding to the annotation type, it indicates that there are instances of annotation usage that were not correctly captured in the code changes. In this case, the incremental code list will be automatically flagged as defective, and an attempt will be made to optimize the incremental code list based on the target annotation information. This could involve rescanning the code, updating the code analysis algorithm, or adjusting the code comparison rules in the version control system to ensure that all annotation information can be captured more accurately in the future and to prevent similar defects from recurring.

[0065] For example, assuming that UserService has the @ABC annotation, ProductService has the @DEF annotation, and OrderService has no annotations, recording the parameters and types of @ABC and @DEF will generate an annotation list, as shown in Table 2: Table 2 Annotation List

[0066] In summary, this application can flexibly handle both first-time and recurring annotation types, ensuring that the annotation list is always up-to-date and comprehensive. Furthermore, it possesses self-diagnostic and corrective capabilities for insufficient annotation information capture, continuously optimizing its performance and improving the accuracy and efficiency of test point generation. This design approach fully considers the complexity and diversity of code changes in software development, providing a solid foundation for achieving efficient and comprehensive annotation testing.

[0067] In step S206 above, the main responsibility is to generate a test point list based on the annotation list, and then generate positive and negative test points for each annotation to ensure coverage of all possible annotation behaviors and boundary conditions.

[0068] In this embodiment of the application, determining the test point list based on the annotation list includes: determining the upper and lower boundaries of the type corresponding to the annotation information based on the parameter type; determining the upper boundary of the business meaning, the lower boundary of the business meaning, the positive equivalence class, and the negative equivalence class corresponding to the annotation information based on the preset rule set provided by the business requirements of the annotation information; and determining the test point list based on the parameter name, parameter type, upper boundary of the type, lower boundary of the type, upper boundary of the business meaning, lower boundary of the business meaning, positive equivalence class, and negative equivalence class.

[0069] The specific process is as follows: Figure 5As shown, firstly, based on the generated annotation list, the annotations are summarized into the "Parameter Name" column of the test point summary list according to the annotation name and parameter name format. Then, it is determined whether the current parameter type is an annotation, and it is summarized into the "Parameter Name" column of the test point summary list according to the annotation A, annotation B, and parameter name format. Next, the "Parameter Name" column is traversed to determine the upper and lower boundaries of the annotation information type. Simultaneously, the upper and lower boundaries of the annotation information's business meaning and positive and negative equivalence classes are determined based on the preset rule set provided by the business requirements. Finally, all information is integrated to generate a structured test point summary list. This list contains detailed information for each annotation parameter, such as parameter name, type, type boundaries, business boundaries, and positive and negative equivalence classes. It serves as the direct basis for test point generation, guiding the testing tools to construct test cases that cover all necessary conditions, thereby ensuring the comprehensiveness and effectiveness of the testing.

[0070] Among them, the upper and lower boundaries of business meaning reflect the effective value range of the parameter in the business logic, while the positive and negative equivalence classes are parameter value classifications based on business rules, used to construct test cases that are closer to actual business scenarios. For example, for an annotation parameter, if the business requirement specifies that its effective business value range is 1 to 6, then the lower boundary of business meaning is 1, and the upper boundary of business meaning is 6; the positive equivalence class may include typical values ​​within the value range such as 2, 3, and 4, while the negative equivalence class may include 0 and 7 outside the value range, used to test boundary conditions and abnormal situations.

[0071] Overall, regarding the @ABC and @DEF annotations: Assuming ABC.a is of type int, then the lower boundary of the type is -2, 147, 483, 648, the upper boundary of the type is 2, 147, 483, 647, the lower boundary of the business logic is 1, the upper boundary is 6, the positive equivalence classes are 2, 3, 4, and the negative equivalence classes are 0, 7.

[0072] Assuming ABC.b is of type char, then the lower boundary of the type is 0x00, the upper boundary of the type is 0xFFFF, the lower boundary of the business logic is 'b', the upper boundary is 'f', the positive equivalence classes are 'c', 'd', 'e', ​​and the negative equivalence classes are 'a', 'g'.

[0073] Assuming ABC.c is of type date, then the lower boundary of the type is LocalDate.MIN, the upper boundary of the type is LocalDate.MAX, the lower boundary of the business logic is 9999-12-31, the upper boundary is 1980-01-01, the positive equivalence classes are 1980-1-2 and 2024-1-1, and the negative equivalence class is 1970-01-01.

[0074] Assuming DEF.da is of type int, then the lower bound of the type is -2, 147, 483, 648, the upper bound of the type is 2, 147, 483, 647, the lower bound of the business logic is 1, the upper bound is 6, the positive equivalence classes are 2, 3, 4, and the negative equivalence classes are 0, 7.

[0075] Assuming DEF.db is of type char, then the lower boundary of the type is 0x00, the upper boundary of the type is 0xFFFF, the lower boundary of the business logic is 'b', the upper boundary is 'f', the positive equivalence classes are 'c', 'd', 'e', ​​and the negative equivalence classes are 'a', 'g'.

[0076] Assuming DEF.dc is of type date, then the lower boundary of the type is LocalDate.MIN, the upper boundary of the type is LocalDate.MAX, the lower boundary of the business logic is 9999-12-31, the upper boundary is 1980-01-01, the positive equivalence classes are 1980-1-2 and 2024-1-1, and the negative equivalence class is 1970-01-01.

[0077] Assuming DEF.e is of type boolean with no upper or lower bounds, filling in "——" will result in positive equivalence classes of true and false, and no negative equivalence class.

[0078] Assuming DEF.f is of type String with no upper or lower bounds, if we fill in "——", the positive equivalence class is "ttttt" and the negative equivalence class is "fffff".

[0079] The final list of test points is shown in Table 3: Table 3. List of Test Points

[0080] In this embodiment of the application, the final generated annotation test points include forward test points and reverse test points, and the annotation test points are written in the annotation calling format. The principle of construction is to ensure that all filled values ​​are called at least once.

[0081] Specifically, positive test points are generated based on the test point list, including: the first positive test point generated based on the lower boundary of the type and positive equivalence classes; the second positive test point generated based on the upper boundary of the type and positive equivalence classes; the third positive test point generated based on the lower boundary of the business meaning and positive equivalence classes; the fourth positive test point generated based on the upper boundary of the business meaning and positive equivalence classes; and the fifth positive test point generated based on positive equivalence classes. Details are as follows: 1) First positive test point: The lower bound values ​​of the same annotation type constitute a test case. If there is no lower bound, the positive equivalence class value is used instead. For example: @ABC(-2147483648, 0x00, LocalDate.MIN); @DEF((-2147483648, 0x00, LocalDate.MIN), true, "ttttt").

[0082] 2) Second positive test point: A test case is formed by taking the upper bound value of the type for the same annotation. If there is no upper bound, the value of the positive equivalence class is used instead. For example: @ABC(2147483647, 0xFFFF, LocalDate.MAX); @DEF((2147483647, 0xFFFF, LocalDate.MAX), false, "ttttt").

[0083] 3) Third positive test point: A test point is formed by taking the lower boundary value of the business meaning of the same annotation. If there is no lower boundary, the positive equivalence class value is used instead. For example: @ABC(1, 'b', 9999-12-31); @DEF((1,'b',9999-12-31),true,"ttttt").

[0084] 4) Fourth positive test point: A test point is formed by taking the upper boundary value of the business meaning of the same annotation. If there is no upper boundary, the positive equivalence class value is used instead. For example: @ABC(6, 'f', 1980-01-01); @DEF((6,'f',1980-01-01),false,"ttttt").

[0085] 5) Fifth positive test point: The values ​​of the positive equivalence classes of the same annotation can be used to form a test point, for example: @ABC(2, 'c', 1980-1-2); @ABC(3, 'd', 2024-1-1); @ABC(4, 'e', ​​1980-1-2); @DEF((2,'c',1980-1-2),true,"ttttt"); @DEF((3,'d',2024-1-1),false,"ttttt"); @DEF((4,'e',1980-1-2),false,"ttttt").

[0086] Based on the test point list, reverse test points are generated, including: generating reverse test points based on the fifth forward test point and the reverse equivalence class. Details are as follows: First, select any one of the fifth positive test points mentioned above, for example: For example, @ABC selects @ABC(2, 'c', 1980-1-2), and @DEF selects @DEF((2, 'c', 1980-1-2), true, "ttttt").

[0087] Secondly, replace each of the reverse equivalence classes one by one to form reverse test points. It should be noted that only one reverse equivalence class value can be replaced at a time, for example: @ABC replaces the first parameter, resulting in @ABC(0, 'c', 1980-1-2) and @ABC(7, 'c', 1980-1-2); The second parameter is replaced by @ABC, resulting in @ABC(2,'a',1980-1-2) and @ABC(2,'g',1980-1-2); @ABC replaces the third parameter, resulting in @ABC(2, 'c', 1970-01-01); The first parameter is replaced by @DEF, resulting in @DEF((0, 'c', 1980-1-2), true, "ttttt") and @DEF((7, 'c', 1980-1-2), true, "ttttt"); The `@DEF` option replaces the second parameter, resulting in `@DEF((2, 'a', 1980-1-2), true, "ttttt")` and `@DEF((2, 'g', 1980-1-2), true, "ttttt")`. @DEF replaces the third parameter, resulting in @DEF((2, 'a', 1970-01-01, true, "ttttt")); The fourth parameter of @DEF has no inverse equivalence class, so it does not need to be replaced. The fifth parameter is replaced by @DEF, resulting in @DEF((2, 'a', 1980-1-2, true, "fffff").

[0088] Overall, this application proposes a systematic and intelligent method for generating framework annotation test points, effectively solving two major problems in traditional annotation testing: strong reliance on understanding requirements and difficulty in quickly obtaining test points. First, by summarizing incremental code information, it accurately identifies code change points, especially annotation changes, reducing unnecessary full code scanning and significantly saving time and effort in test data preparation. Second, through in-depth analysis of annotations, it identifies annotation parameter names, parameter types, and specific usage scenarios, mapping them to corresponding code lines to generate a detailed annotation list. This not only helps in understanding the intent and function of annotations but also provides clear guidance for test point generation, avoiding test omissions or redundancy caused by unclear annotation characteristics. Furthermore, it introduces an intelligent algorithm for generating test points based on the test point compilation list. This algorithm not only generates positive test points based on the type boundaries and business meaning boundaries of annotation parameters but also constructs reverse test points by combining positive and negative equivalence classes, ensuring the robustness and stability of the software under various input conditions.

[0089] According to embodiments of this application, an annotation test point generation apparatus is provided. It should be noted that the annotation test point generation apparatus of this application can be used to execute the annotation test point generation method provided in the embodiments of this application. The annotation test point generation apparatus provided in the embodiments of this application will be described below.

[0090] Figure 6 This is a structural diagram of an annotation test point generation device provided according to an embodiment of this application. Figure 6 As shown, the device includes: The acquisition module 60 is used to acquire incremental code information, wherein the incremental code information is code change information extracted from the version control system or code repository; The identification module 62 is used to identify the annotation information in the incremental code information and generate an annotation list based on the annotation information. The annotation list includes at least the annotation name, the parameter name and the parameter type of the annotation information. The generation module 64 is used to determine the test point sorting list based on the annotation list, and generate annotation test points based on the test point sorting list. The test point sorting list is used to reflect the upper and lower boundaries of the annotation information type, the upper and lower boundaries of the business meaning, and the positive and negative equivalence classes.

[0091] By using the acquisition, recognition, and generation modules in the aforementioned annotation test point generation device, the goal of automatically recognizing and parsing annotation information in incremental code is achieved. This enables the efficient generation of test points that comprehensively cover annotation parameter boundaries and positive and negative equivalence classes. Consequently, it solves the technical problem of low test point generation efficiency in the test preparation stage, especially when facing large-scale code changes and diverse annotation types, since related technologies focus on the execution phase of annotation testing. While annotation logic can be tested through reflection and interceptor mechanisms, this is problematic in the test preparation phase.

[0092] In the annotation test point generation device provided in this application embodiment, the acquisition module is further used to identify incremental code information in the production code file and the code file to be produced, wherein the incremental code information includes at least one of the following: newly added code and optimized code; determine the name of the code file where the incremental code information is located; and generate an incremental code list based on the code file name and the incremental code information.

[0093] In the annotation test point generation device provided in this application embodiment, the identification module is further used to identify annotation instances in the incremental code list; determine the annotation name and corresponding annotation information of the annotation instance, wherein the annotation information includes the parameter name and parameter type of the annotation instance; map the annotation information to the corresponding code block in the incremental code list, and generate an annotation list based on the annotation name, parameter name and parameter type.

[0094] In the annotation test point generation device provided in this application embodiment, the identification module is further used to identify the target parameter type and obtain an identification result, wherein the target parameter type is the parameter type corresponding to the target annotation instance in the annotation list, and the target annotation instance is any annotation instance in the annotation list; if the identification result indicates that there is no annotation type in the target parameter type, the module identifies annotation instances in other code areas of the incremental code list; if the identification result indicates that there is an annotation type in the target parameter type, the module updates the annotation list according to the annotation type.

[0095] In the annotation test point generation device provided in this application embodiment, the identification module is further configured to: determine the target annotation information corresponding to the annotation type when the annotation type is appearing for the first time, and update the annotation list based on the target annotation information; query the incremental code list when the annotation type is not appearing for the first time, and update the annotation list based on the target annotation information if the incremental code list contains target annotation information corresponding to the annotation type; and determine that the incremental code list has defects if the incremental code list does not contain target annotation information corresponding to the annotation type, and optimize the incremental code list based on the target annotation information.

[0096] In the annotation test point generation device provided in this application embodiment, the generation module is further configured to determine the upper boundary and lower boundary of the type corresponding to the annotation information based on the parameter type; determine the upper boundary of the business meaning, lower boundary of the business meaning, positive equivalence class and negative equivalence class corresponding to the annotation information based on the preset rule set provided by the business requirements of the annotation information; and determine the test point sorting list based on the parameter name, parameter type, upper boundary of the type, lower boundary of the type, upper boundary of the business meaning, lower boundary of the business meaning, positive equivalence class and negative equivalence class.

[0097] In the annotation test point generation device provided in this application embodiment, the generation module is further configured to generate a first positive test point based on the lower boundary of the type and the positive equivalence class; generate a second positive test point based on the upper boundary of the type and the positive equivalence class; generate a third positive test point based on the lower boundary of the business meaning and the positive equivalence class; generate a fourth positive test point based on the upper boundary of the business meaning and the positive equivalence class; and generate a fifth positive test point based on the positive equivalence class.

[0098] In the annotation test point generation device provided in the embodiments of this application, the generation module is further used to generate a reverse test point based on the fifth forward test point and the reverse equivalence class.

[0099] This application also provides an electronic device, including: a memory and a processor, wherein the memory is used to store program instructions; and the processor is connected to the memory and used to execute the above-described annotation test point generation method.

[0100] It should be noted that the aforementioned electronic equipment is used to perform Figure 2 The annotation test point generation method shown above also applies to this electronic device, and will not be repeated here.

[0101] This application also provides a non-volatile storage medium, which includes a stored computer program, wherein the device containing the non-volatile storage medium executes the above-described annotation test point generation method by running the computer program.

[0102] It should be noted that the aforementioned non-volatile storage media is used for execution. Figure 2 The annotation test point generation method shown above also applies to this non-volatile storage medium, and will not be repeated here.

[0103] This application also provides a computer program product, including computer instructions that, when executed by a processor, implement the above-described annotation test point generation method.

[0104] It should be noted that the above-mentioned computer program product is used to execute Figure 2The annotation test point generation method shown above also applies to this computer program product, and will not be repeated here.

[0105] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0106] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0107] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0108] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0109] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0110] If the integrated unit is implemented as 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 technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0111] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for generating annotation test points, characterized in that, include: Obtain incremental code information, wherein the incremental code information is code change information extracted from a version control system or code repository; Identify the annotation information in the incremental code information and generate an annotation list based on the annotation information, wherein the annotation list includes at least the annotation name, the parameter name and parameter type of the annotation information; A test point list is determined based on the annotation list, and annotation test points are generated based on the test point list. The test point list is used to reflect the upper and lower boundaries of the type, the upper and lower boundaries of the business meaning, and the positive and negative equivalence classes of the annotation information.

2. The method according to claim 1, characterized in that, The method further includes: Obtain the code files that have been deployed in production and the code files that are yet to be deployed in production; Identify incremental code information in the production-ready code file and the code file to be produced, wherein the incremental code information includes at least one of the following: newly added code and optimized code; Determine the name of the code file containing the incremental code information; An incremental code list is generated based on the code file name and the incremental code information.

3. The method according to claim 2, characterized in that, Identify the annotation information in the incremental code information, and generate an annotation list based on the annotation information, including: Identify annotation instances in the incremental code list; Determine the annotation name and corresponding annotation information of the annotation instance, wherein the annotation information includes the parameter name and parameter type of the annotation instance; The annotation information is mapped to the corresponding code block in the incremental code list, and the annotation list is generated based on the annotation name, the parameter name, and the parameter type.

4. The method according to claim 3, characterized in that, The method further includes: The target parameter type is identified to obtain the identification result, wherein the target parameter type is the parameter type corresponding to the target annotation instance in the annotation list, and the target annotation instance is any annotation instance in the annotation list; If the identification result indicates that there is no annotation type in the target parameter type, identify annotation instances in other code regions of the incremental code list; If the identification result indicates that the annotation type exists in the target parameter type, the annotation list is updated according to the annotation type.

5. The method according to claim 4, characterized in that, The method further includes: If the annotation type is appearing for the first time, determine the target annotation information corresponding to the annotation type, and update the annotation list based on the target annotation information; If the annotation type is not appearing for the first time, query the incremental code list, and if there is target annotation information corresponding to the annotation type in the incremental code list, update the annotation list according to the target annotation information; If no target annotation information corresponding to the annotation type exists in the incremental code list, it is determined that the incremental code list has a defect, and the incremental code list is optimized based on the target annotation information.

6. The method according to claim 1, characterized in that, Based on the annotation list, a test point list is determined, including: The upper and lower boundaries of the type corresponding to the annotation information are determined based on the parameter type. Based on the preset rule set provided by the business requirements of the annotation information, determine the upper boundary of the business meaning, the lower boundary of the business meaning, the positive equivalence class, and the negative equivalence class corresponding to the annotation information; The test point list is determined based on the parameter name, parameter type, upper boundary of the type, lower boundary of the type, upper boundary of the business meaning, lower boundary of the business meaning, positive equivalence class, and negative equivalence class.

7. The method according to claim 6, characterized in that, The annotation test points include positive test points and negative test points. A list of positive test points is generated based on these test points, including: Generate a first positive test point based on the lower boundary of the type and the positive equivalence class; A second positive test point is generated based on the upper boundary of the type and the positive equivalence class; A third positive test point is generated based on the lower boundary of the business meaning and the positive equivalence class; A fourth positive test point is generated based on the upper boundary of the business meaning and the positive equivalence class; A fifth positive test point is generated based on the aforementioned positive equivalence class.

8. The method according to claim 7, characterized in that, Based on the aforementioned test point list, reverse test points are generated, including: The reverse test point is generated based on the fifth forward test point and the reverse equivalence class.

9. An annotation test point generation device, characterized in that, include: The acquisition module is used to acquire incremental code information, wherein the incremental code information is code change information extracted from the version control system or code repository; The identification module is used to identify the annotation information in the incremental code information and generate an annotation list based on the annotation information, wherein the annotation list includes at least the annotation name, the parameter name and parameter type of the annotation information; The generation module is used to determine a test point list based on the annotation list, and generate annotation test points based on the test point list. The test point list is used to reflect the upper and lower boundaries of the type, the upper and lower boundaries of the business meaning, and the positive and negative equivalence classes of the annotation information.

10. An electronic device, characterized in that, include: A memory and a processor, wherein the memory is used to store program instructions; The processor, connected to the memory, is used to execute the annotation test point generation method according to any one of claims 1 to 8.