CN115658478A - Test case screening method and device, electronic equipment and storage medium - Google Patents

Test case screening method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115658478A
CN115658478A CN202211208697.2A CN202211208697A CN115658478A CN 115658478 A CN115658478 A CN 115658478A CN 202211208697 A CN202211208697 A CN 202211208697A CN 115658478 A CN115658478 A CN 115658478A
Authority
CN
China
Prior art keywords
incompatible
code
interface
tested
test
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
CN202211208697.2A
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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202211208697.2A priority Critical patent/CN115658478A/en
Publication of CN115658478A publication Critical patent/CN115658478A/en
Pending legal-status Critical Current

Links

Images

Abstract

The disclosure provides a screening method and device of test cases, electronic equipment and a storage medium, and relates to the technical field of software testing and the like. The specific implementation scheme is as follows: determining that an incompatible test case exists in the function to be tested of the current test interface based on a preset incompatible information table and an incremental code of the function to be tested of the current test interface; extracting attribute information of the current test interface; and screening the test cases incompatible with the functions to be tested of the current test interface from the test case library based on the attribute information of the current test interface and the attribute information of the interface corresponding to each test case in the test case library. The technology disclosed by the invention can effectively improve the screening accuracy and the screening efficiency of the incompatible test cases.

Description

Test case screening method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to the field of software testing and other technologies, and in particular, to a method and an apparatus for screening test cases, an electronic device, and a storage medium.
Background
An interface is a protocol used to define a program that describes a set of related behaviors that may belong to any class or structure. The common interfaces between the servers are used to define the format of data exchange, and the Uniform Resource Locator (URL) of the interfaces is used to locate and divide the functions of different interfaces. An interface can be considered as an essential element of a software service for providing services to the outside. In the context of microservices, many services expose business functions through interfaces, and internal calls for services become calls for Application Program Interfaces (APIs) between services. Therefore, testing of the interface is particularly important.
Typically, a tester performs testing of an interface by automating test cases. Different request parameter combinations are written in the test cases, and assertion verification is carried out on data returned by the request or caused changes so as to judge whether the performance of the service meets the expectation of the product. These test cases are usually not disposable, and the tester will save the historical test cases, and verify whether the upgrade of the interface affects the old function at the next interface upgrade, and such an operation is also called as a regression phase of the automation cases.
Disclosure of Invention
The disclosure provides a test case screening method and device, electronic equipment and a storage medium.
According to one aspect of the present disclosure, a method for screening test cases is provided, including:
determining that an incompatible test case exists in the function to be tested of the current test interface based on a preset incompatible information table and an incremental code of the function to be tested of the current test interface;
extracting attribute information of the current test interface;
and screening the test cases incompatible with the functions to be tested of the current test interface from the test case library based on the attribute information of the current test interface and the attribute information of the interface corresponding to each test case in the test case library.
According to another aspect of the present disclosure, there is provided a test case screening apparatus, including:
the determining module is used for determining that the function to be tested of the current testing interface has an incompatible test case based on a preset incompatible information table and the incremental code of the function to be tested of the current testing interface;
the extracting module is used for extracting the attribute information of the current testing interface;
and the screening module is used for screening the test cases incompatible with the functions to be tested of the current test interface from the test case library based on the attribute information of the current test interface and the attribute information of the interface corresponding to each test case in the test case library.
According to still another aspect of the present disclosure, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the method of the aspects and any possible implementation described above.
According to yet another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of the above-described aspect and any possible implementation.
According to yet another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method of the aspects and any possible implementation as described above.
According to the technology disclosed by the invention, the screening accuracy and the screening efficiency of the incompatible test cases can be effectively improved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a schematic diagram according to a first embodiment of the present disclosure;
FIG. 2 is a schematic diagram according to a second embodiment of the present disclosure;
fig. 3 is a schematic diagram of an incompatible information table provided in this embodiment;
FIG. 4 is a schematic diagram of an incompatible report provided by the present embodiment;
FIG. 5 is a schematic diagram according to a third embodiment of the present disclosure;
FIG. 6 is a schematic diagram according to a fourth embodiment of the present disclosure;
FIG. 7 is a schematic diagram according to a fifth embodiment of the present disclosure;
FIG. 8 is a block diagram of an electronic device used to implement methods of embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It is to be understood that the embodiments described are only a few embodiments of the present disclosure, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without inventive step, are intended to be within the scope of the present disclosure.
It should be noted that the terminal device involved in the embodiments of the present disclosure may include, but is not limited to, a mobile phone, a Personal Digital Assistant (PDA), a wireless handheld device, a Tablet Computer (Tablet Computer), and other intelligent devices; the display device may include, but is not limited to, a personal computer, a television, or the like having a display function.
In addition, the term "and/or" herein is only one kind of association relationship describing an associated object, and means that there may be three kinds of relationships, for example, a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
In the regression phase of the automatic test case, a common problem is that the code upgrading affects the old functions of the interface, for example, some non-mandatory field is set as the mandatory field, and the original legal value is changed into an illegal value, so that the upgraded code is incompatible with the old test case, and the test of the old test case in the regression phase is inevitably failed. The failure due to such incompatibility may, on the one hand, not have interception problems, which may increase the troubleshooting and maintenance costs for the tester, and on the other hand, may also mask real code problems.
Therefore, in order to pre-identify incompatible test cases in the regression phase as early as possible and modify the incompatible test cases into an available state as early as possible so as not to affect the stability of the test task in the regression phase, after the project is designed in detail, a tester can read the interface document in the design document to know the change of the interface field and detect whether the upgraded interface can affect the existing test cases or not through experience. And modifying the test case with influence so that the test case can pass the test of the regression stage to improve the test efficiency of the regression stage. However, in the implementation of the scheme, the judgment factor depends on the completeness and accuracy of the detailed design of the project and the personal experience of the tester, and the selection of the test case depends on manual selection, so that the screening efficiency of the test case incompatible in the regression stage is very low.
FIG. 1 is a schematic diagram according to a first embodiment of the present disclosure; as shown in fig. 1, this embodiment provides a method for screening test cases, which specifically includes the following steps:
s101, determining that incompatible test cases exist in the functions to be tested of the current test interface based on a preset incompatible information table and the incremental codes of the functions to be tested of the current test interface;
s102, extracting attribute information of a current test interface;
s103, screening test cases incompatible with the functions to be tested of the current test interface from the test case library based on the attribute information of the current test interface and the attribute information of the interface corresponding to each test case in the test case library.
The method for screening the test cases is used before the regression stage of the interface test, and can screen the test cases incompatible with the function to be tested of the current test interface from the test case library in a preposed manner, so that a tester can modify the incompatible test cases to make the incompatible test cases compatible with the function to be tested of the current test interface, the test stability of the regression stage is ensured, and the test efficiency is improved.
The functions to be tested of the current test interface of the embodiment are developed by developers in the form of incremental codes. Before the function to be tested of the current test interface is released, the incremental code needs to be tested through the test of the regression stage and other related tests, and the release can be carried out only after the test is passed.
In this embodiment, whether the incremental code hits an incompatible condition in the incompatible information may be detected based on the preset incompatible information table and the incremental code of the function to be tested of the current test interface, and if the incremental code hits the incompatible condition, it may be determined that an incompatible test case exists in the function to be tested of the current test interface.
In this embodiment, when it is determined that an incompatible test case exists in the to-be-tested function of the current test interface, a test case incompatible with the to-be-tested function of the current test interface may be further screened from the test case library. The test case library may include all the test cases used in the history test of the current test interface. During specific screening, screening can be performed based on the attribute information of the current test interface and the attribute information of the interface corresponding to each test case in the test case library, so that the accuracy of screened incompatible test cases can be effectively ensured.
By adopting the scheme, the test cases incompatible with the functions to be tested of the current test interface can be automatically screened in advance before the test in the regression stage, so that testers can timely and accurately modify the test cases to be in line with expectations, the screening accuracy and the screening efficiency of the incompatible test cases can be effectively improved, and the stability and the test efficiency of the test in the regression stage can be effectively improved.
FIG. 2 is a schematic diagram according to a second embodiment of the present disclosure; as shown in fig. 2, the method for screening test cases according to the present embodiment further describes the technical solution of the present disclosure in more detail on the basis of the technical solution of the embodiment shown in fig. 1. As shown in fig. 2, the method for screening test cases in this embodiment may specifically include the following steps:
s201, detecting whether the incremental code of the function to be tested of the current test interface hits incompatible features in the incompatible information table; if yes, go to step S202; and if not, determining that the function to be tested of the current test interface has no incompatible test case, and ending.
S202, determining that incompatible test cases exist in the functions to be tested of the current test interface; step S203 is executed;
because of the functions to be tested of the current test interfaces, they are developed by developers in the form of incremental code. In this embodiment, whether the incremental code hits the incompatible feature of the incompatible information table is detected, and if the incremental code hits the incompatible feature of the incompatible information table, it may be determined that an incompatible test case also exists in the function to be tested of the test interface, so that the incompatible test case may be further obtained.
For example, before this step S201 of this embodiment, the method may further include: configuring an incompatible information table based on the incompatible information of the test case of the historical interface test;
in this embodiment, statistical analysis may be performed on the incompatible information of the test cases of all the historical test interfaces to obtain an incompatible information table. For example, in the incompatible information table, the code characteristics of the delta code may be included. That is, delta code that conforms to the code characteristics, there are often situations that are incompatible with the test cases in the test case library.
In practical applications, the test case may include information about a request Uniform Resource Locator (URL), a request parameter, a return parameter, and the like. When detecting that the test cases are incompatible, whether the code characteristics affect the request or the returned information of the test cases can be analyzed from the aspects. If so, there must be incompatibility. Based on the principle, the incompatible information of the test cases of all historical interface tests can be analyzed, and an incompatible information table can be configured.
Moreover, the scene corresponding to the code feature and the code modification position can also be configured in the incompatible information table, for example, the code modification position can include a first level or a second level and above, specifically, refer to a level where the modified code is located in the whole incremental code. The first level can be called the position of the interface level, the code of the level is easy to detect, the code characteristics and the specific modification content of the code can be very easily obtained, and modification suggestions can be conveniently generated. And the second level and above relates to the internal check logic, which can also be called as the position of the internal check logic level, the code amount of the level is very large, the specific modification content of the code is not easy to obtain, and the modification suggestion is not convenient to generate.
For example, fig. 3 is a schematic diagram of an incompatible information table provided in this embodiment. The levels shown in fig. 3 represent code modification locations. In fig. 3, the incompatible information table includes the level, the scene, and the code feature as an example. The scene may include scene information of a top point, such as column 2, and may further include refined scene information, such as column 3. As shown in fig. 3, in the first level, i.e., the interface level, the change of the starrate protocol field involves the request to delete field, the request to change field, and the refined scenario information of field add/delete/change value. Moreover, the modified code in the code feature shown in fig. 3 all relates to the information such as the request URL, the request parameter, and the return parameter of the test case, so that the test case is not compatible.
The incompatible information table configured by the method of the embodiment has very high accuracy, and can help to screen the incompatible test cases of the embodiment.
It should be noted that the configuration incompatible information table of this embodiment does not need to be configured before each test, but can be reused in multiple tests after being configured. In addition, in practical applications, the incompatible information table may be updated periodically. Or when a tester finds that a scene which can not be covered currently exists, the rule which can adapt to the current code characteristic needs to be added again, so that the incompatible information table is enriched continuously, and the accuracy of the incompatible test case is improved.
Further optionally, in an embodiment of the present disclosure, the step S201 of detecting whether a code feature in an incompatible information table exists in an incremental code of a function to be tested of a current test interface may specifically include the following steps:
(a) Analyzing the incremental code of the function to be tested of the current test interface into a syntax tree;
(b) Acquiring code characteristics of field nodes, code characteristics of method nodes, code characteristics of return nodes and code characteristics of code lines in a syntax tree;
(c) Whether the code characteristics of the field nodes, the code characteristics of the method nodes, the code characteristics of the return nodes or the code characteristics of the code lines in the syntax tree hit the code characteristics in the incompatible information table or not is detected.
If yes, determining that the incremental code of the function to be tested of the current test interface hits the code characteristics in the incompatible information table, and further determining that the function to be tested of the current test interface has an incompatible test case. Correspondingly at this time, the incompatible feature in the incompatible information table may include a code feature in the incompatible information table.
By detecting the code characteristics, whether incompatible test cases exist in the functions to be tested of the current test interface can be accurately determined, the detection accuracy can be ensured, and the detection efficiency is improved.
Or optionally, in an embodiment of the present disclosure, before the step (a 1), the method may further include: acquiring a scene corresponding to an incremental code of a function to be tested of a current test interface; an incompatible scene in the incompatible information table is detected and determined as being hit by the scene.
For example, the incompatible information table of the embodiment shown in fig. 3 may be referred to, where 11 incompatible scenarios are taken as an example, and in practical applications, the incompatible scenarios in the incompatible information table may be updated and expanded based on newly found incompatible scenarios as the test progresses. And (c) firstly, acquiring a scene corresponding to the incremental code of the function to be tested of the current test interface, and if the scene in the incompatible information table is hit, further executing the steps (a) - (c). Otherwise, if the scene in the incompatible information table is not hit, it can be considered that the scene to which the incremental code of the function to be tested of the current test interface belongs does not have an incompatible condition, that is, the function to be tested of the current test interface does not have an incompatible test case. At this time, correspondingly, the incompatible features in the incompatible information table may include scene and code features in the incompatible information table.
The accuracy of screening can be further improved by detecting whether the scene corresponding to the incremental code of the function to be tested of the current test interface hits the scene in the incompatible information table. And when the scene corresponding to the incremental code of the function to be tested of the current test interface does not hit the scene in the incompatible information table, the steps (a) - (c) are not required to be executed, so that when the incompatible test case does not exist in the function to be tested of the current test interface, unnecessary detection can be reduced, and the screening process can be shortened. And when the incompatible information table exists in the function to be tested of the current test interface, further executing the steps (a) - (c) to ensure the accuracy of screening.
S203, extracting the field name and URL of the current test interface based on the incremental code of the function to be tested of the current test interface;
the field name of the current test interface may include a request field name and a return field name. In this embodiment, the field name and the URL of the current test interface are used to accurately and uniquely identify the attribute information of the current test interface.
For example, in this embodiment, a field name of the current test interface may be extracted by using a static code analysis technique based on an incremental code of a function to be tested of the current test interface.
Based on the incremental code of the function to be tested of the current test interface, the call chain analysis technology can be adopted to obtain the URL of the current test interface associated with the incremental code. The calling chain analysis technology can analyze the calling chain of each URL and method to obtain the mapping relation between the method and the URL, the method and the class; and then, the method corresponding to the class can be obtained based on the mapping relation between the method and the class, and further, the URL corresponding to the method can be analyzed based on the mapping relation between the method and the URL.
S204, screening test cases incompatible with the to-be-tested function of the current test interface from the test case library based on the attribute information of the current test interface and the attribute information of the interface corresponding to each test case in the test case library;
by adopting the method for extracting the attribute information of the current test interface, the attribute information of the interface corresponding to each test case in the test case library can also be extracted. And then screening a test case consistent with the attribute information of the current test interface from the test case library, wherein the test case is a test case incompatible with the function to be tested of the current test interface.
S205, obtaining identification information of incompatible test cases;
s206, sending out an incompatible report, wherein the incompatible report carries identification information of the incompatible test case.
In this embodiment, the purpose of sending the incompatible report is to provide prompt information for the tester to modify the incompatible test case, so that the incompatible test case can stably complete the test in the regression stage, and the stability and accuracy of the test in the regression stage are improved.
In order to more clearly represent the incompatible problem in the incompatible report, the testing personnel can modify the incompatible test cases more quickly. Before step S206, obtaining code characteristics in an incompatible information table corresponding to the incompatible test case may be further included.
At this time, correspondingly step S206 issues an incompatible report, which may include: and sending out an incompatible report carrying the identification information and the code characteristics of the incompatible test cases.
Further optionally, in an embodiment of the present disclosure, after obtaining the code features in the incompatible information table corresponding to the incompatible test case, before the step S206 sends out the incompatible report, the following steps may also be included:
(1) Positioning a code modification position based on the incompatible information table and the code characteristics in the incompatible information table corresponding to the incompatible test case;
(2) Detecting whether a code modification location is at or above a first level or a second level; if the first layer is located, executing the step (3); if the test case is located at the second level and above, correspondingly, step S206 may be to issue an incompatible report carrying the identification information, the code characteristics, and the code modification location of the incompatible test case.
(3) Generating a modification suggestion based on the code features; correspondingly, step S206 may issue an incompatible report carrying identification information, code characteristics, code modification location, and modification suggestion of the incompatible test case.
When the code modification position is on the first level, the modification characteristics of the code can be very conveniently and accurately acquired, and the modification characteristics of the code can clearly identify the specific modification information of the code, so that the corresponding modification suggestion can be directly generated based on the modification characteristics of the code. Correspondingly, when the incompatible report is sent out, the code modification position and the modification suggestion are carried, so that the test personnel can modify the incompatible test case conveniently, the modification content of the incompatible test case is consistent with the incremental code of the function to be tested of the current test interface, and the test of the test case in the regression stage can be completed stably.
If the code modification position is at the second level or above, referring to table 3, the code modification related to the internal check logic level is performed, and at this time, based on the code characteristics, the specific modification content of the code cannot be accurately located, so that an accurate modification suggestion cannot be obtained. At the moment, the sent incompatible report only can carry code characteristics and code modification positions for reference of testers, and codes in the incompatible test case are modified, so that the modified test case is consistent with the incremental codes of the functions to be tested of the current test interface, and the test of the test case in the regression stage can be stably completed.
For example, fig. 4 is a schematic diagram of an incompatible report provided by the present embodiment. As shown in fig. 4, to carry incompatible reports of modification suggestions. In the incompatible report, the fact that each test case is to be changed and how to change the test case is identified, and a very clear and very accurate modification suggestion can be provided for the tester, so that the tester can modify the incompatible test case timely and accurately, the modified test case can stably complete the test task of the regression stage, and the test efficiency of the regression stage is improved. Wherein hook indicates incompatibility, indicating that the case is blocked and cannot directly participate in the regression phase test.
The test cases screened by the above method in this embodiment are incompatible test cases related to the functions to be tested of the current test interface. In addition, in the regression phase of testing, some test cases which are related to the functions to be tested of the current test interface and are also compatible need to be screened from the test library. And the test of the regression stage of the functions to be tested of the test interface is realized together.
In addition, optionally, in an embodiment of the present disclosure, since the functions of one interface may be very many, the functions tested by different test cases of a configuration may be different. After the function of the interface is upgraded, the function may be related to a part of functions which are on-line before, but not related to another part of functions. Before the upgraded function comes on-line, a regression phase test is passed to detect whether the upgraded function of the interface is compatible with the related function. In this embodiment, the test case set related to the function to be tested of the current test interface may also be screened from the test case library. And then screening the test cases incompatible with the functions to be tested of the current test interface from the test case set. For example, the test case library in the above technical solution of this embodiment may be a test case set that has been screened and is related to the function to be tested of the current test interface. By adopting the technical scheme of the embodiment, the test cases incompatible with the functions to be tested of the current test interface can be screened from the test case set, and an incompatible report is sent. And further modifying the incompatible test cases by the tester based on the incompatible report. The test case set obtained at this time includes compatible test cases and test cases modified due to incompatibility. And then, the obtained test case set can be used for testing the function to be tested of the current test interface in the regression stage.
According to the screening method of the test case, whether the incompatible test case exists in the function to be tested of the current test interface is determined by detecting whether the incremental code of the function to be tested of the current test interface hits the incompatible feature in the incompatible information table, so that the screening accuracy and the screening efficiency of the test case can be effectively improved.
In addition, in the embodiment, an incompatible report can be sent out after incompatible test cases are screened out. For example, identification information of an incompatible test case can be carried in an incompatible report, or code characteristics can be carried, or a code modification position can be further carried, or a modification suggestion can be further carried, effective modification information can be provided for a tester, the tester can timely and accurately modify the incompatible test case, the modified test case is made to be consistent with the incremental code of the function to be tested of the current test interface, and the test of the test case in the regression stage can be stably completed. Therefore, the scheme of the embodiment can effectively ensure timely and accurate modification of the incompatible test case, effectively accelerate the test flow of the regression stage, and improve the test documentation performance and the test efficiency of the regression stage.
Moreover, according to the technical scheme of the embodiment, in the process of screening the test cases, manual participation is not needed in the whole process, the tester has strong professional knowledge, and the tester does not need to manually screen the test cases.
FIG. 5 is a schematic diagram according to a third embodiment of the present disclosure; as shown in fig. 5, this embodiment provides an application example of a screening method for test cases, and performs code modification of deleting and changing field types of the embodiment shown in fig. 3 in an incremental code of a function to be tested of a current test interface. Then, the research and development engineer RD submits a code, at this time, the incremental code may be scanned based on the incompatible information table according to the method for screening test cases of this embodiment, and whether the incremental code hits an incompatible feature in the incompatible information table is detected, if so, the incremental code may be determined to correspond to the incompatible test case, and at this time, screening of the test case may be triggered.
Specifically, a call chain analysis technique may be employed to obtain the corresponding URL. And querying the label of the test case, namely the caseid, by using the URL and the module name in the incremental code. The use case management platform is further requested to query the content of the case with the case id, including the field name in the case. And then calculating a caseid List influenced by the incremental code based on the field name corresponding to the incremental code and the acquired field names in the contents of the various cases. And (3) listing the caseid List as a branch in the test case library, and recording the state as hook, wherein all cases in the caseid List of the branch are incompatible test cases, are temporarily blocked and cannot automatically execute the test in the regression stage. With reference to the method of the embodiment, a corresponding report is generated based on the obtained incompatible test case, so as to prompt a tester to modify the incompatible test case set case, so that the tester can implement the test at the regression stage. After the case is changed, marking can be carried out in a reporting/visualization mode so as to remove the incompatible marking of the corresponding case; i.e. equivalent to updating the hook status, remove the incompatible tags of the cases of the caseid List. The offline interface can be directly deleted by one key. After the change, the hook status also needs to be updated. At this time, the tester can query the processed caseid List and can perform state merging. That is, the modified cases of the branches are merged into the test case library. After the incremental code is modified, the test of the regression stage can be firstly carried out, and after the test is passed, the incremental code can be released; the modified cases of the branches are then merged into the library. In practical application, the project of one interface may include numerous times of development and release of the incremental code, and the incompatible test cases are screened and modified to conform to the test in the regression phase based on submitting the incremental code of the function to be tested each time according to the implementation manner of the embodiment. For details, reference may be made to the description of the above embodiments, and reference may be made to the implementation flows of the above embodiments, which are not described herein again.
FIG. 6 is a schematic diagram according to a fourth embodiment of the present disclosure; as shown in fig. 6, the present embodiment provides a device 600 for screening test cases, which includes:
the determining module 601 is configured to determine that an incompatible test case exists in the function to be tested of the current test interface based on a preset incompatible information table and an incremental code of the function to be tested of the current test interface;
an extracting module 602, configured to extract attribute information of a current test interface;
the screening module 603 is configured to screen a test case incompatible with the function to be tested of the current test interface from the test case library based on the attribute information of the current test interface and the attribute information of the interface corresponding to each test case in the test case library.
The implementation principle and technical effect of the screening of the test cases by using the modules in the screening apparatus 600 for test cases of this embodiment are the same as the implementation of the related method embodiments, and reference may be made to the description of the related method embodiments in detail, which is not described herein again.
FIG. 7 is a schematic diagram according to a fifth embodiment of the present disclosure; as shown in fig. 7, the present embodiment provides a screening apparatus 700 for test cases, which includes the same-name functional modules shown in fig. 6: a determination module 701, an extraction module 702 and a screening module 703.
In this embodiment, the determining module 701 is configured to:
detecting whether the incremental code of the function to be tested of the current test interface hits incompatible features in the incompatible information table;
and if so, determining that the incompatible test case exists in the function to be tested of the current test interface.
Further optionally, in an embodiment of the present disclosure, the determining module 701 is configured to:
analyzing the incremental code of the function to be tested of the current test interface into a syntax tree;
acquiring code characteristics of field nodes, code characteristics of method nodes, code characteristics of return nodes and code characteristics of code lines in a syntax tree;
whether the code characteristics of the field nodes, the code characteristics of the method nodes, the code characteristics of the return nodes or the code characteristics of the code lines in the syntax tree hit the code characteristics in the incompatible information table or not is detected.
Further optionally, as shown in fig. 7, in an embodiment of the present disclosure, the apparatus 700 for screening test cases further includes:
an obtaining module 704, configured to obtain a scene corresponding to an incremental code of a function to be tested of a current test interface;
the determining module 701 is further configured to detect and determine an incompatible scene in the scene hit incompatible information table.
Further optionally, as shown in fig. 7, in an embodiment of the present disclosure, the apparatus 700 for screening test cases further includes a reporting module 705;
an obtaining module 704, configured to obtain identification information of an incompatible test case;
the reporting module 705 is configured to send an incompatible report, where the incompatible report carries identification information of an incompatible test case.
Further optionally, in an embodiment of the present disclosure, the obtaining module 704 is further configured to obtain a code feature in an incompatible information table corresponding to the incompatible test case;
the reporting module 705 is configured to send an incompatible report carrying the identification information and the code characteristics of the incompatible test case.
Further optionally, as shown in fig. 7, in an embodiment of the present disclosure, the apparatus 700 for screening test cases further includes:
a positioning module 706, configured to position a code modification position based on the incompatible information table and the code features in the incompatible information table corresponding to the incompatible test case;
a determining module 701, configured to determine that the code modification location is located at the second level and above;
the reporting module 705 is configured to send an incompatible report carrying the identification information, the code characteristics, and the code modification location of the incompatible test case.
Further optionally, as shown in fig. 7, in an embodiment of the present disclosure, the apparatus 700 for screening test cases further includes:
a generating module 707, configured to generate a modification suggestion based on the code feature if the code modification position is located in the first hierarchy;
the reporting module 705 is configured to send an incompatible report carrying identification information, code characteristics, a code modification location, and a modification suggestion of the incompatible test case.
Further optionally, in an embodiment of the present disclosure, the extracting module 702 is configured to:
and extracting the field name and the uniform resource locator of the current test interface based on the incremental code of the function to be tested of the current test interface.
Further optionally, in an embodiment of the present disclosure, the extracting module is configured to:
extracting the field name of the current test interface by adopting a static code analysis technology based on the incremental code of the function to be tested of the current test interface;
based on the incremental code of the function to be tested of the current test interface, a call chain analysis technology is adopted to obtain the uniform resource locator of the current test interface associated with the incremental code.
Further optionally, as shown in fig. 7, in an embodiment of the present disclosure, the apparatus 700 for screening test cases further includes:
a configuration module 708, configured to configure the incompatible information table based on the incompatible information of the test case of the historical interface test.
The implementation principle and technical effect of the screening of the test cases by using the modules in the screening apparatus 700 for test cases of this embodiment are the same as the implementation of the related method embodiments, and reference may be made to the description of the related method embodiments in detail, which is not described herein again.
In the technical scheme of the disclosure, the acquisition, storage, application and the like of the personal information of the related user all accord with the regulations of related laws and regulations, and do not violate the good customs of the public order.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 8 illustrates a schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 8, the apparatus 800 includes a computing unit 801 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 802 or a computer program loaded from a storage unit 808 into a Random Access Memory (RAM) 803. In the RAM803, various programs and data required for the operation of the device 800 can also be stored. The calculation unit 801, the ROM802, and the RAM803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
A number of components in the device 800 are connected to the I/O interface 805, including: an input unit 806 such as a keyboard, a mouse, or the like; an output unit 807 such as various types of displays, speakers, and the like; a storage unit 808, such as a magnetic disk, optical disk, or the like; and a communication unit 809 such as a network card, modem, wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
Computing unit 801 may be a variety of general and/or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and the like. The computing unit 801 performs various methods and processes described above, such as the methods described above of the present disclosure. For example, in some embodiments, the above-described methods of the present disclosure may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and/or installed onto device 800 via ROM802 and/or communications unit 809. When loaded into RAM803 and executed by computing unit 801, may perform one or more of the steps of the above-described methods of the present disclosure described above. Alternatively, in other embodiments, the computing unit 801 may be configured in any other suitable manner (e.g., by way of firmware) to perform the above-described methods of the present disclosure.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user may provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server combining a blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (25)

1. A screening method of test cases comprises the following steps:
determining that an incompatible test case exists in the function to be tested of the current test interface based on a preset incompatible information table and an incremental code of the function to be tested of the current test interface;
extracting attribute information of the current test interface;
and screening the test cases incompatible with the functions to be tested of the current test interface from the test case library based on the attribute information of the current test interface and the attribute information of the interface corresponding to each test case in the test case library.
2. The method of claim 1, wherein determining that there is an incompatible test case for the function to be tested of the current test interface based on a preset incompatible information table and an incremental code of the function to be tested of the current test interface comprises:
detecting whether the incremental code of the function to be tested of the current test interface hits incompatible features in the incompatible information table;
and if so, determining that an incompatible test case exists in the function to be tested of the current test interface.
3. The method of claim 2, wherein detecting whether the delta code for the function under test of the current test interface hits an incompatible feature in the table of incompatible information comprises:
analyzing the incremental code of the function to be tested of the current test interface into a syntax tree;
acquiring code characteristics of field nodes, code characteristics of method nodes, code characteristics of return nodes and code characteristics of code lines in the syntax tree;
and detecting whether the code characteristics of the field nodes, the code characteristics of the method nodes, the code characteristics of the return nodes or the code characteristics of the code lines in the syntax tree hit the code characteristics in the incompatible information table.
4. The method of claim 3, wherein prior to parsing the delta code for the function under test of the current test interface into a syntax tree, the method further comprises:
acquiring a scene corresponding to the incremental code of the function to be tested of the current test interface;
detecting and determining that the scene hits an incompatible scene in the incompatible information table.
5. The method of claim 2, wherein after screening the test cases incompatible with the function to be tested of the current test interface from the test case library based on the attribute information of the current test interface and the attribute information of the interface corresponding to each test case in the test case library, the method comprises:
acquiring identification information of the incompatible test case;
and sending an incompatible report, wherein the incompatible report carries the identification information of the incompatible test case.
6. The method of claim 5, wherein prior to said issuing an incompatible report, the method further comprises:
acquiring code characteristics in the incompatible information table corresponding to the incompatible test cases;
the issuing of the incompatible report includes:
and sending an incompatible report carrying the identification information of the incompatible test case and the code characteristics.
7. The method of claim 6, wherein after obtaining the code features in the incompatibility information table corresponding to the incompatible test case and before issuing an incompatibility report, the method further comprises:
positioning a code modification position based on the incompatible information table and the code characteristics in the incompatible information table corresponding to the incompatible test case;
and determining that the code modification location is at or above a second level;
the issuing of the incompatible report includes:
and sending an incompatible report carrying the identification information of the incompatible test case, the code characteristics and the code modification position.
8. The method of claim 6, wherein the method further comprises:
if the code modification position is located in a first level, generating a modification suggestion based on the code characteristics;
the issuing of the incompatible report includes:
and sending out an incompatible report carrying the identification information of the incompatible test case, the code characteristics, the code modification position and the modification suggestion.
9. The method of any one of claims 1-8, wherein extracting attribute information of the current test interface comprises:
and extracting the field name and the uniform resource locator of the current test interface based on the incremental code of the function to be tested of the current test interface.
10. The method of claim 9, wherein extracting a field name and a uniform resource locator of the current test interface based on a delta code of a function to be tested of the current test interface comprises:
extracting the field name of the current test interface by adopting a static code analysis technology based on the incremental code of the function to be tested of the current test interface;
and acquiring the uniform resource locator of the current test interface associated with the incremental code by adopting a call chain analysis technology based on the incremental code of the function to be tested of the current test interface.
11. The method according to any one of claims 1 to 8, wherein before determining that there is an incompatible test case for the function to be tested of the current test interface based on a preset incompatible information table and an incremental code of the function to be tested of the current test interface, the method further comprises:
and configuring the incompatible information table based on the incompatible information of the test case of the historical interface test.
12. A screening device for test cases comprises:
the determining module is used for determining that the function to be tested of the current testing interface has an incompatible test case based on a preset incompatible information table and the incremental code of the function to be tested of the current testing interface;
the extraction module is used for extracting the attribute information of the current test interface;
and the screening module is used for screening the test cases incompatible with the functions to be tested of the current test interface from the test case library based on the attribute information of the current test interface and the attribute information of the interface corresponding to each test case in the test case library.
13. The apparatus of claim 12, wherein the means for determining is configured to:
detecting whether the incremental code of the function to be tested of the current test interface hits incompatible features in the incompatible information table;
and if so, determining that the incompatible test case exists in the function to be tested of the current test interface.
14. The apparatus of claim 13, wherein the means for determining is configured to:
analyzing the incremental code of the function to be tested of the current test interface into a syntax tree;
acquiring code characteristics of field nodes, code characteristics of method nodes, code characteristics of return nodes and code characteristics of code lines in the syntax tree;
and detecting whether the code characteristics of the field nodes, the code characteristics of the method nodes, the code characteristics of the return nodes or the code characteristics of the code lines in the syntax tree hit the code characteristics in the incompatible information table.
15. The apparatus of claim 14, wherein the apparatus further comprises:
the acquisition module is used for acquiring a scene corresponding to the incremental code of the function to be tested of the current test interface;
the determining module is further configured to detect and determine that the scene hits an incompatible scene in the incompatible information table.
16. The apparatus of claim 15, wherein the apparatus comprises a reporting module;
the obtaining module is further configured to obtain identification information of the incompatible test case;
the report module is used for sending out an incompatible report, and the incompatible report carries the identification information of the incompatible test case.
17. The apparatus of claim 16, wherein:
the obtaining module is further configured to obtain a code feature in the incompatible information table corresponding to the incompatible test case;
and the report module is used for sending out an incompatible report carrying the identification information of the incompatible test case and the code characteristics.
18. The apparatus of claim 17, wherein the apparatus further comprises:
the positioning module is used for positioning a code modification position based on the incompatible information table and the code characteristics in the incompatible information table corresponding to the incompatible test case;
the determining module is used for determining that the code modification position is positioned at a second level and above;
the report module is used for sending out an incompatible report carrying the identification information of the incompatible test case, the code characteristics and the code modification position.
19. The apparatus of claim 17, wherein the apparatus further comprises:
the generation module is used for generating a modification suggestion based on the code characteristics if the code modification position is positioned at a first level;
the report module is used for sending out an incompatible report carrying the identification information of the incompatible test case, the code characteristics, the code modification position and the modification suggestion.
20. The apparatus of any one of claims 12-19, wherein the extraction module is to:
and extracting the field name and the uniform resource locator of the current test interface based on the incremental code of the function to be tested of the current test interface.
21. The apparatus of claim 20, wherein the extraction module is to:
extracting the field name of the current test interface by adopting a static code analysis technology based on the incremental code of the function to be tested of the current test interface;
and acquiring the uniform resource locator of the current test interface associated with the incremental code by adopting a call chain analysis technology based on the incremental code of the function to be tested of the current test interface.
22. The apparatus of any of claims 12-19, wherein the apparatus further comprises:
and the configuration module is used for configuring the incompatible information table based on the incompatible information of the test case of the historical interface test.
23. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-11.
24. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-11.
25. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-11.
CN202211208697.2A 2022-09-30 2022-09-30 Test case screening method and device, electronic equipment and storage medium Pending CN115658478A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211208697.2A CN115658478A (en) 2022-09-30 2022-09-30 Test case screening method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211208697.2A CN115658478A (en) 2022-09-30 2022-09-30 Test case screening method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115658478A true CN115658478A (en) 2023-01-31

Family

ID=84984978

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211208697.2A Pending CN115658478A (en) 2022-09-30 2022-09-30 Test case screening method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115658478A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117331849A (en) * 2023-12-01 2024-01-02 杭银消费金融股份有限公司 Testing method and system based on accurate analysis of codes

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117331849A (en) * 2023-12-01 2024-01-02 杭银消费金融股份有限公司 Testing method and system based on accurate analysis of codes
CN117331849B (en) * 2023-12-01 2024-02-27 杭银消费金融股份有限公司 Testing method and system based on accurate analysis of codes

Similar Documents

Publication Publication Date Title
CN111240994B (en) Vulnerability processing method and device, electronic equipment and readable storage medium
CN113656252B (en) Fault positioning method, device, electronic equipment and storage medium
CN115658478A (en) Test case screening method and device, electronic equipment and storage medium
CN115509522A (en) Interface arranging method and system for low-code scene and electronic equipment
CN111352612A (en) Scheduling method and device for code deployment, electronic equipment and storage medium
CN110688305A (en) Test environment synchronization method, device, medium and electronic equipment
CN115687406B (en) Sampling method, device, equipment and storage medium for call chain data
CN115576831A (en) Test case recommendation method, device, equipment and storage medium
CN116089258A (en) Data migration test method, device, equipment, storage medium and program product
CN114546799A (en) Point burying log checking method and device, electronic equipment, storage medium and product
CN115328736A (en) Probe deployment method, device, equipment and storage medium
CN114462030A (en) Privacy policy processing and evidence obtaining method, device, equipment and storage medium
EP3832985A1 (en) Method and apparatus for processing local hot spot, electronic device and storage medium
CN114389969A (en) Client test method and device, electronic equipment and storage medium
CN113434382A (en) Database performance monitoring method and device, electronic equipment and computer readable medium
CN112579402A (en) Method and device for positioning faults of application system
CN111405060A (en) Service influence range determining method, device, tool and electronic equipment
CN114253867B (en) Automatic testing method, device and system based on neural network model
CN114168459A (en) Service testing method and device, electronic equipment and readable storage medium
CN116974940A (en) Interface testing method, device, equipment and storage medium
CN116737121A (en) Software development management method, device, system, equipment and storage medium
CN117544532A (en) Inspection display method and device, electronic equipment and storage medium
CN115686479A (en) File creation method and related device
CN114238149A (en) Batch testing method of accounting system, electronic device and storage medium
CN115454800A (en) Log data verification method and device, electronic equipment, storage medium and product

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