A test case metadata processing method, device, equipment and medium
By extracting and storing function, call, and dependency data in the memory of test cases, the problem of low information entropy in test cases is solved, and automatic acquisition and efficient storage of metadata are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-23
- Publication Date
- 2026-03-17
AI Technical Summary
In existing technologies, test cases themselves have low information entropy and lack the functions of acquiring, parsing and storing metadata, which means that test case developers need to manually evaluate or run test cases to record metadata information.
By querying the code data of test cases, function data and its associated call and dependency data are extracted, and metadata is obtained and stored in the memory of the test cases, avoiding external storage media and supporting fast query and persistence.
It enables automatic acquisition of test case metadata, improves the information entropy of test cases, and simplifies the process of acquiring and storing metadata.
Smart Images

Figure CN116340147B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data testing, and in particular to a method, apparatus, device, and medium for processing test case metadata. Background Technology
[0002] When selecting test cases for automated and precise testing, it is necessary to obtain test case metadata through various means. Currently, the common solution is to collect test case metadata during runtime. This technology focuses on statically acquiring metadata information without running the test cases. A test case is a description of a testing task for a specific software product, reflecting the testing plan, techniques, and strategies. Metadata describes data attributes. In existing technologies, test case developers manually evaluate and mark metadata based on their understanding of the business logic, or record test case metadata information in an external database as a mapping relationship by running test cases. However, test cases themselves have low information entropy and lack the functionality to acquire, parse, and store metadata; therefore, there are areas for improvement. Summary of the Invention
[0003] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a method for processing test case metadata, which solves the problem of low information entropy of test cases themselves in the prior art.
[0004] To achieve the above and other related objectives, the present invention provides a method for processing test case metadata, comprising:
[0005] Query the code data of test cases;
[0006] Based on the pre-defined information collected, extract the function data of the test cases from the code data;
[0007] Obtain the call data of the function data association index;
[0008] Obtain the dependency data of the function data association dependency relationship, and recursively obtain the call relationship data between the dependency data and the call data;
[0009] Query the attribute data of the code data of the test case, and denote it as the first attribute data;
[0010] Query the attribute data of the called data, the dependent data, and the called relationship data regarding the attribute, and denote it as the second attribute data; and
[0011] The first attribute data and the second attribute data are recorded as the metadata of the test case, and the metadata is attached to the memory where the test case resides. The metadata does not require external storage media, facilitating fast querying and searching of the metadata, and also supports persistence to a database.
[0012] In one embodiment of the present invention, the step of obtaining the call data of the function data association index includes:
[0013] Determine whether the function data is associated with dependent data;
[0014] When the function data is associated with dependent data, the call data is obtained by parsing the dependent data.
[0015] When the function data has no associated dependent data, the aggregated index is used to obtain the call data.
[0016] In one embodiment of the present invention, the step of obtaining the call data by parsing the dependency data when the function data is associated with dependency data includes:
[0017] When the function data is associated with dependent data, the call data is obtained by parsing the dependent data, and the attribute data of the dependent data is added to the test case.
[0018] In one embodiment of the present invention, after the step of saving the first attribute data and the second attribute data, denoted as the metadata of the test case, the method includes:
[0019] The test cases are executed and read;
[0020] Access the memory management file of the test case and parse the control data of the test case;
[0021] Update the metadata of the test case based on the control data.
[0022] In one embodiment of the present invention, the step of updating the metadata of the test case based on the control data includes:
[0023] Determine whether the control data is anchor object data;
[0024] When the control data is anchor object data, update the metadata of the test case;
[0025] When the control data is not anchor object data, maintain the metadata of the test case.
[0026] In one embodiment of the present invention, the step of accessing the memory management file of the test case and parsing the control data of the test case includes:
[0027] Based on the association between the test cases and the dependent data, access the memory management file of the test cases and parse the control data of the test cases.
[0028] In one embodiment of the present invention, the step of accessing the memory management file of the test case and parsing the control data of the test case based on the association between the test case and the dependency data includes:
[0029] When the test case is associated with the dependent data, the memory management file of the test case is accessed, and the control data of the test case is parsed.
[0030] When the test case is not associated with the dependent data, the attribute content of the semantic source code of the test case is parsed, the original test logic is executed through the original interpreter, the memory management file of the test case is accessed, and the control data of the test case is parsed.
[0031] The present invention also proposes a test case metadata processing apparatus, comprising:
[0032] The query unit is used to query the code data of test cases;
[0033] The extraction unit is used to extract function data of test cases from the code data based on preset collection information;
[0034] The first acquisition unit is used to acquire the call data associated with the function data;
[0035] The second acquisition unit is used to recursively acquire the dependency data associated with the function data and acquire the call relationship data between the dependency data and the call data;
[0036] The first recording unit is used to query the attribute data of the code data of the test case, and is denoted as the first attribute data;
[0037] The second recording unit is used to query the attribute data of the call data, the dependency data, and the call relationship data regarding the attribute, and is denoted as the second attribute data;
[0038] The storage unit is used to record the first attribute data and the second attribute data as metadata of the test case, and to attach the metadata to the memory where the test case is located.
[0039] The present invention also proposes a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of a test case metadata processing method as described above.
[0040] The present invention also proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of a test case metadata processing method as described in any of the preceding claims.
[0041] As described above, the method, apparatus, device, and medium for processing test case metadata of the present invention have the following beneficial effects: they can automatically acquire the metadata information of test cases and improve the information entropy of test cases. Attached Figure Description
[0042] Figure 1 The diagram shown is a flowchart illustrating a method for processing test case metadata according to the present invention.
[0043] Figure 2 Displayed as Figure 1 A flowchart of step S30.
[0044] Figure 3 This is another flowchart illustrating a method for processing test case metadata according to the present invention.
[0045] Figure 4 Displayed as Figure 3 A flowchart of step S820.
[0046] Figure 5 Displayed as Figure 3 A flowchart of step S830.
[0047] Figure 6 The diagram shown is a structural schematic of a test case metadata processing device according to the present invention.
[0048] Figure 7 The diagram shown is a structural schematic of a computer device according to the present invention. Detailed Implementation
[0049] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features can be combined with each other. It should also be understood that the terminology used in the embodiments of the present invention is for describing specific implementation schemes and not for limiting the scope of protection of the present invention. Test methods in the following embodiments that do not specify specific conditions are generally performed under conventional conditions or according to the conditions recommended by the respective manufacturers.
[0050] Please see Figures 1 to 7 It should be understood that the structures, proportions, sizes, etc., illustrated in the accompanying drawings are merely for illustrative purposes to aid those skilled in the art and to facilitate understanding. They are not intended to limit the scope of the invention and therefore have no substantial technical significance. Any modifications to the structure, changes in proportions, or adjustments to size, without affecting the effectiveness or purpose of the invention, should still fall within the scope of the technical content disclosed herein. Furthermore, the terms "upper," "lower," "left," "right," "middle," and "one" used in this specification are merely for clarity and not intended to limit the scope of the invention. Changes or adjustments to their relative relationships, without substantially altering the technical content, should also be considered within the scope of the invention.
[0051] Please see Figure 1 This invention provides a method for processing test case source data, applicable to automated testing and precision testing. It allows for the automatic acquisition of test case metadata without running all test cases during test case selection. This invention improves the information entropy of test cases, enabling the acquisition, parsing, and storage of metadata without the need for an external database system. Detailed descriptions are provided below using specific embodiments. This invention proposes a method for processing test case source data, which may include the following steps.
[0052] S10, Query the code data of the test cases.
[0053] S20. Based on the preset collected information, extract the function data of the test cases from the code data.
[0054] S30. Obtain the call data of the function data association index.
[0055] S40. Recursively obtain the dependency data of the function data association dependency relationship, and obtain the call relationship data between the dependency data and the call data.
[0056] S50. Query the attribute data of the code data of the test case, and denot it as the first attribute data.
[0057] S60. Query the attribute data of the call data, the dependency data and the call relationship data about the attribute, and denot it as the second attribute data.
[0058] S70. Record the first attribute data and the second attribute data as the metadata of the test case, and attach the metadata to the memory where the test case is located.
[0059] S10, Query the code data of the test cases.
[0060] In some embodiments, a test case refers to a description of a testing task for a specific software product, embodying the test plan, methods, techniques, and strategies. The content of a test case may include test objectives, test environment, input data, test steps, expected results, test scripts, etc., ultimately forming a document. For example, a test case is a set of test inputs, execution conditions, and expected results compiled for a specific objective to verify whether a specific software requirement is met. Code is a source file written by programmers using a language supported by development tools; it is a set of explicit rules representing information in discrete form using characters, symbols, or signal elements. Principles of code design include uniqueness, standardization and universality, extensibility and stability, ease of identification and memorization, brevity and uniform formatting, and ease of modification. Source code (also called source program) refers to an uncompiled text file written according to a certain programming language specification; it is a series of human-readable computer language instructions. Source code is a branch of code; in a sense, source code is equivalent to code. The code data in the test cases is queried and recorded.
[0061] S20. Based on the preset collected information, extract the function data of the test cases from the code data.
[0062] In some embodiments, the computer's function data is a fixed program segment, or subroutine, which performs a fixed operation and has an entry point and an exit point. The entry point consists of the function's parameters; these parameters are substituted into the subroutine for computer processing. The exit point is the function's value, which is returned to the calling program after being calculated by the computer. Collection rules can be pre-defined, and function data can be extracted from the code data if these rules are met.
[0063] S30. Obtain the call data of the function data association index.
[0064] In some embodiments of a relational database, an index is a separate, physical storage structure that sorts the values of one or more columns in a database table. It is a collection of values from one or more columns in a table and a corresponding list of logical pointers to the data pages in the table that physically identify those values. An index acts like a table of contents in a book, allowing you to quickly find the desired content by referring to page numbers. An index provides pointers to data values stored in specified columns of a table, and these pointers are then sorted according to a specified sort order. The database uses the index to find a specific value and then follows the pointers to find the row containing that value. This allows SQL (Structured Query Language) statements corresponding to the table to execute faster, providing quick access to specific information in the database table. Call data refers to one or more pages or files that are tagged across many pages on a website, which facilitates maintenance. After extracting function data for test cases from code data, call data associated with the function data index can be obtained.
[0065] S40. Recursively obtain the dependency data of the function data association dependency relationship, and obtain the call relationship data between the dependency data and the call data.
[0066] In some embodiments, dependency data is the relationship between data manifested through the equality or inequality of attribute values in a relation. Dependency data is an abstraction of the interrelationships between attributes in the real world and belongs to the inherent properties of data. For example, in computer science, dependency data refers to a state when program structure causes data to reference previously processed data. In compiler theory, dependency data is part of data analysis. After obtaining the call data of the function data association index, further dependency data of the function data association dependency relationship, and call relationship data between dependency data and call data can be obtained.
[0067] S50. Query the attribute data of the code data of the test case, and denot it as the first attribute data.
[0068] In some embodiments, a specific thing or data information has many properties and relationships. These properties and relationships are called the attributes of the thing. Data and attributes are inseparable; all data has attributes, and all attributes are attributes of data. The similarity or difference between one piece of data and another piece of data is the similarity or difference between the attributes of one piece of data and the attributes of another piece of data. Query the attribute data of the code data in the test case and record it as the first attribute data.
[0069] S60. Query the attribute data of the call data, the dependency data and the call relationship data about the attribute, and denot it as the second attribute data.
[0070] In some embodiments, attribute data from the call data, dependency data, and call relationship data are queried and denoted as second attribute data. By denoting the attribute data of the code data in the test case as first attribute data and the attribute data from the call data, dependency data, and call relationship data as second attribute data, the information entropy carried by the test case can be increased. Information entropy is a fundamental concept in information theory, which refers to the average amount of information after eliminating redundancy.
[0071] S70. Record the first attribute data and the second attribute data as the metadata of the test case, and attach the metadata to the memory where the test case is located.
[0072] In some embodiments, the first attribute data and the second attribute data are saved and recorded as the metadata of the test case. The metadata is attached to the memory where the test case resides. The storage of metadata does not require external storage media, facilitating fast querying and searching of metadata, and also supports persistence to a database. This achieves object instantiation of the test case by encapsulating the attribute data of the code data, call data, dependency data, and call relationship data in the test case. This improves the information entropy of the test case and allows for automatic acquisition, parsing, and storage of metadata in the test case for evaluation. Metadata is data about data, mainly describing data attributes, used to support functions such as indicating storage location, historical data, resource lookup, and file records. Metadata is a type of electronic catalog used to describe and collect the content or characteristics of data for the purpose of cataloging, thereby assisting in data retrieval.
[0073] Please see Figure 2 The diagram shows the flowchart of the steps for obtaining the call data associated with the function data index according to the present invention. In some embodiments, step S301 can be executed first to determine whether the function data is associated with dependent data. When the function data is associated with dependent data, step S303 can be executed to obtain the call data by parsing the dependent data, for example, through an AST (Abstract Syntax Tree). When the function data is not associated with dependent data, step S302 can be executed to summarize the index to obtain the call data.
[0074] Please see Figure 3The diagram illustrates the steps of updating test case metadata according to the present invention. In some embodiments, in step S70, the first attribute data and the second attribute data are recorded as the test case metadata, and the metadata is attached to the memory where the test case resides. Then, step S810 is executed to read the test case. Next, step S820 is executed to access the test case's memory management file and parse the test case's control data. A control is an encapsulation of data and methods. A control has its own attributes and methods. Attributes are simple accessors to control data, while methods are simple and visible functions of the control. The control creation process includes design, development, debugging, and then the use of the control. Memory management refers to the technology of allocating and using computer memory resources during software runtime. The primary purpose of memory management is to allocate memory resources efficiently and quickly, and to release and reclaim memory resources at appropriate times. Then, step S830 is executed to update the test case metadata based on the control data.
[0075] Please see Figure 4 The flowchart shown illustrates the steps of this invention regarding whether a test case is associated with dependent data. In some embodiments, step S821 can be executed first to determine whether a test case is associated with dependent data. When a test case is associated with dependent data, step S823 can be executed to access the memory management file of the test case and parse the control data of the test case. When a test case is not associated with dependent data, step S822 can be executed to parse the attribute content of the semantic source code of the test case, execute the original test logic through the original interpreter, access the memory management file of the test case, and parse the control data of the test case.
[0076] Please see Figure 5 The diagram shows a flowchart illustrating the steps of determining whether control data is anchor object data according to the present invention. In some embodiments, step S831 can be executed first to determine whether the control data is anchor object data. Next, when the control data is anchor object data, step S833 can be executed to update the metadata of the test case. When the control data is not anchor object data, step S832 can be executed to maintain the metadata of the test case. Anchors are a type of hyperlink in web page creation, acting as a quick locator; they are a type of hyperlink within a page and are widely used. Named anchors can be used to set markers in a document, typically placed at a specific topic or at the top of the document. Links to these named anchors can then be created, quickly taking visitors to a designated location.
[0077] Please see Figure 6The diagram shows a structural schematic of a test case metadata processing device according to the present invention. In some embodiments, the test case metadata processing device may include a monitoring unit 101, a first acquisition unit 102, a query unit 103, a second acquisition unit 104, a storage unit 105, an extraction unit 106, and a storage unit 107. The query unit 101 is used to query the code data of the test case. The extraction unit 102 is used to extract the function data of the test case from the code data according to preset collection information. The first acquisition unit 103 is used to acquire the call data associated with the function data. The second acquisition unit 104 is used to acquire the dependency data associated with the function data and the call relationship data between the dependency data and the call data. The first recording unit 105 is used to query the attribute data of the code data of the test case, denoted as first attribute data. The second recording unit 106 is used to query the attribute data of the call data, the dependency data, and the call relationship data regarding attributes, denoted as second attribute data. The storage unit 107 is used to record the first attribute data and the second attribute data as the metadata of the test case and attach the metadata to the memory where the test case is located.
[0078] Please see Figure 7 The diagram illustrates a structural schematic of a computer device according to an embodiment of the present invention. In one embodiment, a computer device 200 is provided, which may be a server. The computer device 200 includes a processor 201, a memory 202, a network interface 204, and a database connected via a system bus. The processor 201 of the computer device 200 provides computing and control capabilities. The memory 202 of the computer device 200 includes a non-volatile and / or volatile storage medium and internal memory 203. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device 200 is used to communicate with external clients via a network connection. When the computer program is executed by the processor, it implements the functions or steps of a test case metadata processing method on the server side.
[0079] In one embodiment, a computer device 200 is provided, including a memory 202, a processor 201, and a computer program stored in the memory and executable on the processor. When the processor 201 executes the computer program, it performs the following steps:
[0080] The test case code data is queried; based on preset collected information, the function data of the test case is extracted from the code data; the call data associated with the function data is obtained; the dependency data associated with the function data and the call relationship data between the dependency data and the call data are obtained; the attribute data of the code data of the test case is queried and recorded as the first attribute data; the attribute data of the call data, the dependency data and the call relationship data about the attribute are queried and recorded as the second attribute data; and the first attribute data and the second attribute data are recorded as the metadata of the test case, and the metadata is attached to the memory where the test case is located.
[0081] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0082] The test case code data is queried; based on preset collected information, the function data of the test case is extracted from the code data; the call data associated with the function data is obtained; the dependency data associated with the function data and the call relationship data between the dependency data and the call data are obtained; the attribute data of the code data of the test case is queried and recorded as the first attribute data; the attribute data of the call data, the dependency data and the call relationship data about the attribute are queried and recorded as the second attribute data; and the first attribute data and the second attribute data are recorded as the metadata of the test case, and the metadata is attached to the memory where the test case is located.
[0083] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0084] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0085] In summary, this invention can automatically acquire metadata information of test cases, thereby improving the information entropy of test cases. Therefore, this invention effectively overcomes the various shortcomings of existing technologies and has high industrial application value.
[0086] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.
Claims
1. A method of processing test case metadata, characterized by, The method comprises the following steps: querying code data of a test case; extracting function data of the test case from the code data according to preset collection information; obtaining calling data associated with the function data; obtaining dependency data associated with the function data, and recursively obtaining calling relationship data between the dependency data and the calling data; querying attribute data of the code data of the test case, denoted as first attribute data; querying attribute data of the calling data, the dependency data and the calling relationship data, denoted as second attribute data; and attaching the first attribute data and the second attribute data to metadata of the test case, and attaching the metadata to a memory where the test case is located. The step of obtaining the calling data associated with the function data comprises the following steps: determining whether the function data is associated with dependency data; when the function data is associated with dependency data, obtaining calling data by performing syntax analysis on the dependency data, and adding attribute data of the dependency data to the test case; when the function data is not associated with dependency data, aggregating indexes to obtain calling data.
2. The method of claim 1, wherein, After the step of attaching the first attribute data and the second attribute data to the metadata of the test case, and attaching the metadata to the memory where the test case is located, the method comprises the following steps: performing execution reading on the test case; accessing a memory management file of the test case, and analyzing control data of the test case; updating the metadata of the test case according to the control data.
3. The method of claim 2, wherein, The step of updating the metadata of the test case according to the control data comprises the following steps: determining whether the control data is anchor object data; when the control data is anchor object data, updating the metadata of the test case; when the control data is not anchor object data, maintaining the metadata of the test case.
4. The method of claim 2, wherein, The step of accessing the memory management file of the test case, and analyzing the control data of the test case comprises the following step: according to an association relationship between the test case and the dependency data, accessing the memory management file of the test case, and analyzing the control data of the test case.
5. The method of claim 4, wherein, The step of accessing the memory management file of the test case, and analyzing the control data of the test case according to the association relationship between the test case and the dependency data comprises the following steps: when the test case is associated with the dependency data, accessing the memory management file of the test case, and analyzing the control data of the test case; when the test case is not associated with the dependency data, analyzing attribute content of semanticized source code of the test case, executing original test logic by means of an original interpreter, accessing the memory management file of the test case, and analyzing the control data of the test case.
6. An apparatus for processing test case metadata, the apparatus comprising: The method comprises the following steps: a querying unit configured to query code data of a test case; an extracting unit configured to extract function data of the test case from the code data according to preset collection information; a first obtaining unit configured to obtain calling data associated with the function data; a second obtaining unit configured to obtain dependency data associated with the function data, and recursively obtain calling relationship data between the dependency data and the calling data; a second obtaining unit, configured to recursively obtain dependent data associated with the function data, and obtain calling relationship data between the dependent data and the calling data; a first recording unit, configured to query attribute data of the code data of the test case, denoted as first attribute data; a second recording unit, configured to query attribute data of the calling data, the dependent data and the calling relationship data, denoted as second attribute data; a saving unit, configured to record the first attribute data and the second attribute data as metadata of the test case, and attach the metadata to a memory where the test case is located; wherein the step of obtaining the calling data of the function data association index comprises: judging whether the function data is associated with dependent data; when the function data is associated with dependent data, obtaining calling data by performing syntax analysis on the dependent data, and adding attribute data of the dependent data to the test case; when the function data is not associated with dependent data, aggregating indexes to obtain calling data. a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor executes the computer program to implement the steps of the test case metadata processing method according to any one of claims 1 to 5.
7. A computer device, comprising: The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the test case metadata processing method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that,
Citation Information
Patent Citations
Test case generation method and device, electronic device and readable storage medium
CN111611152A
Software regression test system, regression test program and regression test method
JP2008204405A