CN113568833A - Test case determination method and device, computer equipment and readable storage medium - Google Patents

Test case determination method and device, computer equipment and readable storage medium Download PDF

Info

Publication number
CN113568833A
CN113568833A CN202110857314.3A CN202110857314A CN113568833A CN 113568833 A CN113568833 A CN 113568833A CN 202110857314 A CN202110857314 A CN 202110857314A CN 113568833 A CN113568833 A CN 113568833A
Authority
CN
China
Prior art keywords
code
codes
test case
change
acquiring
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110857314.3A
Other languages
Chinese (zh)
Inventor
林丰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen TCL New Technology Co Ltd
Original Assignee
Shenzhen TCL New Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen TCL New Technology Co Ltd filed Critical Shenzhen TCL New Technology Co Ltd
Priority to CN202110857314.3A priority Critical patent/CN113568833A/en
Publication of CN113568833A publication Critical patent/CN113568833A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Abstract

The embodiment of the application discloses a method and a device for determining a test case, computer equipment and a readable storage medium; for each change code, acquiring an affected code corresponding to each change code according to a preset analysis algorithm; acquiring an affected code corresponding to each change code and a requirement identity corresponding to each change code; determining a plurality of test cases corresponding to each demand identity according to the binding relationship between the demand identity and the test cases; mixing the test case sets corresponding to each change code in the change codes to obtain a primary selection test case set; and processing the primarily selected test case set according to the times of the test cases appearing in the primarily selected test case set and the labels of the test cases to obtain a finally selected test case set. The change codes and the affected codes are utilized, and the occurrence times and the labels of the test cases are utilized to obtain a final selection test case set, so that the fineness and the accuracy can be improved.

Description

Test case determination method and device, computer equipment and readable storage medium
Technical Field
The application relates to the technical field of testing, in particular to a method and a device for determining a test case, computer equipment and a readable storage medium.
Background
In the test and verification stage of product development, a product with a changed requirement (i.e., a code for realizing a certain requirement is changed) is usually tested. During testing, the design and selection of test cases are required. However, most of the work in the test case selection process depends on manual completion, and the selection is easy to miss.
In the prior art, in order to reduce the occurrence of selection omission, a common mother library of test cases is usually established, a test design can be made in advance by a professional, and specific testers only need to extract the cases when using the common mother library. However, since the common mother library is a general-purpose mother library, the product cannot be accurately and finely tested.
Disclosure of Invention
The embodiment of the application provides a method and a device for determining a test case, a computer device and a readable storage medium, which can solve the problem that the selection of the test case is not accurate and detailed enough.
The embodiment of the application provides a test case determining method, which is used for determining test cases corresponding to a plurality of modified codes, wherein the modified codes are modified based on the same requirement change, and the method comprises the following steps: for each change code in the plurality of change codes, acquiring an affected code corresponding to each change code according to a preset analysis algorithm, wherein the affected code and the change code have an association relation; acquiring an affected code corresponding to each change code and a requirement identity corresponding to each change code, wherein the requirement identity reflects the requirement of corresponding code implementation; determining a plurality of test cases corresponding to each demand identity according to the binding relationship between the demand identity and the test cases, wherein the test cases are test case sets corresponding to the changed codes; mixing the test case sets corresponding to each change code in the change codes to obtain a primary selection test case set; and processing the primarily selected test case set according to the times of the test cases appearing in the primarily selected test case set and the labels of the test cases to obtain a finally selected test case set.
In the above embodiment, when the requirement changes, in order to adapt to the changed requirement, a plurality of codes of the original code need to be changed, so that a plurality of changed codes appear. For each change code in the plurality of change codes, the corresponding affected code can be obtained according to a preset analysis algorithm. And then acquiring a requirement identity corresponding to the changed code and a requirement identity corresponding to the affected code. Usually, one requirement identity corresponds to a plurality of test cases, and the modified code and the affected code correspond to a plurality of requirement identities and a greater number of test cases, which can be recorded as a test case set corresponding to one modified code. And mixing the test case sets corresponding to the change codes to obtain the initially selected test case set. And acquiring a final test case set according to the initial test case set according to the occurrence times and the labels of the test cases. Due to the process of obtaining the final selection test case set, the change codes and the affected codes affected by the change codes are utilized, so that the detail of the final selection test case set can be improved; and screening the primarily selected test case set by using the occurrence times of the test cases and the labels to obtain a finally selected test case set, so that the accuracy of the finally selected test case set is improved.
Optionally, the obtaining of the affected code corresponding to each change code according to a preset analysis algorithm includes: acquiring all other codes under the class of the change code; acquiring a subclass of the class where the change code is located, wherein a function method in the subclass inherits the function method of the class where the change code is located; acquiring all codes under the subclasses; and recording all other codes under the class of the change codes and all codes under the subclasses as the affected codes.
In the above embodiments, according to the programming concept, the code always belongs to a certain method of a certain class, so when a certain code is changed, other codes of the same class are usually affected; meanwhile, the subclass (i.e., inheritance class) of the class to which the modification code belongs is also affected, so that all other codes in the class to which the modification code belongs and all codes in the subclass can be marked as affected codes, and the coverage of the affected codes can be improved as much as possible.
Optionally, the obtaining of the affected code corresponding to each change code according to a preset analysis algorithm includes: acquiring all calling chains where the change codes are located; and acquiring all codes on each call chain in all call chains, and recording the codes as the affected codes.
In the above embodiment, an entry function may directly or indirectly call codes of each of the other modules, and implement completion of a plurality of different service logics through different call orders and call times. Therefore, the module where the modified code is located may be covered by one or more call chains, and when the code is changed, other codes on the one or more call chains may be affected, so that all codes on all call chains where the modified code is located may be marked as affected codes, and the coverage of the affected codes may be further improved.
Optionally, the obtaining of the affected code corresponding to each change code according to a preset analysis algorithm includes: acquiring a program framework on which the change code depends; at least one code implementing the program framework is obtained and marked as the affected code.
In the above embodiments, the program frames in many fields are mature, and when a developer develops the service logic, the developer may call the code for implementing the program frame to complete the function corresponding to the program frame without re-implementing the program frame. However, if the code that depends on the program framework is modified, the code that implements the program framework may also be affected by the modified code, and therefore, the code that implements the program framework on which the modified code depends can be written as the affected code, and the coverage of the affected code can be further improved.
Optionally, the processing the primarily selected test case set according to the number of times the test case appears in the primarily selected test case set and the label of the test case to obtain a finally selected test case set includes: traversing the initially selected test case set, and acquiring and recording the test cases which repeatedly appear in the initially selected test case set and the repeated occurrence times of the repeatedly appearing test cases; filtering the primarily selected test case set to enable each test case to appear only once, and obtaining a cleaned redundant test case set; classifying the test cases in the cleaned redundant test case set according to labels carried by the test cases to obtain a plurality of test case families; and sequencing the plurality of test case families in a descending order according to the recorded repeated occurrence times to obtain a final selection test case set.
In the above embodiment, after the initially selected test case set is obtained, the initially selected test cases may be traversed first to obtain the test cases that repeatedly appear and the number of times of the repeated occurrences. Then, only once reserving the test cases which appear repeatedly, and eliminating other repeated times; and classifying the test cases into families according to the labels carried by the test cases to obtain the test case families with the same labels. And then, sequencing the plurality of test case families in a descending order according to the recorded repeated occurrence times to obtain a final selection test case set. The developer can test the changed code and the affected code by taking the sequence in the final selection test case set as the priority. The generation process of the final selection test case set is realized by a machine, so that the workload of developers is greatly reduced, and the development efficiency is improved.
According to an aspect of the present application, an embodiment of the present application further provides a test case determining apparatus, where the apparatus includes: the device comprises an influence code acquisition unit, a change code analysis unit and a change code analysis unit, wherein the influence code acquisition unit is used for acquiring an influenced code corresponding to each change code according to a preset analysis algorithm, and the influenced code and the change code have an association relation; the requirement identity identification unit is used for acquiring the affected code corresponding to each change code and the requirement identity identification corresponding to each change code, wherein the requirement identity identification reflects the requirement of corresponding code realization; the test case determining unit is used for determining a plurality of test cases corresponding to each demand identity according to the binding relationship between the demand identity and the test cases, wherein the plurality of test cases are test case sets corresponding to the change codes at the position; the primary selection case acquisition unit is used for mixing the test case sets corresponding to each change code in the change codes to obtain a primary selection test case set; and the final selection case acquisition unit is used for processing the primarily selected test case set according to the times of the test cases appearing in the primarily selected test case set and the labels of the test cases to obtain the final selection test case set.
Optionally, the influence code acquiring unit is specifically configured to: acquiring all other codes under the class of the change code; acquiring a subclass of the class where the change code is located, wherein a function method in the subclass inherits the function method of the class where the change code is located; acquiring all codes under the subclasses; and recording all other codes under the class of the change codes and all codes under the subclasses as the affected codes.
Optionally, the influence code acquiring unit is specifically configured to: acquiring all calling chains where the change codes are located; and acquiring all codes on each call chain in all call chains, and recording the codes as the affected codes.
Optionally, the influence code acquiring unit is specifically configured to: acquiring a program framework on which the change code depends; at least one code implementing the program framework is obtained and marked as the affected code.
Optionally, the final selection case obtaining unit is specifically configured to traverse the primary selection test case set, and obtain and record a test case that repeatedly appears in the primary selection test case set and the repeated occurrence frequency of the repeatedly appearing test case; filtering the primarily selected test case set to enable each test case to appear only once, and obtaining a cleaned redundant test case set; classifying the test cases in the cleaned redundant test case set according to labels carried by the test cases to obtain a plurality of test case families; and sequencing the plurality of test case families in a descending order according to the recorded repeated occurrence times to obtain a final selection test case set.
Embodiments of the present application further provide a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method when executing the computer program.
Embodiments of the present application also provide a computer-readable storage medium, where a plurality of instructions are stored, where the instructions are suitable for being loaded by a processor to execute steps implementing the method described above.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1a shows an overall flowchart of a test case determination method according to a specific implementation manner of an embodiment of the present application;
fig. 1b is a schematic flowchart of a test case determination method provided in an embodiment of the present application;
FIG. 1c is a schematic flow chart of the detailed steps of step 150 in FIG. 1 b;
fig. 2a is a schematic structural block diagram of a preset analysis algorithm of the test case determination method provided in the embodiment of the present application;
FIG. 2b is a schematic structural block diagram of another preset analysis algorithm of the test case determination method according to the embodiment of the present application;
FIG. 2c is a schematic structural block diagram of another preset analysis algorithm of the test case determination method according to the embodiment of the present application;
fig. 3 is a schematic structural diagram of a test case determination apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a computer device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a test case determination method, a test case determination device, computer equipment and a readable storage medium.
The test case determining apparatus may be specifically integrated in an electronic device, and the electronic device may be a terminal, a server, or other devices. The terminal can be a mobile phone, a tablet Computer, an intelligent bluetooth device, a notebook Computer, or a Personal Computer (PC), and the like; the server may be a single server or a server cluster composed of a plurality of servers.
In some embodiments, the test case determining apparatus may be further integrated in a plurality of electronic devices, for example, the test case determining apparatus may be integrated in a plurality of servers, and the test case determining method of the present application is implemented by the plurality of servers, for example, the step of obtaining the corresponding affected code according to the preset analysis algorithm for each change code may be implemented by a server serving as an analysis end; the step of determining the initially selected test case set according to the code-requirement identity-test case can be realized by a server serving as a mapping end; the step of obtaining the final test case set from the initial test case set can be realized by a server serving as a filter terminal.
In some embodiments, the server may also be implemented in the form of a terminal.
Referring to fig. 1a, fig. 1a shows an overall flowchart of a test case determination method provided in a specific implementation manner of an embodiment of the present application, and a developer may change a plurality of codes in software in order to meet a requirement of a change in a software development process. If the developer does not change n codes, the following steps are executed for each changed code of the n changed codes:
acquiring a requirement Identity (ID for short) corresponding to the change code;
performing code parent-child analysis on the modified codes to obtain corresponding affected codes: inheriting a code list, then acquiring a requirement ID corresponding to each inherited code on the inherited code list, and recording the requirement ID as an inherited requirement ID;
and analyzing the dependency relationship of the changed codes to obtain corresponding affected codes: a list of dependent codes is obtained, then a requirement ID corresponding to each dependent code on the list of dependent codes is obtained and is marked as a dependent requirement ID;
and carrying out call chain relation analysis on the changed codes to obtain corresponding affected codes: calling a calling chain list where the chain codes are located, then acquiring a requirement ID corresponding to each calling chain code on the calling chain list, and recording the requirement ID as a link requirement ID;
according to the requirement ID and the mapping table of the test case, acquiring a case set corresponding to the requirement ID, the inheritance requirement ID, the dependency requirement ID and the link requirement ID corresponding to the change code respectively: use case set 1, use case set 2, use case set 3, and use case set 4.
Test cases in the case set 1, the case set 2, the case set 3 and the case set 4 are mixed, and then the mixed test cases are reclassified into families according to the label corresponding to each test case. After classification, each family of test cases has the same label. Subsequently, the use case families are prioritized, for example, by priority, so that a recommended use case family with a smoke tag, a recommended use case family with full functional security, and a recommended use case family with a production verification tag can be obtained.
The specific analysis processes of code parent and child analysis, dependency relationship analysis and call chain relationship analysis will be described in detail below.
The following are detailed below. The numbers in the following examples are not intended to limit the order of preference of the examples.
In this embodiment, a test case determining method is provided, as shown in fig. 1b, a specific flow of the edge processing method may be as follows 110 to 150:
110. and for each change code in the plurality of change codes, acquiring the affected code corresponding to each change code according to a preset analysis algorithm.
As described above, the changed codes are changed based on the same change in demand, and thus, the changed codes all correspond to the same demand ID. The preset analysis algorithm is a preset analysis algorithm and comprises a code parent-child analysis method, a dependency relationship analysis method and a call chain relationship analysis method. The predetermined analysis algorithm may include any one, any two, or all three of the three analysis methods described above.
It should be understood that the predetermined analysis algorithm may also include other analysis methods, and the specific analysis method included in the predetermined analysis algorithm should not be construed as limiting the present application. The affected code has an association with the altering code.
Optionally, the code parent-child class analysis method is explained in detail by the following steps:
acquiring all other codes under the class of the change code; acquiring a subclass of the class where the change code is located, wherein a function method in the subclass inherits the function method of the class where the change code is located; acquiring all codes under the subclasses; and recording all other codes under the class of the change codes and all codes under the subclasses as the affected codes.
Referring to FIG. 2a, for class A (hereinafter class A), the following three functional methods are included: method-1, method-2, and method-3, wherein if an alteration code is present in method-2, then both method-1 and method-3 can be marked as affected codes. Class B is a subclass of Class A, and comprises three functional methods: method-4, method-5, and method-6, then method-4, method-5, and method-6 can also be marked as affected codes.
According to the programming concept, codes always belong to a certain method of a certain class, so when a certain code is changed, other codes of the same class are affected; meanwhile, the subclass (i.e., inheritance class) of the class to which the modification code belongs is also affected, so that all other codes in the class to which the modification code belongs and all codes in the subclass can be marked as affected codes, and the coverage of the affected codes can be improved as much as possible.
Optionally, the call chain relation analysis method is detailed by the following steps:
acquiring all calling chains where the change codes are located; and acquiring all codes on each call chain in all call chains, and recording the codes as the affected codes.
Referring to fig. 2b, fig. 2b totally includes 4 call chains, which are: code 1-code 2; code 1-code 3-code 6; code 1-code 4-code 6; code 1-code 5-code 7. Since the modified code is code 6, the call chain in which code 6 is located: code 1-code 3-code 6; code 1-code 4-code 6 are all affected, and thus code 1, code 3, and code 4 may all be noted as affected codes.
Often, an entry function (i.e., main function) is used as an entry of the whole code logic, and the codes of other modules are directly or indirectly called, and various different service logics are completed through different calling orders and calling times. Therefore, the module where the modified code is located may be covered by one or more call chains, and when the code is changed, other codes on the one or more call chains may be affected, so that all codes on all call chains where the modified code is located may be marked as affected codes, and the coverage of the affected codes may be further improved.
Alternatively, the dependency analysis method is explained in detail by the following steps:
acquiring a program framework on which the change code depends; at least one code implementing the program framework is obtained and marked as the affected code.
Referring to fig. 2C, it is not set that the current modified code is yyyy in method-1, the modified code depends on a certain program framework, and the code implementing the program framework includes code a, code B, and code C, so that code a, code B, and code C can be recorded as affected codes.
Program frames in many fields are mature, and developers can complete corresponding functions of the program frames by calling codes for realizing the program frames without realizing the program frames again when developing business logic. For example, for a relevant framework of a hypertext Transfer Protocol (http), when a developer performs service logic development, the http Protocol does not need to be implemented again, and http communication can be completed only by calling a relevant Protocol code, at this time, it may be called that a code corresponding to a product developed by the developer depends on the http framework. This may improve code reuse and maintainability.
However, if the code that depends on the program framework is modified, the code that implements the program framework may also be affected by the modified code, and therefore, the code that implements the program framework on which the modified code depends can be written as the affected code, and the coverage of the affected code can be further improved.
120. And acquiring the affected code corresponding to each change code and the requirement identity corresponding to each change code.
Wherein the requirement identity reflects a requirement of a corresponding code implementation. The number of the affected codes analyzed by the three analysis methods is not more than one, so that for a plurality of affected codes and changed codes, the requirement ID corresponding to the codes can be acquired according to the requirement to be realized by the codes.
Optionally, in a specific embodiment, the requirement ID may be carried in a code, so that the requirement ID may be directly obtained from the code.
130. And determining a plurality of test cases corresponding to each demand identity according to the binding relationship between the demand identity and the test cases.
The Test Case (Test Case) refers to the description of a Test task for a software product or code, and embodies a Test scheme, a method, a technology and a strategy. Generally speaking, a requirement often needs to be tested from multiple aspects, and therefore, the binding relationship between the requirement ID and the test case may be a one-to-many correspondence relationship, that is, one requirement ID corresponds to multiple test cases.
Among the plurality of requirement IDs, there are both requirement IDs corresponding to change codes and requirement IDs corresponding to affected codes associated with change codes, e.g., inherited requirement IDs, dependent requirement IDs, and link requirement IDs. Each requirement ID in the multiple requirement IDs corresponds to multiple test cases, so the test cases corresponding to the multiple requirement IDs can form a large-number test case set, and the test case set is the test case set corresponding to the change code.
140. And mixing the test case sets corresponding to each change code in the change codes to obtain the initially selected test case set.
And (4) obtaining a test case set corresponding to each change code according to the method from the step 110 to the step 130, and mixing the test case sets corresponding to the N change codes together to obtain an initially selected test case set.
150. And processing the primarily selected test case set according to the times of the test cases appearing in the primarily selected test case set and the labels of the test cases to obtain a finally selected test case set.
When the requirement changes, in order to adapt to the changed requirement, a plurality of codes of the original code need to be changed, so that a plurality of changed codes appear. For each change code in the plurality of change codes, the corresponding affected code can be obtained according to a preset analysis algorithm. And then acquiring a requirement identity corresponding to the changed code and a requirement identity corresponding to the affected code. Usually, one requirement identity corresponds to a plurality of test cases, and the modified code and the affected code correspond to a plurality of requirement identities and a greater number of test cases, which can be recorded as a test case set corresponding to one modified code. And mixing the test case sets corresponding to the change codes to obtain the initially selected test case set. And acquiring a final test case set according to the initial test case set according to the occurrence times and the labels of the test cases. Due to the process of obtaining the final selection test case set, the change codes and the affected codes affected by the change codes are utilized, so that the detail of the final selection test case set can be improved; and screening the primarily selected test case set by using the occurrence times of the test cases and the labels to obtain a finally selected test case set, so that the accuracy of the finally selected test case set is improved.
Optionally, referring to fig. 1c, in an embodiment, step 150 may specifically include steps 151 to 154:
151. and traversing the initially selected test case set, and acquiring and recording the test cases which repeatedly appear in the initially selected test case set and the repeated occurrence times of the repeatedly appearing test cases.
152. And filtering the initially selected test case set to enable each test case to appear only once, so as to obtain the cleaned redundant test case set.
For the test cases which occur repeatedly, the test cases which occur repeatedly for two times or more can be filtered through the identity marks of the test cases, so that the test cases corresponding to each identity mark are only reserved once.
153. And classifying the test cases in the cleaned redundant test case set according to the labels carried by the test cases to obtain a plurality of test case families.
And classifying the test in the cleaned redundant test case set according to the label carried by the test case. For example, some test cases, which are often found to be problematic, are labeled as smoking; some test cases can find compatibility problems, and labels of the test cases are compatibility/user experience classes and the like. By grouping test cases with the same label, a plurality of test case families can be obtained.
154. And sequencing the plurality of test case families in a descending order according to the recorded repeated occurrence times to obtain a final selection test case set.
If a certain test case appears repeatedly, the influence of the influenced code corresponding to the test case is larger, and therefore the higher priority level of the test case is proved. For each test case family, the repeated occurrence times of a plurality of test cases in the test case family can be accumulated, and then the plurality of test case families are subjected to descending order arrangement according to the number obtained by accumulation, so that a final selection test case set can be obtained.
In the above embodiment, after the initially selected test case set is obtained, the initially selected test cases may be traversed first to obtain the test cases that repeatedly appear and the number of times of the repeated occurrences. Then, only once reserving the test cases which appear repeatedly, and eliminating other repeated times; and classifying the test cases into families according to the labels carried by the test cases to obtain the test case families with the same labels. And then, sequencing the plurality of test case families in a descending order according to the recorded repeated occurrence times to obtain a final selection test case set. The developer can test the changed code and the affected code by taking the sequence in the final selection test case set as the priority. The generation process of the final selection test case set is realized by a machine, so that the workload of developers is greatly reduced, and the development efficiency is improved.
In order to better implement the method, an embodiment of the present application further provides a test case determining apparatus, where the test case determining apparatus may be specifically integrated in an electronic device, and the electronic device may be a terminal, a server, or other devices. The terminal can be a mobile phone, a tablet computer, an intelligent Bluetooth device, a notebook computer, a personal computer and other devices; the server may be a single server or a server cluster composed of a plurality of servers.
For example, as shown in fig. 3, the test case determining apparatus may include:
an affected code obtaining unit 301, configured to, for each change code in the plurality of change codes, obtain, according to a preset analysis algorithm, an affected code corresponding to each change code, where the affected code and the change code have an association relationship.
A requirement identity identification unit 302, configured to obtain an affected code corresponding to each change code and a requirement identity corresponding to each change code, where the requirement identity reflects a requirement for implementing a corresponding code.
The test case determining unit 303 is configured to determine, according to a binding relationship between the requirement identity and the test case, a plurality of test cases corresponding to each requirement identity, where the plurality of test cases are a test case set corresponding to the change code.
The preliminary selection case obtaining unit 304 is configured to mix the test case sets corresponding to each change code in the multiple change codes to obtain a preliminary selection test case set.
And a final selection example obtaining unit 305, configured to process the primarily selected test case set according to the number of times that the test cases appear in the primarily selected test case set and the labels of the test cases, so as to obtain a final selection test case set.
Optionally, the influence code obtaining unit 301 is specifically configured to: acquiring all other codes under the class of the change code; acquiring a subclass of the class where the change code is located, wherein a function method in the subclass inherits the function method of the class where the change code is located; acquiring all codes under the subclasses; and recording all other codes under the class of the change codes and all codes under the subclasses as the affected codes.
Optionally, the influence code obtaining unit 301 is specifically configured to: acquiring all calling chains where the change codes are located; and acquiring all codes on each call chain in all call chains, and recording the codes as the affected codes.
Optionally, the influence code obtaining unit 301 is specifically configured to: acquiring a program framework on which the change code depends; at least one code implementing the program framework is obtained and marked as the affected code.
Optionally, the final-choice-case obtaining unit 305 is specifically configured to traverse the preliminary-choice test case set, and obtain and record a test case that repeatedly appears in the preliminary-choice test case set and the repeated occurrence frequency of the repeatedly appearing test case; filtering the primarily selected test case set to enable each test case to appear only once, and obtaining a cleaned redundant test case set; classifying the test cases in the cleaned redundant test case set according to labels carried by the test cases to obtain a plurality of test case families; and sequencing the plurality of test case families in a descending order according to the recorded repeated occurrence times to obtain a final selection test case set.
In a specific implementation, the above units may be implemented as independent entities, or may be combined arbitrarily to be implemented as the same or several entities, and the specific implementation of the above units may refer to the foregoing method embodiments, which are not described herein again.
Correspondingly, the embodiment of the present application further provides a computer device, where the computer device may be a terminal or a server, and the terminal may be a terminal device such as a smart phone, a tablet computer, a notebook computer, a touch screen, a game machine, a Personal computer, and a Personal Digital Assistant (PDA).
Before the method for determining the test case provided by the embodiment of the application exists, after the code is changed, a developer needs to give a test suggestion, and the developer is advised which block of functional logic the tester wants to test according to the experience of the developer, and then the tester selects the appropriate test case according to the functional logic. At this time, the conventional scheme also requires the organization of test case review, and ensures that the test cases selected by the tester are enough. After the test cases are selected, corresponding test execution work can be performed, and a plurality of problems are found and fed back to developers to be corrected. Because the code is changed again by the correction of the developer, the developer needs to give the test suggestion again, and the tester selects and organizes and reviews the test case according to the test suggestion again. After the operation is repeated for a plurality of times, when the tester can not test the functional defects, the product can be released to be on-line. However, due to the limited testing resources, all testing scenes cannot be exhausted, the condition of test missing inevitably occurs, and after the test missing occurs, according to the traditional solution, the testing design capability of the tester needs to be trained again, and the next product development is expected to have no similar test missing event.
After the test case determining method provided by the embodiment of the application is adopted and the codes are changed, developers do not need to give test suggestions according to own experiences, and at the moment, affected codes corresponding to the changed codes can be obtained by means of the method, so that all test cases needing to be covered can be selected and given to the testers to be executed. At the moment, the tester still finds a plurality of defects and feeds back the defects to the developer again for code repair, and the developer can analyze the defects again by using the method after repairing the defects. The test is repeated for a plurality of times without the need of developers to give test suggestions or test personnel to select test cases, so that a great part of workload is avoided. After the product is released and on-line, due to the same problem, the product still has a test missing situation, at this time, related system developers need to be organized to improve the test case determination method, and after improvement, all projects using the method can benefit immediately, and the method is not beneficial to only trained personnel under the traditional scheme, so that the training cost is greatly saved, and the similar test missing event can be avoided as much as possible in the next time.
The method and the device for determining the test cases solve the problems of large workload and limited effect of test case design in the field of product research, development, test and verification. The method and the device can realize refined test design through automatic analysis of codes and requirements, realize systematization, do not depend on the individual test design capability of a tester any more, automatically analyze and recommend cases, and avoid the repeated workload that case design and selection are done again each time the requirements or the codes are changed. The test design is ensured to be sufficiently refined, meanwhile, the time for design selection is saved, and the research and development efficiency is improved.
As shown in fig. 4, fig. 4 is a schematic structural diagram of a computer device 400 according to an embodiment of the present application, where the computer device 400 includes a processor 401 having one or more processing cores, a memory 402 having one or more computer-readable storage media, and a computer program stored in the memory 402 and running on the processor. The processor 401 is electrically connected to the memory 402. Those skilled in the art will appreciate that the computer device configurations illustrated in the figures are not meant to be limiting of computer devices and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The processor 401 is a control center of the computer device 400, connects the respective parts of the entire computer device 400 using various interfaces and lines, performs various functions of the computer device 400 and processes data by running or loading software programs and/or modules stored in the memory 402 and calling data stored in the memory 402, thereby monitoring the computer device 400 as a whole.
In the embodiment of the present application, the processor 401 in the computer device 400 loads instructions corresponding to processes of one or more application programs into the memory 402 according to the following steps, and the processor 401 runs the application programs stored in the memory 402, thereby implementing various functions: for each change code in the plurality of change codes, acquiring an affected code corresponding to each change code according to a preset analysis algorithm, wherein the affected code and the change code have an association relation; acquiring an affected code corresponding to each change code and a requirement identity corresponding to each change code, wherein the requirement identity reflects the requirement of corresponding code implementation; determining a plurality of test cases corresponding to each demand identity according to the binding relationship between the demand identity and the test cases, wherein the test cases are test case sets corresponding to the changed codes; mixing the test case sets corresponding to each change code in the change codes to obtain a primary selection test case set; and processing the primarily selected test case set according to the times of the test cases appearing in the primarily selected test case set and the labels of the test cases to obtain a finally selected test case set.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Optionally, as shown in fig. 4, the computer device 400 further includes: touch-sensitive display screen 403, radio frequency circuit 404, audio circuit 405, input unit 406 and power 407. The processor 401 is electrically connected to the touch display screen 403, the radio frequency circuit 404, the audio circuit 405, the input unit 406, and the power source 407. Those skilled in the art will appreciate that the computer device configuration illustrated in FIG. 4 does not constitute a limitation of computer devices, and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The touch display screen 403 may be used for displaying a graphical user interface and receiving operation instructions generated by a user acting on the graphical user interface. The touch display screen 403 may include a display panel and a touch panel. The display panel may be used, among other things, to display information entered by or provided to a user and various graphical user interfaces of the computer device, which may be made up of graphics, text, icons, video, and any combination thereof. Alternatively, the Display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations of a user on or near the touch panel (for example, operations of the user on or near the touch panel using any suitable object or accessory such as a finger, a stylus pen, and the like), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 401, and can receive and execute commands sent by the processor 401. The touch panel may overlay the display panel, and when the touch panel detects a touch operation thereon or nearby, the touch panel may transmit the touch operation to the processor 401 to determine the type of the touch event, and then the processor 401 may provide a corresponding visual output on the display panel according to the type of the touch event. In the embodiment of the present application, the touch panel and the display panel may be integrated into the touch display screen 403 to realize input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two separate components to perform the input and output functions. That is, the touch display screen 403 may also be used as a part of the input unit 406 to implement an input function.
The rf circuit 404 may be used for transceiving rf signals to establish wireless communication with a network device or other computer device via wireless communication, and for transceiving signals with the network device or other computer device.
The audio circuit 405 may be used to provide an audio interface between a user and a computer device through speakers, microphones. The audio circuit 405 may transmit the electrical signal converted from the received audio data to a speaker, and convert the electrical signal into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 405 and converted into audio data, which is then processed by the audio data output processor 401, and then sent to, for example, another computer device via the radio frequency circuit 404, or output to the memory 402 for further processing. The audio circuit 405 may also include an earbud jack to provide communication of a peripheral headset with the computer device.
The input unit 406 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 407 is used to power the various components of the computer device 400. Optionally, the power source 407 may be logically connected to the processor 401 through a power management system, so as to implement functions of managing charging, discharging, power consumption management, and the like through the power management system. The power supply 407 may also include one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, or any other component.
Although not shown in fig. 4, the computer device 400 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described in detail herein.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present application provide a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer programs can be loaded by a processor to execute the steps in any one of the test case determination methods provided in the embodiments of the present application. For example, the computer program may perform the steps of: for each change code in the plurality of change codes, acquiring an affected code corresponding to each change code according to a preset analysis algorithm, wherein the affected code and the change code have an association relation; acquiring an affected code corresponding to each change code and a requirement identity corresponding to each change code, wherein the requirement identity reflects the requirement of corresponding code implementation; determining a plurality of test cases corresponding to each demand identity according to the binding relationship between the demand identity and the test cases, wherein the test cases are test case sets corresponding to the changed codes; mixing the test case sets corresponding to each change code in the change codes to obtain a primary selection test case set; and processing the primarily selected test case set according to the times of the test cases appearing in the primarily selected test case set and the labels of the test cases to obtain a finally selected test case set.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the computer-readable storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the computer program stored in the computer-readable storage medium can execute the steps in any test case determination method provided in the embodiments of the present application, beneficial effects that can be achieved by any test case determination method provided in the embodiments of the present application can be achieved, for details, see the foregoing embodiments, and are not described herein again.
The test case determination method, the test case determination device, the computer-readable storage medium, and the computer device provided in the embodiments of the present application are introduced in detail, and a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the embodiments is only used to help understanding the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A test case determining method is used for determining test cases corresponding to a plurality of modified codes, wherein the modified codes are changed based on the same requirement change, and the method comprises the following steps:
for each change code in the plurality of change codes, acquiring an affected code corresponding to each change code according to a preset analysis algorithm, wherein the affected code and the change code have an association relation;
acquiring an affected code corresponding to each change code and a requirement identity corresponding to each change code, wherein the requirement identity reflects the requirement of corresponding code implementation;
determining a plurality of test cases corresponding to each demand identity according to the binding relationship between the demand identity and the test cases, wherein the test cases are test case sets corresponding to the changed codes;
mixing the test case sets corresponding to each change code in the change codes to obtain a primary selection test case set;
and processing the primarily selected test case set according to the times of the test cases appearing in the primarily selected test case set and the labels of the test cases to obtain a finally selected test case set.
2. The method of claim 1, wherein said obtaining affected codes corresponding to each of said change codes according to a predetermined analysis algorithm comprises:
acquiring all other codes under the class of the change code;
acquiring a subclass of the class where the change code is located, wherein a function method in the subclass inherits the function method of the class where the change code is located;
acquiring all codes under the subclasses;
and recording all other codes under the class of the change codes and all codes under the subclasses as the affected codes.
3. The method of claim 1, wherein said obtaining affected codes corresponding to each of said change codes according to a predetermined analysis algorithm comprises:
acquiring all calling chains where the change codes are located;
and acquiring all codes on each call chain in all call chains, and recording the codes as the affected codes.
4. The method of claim 1, wherein said obtaining affected codes corresponding to each of said change codes according to a predetermined analysis algorithm comprises:
acquiring a program framework on which the change code depends;
at least one code implementing the program framework is obtained and marked as the affected code.
5. The method of claim 1, wherein the step of processing the initially selected test case set according to the number of times the test cases appear in the initially selected test case set and the labels of the test cases to obtain a finally selected test case set comprises:
traversing the initially selected test case set, and acquiring and recording the test cases which repeatedly appear in the initially selected test case set and the repeated occurrence times of the repeatedly appearing test cases;
filtering the primarily selected test case set to enable each test case to appear only once, and obtaining a cleaned redundant test case set;
classifying the test cases in the cleaned redundant test case set according to labels carried by the test cases to obtain a plurality of test case families;
and sequencing the plurality of test case families in a descending order according to the recorded repeated occurrence times to obtain a final selection test case set.
6. A test case determination apparatus, the apparatus comprising:
the device comprises an influence code acquisition unit, a change code analysis unit and a change code analysis unit, wherein the influence code acquisition unit is used for acquiring an influenced code corresponding to each change code in a plurality of change codes according to a preset analysis algorithm, and the influenced code and the change code have an association relation;
the requirement identity identification unit is used for acquiring the affected code corresponding to each change code and the requirement identity identification corresponding to each change code, wherein the requirement identity identification reflects the requirement of corresponding code realization;
the test case determining unit is used for determining a plurality of test cases corresponding to each demand identity according to the binding relationship between the demand identity and the test cases, wherein the plurality of test cases are test case sets corresponding to the change codes at the position;
the primary selection case acquisition unit is used for mixing the test case sets corresponding to each change code in the change codes to obtain a primary selection test case set;
and the final selection case acquisition unit is used for processing the primarily selected test case set according to the times of the test cases appearing in the primarily selected test case set and the labels of the test cases to obtain the final selection test case set.
7. The apparatus of claim 6, wherein the impact code acquisition unit is specifically configured to:
acquiring all other codes under the class of the change code;
acquiring a subclass of the class where the change code is located, wherein a function method in the subclass inherits the function method of the class where the change code is located;
acquiring all codes under the subclasses;
and recording all other codes under the class of the change codes and all codes under the subclasses as the affected codes.
8. The apparatus of claim 6, wherein the impact code acquisition unit is specifically configured to:
acquiring all calling chains where the change codes are located;
and acquiring all codes on each call chain in all call chains, and recording the codes as the affected codes.
9. A computer device comprising a processor and a memory, the memory storing a plurality of instructions; the processor loads instructions from the memory to perform the steps of the test case determination method according to any one of claims 1 to 5.
10. A computer-readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps of the test case determination method according to any one of claims 1 to 5.
CN202110857314.3A 2021-07-28 2021-07-28 Test case determination method and device, computer equipment and readable storage medium Pending CN113568833A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110857314.3A CN113568833A (en) 2021-07-28 2021-07-28 Test case determination method and device, computer equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110857314.3A CN113568833A (en) 2021-07-28 2021-07-28 Test case determination method and device, computer equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN113568833A true CN113568833A (en) 2021-10-29

Family

ID=78168459

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110857314.3A Pending CN113568833A (en) 2021-07-28 2021-07-28 Test case determination method and device, computer equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN113568833A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114168472A (en) * 2021-12-09 2022-03-11 惠州Tcl移动通信有限公司 Use case execution method and device, electronic equipment and computer readable storage medium
CN115905031A (en) * 2023-03-14 2023-04-04 云筑信息科技(成都)有限公司 Test case recommendation method based on accurate quality assurance system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103425584A (en) * 2013-08-27 2013-12-04 上海复深蓝信息技术有限公司 Large-scale application regression testing information processing method based on Java bytecode
CN106326105A (en) * 2015-07-09 2017-01-11 富士通株式会社 Method and device for generating test case of application program
CN107957957A (en) * 2017-12-28 2018-04-24 网易(杭州)网络有限公司 The acquisition methods and device of test case
CN109783349A (en) * 2018-12-10 2019-05-21 江苏大学 A kind of priorities of test cases sort method and system based on dynamical feedback weight
CN111382073A (en) * 2020-03-09 2020-07-07 腾讯科技(深圳)有限公司 Automatic test case determination method, device, equipment and storage medium
CN111752843A (en) * 2020-06-29 2020-10-09 百度在线网络技术(北京)有限公司 Method, device, electronic equipment and readable storage medium for determining influence surface
CN113010433A (en) * 2021-03-31 2021-06-22 锐凌无线通讯科技(深圳)有限公司 Continuous integration test method, system and related equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103425584A (en) * 2013-08-27 2013-12-04 上海复深蓝信息技术有限公司 Large-scale application regression testing information processing method based on Java bytecode
CN106326105A (en) * 2015-07-09 2017-01-11 富士通株式会社 Method and device for generating test case of application program
CN107957957A (en) * 2017-12-28 2018-04-24 网易(杭州)网络有限公司 The acquisition methods and device of test case
CN109783349A (en) * 2018-12-10 2019-05-21 江苏大学 A kind of priorities of test cases sort method and system based on dynamical feedback weight
CN111382073A (en) * 2020-03-09 2020-07-07 腾讯科技(深圳)有限公司 Automatic test case determination method, device, equipment and storage medium
CN111752843A (en) * 2020-06-29 2020-10-09 百度在线网络技术(北京)有限公司 Method, device, electronic equipment and readable storage medium for determining influence surface
CN113010433A (en) * 2021-03-31 2021-06-22 锐凌无线通讯科技(深圳)有限公司 Continuous integration test method, system and related equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张李梅: "基于函数调用路径的测试用例混合优化方法", 《科学技术与工程》, vol. 20, no. 9, pages 3641 - 3645 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114168472A (en) * 2021-12-09 2022-03-11 惠州Tcl移动通信有限公司 Use case execution method and device, electronic equipment and computer readable storage medium
CN115905031A (en) * 2023-03-14 2023-04-04 云筑信息科技(成都)有限公司 Test case recommendation method based on accurate quality assurance system
CN115905031B (en) * 2023-03-14 2023-06-23 云筑信息科技(成都)有限公司 Test case recommendation method based on accurate quality assurance system

Similar Documents

Publication Publication Date Title
CN113568833A (en) Test case determination method and device, computer equipment and readable storage medium
CN107765853A (en) Using method for closing, device, storage medium and electronic equipment
CN113268416A (en) Application program testing method and device, storage medium and terminal
CN109975688A (en) General evaluating method and device for heterogeneous chip
CN101594627A (en) A kind of apparatus and method of simulating mobile terminal fault
CN112650673A (en) Method and device for creating test case in transaction tracking system and electronic equipment
CN115185819A (en) System testing method, device, equipment and computer readable storage medium
CN115237889A (en) Database switching method and device, storage medium and computer equipment
CN114579136A (en) Code processing method and device, computer equipment and storage medium
CN114727100A (en) Joint debugging method and device for monitoring equipment
CN114706371A (en) Complete vehicle network non-dormancy diagnosis method and device, electronic equipment and storage medium
CN107391361A (en) A kind of POS terminal automatic test approach and device
CN112487669A (en) System and method for verifying control logic design of nuclear power plant
CN111861021A (en) Business risk prediction method, device, equipment and computer readable storage medium
CN112183982A (en) Workflow creating method and device, computer equipment and storage medium
CN111045849A (en) Method, device, server and storage medium for identifying reason of checking abnormality
CN115543834A (en) Code issuing method and device, electronic equipment and storage medium
CN115629989A (en) Test data determination method and device, computer equipment and storage medium
CN115495355A (en) Environment configuration information comparison method and device, terminal and storage medium
CN116383071A (en) Service flow testing method and device, computer equipment and storage medium
CN117609062A (en) Automatic test method, system, equipment and storage medium based on AI
CN116361181A (en) library automatic coverage comparison method and device, storage medium and computer equipment
CN115509940A (en) Test method and device based on scene, computer equipment and storage medium
CN115629788A (en) Data entry method and device, intelligent terminal and storage medium
CN115202716A (en) Method and device for detecting dependence deficiency, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination