CN117827637A - Automatic test method and device and electronic equipment - Google Patents

Automatic test method and device and electronic equipment Download PDF

Info

Publication number
CN117827637A
CN117827637A CN202311527532.6A CN202311527532A CN117827637A CN 117827637 A CN117827637 A CN 117827637A CN 202311527532 A CN202311527532 A CN 202311527532A CN 117827637 A CN117827637 A CN 117827637A
Authority
CN
China
Prior art keywords
test
template
determining
historical
filling
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
CN202311527532.6A
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.)
Suzhou Tsing Standard Automobile Technology Co ltd
Original Assignee
Suzhou Tsing Standard Automobile 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 Suzhou Tsing Standard Automobile Technology Co ltd filed Critical Suzhou Tsing Standard Automobile Technology Co ltd
Priority to CN202311527532.6A priority Critical patent/CN117827637A/en
Publication of CN117827637A publication Critical patent/CN117827637A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses an automatic testing method, an automatic testing device and electronic equipment. The specific scheme is as follows: when a task to be tested is received, determining a test type and a test case identifier corresponding to the task to be tested; the method comprises the steps of calling a test template to be used based on a test type, and determining a difference information filling template based on a test case identification, wherein the test template to be used is determined based on historical test cases of a plurality of historical test tasks belonging to the same test type; filling a difference information filling template according to test data corresponding to a task to be tested so as to obtain a text to be used of filling information; and generating a target test case corresponding to the task to be tested based on the text to be used, the test case identifier and the test template to be used. The technical scheme provided by the embodiment of the invention reduces the workload of generating the target test case, improves the efficiency of generating the target test case, and improves the accuracy of the target test case.

Description

Automatic test method and device and electronic equipment
Technical Field
The present invention relates to the field of automated testing technologies, and in particular, to an automated testing method, an apparatus, and an electronic device.
Background
With the development of the internet, the mobile internet has become a part of people's daily life. In order to meet the requirements of users for higher experience, test engineers need to ensure the quality and stability of products, and automated testing can improve the testing efficiency and release manpower.
At present, the existing automatic test is realized based on automatic test software, one is to manually build an automatic test case by a tester, then test the test by corresponding automatic test software, and the other is to convert an Excel case into a case in a format which can be identified by the automatic test software by a script, so that the process of manually building the automatic test case can be simplified to a certain extent. But the Excel use case filling process requires that each step in the use case be filled out clearly based on a manual manner. When processing is performed based on the method, the workload of form filling is large, filling errors can be generated, and various errors occur when the script analyzes Excel, so that the efficiency and the accuracy of generating the automatic test case are relatively low.
Disclosure of Invention
The invention provides an automatic test method, an automatic test device and electronic equipment, which reduce the workload of generating target test cases, improve the efficiency of generating the target test cases and improve the accuracy of the target test cases.
According to an aspect of the present invention, there is provided an automated test method comprising:
when a task to be tested is received, determining a test type and a test case identifier corresponding to the task to be tested;
the method comprises the steps of calling a test template to be used based on a test type, and determining a difference information filling template based on a test case identification, wherein the test template to be used is determined based on historical test cases of a plurality of historical test tasks belonging to the same test type;
filling a difference information filling template according to test data corresponding to a task to be tested so as to obtain a text to be used of filling information;
and generating a target test case corresponding to the task to be tested based on the text to be used, the test case identifier and the test template to be used.
According to another aspect of the present invention, there is provided an automated testing apparatus comprising:
the type and identification determining module is used for determining a test type and a test case identification corresponding to the task to be tested when the task to be tested is received;
the filling template determining module is used for retrieving a to-be-used test template based on the test type and determining a difference information filling template based on the test case identification, wherein the to-be-used test template is determined based on historical test cases of a plurality of historical test tasks belonging to the same test type;
The to-be-used text acquisition module is used for filling the difference information filling template according to the test data corresponding to the task to be tested so as to obtain a to-be-used text of the filling information;
the target test case generation module is used for generating a target test case corresponding to the task to be tested based on the text to be used, the test case identification and the test template to be used.
According to another aspect of the present invention, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the automated test method of any of the embodiments of the invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to execute an automated test method embodying any one of the embodiments of the present invention.
According to the technical scheme, when the task to be tested is received, the test type and the test case identification corresponding to the task to be tested are determined, then the test template to be used is called based on the test type, the difference information filling template is determined based on the test case identification, the difference information filling template is filled according to the test data corresponding to the task to be tested, the text to be used of the filling information is obtained, and further, the target test case corresponding to the task to be tested is generated based on the text to be used, the test case identification and the test template to be used. The method solves the problems of form filling errors and low efficiency caused by filling test cases based on a manual mode in the prior art, reduces the workload of generating the target test cases, improves the efficiency of generating the target test cases, and improves the accuracy of the target test cases.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an automated test method provided by an embodiment of the present invention;
FIG. 2 is a flowchart illustrating an automated test method according to an embodiment of the present invention;
FIG. 3 is an exemplary diagram of an automated test method provided by an embodiment of the present invention;
FIG. 4 is a schematic diagram of an automated test equipment according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device implementing an automated test method according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of an automatic test method according to a first embodiment of the present invention, where the method may be applied to the situation of low efficiency and accuracy caused by using test scripts to convert Excel cases into cases in a format recognizable by automatic test software, where the method may be performed by an automatic test device, where the automatic test device may be implemented in the form of hardware and/or software, and where the automatic test device may be configured in an electronic device such as a mobile phone, a computer, or a server. As shown in fig. 1, the method includes:
S110, when a task to be tested is received, determining a test type and a test case identifier corresponding to the task to be tested.
In the software development process, in order to ensure the accuracy of the software quality and the requirement of the development flow, a task for testing the software is received, namely the task to be tested. After receiving the task to be tested, the requirements corresponding to the task to be tested can be analyzed, so that the test type corresponding to the task to be tested is determined. The test type is understood to be a type of test determined according to the requirements of the task to be tested and the purpose of the test. For example, the test type may be a functional test, a performance test, a security test, or a compatibility test, which is not limited in this embodiment. The test case identification may be understood as an identifier that is used to uniquely identify and distinguish the test case corresponding to each task to be tested. The test case identification can be used for conveniently and subsequently determining the test case corresponding to the task to be tested, so that the traceability of the task to be tested is improved.
Specifically, when a task to be tested is received, in order to ensure that a corresponding test case is generated in a subsequent efficient and accurate manner, the requirements of the task to be tested and the purpose of testing can be analyzed, and the test type corresponding to the task to be tested can be determined. Meanwhile, in order to facilitate subsequent reference of the corresponding templates and increase traceability, the test case identification corresponding to the task to be tested can be determined, so that the accuracy of test case generation is ensured.
S120, calling a test template to be used based on the test type, and determining a difference information filling template based on the test case identification.
Wherein the test templates to be used are determined based on historical test cases of a plurality of historical test tasks belonging to the same test type.
In the embodiment of the invention, the test templates to be used can be determined according to the historical test examples corresponding to a plurality of historical test tasks of the same test type, and the type of the test templates is universal. The test template can comprise corresponding test steps abstracted based on the historical test cases. I.e. the test templates to be used corresponding to different test types are different. The historical test task may be a test task performed before the task to be tested is executed. The historical test cases may be related test cases obtained in a historical test task. The difference information populating template may be a table or form used to record the difference information.
Specifically, a general test template can be abstracted according to the historical test examples corresponding to a plurality of historical test tasks of the same test type, namely, the test template to be used. After determining the test type corresponding to the task to be tested, determining the universal test template to be used corresponding to the test type based on the test type. Meanwhile, according to the test case identification corresponding to the task to be tested, the position information of the task to be tested in the difference information filling template is determined, so that the data information to be filled in the difference information filling template is determined, and the data information in the subsequent task to be tested is filled.
It should be noted that, the test case identifiers corresponding to the tasks to be tested are filled in the corresponding positions of the difference information filling templates, and the position information of the tasks to be tested in the difference information filling templates, namely the filled positions of the tasks to be tested in the difference information filling templates, is determined based on the test case identifiers of the corresponding positions in the difference information filling templates.
Optionally, before the test template to be used is called based on the test type and the difference information filling template is determined based on the test case identification, the method further comprises: acquiring a plurality of historical test cases; determining the similarity between any two historical test cases, and determining a historical case group based on the similarity; wherein, the history instance group comprises at least one history test instance; determining a test type of the history instance group based on the test content of at least one history test instance in the history instance group; based on the historical instance group corresponding to the same test type, a corresponding test template is determined.
In the embodiment of the invention, the similarity can refer to the similarity degree between the historical test cases. Alternatively, the similarity between two historical test cases may be determined by comparing the test steps corresponding to the two historical test cases, where the test contents included in the test steps, that is, the corresponding test operations are the same or similar, and the similarity may be considered to be higher. The set of history instances may be a set of history test instances with a higher degree of similarity. The test templates are universal test templates abstracted out based on the historical instance groups of the same test type.
Specifically, a plurality of history test cases may be obtained from a corresponding database or file storing the history test cases. Thereafter, from the obtained plurality of history test cases, the similarity between any two history test cases may be compared. And comparing whether the test contents or the corresponding operations contained in the test steps corresponding to any two historical test cases are the same or similar, and if the test contents or the corresponding operations are the same or similar, considering that the two historical test cases are higher in similarity. After determining that the similarity of any two history test cases is higher, the history test cases with higher similarity can be classified into a history case group. Where there may be a situation where there is no similarity between other historical test cases and a certain historical test case, the historical test cases may also be categorized as a historical case group. Thus, at least one history test case is included in the set of history cases. Then, according to the test content in the history test cases in the history case group, the test type corresponding to the history case group can be analyzed and determined, and according to the test type corresponding to the history case group, the history test cases in the history case group are processed, and the corresponding test templates are abstracted.
Optionally, determining the similarity between any two historical test cases and determining the set of historical test cases based on the similarity includes: acquiring any two history test cases; extracting features corresponding to any two history test cases based on any two history test cases; judging the similarity of any two historical test cases based on the characteristics corresponding to any two historical test cases; based on the similarity, a set of historical instances is determined.
In the embodiment of the invention, the characteristics corresponding to the history test case can be the operation in the test step corresponding to the history test case, the execution sequence of the test step, the data type of the corresponding data in the test step and the like. This embodiment is not limited thereto.
Specifically, any two history test cases may be obtained from a corresponding database or file storing the history test cases. And then, selecting and extracting the features corresponding to the two historical test cases according to actual requirements, for example, selecting and extracting the features such as the operation in the test steps corresponding to the historical test cases, the execution sequence of the test steps, the data types of corresponding data in the test steps and the like. Then, the similarity of the corresponding features can be judged through manual selection, and the similarity of the corresponding features can also be judged by utilizing a corresponding similarity calculation algorithm. And determining the similarity of the historical test cases according to the similarity of the features in any two judged historical test cases. Thus, the history test cases with higher similarity belong to the same history case group.
Optionally, determining the test type of the history instance group based on the test content of at least one history test instance in the history instance group includes: comparing the test contents of at least one historical test instance in the historical instance group, and determining the public characteristics of the test contents; based on the common characteristics, test types of the historical instance group are generalized.
In the embodiment of the invention, the common characteristic can be a characteristic common to the test content in each history test case in the history case group, and optionally, the common characteristic can be a test purpose corresponding to the test content in the history test case. For example, the test content in the history test case may be a test that obtains a function point for a particular function, which may categorize the history test case as a type of function test.
Specifically, according to the test contents of the history test cases in the history case group, the common characteristic, namely the common characteristic, of the test contents of each history test case is judged. The description is given by taking the common characteristic as an example of the test purpose, and when the test purposes corresponding to the test content of each history test case are the same, it can be described that the history test cases in the history case group are the same test type, so that the test type of the history case group is correspondingly determined.
Optionally, determining the corresponding test template based on the history instance group corresponding to the same test type includes: abstracting a test template step corresponding to the test step based on the test step of at least one historical test example in a historical example group corresponding to the same test type; based on the test template step, a corresponding test template is determined.
In the embodiment of the present invention, the test template step may be a step obtained by replacing specific data in the test steps in at least one historical test case with a generic data representation. For example, where one of the test steps of the historical test case is "enter '1' in the input box and the test step of the other historical test case is" enter '3' in the input box, the corresponding test template step may be enter 'a' in the input box. This is by way of example only and is not intended to be limiting in any way.
Specifically, the historical test cases in the historical case group corresponding to the same test type can be analyzed and compared, then test data of corresponding test steps in the historical test cases are removed to be replaced by general data representation, namely, abstract processing is carried out on the test steps of the historical test cases, and therefore general test template steps are obtained. Thereafter, the test template steps may be integrated to determine a corresponding test template.
Optionally, after determining the corresponding test template, the method further includes: the test templates comprise at least one subtest template; the at least one subtest template comprises test case identifications, wherein the test case identifications are used for representing test types corresponding to the subtest templates.
In the embodiment of the invention, the subtest template can be a test template formed by general test steps abstracted according to the corresponding test instance. The at least one subtest template may refine the test type so that the test is more accurate.
Specifically, the test template may include at least one sub-test template, where each sub-test template may include a test case identifier corresponding to the test template. The test case identification may correspond to a test type of the subtest template. So as to determine the test type based on the test case identification later, thereby judging and calling the corresponding subtest template based on the test type.
Optionally, the method further comprises: generating a difference information filling template; generating a difference information population template, comprising: determining test data corresponding to the test steps of each historical test instance based on the test steps of at least one historical test instance in the historical instance group corresponding to the same test type; determining difference information corresponding to the test steps based on the test data and the test templates corresponding to the historical instance groups; determining position information of the difference information in the filling template; based on the location information, a difference information population template is determined.
In the embodiment of the present invention, the difference information may be data information such as different values or variables between the test steps of the history test case and the test steps of the test template. The location information may be understood as the location where the difference information is located in the filling template.
Specifically, according to the testing steps of the history test cases of the same testing type, testing data corresponding to the testing steps of each history test case are determined, testing data corresponding to the testing steps of the history test cases are compared with testing data corresponding to the testing steps of the testing templates, difference information corresponding to the testing steps of the history test cases is determined, and then position information of the difference information in the filling templates is determined, so that the difference information filling templates are generated based on the mode, and corresponding positions of the difference information filling templates can be determined and filled based on new difference information.
S130, filling the difference information filling template according to the test data corresponding to the task to be tested, so as to obtain a text to be used of the filling information.
In the embodiment of the present invention, the filling information may be difference information corresponding to test data corresponding to a task to be tested relative to test data of a test step corresponding to a test template to be used. For example, the test data corresponding to the task to be tested may be 'a=0', and the test data corresponding to the task to be tested in the test template to be used may be 'a', and the filling information that may be filled in the difference information filling template in the task to be filled in the test may be '0'. The text to be used may be a generated text after the test data fills the difference information filling template. Wherein, the variable and the specific data value can be used as difference information, which is only taken as an example, and the embodiment is not limited to this.
Specifically, the difference information filling template is filled according to the test data corresponding to the task to be tested, so that the text after the difference information filling template is filled, namely the text to be used, can be obtained. The text to be used comprises difference information of corresponding testing steps between the task to be tested and the testing template to be used.
And S140, generating a target test case corresponding to the task to be tested based on the text to be used, the test case identification and the test template to be used.
In the embodiment of the invention, the target test case can be a test case correspondingly generated according to the task to be tested.
Specifically, a corresponding test template to be used can be determined according to the test case identification, and the filling information in the text to be used is utilized to replace the data information of the corresponding position of the test template to be used, so that the target test case corresponding to the task to be tested is obtained.
Optionally, generating the target test case corresponding to the task to be tested based on the text to be used, the test case identifier and the test template to be used includes: determining a to-be-used test template corresponding to the test case identifier based on the test case identifier; determining filling information corresponding to a test template to be used based on the text to be used; and filling the test template to be used based on the filling information, and generating a target test case corresponding to the task to be tested.
The text to be used comprises a test number and a test name corresponding to the task to be tested, and the test number and the test name corresponding to the target test case are determined based on the test number and the test name in the text to be used.
In the embodiment of the invention, the test number can be a number corresponding to the task to be tested defined according to actual requirements. The test name may be the name of the task to be tested defined according to the actual requirement.
Specifically, the to-be-used test template corresponding to the test case identifier is determined according to the test case identifier, namely the to-be-used text and the to-be-used test template can be corresponding according to the test case identifier, and the to-be-used text and the to-be-used test template are determined to be corresponding. And then analyzing the content of the test template to be used by utilizing the corresponding script, and replacing the data information of the corresponding position by utilizing the filling information so as to generate the target test case.
According to the technical scheme, when a task to be tested is received, a test type and a test case identification corresponding to the task to be tested are determined, then a test template to be used is called based on the test type, a difference information filling template is determined based on the test case identification, the difference information filling template is filled according to test data corresponding to the task to be tested, a text to be used of filling information is obtained, and further, a target test case corresponding to the task to be tested is generated based on the text to be used, the test case identification and the test template to be used. The method solves the problems of form filling errors and low efficiency caused by filling test cases based on a manual mode in the prior art, reduces the workload of generating the target test cases, improves the efficiency of generating the target test cases, and improves the accuracy of the target test cases.
Example two
Fig. 2 is a flowchart illustrating an automatic test method according to a second embodiment of the present invention, and this embodiment is an example of the above embodiment. As shown in fig. 2, the method includes:
s210, acquiring a class of test cases with higher similarity of test steps.
In the embodiment of the invention, one type of test cases with higher similarity of test steps corresponds to the history instance group corresponding to the same test type mentioned in the embodiment.
Specifically, the test cases of the same type with higher similarity of the test steps can be obtained in the engineering practice process or in the corresponding test case database.
S220, abstracting a demo test case according to the test steps of the test case, and building the demo automatic test case in corresponding automatic test software.
Wherein, the demo automatic test case is in an xml format.
In the embodiment of the present invention, the demo test case corresponds to the test template mentioned in the above embodiment.
Specifically, according to the test steps of the test cases of the same type, specific test data in the test steps can be replaced by general data representation, so that abstract processing of the test steps is realized, and a general demo test template is obtained. The demo automatic test case can be built by using automatic test software. For example, the automated test software may be a TAE (TestAutomation Executor, automated test software). This embodiment is not limited thereto. Alternatively, the format of the demo automatic test case may be xml format.
Illustratively, as shown in fig. 3, according to the testing steps of such test cases, a demo automatic test case is built by using automatic test software.
S230, analyzing different information in the test steps of the test case and the demo test case, taking the difference item as filling content of the Excel test case, and designing an Excel test case template according to the principle.
In the embodiment of the present invention, the difference item may be different data information such as a numerical value or a variable between the test step of the test case and the test step of the demo test case, and corresponds to the difference information mentioned in the above embodiment. An Excel test case may be a table used to store difference items. Based on the above manner, the Excel test case designed to fill the difference item is an Excel test case template, which corresponds to the difference information filling template mentioned in the above embodiment.
Specifically, the test steps of the test cases of the same type are compared with the test steps of the demo test case, the data information of different values or variables in the test steps of each test case and the test steps of the demo test case in the type is determined, and the data information is stored into the Excel case as a difference item. Based on the mode of storing the difference items, corresponding Excel test case templates are correspondingly designed.
S240, filling in the differentiation information of each test case and the demo test case in an Excel test case template according to the specified format requirement.
In the embodiment of the present invention, the difference information, that is, the difference item mentioned in the embodiment, corresponds to the difference information mentioned in the above embodiment.
Specifically, according to the format of the designed Excel test case template, the difference items of the test cases of the same type and the demo test case, namely the difference information, are filled into the Excel test case template.
Illustratively, as shown in FIG. 3, the Excel test case templates are filled with the difference items of the test case steps.
S250, analyzing the test cases in the Excel format by utilizing the development script, and reading out the case number, the case name and the differentiation information of the demo test cases of each test case.
In the embodiment of the present invention, the Excel test case is the Excel test case mentioned in the embodiment. The case numbers correspond to the test numbers mentioned in the above examples. The case names correspond to the test names mentioned in the above embodiments.
Specifically, the test case in the Excel format can be obtained by filling the differentiation information into the Excel test case template. Corresponding development scripts can be designed to analyze test cases in an Excel format, so that the case number and the case name of each test case in the type and the differentiation information between each test case and the demo test case are obtained.
S260, analyzing the content of the demo test case by utilizing a development script in combination with the format of the automatic test case, replacing the differential information of the test steps, and directly multiplexing the test steps identical to the demo test case.
Specifically, since the demo test case is in an xml format, a corresponding development script can be designed in combination with the format of the automated test case. And analyzing the content of the demo test case by using the development script, and replacing the data information of the position corresponding to the test step of the demo test case based on the obtained differential information. Wherein, there may be test steps of the demo test case that do not need to replace the differential information, and the corresponding test steps may be directly multiplexed.
By way of example, in combination with the above example, as shown in fig. 3, after a demo automatic test case is built and the difference item of the test step is filled in the Excel test case template, the test case and the demo automatic test case in the Excel format may be parsed by using the development script, and meanwhile, the corresponding data content in the demo test case is replaced by the difference information, and then the automatic test case may be generated in batches based on the above manner.
S270, naming the newly generated automatic test cases according to the case numbers and the case names of each test case, so as to realize batch generation of the automatic test cases corresponding to each Excel case.
In the embodiment of the invention, the newly generated automated test case corresponds to the target test case mentioned in the above embodiment.
Specifically, after a new automated test case is generated by using the development script, the case number and the case name of the newly generated automated test case may be determined by using the case number and the case name of each test case. Thus, the batch generation of the automatic test cases is realized.
According to the technical scheme, the demo test cases are obtained by obtaining the test cases with high similarity of the test steps and abstracting the test steps of the test cases. And building the demo automatic test case by using corresponding automatic test software. And then, filling different information in the Excel test cases as difference items according to different information in the test steps in the test cases and the demo test cases. And analyzing the Excel test cases by using the development scripts to obtain the case number, the case name and the differentiation information of the demo test cases corresponding to each test case. Based on the method, the development script is utilized to analyze the demo test cases and replace the differentiation information, and meanwhile, the newly generated automatic test cases are named by utilizing the case number and the case name of each test case, so that the automatic test cases are generated in batches based on the mode. The method solves the problems of form filling errors and low efficiency caused by filling test case steps based on a manual mode in the prior art, reduces the workload of generating the target test case, improves the efficiency of generating the target test case, and improves the accuracy of the target test case. The method solves the problems of form filling errors and low efficiency caused by filling test cases based on a manual mode in the prior art, reduces the workload of generating the automatic test cases, improves the efficiency of generating the automatic test cases, and improves the accuracy of the automatic test cases.
Example III
Fig. 4 is a schematic structural diagram of an automatic testing device according to a third embodiment of the present invention. As shown in fig. 4, the apparatus includes: the type and identity determination module 310, the filling template determination module 320, the text to be used acquisition module 330, and the target test case generation module 340.
The type and identifier determining module 310 is configured to determine, when receiving a task to be tested, a test type and a test case identifier corresponding to the task to be tested; a filling template determining module 320, configured to retrieve a to-be-used test template based on a test type, and determine a difference information filling template based on a test case identifier, where the to-be-used test template is determined based on a history test case of a plurality of history test tasks belonging to the same test type; the text to be used obtaining module 330 is configured to populate the difference information population template according to the test data corresponding to the task to be tested, so as to obtain a text to be used of the population information; the target test case generating module 340 is configured to generate a target test case corresponding to the task to be tested based on the text to be used, the test case identifier, and the test template to be used.
According to the technical scheme, when a task to be tested is received, a test type and a test case identification corresponding to the task to be tested are determined, then a test template to be used is called based on the test type, a difference information filling template is determined based on the test case identification, the difference information filling template is filled according to test data corresponding to the task to be tested, a text to be used of filling information is obtained, and further, a target test case corresponding to the task to be tested is generated based on the text to be used, the test case identification and the test template to be used. The method solves the problems of form filling errors and low efficiency caused by filling test cases based on a manual mode in the prior art, reduces the workload of generating the target test cases, improves the efficiency of generating the target test cases, and improves the accuracy of the target test cases.
On the basis of the above embodiment, optionally, before the filling the template determining module, the test template determining module further includes: a history test case acquisition unit configured to acquire a plurality of history test cases; a similarity determining unit for determining the similarity between any two history test cases and determining a history case group based on the similarity; wherein, the history instance group comprises at least one history test instance; the test type determining unit is used for determining the test type of the history instance group based on the test content of at least one history test instance in the history instance group; and the test template determining unit is used for determining a corresponding test template based on the history instance group corresponding to the same test type.
Optionally, the similarity determining unit includes: a history test case acquisition subunit, configured to acquire any two history test cases; the feature extraction subunit is used for extracting features corresponding to any two history test cases based on any two history test cases; the similarity judging subunit is used for judging the similarity of any two history test cases based on the characteristics corresponding to any two history test cases; a history instance group determination subunit configured to determine a history instance group based on the similarity.
Optionally, the test type determining unit includes: a common characteristic determining subunit, configured to compare the test contents of at least one historical test case in the historical case group, and determine a common characteristic of the test contents; a test type determination subunit for generalizing the test types of the set of historical examples based on the common characteristics.
Optionally, the test template determining unit includes: the template step determining subunit is used for abstracting out a test template step corresponding to the test step based on the test step of at least one historical test instance in the historical instance group corresponding to the same test type; and the test template determining subunit is used for determining the corresponding test template based on the test template step.
Optionally, after testing the template determining unit, the method further includes: the subtest template test type determining unit is used for determining that the test template comprises at least one subtest template; the at least one subtest template comprises test case identifications, wherein the test case identifications are used for representing test types corresponding to the subtest templates.
Optionally, before the filling template determining module, the filling template generating module is further included, and the filling template generating module is used for generating a difference information filling template; the module comprises: the test data determining unit is used for determining the test data corresponding to the test steps of each historical test instance based on the test steps of at least one historical test instance in the historical instance group corresponding to the same test type; the difference information determining unit is used for determining difference information corresponding to the testing steps based on the testing templates corresponding to the testing data and the historical instance group; a position information determining unit for determining position information of the difference information in the filling template; and a filling template determining unit for determining a difference information filling template based on the position information.
Optionally, the target test case generating module includes: the to-be-used test template determining unit is used for determining a to-be-used test template corresponding to the test case identifier based on the test case identifier; the filling information determining unit is used for determining filling information corresponding to the test template to be used based on the text to be used; the target test case generating unit is used for filling the test templates to be used based on the filling information and generating target test cases corresponding to the tasks to be tested; the text to be used comprises a test number and a test name corresponding to the task to be tested, and the test number and the test name corresponding to the target test case are determined based on the test number and the test name in the text to be used.
The automatic testing device provided by the embodiment of the invention can execute the automatic testing method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example IV
Fig. 5 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 5, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as automated testing methods.
In some embodiments, the automated testing method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more of the steps of the automated test method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the automated test method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
The computer program for implementing the automated test method of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program 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.
Example five
The fifth embodiment of the present invention further provides a computer readable storage medium storing computer instructions for causing a processor to execute an automated test method, the method comprising:
when a task to be tested is received, determining a test type and a test case identifier corresponding to the task to be tested; the method comprises the steps of calling a test template to be used based on a test type, and determining a difference information filling template based on a test case identification, wherein the test template to be used is determined based on historical test cases of a plurality of historical test tasks belonging to the same test type; filling a difference information filling template according to test data corresponding to a task to be tested so as to obtain a text to be used of filling information; and generating a target test case corresponding to the task to be tested based on the text to be used, the test case identifier and the test template to be used.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage 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. Alternatively, the computer readable storage medium may be a machine readable signal medium. 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 portable 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 an electronic device 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) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background 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 background, 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), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically 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 can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. An automated testing method, comprising:
when a task to be tested is received, determining a test type and a test case identifier corresponding to the task to be tested;
retrieving a test template to be used based on the test type, and determining a difference information filling template based on the test case identification, wherein the test template to be used is determined based on historical test cases of a plurality of historical test tasks belonging to the same test type;
filling the difference information filling template according to the test data corresponding to the task to be tested to obtain a text to be used of filling information;
and generating a target test case corresponding to the task to be tested based on the text to be used, the test case identifier and the test template to be used.
2. The method of claim 1, wherein the invoking the test template to be used based on the test type and prior to determining the difference information filling template based on the test case identification, further comprises:
acquiring a plurality of historical test cases;
determining the similarity between any two historical test cases, and determining a historical case group based on the similarity; wherein the history instance group comprises at least one history test instance;
Determining the test type of the history instance group based on the test content of at least one history test instance in the history instance group;
based on the historical instance group corresponding to the same test type, a corresponding test template is determined.
3. The method of claim 2, wherein determining the similarity between any two historical test cases and determining the set of historical test cases based on the similarity comprises:
acquiring any two history test cases;
extracting features corresponding to any two history test cases based on the any two history test cases;
judging the similarity of any two history test cases based on the characteristics corresponding to the any two history test cases;
based on the similarity, a set of historical instances is determined.
4. The method of claim 2, wherein the determining the test type of the set of history instances based on the test content of at least one history test instance in the set of history instances comprises:
comparing the test content of at least one historical test instance in the historical instance group, and determining the public characteristic of the test content;
based on the common characteristics, test types of the set of historical instances are generalized.
5. The method of claim 2, wherein determining the corresponding test templates based on the set of history instances corresponding to the same test type comprises:
abstracting a test template step corresponding to the test step based on the test step of at least one historical test example in a historical example group corresponding to the same test type;
and determining a corresponding test template based on the test template step.
6. The method of claim 2, wherein after determining the corresponding test template, further comprising:
the test templates comprise at least one subtest template;
the at least one subtest template comprises a test case identifier, wherein the test case identifier is used for representing a test type corresponding to the subtest template.
7. The method as recited in claim 2, further comprising:
generating a difference information filling template;
the generating the difference information filling template comprises the following steps:
determining test data corresponding to the test steps of each historical test instance based on the test steps of at least one historical test instance in a historical instance group corresponding to the same test type;
Determining difference information corresponding to the test step based on the test data and a test template corresponding to the historical instance group;
determining position information of the difference information in a filling template;
and determining a difference information filling template based on the position information.
8. The method of claim 1, wherein the generating, based on the text to be used, the test case identification, and the test template to be used, a target test case corresponding to the task to be tested comprises:
determining a test template to be used corresponding to the test case identifier based on the test case identifier;
determining filling information corresponding to the test template to be used based on the text to be used;
filling the to-be-used test template based on the filling information, and generating the target test case corresponding to the to-be-tested task;
the text to be used comprises a test number and a test name corresponding to the task to be tested, and the test number and the test name corresponding to the target test case are determined based on the test number and the test name in the text to be used.
9. An automated test equipment, comprising:
the type and identification determining module is used for determining a test type and a test case identification corresponding to a task to be tested when the task to be tested is received;
the filling template determining module is used for calling a to-be-used test template based on the test type and determining a difference information filling template based on the test case identification, wherein the to-be-used test template is determined based on historical test cases of a plurality of historical test tasks belonging to the same test type;
the to-be-used text acquisition module is used for filling the difference information filling template according to the test data corresponding to the task to be tested so as to obtain to-be-used text of filling information;
the target test case generation module is used for generating a target test case corresponding to the task to be tested based on the text to be used, the test case identification and the test template to be used.
10. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the automated test method of any of claims 1-8.
CN202311527532.6A 2023-11-16 2023-11-16 Automatic test method and device and electronic equipment Pending CN117827637A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311527532.6A CN117827637A (en) 2023-11-16 2023-11-16 Automatic test method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311527532.6A CN117827637A (en) 2023-11-16 2023-11-16 Automatic test method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN117827637A true CN117827637A (en) 2024-04-05

Family

ID=90517973

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311527532.6A Pending CN117827637A (en) 2023-11-16 2023-11-16 Automatic test method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN117827637A (en)

Similar Documents

Publication Publication Date Title
CN116881156A (en) Automatic test method, device, equipment and storage medium
CN116975081A (en) Log diagnosis set updating method, device, equipment and storage medium
CN115048352B (en) Log field extraction method, device, equipment and storage medium
CN116303013A (en) Source code analysis method, device, electronic equipment and storage medium
CN116467161A (en) Application testing method and device, electronic equipment and storage medium
CN114443493A (en) Test case generation method and device, electronic equipment and storage medium
CN115687406A (en) Sampling method, device and equipment of call chain data and storage medium
CN117827637A (en) Automatic test method and device and electronic equipment
CN114722401A (en) Equipment safety testing method, device, equipment and storage medium
CN115328736A (en) Probe deployment method, device, equipment and storage medium
CN114444514A (en) Semantic matching model training method, semantic matching method and related device
CN117271373B (en) Automatic construction method and device for test cases, electronic equipment and storage medium
CN117492822B (en) Change contrast method, device, electronic equipment and storage medium
CN116401113B (en) Environment verification method, device and medium for heterogeneous many-core architecture acceleration card
CN117150215B (en) Assessment result determining method and device, electronic equipment and storage medium
CN117472751A (en) Vehicle system function analysis method, device, equipment and medium
CN117724980A (en) Method and device for testing software framework performance, electronic equipment and storage medium
CN118012936A (en) Data extraction method, device, equipment and storage medium
CN117033235A (en) Method, device, equipment and storage medium for testing relevance of software program
CN117851599A (en) Method, device, equipment and medium for extracting text of other elements of investment supervision
CN117056222A (en) Interface test file generation method and device, electronic equipment and storage medium
CN117931155A (en) Code generation method, device, equipment and medium
CN116303071A (en) Interface testing method and device, electronic equipment and storage medium
CN116431809A (en) Text labeling method, device and storage medium based on bank customer service scene
CN118113916A (en) Data processing method, device, 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