Test method, electronic equipment and medium

By dynamically adjusting the bidirectional mapping relationship between code segments and test cases, the problem of inaccurate mapping in traditional testing methods is solved, and more efficient and accurate test result output is achieved. It is suitable for scenarios such as financial risk control, e-commerce inventory, and medical diagnosis.

CN120610902AActive Publication Date: 2025-09-09HANGZHOU PINGPONG INTELLIGENT TECH CO LTD
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202511114457.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-11
Publication Date
2025-09-09
Estimated Expiration
2045-08-11

AI Technical Summary

Technical Problem

In traditional testing methods, the mapping between test cases and code segments is inaccurate, resulting in inaccurate test results and incomplete test coverage, which especially affects the project development progress in scenarios with frequent code changes and requirement changes.

Method used

By dynamically adjusting the bidirectional mapping relationship between code segments and test cases, the mapping relationship is updated in real time, the matching objects are determined according to the correlation characteristics of the code segments and test cases, a target mapping relationship is formed, and the test cases are executed to output the test results.

Benefits of technology

It improves the accuracy and efficiency of the testing method, ensures that the functions and performance of the code segment are fully covered, and provides complete test result backtracking data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120610902A_ABST
    Figure CN120610902A_ABST
Patent Text Reader

Abstract

The invention discloses a testing method, electronic equipment and a medium, and relates to the technical field of computers, the testing method comprises the steps that an initial mapping relation between a plurality of tested code segments and a plurality of test cases is obtained, and the test code segments and the test cases are objects of the initial mapping relation; under the condition that it is determined that the initial mapping relation is damaged, configuring an object which can be matched with the object which destroys the initial mapping relation to form an updated target mapping relation; and executing the test case in the target mapping relation, and outputting a test result. The method has the advantages of automatically updating the mapping relation between the test case and the code segment, improving the test coverage range and the test accuracy and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a testing method, electronic equipment and a medium. Background Art

[0002] Test cases are an effective means of verifying code functionality and performance. Code defects can be located by executing test cases and analyzing test results.

[0003] Traditional testing methods typically divide code into multiple independent code segments by function or module. For each code segment, test cases are designed, consisting of test items such as different inputs and coverage boundaries. The mapping between test cases and code segments is marked through annotations or configuration files. Test cases are loaded and run according to this mapping, and the corresponding test results are output. This testing approach has been widely used in scenarios such as financial risk control, e-commerce inventory management, and medical diagnosis.

[0004] However, traditional testing methods have the problem of inaccurate mapping between test cases and code segments, which in turn interferes with test results. Summary of the Invention

[0005] The present invention aims to, to a certain extent, address one of the technical problems in the related art. To this end, the present invention provides a testing method, an electronic device for executing the testing method, and a computer-readable medium, which have the advantages of automatically updating the mapping relationship between test cases and code segments, improving test coverage and test accuracy, etc.

[0006] In order to achieve the above object, as a first aspect of the present invention, a testing method is provided, wherein the method comprises: Obtaining an initial mapping relationship between a plurality of tested code segments and a plurality of test cases, wherein the tested code segments and the test cases are both objects of the initial mapping relationship; When it is determined that the initial mapping relationship has been destroyed, configuring an object that can match the object that destroyed the initial mapping relationship to form an updated target mapping relationship; Execute the test cases in the target mapping relationship and output the test results.

[0007] Optionally, the testing method further includes: Periodically check the flags of each code segment under test; In the case where there is an unmarked tested code segment, determining that the initial mapping relationship is destroyed; The step of configuring an object that can match the object that destroys the initial mapping relationship to form an updated target mapping relationship includes: Configure matching test cases for unlabeled tested code segments.

[0008] Optionally, the method further includes: When a change in the code segment is detected, determining that the initial mapping relationship is destroyed; The step of configuring an object that can match the object that destroys the initial mapping relationship to form an updated target mapping relationship includes: Identify the code segments associated with the changed code segment; Determine the test case that matches the changed code segment according to the initial mapping relationship; and the test case that matches the associated code segment; The initial mapping relationship is updated according to the changed code segments and their matching test cases, and the associated code segments and their matching test cases to form an updated target mapping relationship.

[0009] Optionally, determining the code segment associated with the changed code segment includes: Extracting feature information of the code segment after the change and feature information of the code segment before the change; Compare the feature information of the code segment after the change with the feature information of the code segment before the change to obtain a code change factor; When the code change factor is within a preset code change range, code segments associated with the changed code segment are determined within the code change range.

[0010] Optionally, the code segment change includes adding a new code segment, modifying a code segment, and deleting a code segment.

[0011] Optionally, the method further includes: When a change in the test case is detected, determining that the initial mapping relationship is destroyed; The step of configuring an object that can match the object that destroys the initial mapping relationship to form an updated target mapping relationship includes: Identify the test cases associated with the changed test case; Determine the code segments that match the changed test case according to the initial mapping relationship; and the code segments that match the associated test cases; The initial mapping relationship is updated according to the changed test case and its matching code segment, and the associated test case and its matching code segment to form an updated target mapping relationship.

[0012] Optionally, the changes to the test cases include adding new test cases, modifying test cases, and deleting test cases.

[0013] Optionally, executing the test cases in the target mapping relationship and outputting the test results includes: Obtaining execution process data of the test case in the target mapping relationship; Updating the execution process data to the attribute information of the target mapping relationship; Output test results.

[0014] As a second aspect of the present invention, there is provided an electronic device, comprising: one or more processors; A memory having one or more computer programs stored thereon, wherein when the one or more computer programs are executed by the one or more processors, the one or more processors implement the testing method provided according to the first aspect of the present invention.

[0015] In addition, as a third aspect of the present invention, a computer-readable medium is provided, on which a computer program is stored, wherein when the computer program is executed by a processor, the test method provided by the first aspect of the present invention is implemented.

[0016] The testing method provided by the present invention first obtains initial mapping relationships between multiple code segments and multiple test cases. If the initial mapping relationships are determined to be broken, matching objects are configured for the objects that broke the initial mapping relationships to form an updated target mapping relationship. The test cases in the target mapping relationships are then executed and test results are output. When a code segment changes, the code segment in the initial mapping relationship is used as a reference object. The associated code segment is determined based on the association characteristics between the initial mapping relationship and the code segment (such as call relationships and dependency chains). The corresponding test case is then determined based on the associated code segment and the initial mapping relationship. When a test case changes, the associated test case is determined based on the association characteristics between the test cases (such as coverage logic and input parameters). The corresponding code segment is then determined based on the associated test case and the initial mapping relationship. When neither the code segment nor the test case changes, the method self-checks the initial mapping relationship by periodically checking the tags of each tested code segment. When untagged code segments are detected, matching test cases are configured for the untagged code segments. The above three implementation methods are all used to form an updated target mapping relationship. In addition, during the execution of the test case of the target mapping relationship, the execution process data of the test case of the target mapping relationship (such as code execution location, test environment information) obtained is updated to the attribute information of the target mapping relationship, and the final output test results include code coverage.

[0017] The testing method provided by the present invention solves the problems of inaccurate mapping of test cases and code segments caused by frequent code changes, such as test case failure and missed tests, and frequent changes of test cases ignoring verification of code compatibility, in traditional methods, by dynamically adjusting the bidirectional mapping relationship between code segments and test cases. This not only improves the test scope of the entire testing method, but also improves the accuracy and testing efficiency of the testing method. In addition, by constructing and updating a multi-element mapping library (attribute information of the mapping relationship) of test cases, code segments and test environment information, complete backtracking data is provided for test result backtracking.

[0018] These features and advantages of the present invention will be further disclosed in the following detailed description and accompanying drawings. The preferred embodiments and means of the present invention will be fully illustrated in conjunction with the accompanying drawings, but are not intended to limit the technical solutions of the present invention. Furthermore, although multiple features, elements, and components may be present in each of the following text and accompanying drawings, they may be labeled with different symbols or numbers for convenience, but all represent components with the same or similar structure or function. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The present invention will be further described below in conjunction with the accompanying drawings: Figure 1 A flow chart of a testing method provided by the present invention; Figure 2 A flow chart of another embodiment of the testing method provided by the present invention; Figure 3 A flow chart of an implementation of step S120 of the testing method provided by the present invention; Figure 4 A flow chart of an implementation of step S122 of the testing method provided by the present invention; Figure 5 A flowchart of another embodiment of step S120 of the testing method provided by the present invention; Figure 6 A flow chart of an implementation of step S130 of the testing method provided by the present invention; Figure 7 A schematic diagram of the mutual calls between codes in the test method provided by the present invention; Figure 8 A schematic diagram of a mapping relationship between the test method code segments and test cases provided by the present invention; Figure 9 A module diagram of an electronic device provided by the present invention; Figure 10 A schematic diagram of a computer-readable medium provided by the present invention.

[0020] Description of Reference Numerals Among them, 101 is a processor; 102 is a memory; 103 is an I / O interface; and 104 is a bus. DETAILED DESCRIPTION

[0021] The following describes embodiments of the present invention in detail, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described in the embodiments are intended to explain the present invention and are not to be construed as limiting the present invention.

[0022] References in this specification to "one embodiment," "an example," or "an example" mean that a particular feature, structure, or characteristic described in connection with the embodiment itself can be included in at least one embodiment disclosed herein. The appearances of the phrase "in one embodiment" in various places in the specification are not necessarily all referring to the same embodiment.

[0023] Traditional testing methods rely on pre-establishing static associations between code segments and test cases through tools, and then executing test cases to verify the functionality and performance of the code segments. However, this testing method relies heavily on the accuracy of the association. When using tools to complete the association process, there are association defaults, resulting in incomplete initial mapping; or after the association process is completed, when the code segment changes, the corresponding test case needs to be re-labeled, resulting in a delay in test case updates; or the code segment is not adjusted in time with the change of the test case; all of these will lead to inaccurate mapping of test cases and code segments, resulting in incomplete test coverage and low test accuracy. Similarly, in development scenarios where requirements change frequently or customized / differentiated projects surge, traditional testing methods not only fail to obtain accurate test results, but also affect project development progress.

[0024] In view of this, in order to solve the problem of mismatch between code segments and test cases in traditional testing methods, as a first aspect of the present invention, a testing method is provided, such as Figure 1 As shown, the test method includes: In step S110, initial mapping relationships between a plurality of tested code segments and a plurality of test cases are obtained, wherein both the tested code segments and the test cases are objects of the initial mapping relationship; In step S120, when it is determined that the initial mapping relationship has been destroyed, an object that can match the object that destroyed the initial mapping relationship is configured to form an updated target mapping relationship; In step S130, the test cases in the target mapping relationship are executed and the test results are output.

[0025] The testing method provided by the present invention first obtains initial mapping relationships between multiple code segments and multiple test cases. If the initial mapping relationships are determined to be broken, matching objects are configured for the objects that broke the initial mapping relationships to form an updated target mapping relationship. The test cases in the target mapping relationships are then executed and test results are output. When a code segment changes, the code segment in the initial mapping relationship is used as a reference object. The associated code segment is determined based on the association characteristics between the initial mapping relationship and the code segment (such as call relationships and dependency chains). The corresponding test case is then determined based on the associated code segment and the initial mapping relationship. When a test case changes, the associated test case is determined based on the association characteristics between the test cases (such as coverage logic and input parameters). The corresponding code segment is then determined based on the associated test case and the initial mapping relationship. When neither the code segment nor the test case changes, the method self-checks the initial mapping relationship by periodically checking the tags of each tested code segment. When untagged code segments are detected, matching test cases are configured for the untagged code segments. The above three implementation methods are all used to form an updated target mapping relationship. In addition, during the execution of the test case of the target mapping relationship, the execution process data of the test case of the target mapping relationship (such as code execution location, test environment information) obtained is updated to the attribute information of the target mapping relationship, and the final output test results include code coverage.

[0026] The testing method provided by the present invention solves the problems of inaccurate mapping of test cases and code segments caused by frequent code changes, such as test case failure and missed tests, and frequent changes of test cases ignoring verification of code compatibility, in traditional methods, by dynamically adjusting the bidirectional mapping relationship between code segments and test cases. This not only improves the test scope of the entire testing method, but also improves the accuracy and testing efficiency of the testing method. In addition, by constructing and updating a multi-element mapping library (attribute information of the mapping relationship) of test cases, code segments and test environment information, complete backtracking data is provided for test result backtracking.

[0027] The initial mapping relationships are obtained through manual labeling. First, code sections are marked by defining annotations (such as @TestScenario) to associate business scenarios. The annotations are then parsed to generate mappings between test cases and code sections. Annotations can define multiple dimensions. For example, in the cross-border payment sector, annotations can include business dimensions (including module, transaction type, and business scenario), technical dimensions (including relevant channels, terminal types, and data structures), and quality dimensions (including test level, risk level, and defect type). For example, a test case can be tagged with custom annotations such as [Module] [Related Channel] [Transaction Type] [Card Type] [Transaction Currency] [Transaction Status], resulting in [Transaction Module] [Citibank Channel] [Authorized Transaction] [Physical Credit Card] [USD] [Authorization Failed]. The unique identifier of the test case can also be used as a label.

[0028] The mapping relationship mentioned above includes a forward mapping relationship (test cases mapped according to code changes) and a reverse mapping relationship (code segments mapped according to test case changes). In actual application scenarios, the code segments that implement various functional modules are not independent, so there is an association relationship between code segments (such as code segment A calls code segment B, code segment D, code segment E, and code segment F are on a dependency chain and together constitute a functional module), and test cases are not independent, such as test case A and test case B include common input parameters, and test case C and test case D need to be executed in series. Inevitably, since the definition annotations are done manually, the initial mapping relationship obtained may have default situations, such as isolated test cases, that is, the test case has no corresponding executable code segment, or the code segment is isolated, that is, the code segment has no corresponding test case to verify its function and performance. In order to avoid the problem of inaccurate mapping of this initial mapping relationship, the test method provided by the present invention can start self-checking when no code change information or test case change information is detected, so as to update the initial mapping relationship and obtain the target test case. The self-checking method is executed periodically, as an optional implementation method, such as Figure 2 As shown, the method further includes: In step S110, initial mapping relationships between a plurality of tested code segments and a plurality of test cases are obtained, wherein both the tested code segments and the test cases are objects of the initial mapping relationship; In step S120, the flags of each tested code segment are periodically checked; In step S130, if there is an unmarked code segment under test, it is determined that the initial mapping relationship is destroyed; In step S140 , a matching test case is configured for the unmarked tested code segment.

[0029] It should be noted that the self-check method is performed periodically, and the corresponding self-check period can be set according to actual testing requirements. In scenarios where frequent checks are required, the self-check period can be set to 10 seconds, 30 seconds, or 60 seconds. In scenarios where frequent checks are not required, the self-check period can be set to 5 minutes, 8 minutes, or 10 minutes.

[0030] The dynamic adjustment of the bidirectional initial mapping relationship between the code segment and the test case proposed by the present invention can also be started when a change is received. First, the forward mapping relationship is described in detail. When a change is detected in the code segment, the forward mapping relationship is adjusted. As another implementation method of step S120, Figure 3 As shown, the method further includes: In step S121, when a change in the code segment is detected, it is determined that the initial mapping relationship is destroyed; In step S122, a code segment associated with the changed code segment is determined; In step S123, the test case matching the changed code segment and the test case matching the associated code segment are determined according to the initial mapping relationship; In step S124 , the initial mapping relationship is updated according to the changed code segment and its matching test case, and the associated code segment and its matching test case, to form an updated target mapping relationship.

[0031] It should be noted that code segments must be associated with each other. Code segments do not strictly represent all the codes in the test method divided into pieces according to a certain method. They only represent a certain range of the complete code, and this range is associated with the test case. For example, lines 100 to 500 (code segment) in the complete code correspond to the test case of a certain scenario.

[0032] Detecting code segment changes can be done not only through direct analysis of the operation log parameters of existing version control systems, such as the distributed version control system Git and centralized version control systems (SVN, Subversion), but also by regularly comparing the current code with saved historical code snapshots. Using detection and recognition algorithms, we can determine whether the code content has changed and the type of change, such as new code additions, code modifications, and code deletions. Code changes include, but are not limited to, adding new code segments, adding content within a specific code segment, modifying content within a specific code segment, deleting code segments, and deleting content within a specific code segment.

[0033] When a code segment change is detected, due to the calling and being-called relationship between code segments (i.e., the output of code segment A is the input of code segment B, and vice versa), all associated code segments in the entire code that are associated with the changed code segment can be determined based on this relationship. All detected associated code segments (including the changed code segment) are then sequentially mapped to their matching test cases using the initial mapping relationship. It should be noted that the matched test cases can be a test case set consisting of multiple test cases. This testing method ensures that the functionality and performance of all code segments associated with a changed code segment are tested, thereby improving the accuracy and coverage of the testing method.

[0034] In order to avoid the influence of redundant code segments on the test results and further improve the accuracy and timeliness of the test method, as an optional implementation of step S122, Figure 4 As shown, the determining of the code segment associated with the changed code segment includes: In step S122a, feature information of the code segment after the change and feature information of the code segment before the change are extracted; In step S122b, the feature information of the code segment after the change is compared with the feature information of the code segment before the change to obtain a code change factor; In step S122c, when the code change factor is within a preset code change range, code segments associated with the changed code segment are determined within the code change range.

[0035] Steps S122a-S122c above aim to define a preset code change range before determining all associated code segments, thereby avoiding the association of redundant or invalid associated code segments. The characteristic information of a code segment includes, but is not limited to, the code name, class name within the code, number of lines of code, code annotations, one or a combination of code functions, etc. The code change factor reflects the amount of change before and after the code change. When the amount of change (code change factor) is large, the preset code change range is large; when the amount of change (code change factor) is small, the preset code change range is small.

[0036] Similarly, the above-mentioned determination of test cases based on the code change content and the initial mapping relationship is an incremental testing method. Only the corresponding test cases are determined for the changed content, and the functionality and performance of the changed code are verified by executing the corresponding test cases. This incremental testing method solves the problems of test redundancy and long test cycles that occur in the traditional full-scale testing method (executing all test cases).

[0037] In addition to the association between code segments, the initial mapping relationship also includes the association between test cases (e.g., test cases have the same parameters, test case A covers test case B). When a change in a test case is detected, the reverse mapping relationship is adjusted. As another implementation of step S120, Figure 5 As shown, the method further includes: In step S121, when a change in the test case is detected, it is determined that the initial mapping relationship is destroyed; In step S122, the test cases associated with the changed test case are determined; In step S123, the code segment matching the changed test case and the code segment matching the associated test case are determined according to the initial mapping relationship; In step S124 , the initial mapping relationship is updated according to the changed test case and its matching code segment, and the associated test case and its matching code segment, to form an updated target mapping relationship.

[0038] In order to improve the accuracy of the test method and prevent the occurrence of missed tests, the above steps S121-S124 illustrate that when a test case is changed, its associated test cases are re-determined based on the changed test case to re-verify the function and performance of the code segment. It should be explained in detail that the changed test case may be a single test case or multiple test cases. Due to the association relationship between test cases, the test case associated with the changed test case may be a single test case or multiple test cases. Changes to test cases include but are not limited to adding new test cases, modifying test cases, and deleting test cases. The above addition, modification, and deletion include but are not limited to performing the above operations on the input parameters of the test case. For example, Test1(a, b) indicates that the input parameters of the test case Test1 are a and b. When the input parameters of Test1(a, b) are added to Test1(a, b, c), it indicates that new input parameters are added (new test case is added); when the input parameters of Test1(a, b) are changed to Test1(a', b), it indicates that the input parameters are modified (the test case is modified); when the input parameters of Test1(a, b) are deleted to Test1(a), it indicates that the input parameters are deleted. When the entire test case Test1 is deleted, it indicates that the test case is deleted.

[0039] When determining target associated test cases, taking into account the timeliness of the test method and the utilization of computing resources, all associated test cases of the modified test case will be processed to obtain a precise range of target test cases. Similarly, determining associated test cases can include the following methods: Increasing the number of associated test cases when adding a new test case; decreasing the number of associated test cases when deleting a test case.

[0040] Further explaining steps S121-S124 in detail, first, all associated test cases of the changed test case are determined based on the associations between test cases (such as coverage logic and associated input parameters). The secondary screening of associated test cases is not performed sequentially, nor is it selectively performed one by one, which is related to the way the test case is changed. When a new input parameter is detected, it is necessary to test as many test cases as possible to verify the impact of the new input parameter on the test results from all aspects. Therefore, it is necessary to add associated test cases, and the added associated test cases and the test case with the changed configuration parameters are used as target test cases. When the deletion of an input parameter is detected, considering that the deleted input parameter has a low contribution to the test method, some associated test cases can be deleted, and the deleted associated test cases and the test case with the changed configuration parameters are used as target test cases. This can both ensure the coverage of the test method and improve test efficiency. In addition, when only the input parameters are modified, since the code segment corresponding to the test case has already been verified, the associated test cases before the test case with the changed configuration parameters are reused.

[0041] After the test case is determined, the updated target mapping relationship can be obtained by monitoring the execution of the test case and outputting the test result. As an optional implementation of step S130, Figure 6 As shown, executing the test cases in the target mapping relationship and outputting the test results include: In step S131, the execution process data of the test case in the target mapping relationship is obtained; In step S132, the execution process data is updated to the attribute information of the target mapping relationship; In step S133, the test result is output.

[0042] The execution process data also includes code location information and test environment information. Methods for obtaining the corresponding code location (including but not limited to code line number, code start coordinate location, and code end coordinate location) during the execution of the target test case include but are not limited to JaCoCo bytecode instrumentation technology. Bytecode instrumentation technology can be used to track the number of code lines executed. Based on the code location during the test case execution, the relationship between the code location (including code segment) and the test case is obtained, and this relationship is updated into a mapping relationship. After the test case execution is completed, all pending mapping relationships are updated. For example, when executing a test case labeled [Transaction Module][Citibank Channel][Authorization Transaction][Physical Credit Card][US Dollar][Authorization Failed], the JaCoCo-colored code segment is A. The mapping relationship A-[Transaction Module][Citibank Channel][Authorization Transaction][Physical Credit Card][US Dollar][Authorization Failed] is saved and updated. During the execution process, the executed code segment can also be colored using a coloring model to improve the tester's understanding of the test method process. The output test results should be detailed, including but not limited to test case identification information, code coverage data, etc.

[0043] Test environment information includes, but is not limited to, test code version information, test equipment name, test platform information, and test logs. To better track test results, reproduce them, or analyze the causes of performance indicators in test results, after updating the mapping between test cases and code segments, this test environment information needs to be stored in the mapping's attribute information. As an optional implementation, a multi-dimensional mapping library of test cases, code segments, and test environment information can be constructed using a knowledge graph or graph data approach.

[0044] The above shows that, in addition to starting execution when a change is detected, the entire method can also periodically detect whether there is a mapping mismatch problem in the mapping relationship. If there is a mapping mismatch problem, the mapping relationship is updated according to the execution result.

[0045] The testing method provided by the present invention solves the problems of inaccurate mapping of test cases and code segments caused by frequent code changes, such as test case failure and missed tests, and frequent changes of test cases ignoring verification of code compatibility, in traditional methods, by dynamically adjusting the bidirectional mapping relationship between code segments and test cases. This not only improves the test scope of the entire testing method, but also improves the accuracy and testing efficiency of the testing method. In addition, by constructing and updating a multi-element mapping library (attribute information of the mapping relationship) of test cases, code segments and test environment information, complete backtracking data is provided for test result backtracking. Figure 7A schematic diagram of mutual calls between code segments is given. The output of code segment A is the input of code segments B and C; the input of code segment C depends on the output of code segments A and D. Figure 8 A schematic diagram of the mapping relationship between code segments and test cases is given. Code segments and test cases do not have a one-to-one correspondence. There may be cases where one code segment requires two test cases or one test case can be used to test two code segments.

[0046] As a second aspect of the present invention, there is provided an electronic device, such as Figure 9 Shown, including: One or more processors 101; The memory 102 stores one or more computer programs. When the one or more computer programs are executed by the one or more processors 101, the one or more processors 101 implement the testing method provided according to the first aspect of the present invention.

[0047] The tool may further include one or more I / O interfaces 103 connected between the processor 101 and the memory 102 and configured to implement information exchange between the processor 101 and the memory 102 .

[0048] Among them, the processor 101 is a device with data processing capabilities, including but not limited to the central processing unit 101 (CPU); the first memory 102 is a device with data storage capabilities, including but not limited to random access memory 102 (RAM, more specifically such as SDRAM, DDR, etc.), read-only memory 102 (ROM), electrically erasable programmable read-only memory 102 (EEPROM), flash memory (FLASH); the I / O interface 103 (read-write interface) is connected between the processor 101 and the memory 102, and can realize information exchange between the processor 101 and the memory 102, including but not limited to the data bus 104 (Bus), etc.

[0049] In some embodiments, the processor 101 , the memory 102 , and the I / O interface 103 are connected to each other via a bus 104 , and further connected to other components of the computing device.

[0050] In addition, as a third aspect of the present invention, a computer readable medium is provided, on which a computer program is stored. Figure 10 As shown, when the computer program is executed by a processor, the credit testing method provided by the first aspect of the present invention is implemented.

[0051] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program. Accordingly, the computer program can be stored in a non-volatile computer-readable storage medium, and when the computer program is executed, it can implement the method of any of the above-mentioned embodiments. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double 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.

[0052] The above are only specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Those skilled in the art should understand that the present invention includes but is not limited to the contents described in the drawings and the above specific embodiments. Any modifications that do not deviate from the functional and structural principles of the present invention are intended to be included within the scope of the claims.

Claims

1. A testing method, characterized in that: The test method includes: Obtaining an initial mapping relationship between a plurality of tested code segments and a plurality of test cases, wherein the tested code segments and the test cases are both objects of the initial mapping relationship; When it is determined that the initial mapping relationship has been destroyed, configuring an object that can match the object that destroyed the initial mapping relationship to form an updated target mapping relationship; Execute the test cases in the target mapping relationship and output the test results.

2. The testing method according to claim 1, wherein: The test method further comprises: Periodically check the flags of each code segment under test; In the case where there is an unmarked tested code segment, determining that the initial mapping relationship is destroyed; The step of configuring an object that can match the object that destroys the initial mapping relationship to form an updated target mapping relationship includes: Configure matching test cases for unlabeled tested code segments.

3. The testing method according to claim 1, wherein: The method further comprises: When a change in the code segment is detected, determining that the initial mapping relationship is destroyed; The step of configuring an object that can match the object that destroys the initial mapping relationship to form an updated target mapping relationship includes: Identify the code segments associated with the changed code segment; Determine the test case that matches the changed code segment according to the initial mapping relationship; and the test case that matches the associated code segment; The initial mapping relationship is updated according to the changed code segments and their matching test cases, and the associated code segments and their matching test cases to form an updated target mapping relationship.

4. The testing method according to claim 3, wherein: The determining of the code segment associated with the changed code segment includes: Extracting feature information of the code segment after the change and feature information of the code segment before the change; Compare the feature information of the code segment after the change with the feature information of the code segment before the change to obtain a code change factor; When the code change factor is within a preset code change range, code segments associated with the changed code segment are determined within the code change range.

5. The testing method according to claim 4, characterized in that: The code segment changes include adding a new code segment, modifying a code segment, and deleting a code segment.

6. The testing method according to claim 1, wherein: The method further comprises: When a change in the test case is detected, determining that the initial mapping relationship is destroyed; The step of configuring an object that can match the object that destroys the initial mapping relationship to form an updated target mapping relationship includes: Identify the test cases associated with the changed test case; Determine the code segments that match the changed test case according to the initial mapping relationship; and the code segments that match the associated test cases; The initial mapping relationship is updated according to the changed test case and its matching code segment, and the associated test case and its matching code segment to form an updated target mapping relationship.

7. The testing method according to claim 6, characterized in that: The test case changes include adding new test cases, modifying test cases, and deleting test cases.

8. The testing method according to claim 1, wherein: The executing the test cases in the target mapping relationship and outputting the test results includes: Obtaining execution process data of the test case in the target mapping relationship; Updating the execution process data to the attribute information of the target mapping relationship; Output test results.

9. An electronic device, characterized in that: include: one or more processors; A memory having one or more computer programs stored thereon, wherein when the one or more computer programs are executed by the one or more processors, the one or more processors implement the testing method according to any one of claims 1 to 8.

10. A computer-readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the testing method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Testing mapping relation database generation method and device, computer equipment and storage medium

    CN108874661A

  • Regression test case selection method and device, terminal and storage medium

    CN109446097A

  • Application test method and device, equipment and storage medium

    CN112131114A

  • Interface test method, device and equipment in code iterative update

    CN113626325A

  • Test case knowledge base construction method and device, electronic equipment and storage medium

    CN113704094A