CN113282493A - Method and device for smoke test, storage medium and electronic equipment - Google Patents
Method and device for smoke test, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN113282493A CN113282493A CN202110570183.0A CN202110570183A CN113282493A CN 113282493 A CN113282493 A CN 113282493A CN 202110570183 A CN202110570183 A CN 202110570183A CN 113282493 A CN113282493 A CN 113282493A
- Authority
- CN
- China
- Prior art keywords
- test
- interface
- interfaces
- test cases
- tested
- 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.)
- Withdrawn
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3692—Test management for test results analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3696—Methods or tools to render software testable
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/242—Query formulation
- G06F16/2433—Query languages
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Mathematical Physics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the application discloses a smoking test method and device, a storage medium and electronic equipment, and relates to the technical field of computers. The method comprises the following steps: acquiring N interfaces corresponding to changed codes in a project to be tested after the codes are changed; n is a positive integer greater than 0; generating a group of test cases corresponding to each interface respectively based on the N interfaces, wherein the test cases comprise N groups; wherein the number of the test cases in each group is at least one; generating a smoking test task corresponding to the item to be tested based on the N groups of test cases; and indicating the to-be-tested project to execute the smoking test task and acquiring a smoking test result. By adopting the embodiment of the application, the labor cost of smoking test can be reduced, and the smoking test efficiency is improved.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for smoking test, a storage medium, and an electronic device.
Background
During software development, it is often necessary to perform smoke tests on the software. The smoking test is used for testing whether the software with the changed codes operates as expected or not and the changed codes cannot damage the stability of operation, and the smoking test is called by man that the test task of testing whether the software can normally operate is simple because the test time is short and the test task can be finished by the skill of smoking one cigarette. When the smoking test is failed, the subsequent test of the software is not needed. Therefore, it can be said that the smoke test is an economical test means applied to the initial test of the software in the software development process. However, in the prior art, the smoking test is generally divided into two schemes: artificial regression and historical regression. The manual regression scheme requires manually compiling a set of test cases to test whether the running of the software can be smoothly carried out, so that a large amount of manpower is consumed. The historical regression scheme requires that the whole quantity of software is regressed, however, the whole quantity of software can regress to a great number of historical interfaces, and the time consumption is long.
Disclosure of Invention
The embodiment of the application provides a smoking test method and device, a storage medium and electronic equipment, which can reduce the labor cost of smoking test and improve the smoking test efficiency. The technical scheme is as follows:
in a first aspect, the present application is directed to a method of smoking testing, the method comprising:
acquiring N interfaces corresponding to changed codes in a project to be tested after the codes are changed; n is a positive integer greater than 0;
generating a group of test cases corresponding to each interface based on the N interfaces; the test cases comprise N groups, and the number of each group of test cases is at least one;
generating a smoking test task corresponding to the item to be tested based on the N groups of test cases;
and indicating the to-be-tested project to execute the smoking test task and acquiring a smoking test result.
In a second aspect, the present application provides a smoke test device, the device comprising:
the interface acquisition module is used for acquiring N interfaces corresponding to changed codes in the item to be tested after the codes are changed; n is a positive integer greater than 0;
the test case module is used for generating a group of test cases corresponding to each interface based on the N interfaces; the test cases comprise N groups, and the number of each group of test cases is at least one;
the task generation module is used for generating a smoking test task corresponding to the item to be tested based on the N groups of test cases;
and the result acquisition module is used for indicating the to-be-tested project to execute the smoking test task and acquiring a smoking test result.
In a third aspect, embodiments of the present application provide a computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the above-mentioned method steps.
In a fourth aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the above-mentioned method steps.
The beneficial effects brought by the technical scheme provided by some embodiments of the application at least comprise:
the interface corresponding to the changed code in the item to be tested after the code is changed is obtained, the corresponding test case is generated and expanded by using the interface, and the expanded test case is further used for carrying out the smoke test on the item to be tested, so that the smoke test aiming at the item to be tested is completed automatically, and the trouble of manually writing the test case and carrying out the smoke test is avoided; the method comprises the steps that a plurality of test cases corresponding to interfaces corresponding to changed codes are used for conducting smoking test on items to be tested after the codes are changed, so that the coverage rate of the test cases on the interfaces affected by code change in the items to be tested is improved, and the test effect of the smoking test is improved; the test case is generated only aiming at the interface corresponding to the change code, so that the smoking detection of the item to be tested is completed through the test case, and the problem of overlong detection time caused by returning all the interfaces of the item to be tested in the prior art is solved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a smoking test method provided in an embodiment of the present application;
FIG. 2 is a schematic structural diagram of an item to be tested according to an embodiment of the present application;
FIG. 3 is a schematic flow chart of a smoke test device according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram for acquiring a basic test case corresponding to each interface according to an embodiment of the present application;
FIG. 5 is a schematic flow chart of a smoking test method provided in an embodiment of the present application;
fig. 6 is a schematic structural diagram of an item to be detected according to an embodiment of the present application;
FIG. 7 is a schematic flow chart of a smoking test method provided in an embodiment of the present application;
FIG. 8 is a schematic structural diagram of a smoke test device according to an embodiment of the present disclosure;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the description of the present application, it is to be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. In the description of the present application, it is noted that, unless explicitly stated or limited otherwise, "including" and "having" and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. The specific meaning of the above terms in the present application can be understood in a specific case by those of ordinary skill in the art. Further, in the description of the present application, "a plurality" means two or more unless otherwise specified. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The present application will be described in detail with reference to specific examples.
It should be noted that the smoking test method provided by the present application is applied to one or more electronic devices. The electronic device includes, but is not limited to, a Mobile Station (MS), a Mobile Terminal device (Mobile Terminal), a Mobile phone (Mobile Telephone), a handset (handset), a portable device (portable equipment), and the like, and the electronic device may communicate with one or more core networks via a Radio Access Network (RAN), for example, the electronic device may be a Mobile phone (or referred to as a "cellular" phone), a computer with a wireless communication function, and the electronic device may also be a portable, pocket, hand-held, computer-embedded, or vehicle-mounted Mobile device or device. It can be understood that, in the present application, the electronic device may further have a display device and a camera mounted thereon, the display device may display various devices capable of implementing a display function, and the camera is used for collecting video data; for example: the display device may be a Cathode ray tube (Cathode ray tube, CR) display, a Light-emitting diode (LED) display, an electronic ink screen, a Liquid Crystal Display (LCD), a Plasma Display Panel (PDP), or the like. The user can input some preset instructions by using the display device on the electronic device to indicate the electronic device to complete corresponding tasks based on the preset instructions. For example, a user uses a smoking test method to perform a smoking test on an app of an application program under development on an electronic device, where the app is the item to be tested.
In one embodiment, as shown in fig. 1, a method of smoking testing is specifically proposed, which may be implemented in dependence on a computer program, operable on a smoking testing device based on the von neumann architecture. The computer program may be integrated into the application or may run as a separate tool-like application.
Specifically, the smoking test method comprises the following steps:
s101, obtaining N interfaces corresponding to changed codes in the item to be tested after the codes are changed.
The item to be tested can be understood as any software, system or application program with testing requirements after code change, wherein the code change comprises any one or more of code deletion, code addition, code replacement and the like. According to the classification of Software Engineering Knowledge system (Software Engineering Body of Knowledge, SWEBOK), the Software development process is composed of a group of Software development activities, and the group of Software development activities mainly includes: requirement engineering, software design, software construction, software testing, software maintenance and evolution. The smoke test belongs to a part of software test and is used for testing whether the item to be tested after code change can normally run or not and whether the running stability of the item to be tested is not damaged or not.
When the code of the item to be tested is changed, the changed code can affect part or all of the interfaces in the item to be tested. An Application Programming Interface (API) (hereinafter, referred to as an Interface) may be understood as an Interface used when software or a plurality of modules included in an Application interact with each other, in other words, each module in the software completes interaction through the Interface to realize a function. For example, a developer wants to add an instant messaging function to an item to be tested, that is, an instant messaging module is created through a code corresponding to the instant messaging function, and the instant messaging module needs to interact with a module for storing user data and a cache module included in the item to be tested, so that the instant messaging module has an interface thereof to complete the interaction, wherein the number of the interfaces may be one or more.
The format of the interface includes any one format such as JS Object Notation (JSON), Markup Language (YAML Ain' a Markup Language, YAML), eXtensible Markup Language (XML), and the like.
In this embodiment of the application, the method for obtaining N interfaces corresponding to changed codes in a project to be tested after the codes are changed may be obtained from a developer who develops the project to be tested, or obtaining the interfaces according to the changed codes on an interface service platform, where the interface service platform includes swagger, WiKi, or Yapi, the swagger refers to a Web service platform that generates back-end interface data based on a standard and complete Spring framework, the WiKi refers to a hypertext system that is open on a network and can be collaboratively created by multiple people, and the Yapi refers to an interface management platform with a powerful function. In other words, the interface service platform acquires the N interfaces corresponding to the change codes and the interface data corresponding to the N interfaces based on the change codes.
S102, generating a group of test cases corresponding to each interface based on the N interfaces, wherein the test cases comprise N groups.
The test case can be understood as test content corresponding to a series of test tasks to be executed when the smoking test is completed on the project to be tested. The test case is the combination of Structured Query Language (SQL) statements, and when some key statements or key parameter values of the SQL statements in a certain test case are subjected to operation processing such as cleaning, data replacement and the like, and the basic structure of the test case is not changed, a similar test case of the test case is obtained.
In the prior art, the test cases of the smoke test for the items to be tested are generally not designed separately, nor have specific design principles and standards, some test cases with basic functions are directly extracted from the existing software test case library, and the randomness of the selection mode is relatively large, so that some functions of the items to be tested in the smoke test, especially the functions newly added after the codes are updated, may be missed by the selected test cases, or the items to be tested do not use N interfaces corresponding to the updated codes when the test cases are completed,
according to the method and the device, a group of test cases are generated for each interface in the N interfaces corresponding to the update codes, so that the test objects of the test cases cover the N interfaces corresponding to the update codes, and the test effect of the smoke test for the to-be-tested items is improved.
In one embodiment, the method for generating a corresponding set of test cases based on each interface may be: and generating a basic test case based on the interface data of each interface, and generating a group of test cases based on each basic test case. The basic test case may be understood as a test case designed for the interface based on the structural data of the corresponding interface, and the interface is covered by one hundred percent, in other words, when the item to be tested completes the basic test case to realize a certain function, the interface corresponding to the basic test case is used at all times. The above-mentioned generating a group of test cases based on each basic test case may be: and changing key statements or key parameter values in the basic test case formed by the SQL statements, wherein the changing mode comprises operations of parameter modification, statement deletion and the like, and the basic structure of the basic test case is not changed, so that a group of test cases corresponding to the basic test case is obtained.
In another embodiment, the method for generating the corresponding test case based on each interface respectively may be: when a smoking test is carried out on a plurality of items to be tested, recording a group of test cases written by manpower when each interface carries out the smoking test for the first time, and storing the recorded interfaces and the corresponding test cases in a historical database; and aiming at N interfaces of the item to be tested in the application, matching search is carried out on a group of test cases corresponding to each interface in the N interfaces in a historical data database, and N groups of test cases respectively corresponding to the N interfaces are obtained based on the search result.
As shown in fig. 2, a schematic structural diagram of an item to be tested provided in the embodiment of the present application includes: the system comprises a to-be-tested project and N interfaces corresponding to change codes in the to-be-tested project. Wherein, N interfaces include: interface 10, interface 20, interfaces 30, … …, interface N0. Each interface corresponds to a set of test cases, specifically, the interface 10 corresponds to a set of test cases: test case 11, test case 12, … …, test case 1A, interface 20 corresponds to a set of test cases: test case 21, test case 22, … …, test case 2B, interface 30 corresponds to a set of test cases: test case 31, test case 32, … …, test case 3B, interface N0 corresponds to a group of test cases: test case N1, test cases N2, … …, test case NN.
The step of obtaining the code change corresponding to the N interfaces based on the item to be tested is referred to as the step S101, and the step of obtaining a group of test cases corresponding to each interface based on each interface is referred to as the step S102, which is not described herein again.
S103, generating a smoking test task corresponding to the item to be tested based on the N groups of test cases.
As shown in fig. 2, the smoking test task corresponding to the item to be tested is generated based on the N groups of test cases, and it can be understood that the specific content of the smoking test task is that the N groups of test tasks need to be sequentially executed for the item to be tested.
In one embodiment, the method screens at least N test cases included in the N groups of test cases to reduce the duration of the smoking test task and improve the efficiency of the smoking test. The specific screening process is as follows: acquiring executed test cases in each group of test cases according to a historical database, and changing the executed test cases into first test cases which have historical execution records in the historical database; based on the historical execution record, obtaining a first weight of a first test case, obtaining a second weight of the first test case according to the test function range of the smoking test and the test function corresponding to the first test case, taking the sum of the first weight and the second weight as the weight of the first test case, and judging whether the first test case can be selected as a target test case according to the weight, wherein the target test case is defined as the test case which needs to be executed by the item to be tested in the smoking test task.
The beneficial effects brought by the technical scheme provided by some embodiments of the application at least comprise:
the method has the advantages that each test case does not need to be executed in sequence, the consumed test cost is saved, the smoke test efficiency is improved, the low efficiency of one-by-one execution of the test cases is made up, the intelligent advantage of high-efficiency test on a large number of test cases is exerted, the agile implementation of the smoke test on the items to be tested is thoroughly ensured, the test accuracy is ensured, and the influence of screening the test cases on the test effect is avoided.
And S104, indicating the project to be tested to execute the smoking test task and acquiring a smoking test result.
Each test case may include a configuration environment of the item to be tested, input data for the item to be tested, a step to be executed by the item to be tested, an expected result, and the like, so that each time the item to be tested executes one test case, the execution result may be used as a test result of the smoking test of the item to be tested, and according to the test result, the quality and performance of the item to be tested may be known, and whether the item to be tested passes the smoking test may be determined.
For example, some interfaces of N interfaces in the item to be tested are interfaces based on the http protocol, so the main contents of the test case corresponding to the interfaces are: the sending and receiving of the http request are simulated through tools or codes, wherein the tools comprise postman, jmeter, souui, java + httpparent, robotframe + httplry and the like.
And after the smoking test result is obtained, judging whether the item to be tested passes the smoking test or not based on a preset rule. For example, the preset rule is that the success rate of executing N groups of test cases on the item to be tested is 95%, and the probability of meeting the expected result in the successfully executed test cases is 80%; and acquiring the smoking test result of the N groups of test cases in the smoking test task executed by the item to be tested, and judging whether the item to be tested passes the smoking test or not based on the smoking test result and the preset rule.
As shown in fig. 2, the N groups of test cases constitute specific contents of a smoking test task for the item to be tested, instruct the item to be tested to execute the N groups of test cases, and obtain a smoking test result. And after the smoking test result is obtained, judging whether the item to be tested passes the smoking test or not based on the smoking test result.
According to the method and the device, the interface corresponding to the changed code in the item to be tested after the code is changed is obtained, the corresponding test case is generated and expanded by using the interface, the expanded test case is further used for carrying out the smoke test on the item to be tested, the smoke test aiming at the item to be tested is completed automatically, and the trouble of manually writing the test case and carrying out the smoke test is avoided; the method comprises the steps that a plurality of test cases corresponding to interfaces corresponding to changed codes are used for conducting smoking test on items to be tested after the codes are changed, so that the coverage rate of the test cases on the interfaces affected by code change in the items to be tested is improved, and the test effect of the smoking test is improved; the test case is generated only aiming at the interface corresponding to the change code, so that the smoking detection of the item to be tested is completed through the test case, and the problem of overlong detection time caused by returning all the interfaces of the item to be tested in the prior art is solved.
In one embodiment, as shown in fig. 3, a method of smoking testing is specifically proposed, which may be implemented in dependence on a computer program, operable on a smoking testing device based on the von neumann architecture. The computer program may be integrated into the application or may run as a separate tool-like application.
Specifically, the smoking test method comprises the following steps:
s201, obtaining N interfaces corresponding to changed codes in the item to be tested after the codes are changed.
In the embodiment of the application, the method for obtaining the N interfaces corresponding to the changed codes in the project to be tested after the codes are changed may be obtained from a developer who develops the project to be tested, or obtaining the interfaces on an interface service platform according to the changed codes. The specific work flow of step S201 refers to step S101 described in fig. 1, and is not described herein again.
S202, respectively analyzing interface data corresponding to each interface, wherein the number of the interface data comprises N.
The interface data may be understood as data representing an interface, such as an identifier, a function, and configuration data of the corresponding interface, and in this application, particularly, the interface data includes an interface number of entry parameter data and an interface number of exit parameter data of the interface, where the entry parameter data and the exit parameter data include any one format of string, int, or long. It is understood that the expression format of the interface data includes any one format of JS Object Notation (JSON), Markup Language (YAML Ain' a Markup Language, YAML), eXtensible Markup Language (XML), and the like.
In one embodiment, the method for acquiring the interface data corresponding to the interface may be that the interface service platform includes swagger, WiKi, or Yapi. The system comprises a Web server, a wiki, a hypertext system and a Yapi interface management platform, wherein the swagger is a Web service platform for generating back-end interface data based on a standard and complete Spring framework, the wiki is a hypertext system which is open on the network and can be collaboratively created by multiple people, and the Yapi is an interface management platform with powerful function. Through the interface service platform, a tester carries out matching search on the interface service platform through the identifier representing the interface, so as to obtain interface data corresponding to the interface. In another embodiment, the mass interface data can be acquired by a tester through a Log Service (Log Service) provided by an Aliskian Log.
In another embodiment, the method for obtaining the interface data may be based on the interfaces and the interface data corresponding to the interfaces stored in the history database. The historical database is maintained by a developer, in other words, when the historical database is established, the interface and the interface data corresponding to the interface are written, in particular, the interface and the interface data comprising the input parameter data and the output parameter data of the interface are written.
S203, acquiring a basic test case corresponding to each interface through the N interface data, wherein the basic test cases comprise N.
In the embodiment of the present application, the method for obtaining one basic test case corresponding to each interface through N interface data includes: acquiring x first interfaces and y second interfaces which are included in the N interfaces; the first interface is an interface which needs to generate a corresponding basic test case, the second interface is an interface which does not need to generate a corresponding basic test case, x and y are integers which are greater than or equal to 0, and x + y is equal to N; generating x basic test cases corresponding to the x first interfaces respectively based on the interface data corresponding to each first interface respectively; and acquiring y basic test cases corresponding to the y second interfaces respectively through a historical database.
As shown in fig. 4, a schematic structural diagram for obtaining a basic test case respectively corresponding to each interface provided in the embodiment of the present application includes: the device comprises N interfaces, x first interfaces and y second interfaces, wherein the x first interfaces and the y second interfaces correspond to the N interfaces, the first interfaces are interfaces needing to generate corresponding basic test cases, and the second interfaces are interfaces needing not to generate corresponding basic test cases. Specifically, the x first interfaces include: first interface 10, first interface 20, first interface 40, etc., the y second interfaces include: second interface 30, second interface N0, etc.
In the embodiment of the present application, a method for generating a basic test case by a first interface that needs to generate the basic test case includes: based on the interface structure data corresponding to the interface obtained in step S202, a corresponding basic test case is generated. Specifically, the main contents of the basic test case can be divided into an input part, a logic body part and an output part, and both the input part and the output part need to be acquired from the interface data.
For example, the basic test case is used for indicating whether an identity card number input by a user is correct in a project to be tested, and relates to an interface corresponding to a data storage module and an interface corresponding to a verification module of the project to be tested; the input part of the basic test part needs to determine the data of the required item, the length of the parameter value and the validity of the parameter value, which are all obtained from the interface data obtained in step S202, for example, the parameters entered in the interface data specify that the required item is the user name and the user identity card number, and specify that the length of the parameter value of the user name is not more than 5 characters, the length of the parameter value of the user identity card number is not more than 30 characters, and specify the check logic of the two parameter values; the logic portion of the base test case needs to determine the processing of the input portion and possible processing results, such as: the determination of the logic branches is based on the interface data of the corresponding interface, and finally each logic branch corresponds to an output result.
The method for acquiring the corresponding basic test case without generating the second interface of the second basic test case comprises the following steps: and matching a basic test case corresponding to the interface data in the database based on the interface data. When a smoking test is carried out on a plurality of items to be tested, recording a test case which is manually written when each interface carries out the smoking test for the first time, and storing the recorded interfaces and corresponding basic test cases in a historical database; and aiming at y second interfaces of the item to be tested in the application, matching search is carried out on one basic test case corresponding to each interface in the y second interfaces in a historical data database, and y basic test cases respectively corresponding to the y second interfaces are obtained based on the search result.
In this embodiment of the present application, a method for distinguishing x first interfaces and y second interfaces among N interfaces includes: acquiring interface data corresponding to each interface in the N interfaces, searching in a historical database, determining whether the interface corresponding to the interface data has a corresponding basic test case in the historical database, if so, determining that the interface is a second interface, and if not, determining that the interface is a first interface.
S204, expanding each basic test case to obtain each group of test cases corresponding to each basic test case, wherein the test cases comprise N groups.
As shown in fig. 4, the basic test case corresponding to each interface is expanded to generate a set of basic test cases corresponding to each basic test case. Specifically, the expanding of the basic test case 10 corresponding to the first interface 10 to generate a group of test cases includes: the test case 11, the test case 12, the test case … …, and the test case 1A, the basic test case 20 corresponding to the first interface 20 is expanded to generate a group of test cases: the test case 21, the test cases 22, … …, and the test case 2B, and the basic test case 30 corresponding to the second interface 30 is expanded to generate a group of test cases, including: the test case 31, the test case 32, the test case … …, and the test case 3B, and the basic test case 40 corresponding to the first interface 40 is expanded to generate a group of test cases, including: the test case 41, the test cases 42 and … … and the test case 4D are expanded, and a group of test cases is generated by expanding a basic test case N0 corresponding to the first interface N0, wherein the basic test case comprises a test case N1, test cases N2 and … … and a test case NN.
The method includes the steps of S203, dividing N interfaces into a first interface and a second interface to respectively obtain a basic test case corresponding to the first interface and a basic test case corresponding to the second interface, and expanding the N basic test cases through step 204 to generate N groups of test cases. The method for generating the N groups of test cases is simple, strong in operability and good in guiding significance for realizing the automatic smoking test of the items to be tested.
And S205, generating a smoking test task corresponding to the item to be tested based on the N groups of test cases.
And generating a smoking test task corresponding to the item to be tested based on the N groups of test cases, wherein the specific content of the smoking test task is that the N groups of test tasks are required to be sequentially executed for the item to be tested. The specific work flow of step S205 refers to step S103 described in fig. 1, and is not described herein again.
And S206, indicating the project to be tested to execute the smoking test task and acquiring a smoking test result.
Each test case may include a configuration environment of the item to be tested, input data for the item to be tested, a step to be executed by the item to be tested, an expected result, and the like, so that each time the item to be tested executes one test case, the execution result may be used as a test result of the smoking test of the item to be tested, and according to the test result, the quality and performance of the item to be tested may be known, and whether the item to be tested passes the smoking test may be determined. The specific work flow of step S206 refers to step S104 described in fig. 1, and is not described herein again.
According to the method and the device, the interface corresponding to the changed code in the item to be tested after the code is changed is obtained, the corresponding test case is generated and expanded by using the interface, the expanded test case is further used for carrying out the smoke test on the item to be tested, the smoke test aiming at the item to be tested is completed automatically, and the trouble of manually writing the test case and carrying out the smoke test is avoided; the method comprises the steps that a plurality of test cases corresponding to interfaces corresponding to changed codes are used for conducting smoking test on items to be tested after the codes are changed, so that the coverage rate of the test cases on the interfaces affected by code change in the items to be tested is improved, and the test effect of the smoking test is improved; the test case is generated only aiming at the interface corresponding to the change code, so that the smoking detection of the item to be tested is completed through the test case, and the problem of overlong detection time caused by returning all the interfaces of the item to be tested in the prior art is solved.
In one embodiment, as shown in fig. 5, a method of smoking testing is specifically proposed, which may be implemented in dependence on a computer program, operable on a smoking testing device based on the von neumann architecture. The computer program may be integrated into the application or may run as a separate tool-like application.
Specifically, the smoking test method comprises the following steps:
s301, obtaining N interfaces corresponding to the changed codes in the item to be tested after the codes are changed.
In the embodiment of the application, the method for obtaining the N interfaces corresponding to the changed codes in the project to be tested after the codes are changed may be obtained from a developer who develops the project to be tested, or obtaining the interfaces on an interface service platform according to the changed codes. The specific work flow of step S301 refers to step S101 described in fig. 1, and is not described herein again.
S302, respectively analyzing interface data corresponding to each interface, wherein the number of the interface data comprises N.
The interface data may be understood as data representing an interface, such as an identifier, a function, and configuration data of the corresponding interface, and in this application, particularly, the interface data includes an interface number of entry parameter data and an interface number of exit parameter data of the interface, where the entry parameter data and the exit parameter data include any one format of string, int, or long. It is understood that the expression format of the interface data includes any one format of JS Object Notation (JSON), Markup Language (YAML Ain' a Markup Language, YAML), eXtensible Markup Language (XML), and the like.
The specific work flow of step S302 refers to step S202 described in fig. 3, and is not described herein again.
S303, acquiring a basic test case corresponding to each interface through the N interface data, wherein the basic test cases comprise N.
In the embodiment of the present application, the method for obtaining one basic test case corresponding to each interface through N interface data includes: acquiring x first interfaces and y second interfaces which are included in the N interfaces; the first interface is an interface which needs to generate a corresponding basic test case, the second interface is an interface which does not need to generate a corresponding basic test case, x and y are integers which are greater than or equal to 0, and x + y is equal to N; generating x basic test cases corresponding to the x first interfaces respectively based on the interface data corresponding to each first interface respectively; and acquiring y basic test cases corresponding to the y second interfaces respectively through a historical database.
The steps of this application refer to step S203 shown in fig. 2, which is not described herein again.
S304, acquiring a group of similar interfaces with the similarity exceeding a threshold value, wherein the similar interfaces comprise N groups.
As shown in fig. 6, a schematic structural diagram of an item to be detected provided in the embodiment of the present application includes: the system comprises a project to be detected and N interfaces corresponding to the project to be detected. Wherein, N interfaces include: interface 10, interface 20, … …, interface N0. Acquiring a group of similar interfaces with the similarity exceeding a threshold with each interface, as shown in fig. 6, acquiring a group of similar interfaces 10 with the similarity exceeding a threshold with the interface 10, acquiring a group of similar interfaces 20 with the similarity exceeding a threshold with the interface 20, and acquiring a group of similar interfaces N0 with the similarity exceeding a threshold with the interface N0.
In one embodiment, a group of similar interfaces whose hierarchical structure similarity corresponding to each interface exceeds a threshold is obtained, in other words, the hierarchical structure between each interface is used as a condition for judging whether the interfaces have similarity. Therein, the hierarchy can be understood as a naming convention for the interface.
In this embodiment of the present application, the method for obtaining a group of similar interfaces whose hierarchical structure similarity corresponding to each interface exceeds a threshold includes: matching in a database at least comprising a hierarchical structure of all interfaces in the item to be tested; and acquiring each group of similar interfaces with the similarity of the hierarchical structure of each interface exceeding a threshold value based on the matching result, wherein the similar interfaces comprise N groups.
In another embodiment, a group of similar interfaces whose usage methods and usage occasions corresponding to each interface exceed threshold values is obtained, in other words, the usage method and usage occasion between each interface are used as conditions for judging whether the interfaces have similarity or not. For example, the interfaces and their corresponding similar interfaces are used in the field of video processing, and are used for some application program to frame video.
S305, acquiring parameter values required by expansion of the basic test case corresponding to the interface corresponding to each similar interface based on the basic test case corresponding to each group of similar interfaces.
Since a group of similar interfaces corresponding to each interface is obtained in step S304, a group of basic test cases corresponding to the corresponding similar interfaces is obtained based on the group of similar interfaces, and further, parameter values required for swelling the basic test cases corresponding to the interfaces are obtained from the basic test cases.
For example, the interface 10 corresponds to a group of similar interfaces 10 and the basic test case 10, and the basic test case corresponding to each similar interface is obtained based on each similar interface in the group of similar interfaces 10, so as to obtain the basic test case corresponding to the similar interface 10 shown in fig. 6, and further obtain the parameter values 10 required by the basic test case 10 to expand into a group of test cases from the basic test case corresponding to the similar interface. The interface 20 corresponds to a group of similar interfaces 20 and the basic test case 20, and the basic test case corresponding to each similar interface is obtained based on each similar interface in the group of similar interfaces 20, so as to obtain the basic test case corresponding to the similar interface 20 shown in fig. 6, and further obtain the parameter values 20 required by the expansion of the basic test case 20 into a group of test cases from the basic test case corresponding to the similar interface.
For a method for obtaining a basic test case corresponding to each similar interface in a group of similar interfaces 10, refer to the method for obtaining a basic test case based on each interface provided in the present application, and details are not described here.
S306, expanding the basic test case corresponding to the interface corresponding to each similar interface through the parameter value of each similar interface.
As shown in fig. 6, the basic test case corresponding to the interface corresponding to each similar interface is inflated by the parameter value of each similar interface. For example, the interface 10 corresponds to a group of similar interfaces 10 and the basic test case 10, and the basic test case corresponding to each similar interface is obtained based on each similar interface in the group of similar interfaces 10, so as to obtain the basic test case corresponding to the similar interface 10 shown in fig. 6, and further obtain the parameter values 10 required by the basic test case 10 to expand into a group of test cases from the basic test case corresponding to the similar interface.
A basic test case is expanded into a group of basic test cases, the test cases are the combination of SQL sentences, and when some key sentences or key parameter values of the SQL sentences in the basic test cases are cleaned, data are replaced and other operation processing is carried out, and the basic structure of the basic test cases is not changed, the group of test cases of the basic test cases is obtained. For example, the operations such as cleaning and data replacement are performed on key statements or key parameter values in the input part, the logic main part and the output part of the basic test case, and parameter values required for replacement and positioning values for positioning the key statements are obtained from the basic test case corresponding to the similar interface.
Compared with the method that the corresponding interface is tested only by using a single basic test case, the test of the corresponding interface based on a group of test cases is more comprehensive and more accurate.
S307, each group of test cases corresponding to each basic test case is obtained, and the test cases comprise N groups.
Expanding the basic test case 10 corresponding to the interface 10 to generate a group of test cases, including: the test case 11, the test case 12, the test case … …, and the test case 1A, the basic test case 20 corresponding to the interface 20 is expanded to generate a group of test cases: the test case 21, the test cases 22 and … … and the test case 2B are expanded, and a group of test cases is generated by expanding a basic test case N0 corresponding to an interface N0, wherein the basic test case comprises a test case N1, test cases N2 and … … and a test case NN.
And S308, generating a smoking test task corresponding to the item to be tested based on the N groups of test cases.
And generating a smoking test task corresponding to the item to be tested based on the N groups of test cases, wherein the specific content of the smoking test task is that the N groups of test tasks are required to be sequentially executed for the item to be tested. The specific work flow of step S205 refers to step S103 described in fig. 1, and is not described herein again.
And S309, indicating the to-be-tested item to execute a smoking test task, and acquiring a smoking test result.
Each test case may include a configuration environment of the item to be tested, input data for the item to be tested, a step to be executed by the item to be tested, an expected result, and the like, so that each time the item to be tested executes one test case, the execution result may be used as a test result of the smoking test of the item to be tested, and according to the test result, the quality and performance of the item to be tested may be known, and whether the item to be tested passes the smoking test may be determined. The specific work flow of step S206 refers to step S104 described in fig. 1, and is not described herein again.
According to the method and the device, the interface corresponding to the changed code in the item to be tested after the code is changed is obtained, the corresponding test case is generated and expanded by using the interface, the expanded test case is further used for carrying out the smoke test on the item to be tested, the smoke test aiming at the item to be tested is completed automatically, and the trouble of manually writing the test case and carrying out the smoke test is avoided; the method comprises the steps that a plurality of test cases corresponding to interfaces corresponding to changed codes are used for conducting smoking test on items to be tested after the codes are changed, so that the coverage rate of the test cases on the interfaces affected by code change in the items to be tested is improved, and the test effect of the smoking test is improved; the test case is generated only aiming at the interface corresponding to the change code, so that the smoking detection of the item to be tested is completed through the test case, and the problem of overlong detection time caused by returning all the interfaces of the item to be tested in the prior art is solved.
In one embodiment, as shown in fig. 7, a method of smoking testing is specifically proposed, which may be implemented in dependence on a computer program, operable on a smoking testing device based on the von neumann architecture. The computer program may be integrated into the application or may run as a separate tool-like application.
Specifically, the smoking test method comprises the following steps:
s401, obtaining N interfaces corresponding to the changed codes in the item to be tested after the codes are changed.
In the embodiment of the application, the method for obtaining the N interfaces corresponding to the changed codes in the project to be tested after the codes are changed may be obtained from a developer who develops the project to be tested, or obtaining the interfaces on an interface service platform according to the changed codes. The specific work flow of step S401 refers to step S101 described in fig. 1, and is not described herein again.
S402, generating a group of test cases corresponding to each interface based on the N interfaces, wherein the test cases comprise N groups.
In the embodiment of the present application, the method for generating a group of test cases corresponding to each interface based on N interfaces may be a method shown in fig. 3: step S303, acquiring a basic test case corresponding to each interface through N interface data, wherein the basic test cases comprise N; s304, acquiring a group of similar interfaces with the similarity of each interface exceeding a threshold, wherein the similar interfaces comprise N groups; s305, acquiring parameter values required by expansion of the basic test case corresponding to the interface corresponding to each similar interface based on the basic test case corresponding to each group of similar interfaces; s306, expanding the basic test case corresponding to the interface corresponding to each similar interface through the parameter value of each similar interface; s307, each group of test cases corresponding to each basic test case is obtained, and the test cases comprise N groups.
The specific work flow of step S402 refers to steps S303 to S107 described in fig. 3, and is not described herein again.
And S403, filtering the N groups of test cases, and filtering invalid test cases in the N groups of test cases.
In the embodiment of the present application, the method for filtering out invalid test cases from N groups of test cases includes: initializing the N groups of test cases based on the processing requirements of the test case detection platform; inputting the N groups of test cases subjected to initialization processing into the test case detection platform so as to enable the N groups of test cases subjected to initialization processing to execute the validity test tasks of the test case detection platform; obtaining effectiveness test results of the N groups of test cases after initialization processing to execute the test tasks, and judging whether each test case is effective or not based on the effectiveness test results; and filtering invalid test cases in the N groups of test cases.
In the above embodiment, initializing N groups of test cases may be understood as: and converting the format of the test case into the required format of the tester case detection platform based on the processing requirement of the test case detection platform. For example, the format of the test case is converted from JSON format to YAML format.
The invalid test case may be understood as a test case having a similarity exceeding a similarity threshold with other test cases, having no practicality, having no invalid conditions such as a use scenario, and the like, among a group of test cases. The test case detection platform is a third-party test case detection platform for filtering test cases in the prior art.
The beneficial effects brought by the technical scheme provided by some embodiments of the application at least comprise:
each group of test cases are filtered, invalid test cases are filtered, each test case in each group of test cases does not need to be executed in sequence, the consumed test cost is saved, the smoke test efficiency is improved, the low efficiency of one-by-one execution of the test cases is made up, the intelligent advantage of high-efficiency test of a large number of test cases is exerted, the agile implementation of smoke test for the items to be tested is thoroughly ensured, the test accuracy is also ensured, and the influence of screening the test cases on the test effect is avoided.
S404, generating a smoking test task corresponding to the item to be tested based on the N groups of test cases after filtering.
And generating a smoking test task corresponding to the item to be tested based on the N groups of test cases, wherein the specific content of the smoking test task is that the N groups of test tasks are required to be sequentially executed for the item to be tested. The specific work flow of step S404 refers to step S103 described in fig. 1, and is not described herein again.
S405, indicating the project to be tested to execute the smoking test task and obtaining the smoking test result.
Each test case may include a configuration environment of the item to be tested, input data for the item to be tested, a step to be executed by the item to be tested, an expected result, and the like, so that each time the item to be tested executes one test case, the execution result may be used as a test result of the smoking test of the item to be tested, and according to the test result, the quality and performance of the item to be tested may be known, and whether the item to be tested passes the smoking test may be determined. The specific work flow of step S405 refers to step S104 described in fig. 1, and is not described herein again.
According to the method and the device, the interface corresponding to the changed code in the item to be tested after the code is changed is obtained, the corresponding test case is generated and expanded by using the interface, the expanded test case is further used for carrying out the smoke test on the item to be tested, the smoke test aiming at the item to be tested is completed automatically, and the trouble of manually writing the test case and carrying out the smoke test is avoided; the method comprises the steps that a plurality of test cases corresponding to interfaces corresponding to changed codes are used for conducting smoking test on items to be tested after the codes are changed, so that the coverage rate of the test cases on the interfaces affected by code change in the items to be tested is improved, and the test effect of the smoking test is improved; the test case is generated only aiming at the interface corresponding to the change code, so that the smoking detection of the item to be tested is completed through the test case, and the problem of overlong detection time caused by returning all the interfaces of the item to be tested in the prior art is solved.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Please refer to fig. 8, which shows a schematic structural diagram of a smoke test device according to an exemplary embodiment of the present application. The smoke test apparatus may be implemented as all or part of the apparatus in software, hardware or a combination of both. The smoke test device comprises an interface module 801, a test case module 802, a task generation module 803 and a result acquisition module 804.
The interface acquiring module 801 is used for acquiring N interfaces corresponding to changed codes in the item to be tested after the codes are changed; n is a positive integer greater than 0;
a test case module 802, configured to generate a group of test cases corresponding to each of the N interfaces based on the N interfaces, where each test case includes N groups; wherein the number of the test cases in each group is at least one;
a task generating module 803, configured to generate a smoking test task corresponding to the item to be tested based on the N groups of test cases;
and the result obtaining module 804 is configured to instruct the item to be tested to execute the smoking test task, and obtain a smoking test result.
Optionally, the test case module 802 includes:
the interface unit is used for respectively analyzing interface data corresponding to each interface, and the number of the interface data comprises N;
the acquisition unit is used for acquiring a basic test case corresponding to each interface through the N interface data, wherein the basic test case comprises N basic test cases;
and the expansion unit is used for expanding each basic test case to obtain each group of test cases corresponding to each basic test case, wherein the test cases have N groups in total.
Optionally, the obtaining unit includes:
the acquiring subunit is used for acquiring x first interfaces and y second interfaces included in the N interfaces; the first interface is an interface which needs to generate a corresponding basic test case, the second interface is an interface which does not need to generate the corresponding basic test case, x and y are integers which are greater than or equal to 0 respectively, and x + y is equal to N;
a basic generating subunit, configured to generate x basic test cases corresponding to x first interfaces, based on interface data corresponding to each first interface;
and the history acquisition subunit is used for acquiring y basic test cases corresponding to the y second interfaces respectively through a history database.
Optionally, the smoking test device further comprises:
the filtering module is used for filtering the N groups of test cases and filtering invalid test cases in the N groups of test cases;
the result obtaining module 804 is further configured to generate a smoking test task corresponding to the item to be tested based on the filtered N groups of test cases.
Optionally, the filtering module includes:
the processing unit is used for initializing the N groups of test cases based on the processing requirements of the test case detection platform;
the input unit is used for inputting the N groups of test cases subjected to the initialization processing into the test case detection platform so as to enable the N groups of test cases subjected to the initialization processing to execute the validity test tasks of the test case detection platform;
the testing unit is used for obtaining the effectiveness testing result of the N groups of testing cases after the initialization processing for executing the testing task and judging whether each testing case is effective or not based on the effectiveness testing result;
and the filtering unit is used for filtering invalid test cases in the N groups of test cases.
Optionally, the expansion unit comprises:
the acquisition subunit is used for acquiring a group of similar interfaces of which the similarity with each interface exceeds a threshold value, wherein the similar interfaces comprise N groups; each group of similar interfaces comprises at least one similar interface, each similar interface corresponds to one basic test case, and each group of similar interfaces comprises one group of corresponding basic test cases;
the parameter subunit is used for acquiring parameter values required by expansion of the basic test cases corresponding to the interfaces corresponding to each similar interface based on the basic test cases corresponding to each group of similar interfaces, wherein the number of the parameter values is N;
the expansion subunit is used for expanding the basic test case corresponding to the interface corresponding to each similar interface according to the parameter value of each similar interface;
and the test subunit is used for acquiring each group of test cases corresponding to each basic test case, wherein the test cases have N groups in total.
Optionally, the obtaining subunit is further configured to:
acquiring the hierarchical structure of each interface, and matching in a database at least comprising the hierarchical structures of all the interfaces in the project to be tested;
and acquiring each group of similar interfaces with the similarity of the hierarchical structure of each interface exceeding a threshold value based on the matching result, wherein the similar interfaces comprise N groups.
It should be noted that, when the smoking test apparatus provided in the above embodiment executes the smoking test method, only the division of the above functional modules is taken as an example, and in practical applications, the above functions may be distributed to different functional modules according to needs, that is, the internal structure of the apparatus may be divided into different functional modules to complete all or part of the above described functions. In addition, the embodiment of the smoke test device and the embodiment of the smoke test method provided by the above embodiments belong to the same concept, and the detailed implementation process is shown in the embodiment of the method and is not described herein again.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
According to the method and the device, the interface corresponding to the changed code in the item to be tested after the code is changed is obtained, the corresponding test case is generated and expanded by using the interface, the expanded test case is further used for carrying out the smoke test on the item to be tested, the smoke test aiming at the item to be tested is completed automatically, and the trouble of manually writing the test case and carrying out the smoke test is avoided; the method comprises the steps that a plurality of test cases corresponding to interfaces corresponding to changed codes are used for conducting smoking test on items to be tested after the codes are changed, so that the coverage rate of the test cases on the interfaces affected by code change in the items to be tested is improved, and the test effect of the smoking test is improved; the test case is generated only aiming at the interface corresponding to the change code, so that the smoking detection of the item to be tested is completed through the test case, and the problem of overlong detection time caused by returning all the interfaces of the item to be tested in the prior art is solved.
An embodiment of the present application further provides a computer storage medium, where the computer storage medium may store a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the smoking test method according to the embodiment shown in fig. 1 to 7, and a specific execution process may refer to specific descriptions of the embodiment shown in fig. 1 to 7, which is not described herein again.
The present application further provides a computer program product, where at least one instruction is stored, and the at least one instruction is loaded by the processor and executes the smoking test method according to the embodiment shown in fig. 1 to 7, where a specific execution process may refer to specific descriptions of the embodiment shown in fig. 1 to 7, and is not described herein again.
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 9, the electronic device 900 may include: at least one processor 901, at least one network interface 904, a user interface 903, memory 905, at least one communication bus 902.
Wherein a communication bus 902 is used to enable connective communication between these components.
The user interface 903 may include a Display screen (Display) and a Camera (Camera), and the optional user interface 903 may also include a standard wired interface and a wireless interface.
The network interface 904 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), among others.
The Memory 905 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). Optionally, the memory 905 includes a non-transitory computer-readable medium. The memory 905 may be used to store instructions, programs, code, sets of codes, or sets of instructions. The memory 905 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the above-described method embodiments, and the like; the storage data area may store data and the like referred to in the above respective method embodiments. The memory 905 may optionally be at least one memory device located remotely from the processor 901. As shown in fig. 9, the memory 905, which is one type of computer storage medium, may include an operating system, a network communication module, a user interface module, and a smoke test application.
In the electronic device 900 shown in fig. 9, the user interface 903 is mainly used for providing an input interface for a user to obtain data input by the user; and the processor 901 may be configured to invoke the smoking test application stored in the memory 905, and specifically perform the following operations:
acquiring N interfaces corresponding to changed codes in a project to be tested after the codes are changed; n is a positive integer greater than 0;
generating a group of test cases corresponding to each interface respectively based on the N interfaces, wherein the test cases comprise N groups; wherein the number of the test cases in each group is at least one;
generating a smoking test task corresponding to the item to be tested based on the N groups of test cases;
and indicating the to-be-tested project to execute the smoking test task and acquiring a smoking test result.
In one or more possible embodiments, when the processor 901 executes the test case group corresponding to each of the interfaces based on the N interfaces to generate, the following operations are specifically executed:
respectively analyzing interface data corresponding to each interface, wherein the number of the interface data comprises N;
acquiring a basic test case corresponding to each interface through the N interface data, wherein the basic test case comprises N basic test cases;
and expanding each basic test case to obtain each group of test cases corresponding to each basic test case, wherein the test cases have N groups in total.
In one or more possible embodiments, when the processor 901 executes the above-mentioned data of the N interfaces to obtain one basic test case corresponding to each of the interfaces, the following operations are specifically executed:
acquiring x first interfaces and y second interfaces which are included in the N interfaces; the first interface is an interface which needs to generate a corresponding basic test case, the second interface is an interface which does not need to generate the corresponding basic test case, x and y are integers which are greater than or equal to 0 respectively, and x + y is equal to N;
generating x basic test cases corresponding to the x first interfaces respectively based on the interface data corresponding to each first interface respectively;
and acquiring y basic test cases corresponding to the y second interfaces respectively through a historical database.
In one or more possible embodiments, after the processor 901 executes the above-mentioned generation of a set of test cases corresponding to each of the interfaces based on the N interfaces, the following operations are further performed:
filtering the N groups of test cases, and filtering invalid test cases in the N groups of test cases;
when the processor 901 executes the smoking test task corresponding to the item to be tested based on the N groups of test cases, the following operations are specifically executed:
and generating a smoking test task corresponding to the item to be tested based on the filtered N groups of test cases.
In one or more possible embodiments, when the processor 901 performs the filtering on the N groups of test cases and filters out invalid test cases in the N groups of test cases, the following operations are specifically performed:
initializing the N groups of test cases based on the processing requirements of the test case detection platform;
inputting the N groups of test cases subjected to initialization processing into the test case detection platform so as to enable the N groups of test cases subjected to initialization processing to execute the validity test tasks of the test case detection platform;
obtaining effectiveness test results of the N groups of test cases after the initialization processing for executing the test tasks, and judging whether each test case is effective or not based on the effectiveness test results;
and filtering invalid test cases in the N groups of test cases.
In one or more possible embodiments, when the processor 901 performs the dilation on each basic test case to obtain each group of test cases corresponding to each basic test case, the following operations are specifically performed:
acquiring a group of similar interfaces with the similarity of each interface exceeding a threshold value, wherein the similar interfaces comprise N groups; each group of similar interfaces comprises at least one similar interface, each similar interface corresponds to one basic test case, and each group of similar interfaces comprises one group of corresponding basic test cases;
acquiring parameter values required by expansion of the basic test case corresponding to the interface corresponding to each similar interface based on the basic test case corresponding to each group of similar interfaces, wherein the number of the parameter values is N;
expanding the basic test case corresponding to the interface corresponding to each similar interface according to the parameter value of each similar interface;
and acquiring each group of test cases corresponding to each basic test case, wherein the test cases are N groups in total.
In one or more possible embodiments, when the processor 901 performs the acquiring of the N groups of similar interfaces whose similarities with the N interfaces respectively exceed the threshold, specifically perform the following operations:
acquiring the hierarchical structure of each interface, and matching in a database at least comprising the hierarchical structures of all the interfaces in the project to be tested;
and acquiring each group of similar interfaces with the similarity of the hierarchical structure of each interface exceeding a threshold value based on the matching result, wherein the similar interfaces comprise N groups.
According to the method and the device, the interface corresponding to the changed code in the item to be tested after the code is changed is obtained, the corresponding test case is generated and expanded by using the interface, the expanded test case is further used for carrying out the smoke test on the item to be tested, the smoke test aiming at the item to be tested is completed automatically, and the trouble of manually writing the test case and carrying out the smoke test is avoided; the method comprises the steps that a plurality of test cases corresponding to interfaces corresponding to changed codes are used for conducting smoking test on items to be tested after the codes are changed, so that the coverage rate of the test cases on the interfaces affected by code change in the items to be tested is improved, and the test effect of the smoking test is improved; the test case is generated only aiming at the interface corresponding to the change code, so that the smoking detection of the item to be tested is completed through the test case, and the problem of overlong detection time caused by returning all the interfaces of the item to be tested in the prior art is solved.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory or a random access memory.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto, and all equivalent variations and modifications can be made to the present application.
Claims (10)
1. A method of smoking testing, the method comprising:
acquiring N interfaces corresponding to changed codes in a project to be tested after the codes are changed; n is a positive integer greater than 0;
generating a group of test cases corresponding to each interface based on the N interfaces; the test cases comprise N groups, and the number of each group of test cases is at least one;
generating a smoking test task corresponding to the item to be tested based on the N groups of test cases;
and indicating the to-be-tested project to execute the smoking test task and acquiring a smoking test result.
2. The method according to claim 1, wherein the generating a set of test cases respectively corresponding to each of the N interfaces based on the N interfaces comprises:
respectively analyzing interface data corresponding to each interface, wherein the number of the interface data comprises N;
acquiring a basic test case corresponding to each interface through the N interface data, wherein the basic test case comprises N basic test cases;
and expanding each basic test case to obtain each group of test cases corresponding to each basic test case.
3. The method according to claim 2, wherein the obtaining a basic test case corresponding to each of the interfaces through the N interface data includes:
acquiring x first interfaces and y second interfaces which are included in the N interfaces; the first interface is an interface which needs to generate a corresponding basic test case, the second interface is an interface which does not need to generate the corresponding basic test case, x and y are integers which are greater than or equal to 0 respectively, and x + y is equal to N;
generating x basic test cases corresponding to the x first interfaces respectively based on the interface data corresponding to each first interface respectively;
and acquiring y basic test cases corresponding to the y second interfaces respectively through a historical database.
4. The method according to claim 1, wherein after generating a set of test cases respectively corresponding to each of the interfaces based on the N interfaces, the method further comprises:
filtering the N groups of test cases, and filtering invalid test cases in the N groups of test cases;
the generating of the smoking test task corresponding to the item to be tested based on the N groups of test cases comprises the following steps:
and generating a smoking test task corresponding to the item to be tested based on the filtered N groups of test cases.
5. The method of claim 4, wherein the filtering the N groups of test cases to filter out invalid test cases from the N groups of test cases comprises:
initializing the N groups of test cases based on the processing requirements of the test case detection platform;
inputting the N groups of test cases subjected to initialization processing into the test case detection platform so as to enable the N groups of test cases subjected to initialization processing to execute the validity test tasks of the test case detection platform;
obtaining effectiveness test results of the N groups of test cases after the initialization processing for executing the test tasks, and judging whether each test case is effective or not based on the effectiveness test results;
and filtering invalid test cases in the N groups of test cases.
6. The method according to claim 2, wherein the expanding each of the basic test cases to obtain each group of the test cases corresponding to each of the basic test cases comprises:
acquiring a group of similar interfaces with the similarity of each interface exceeding a threshold value, wherein the similar interfaces comprise N groups; each group of similar interfaces comprises at least one similar interface, each similar interface corresponds to one basic test case, and each group of similar interfaces comprises one group of corresponding basic test cases;
acquiring parameter values required by expansion of the basic test case corresponding to the interface corresponding to each similar interface based on the basic test case corresponding to each group of similar interfaces, wherein the number of the parameter values is N;
expanding the basic test case corresponding to the interface corresponding to each similar interface according to the parameter value of each similar interface;
and acquiring each group of test cases corresponding to each basic test case.
7. The method according to claim 6, wherein the obtaining N groups of similar interfaces whose similarities with the N interfaces respectively exceed a threshold value comprises:
acquiring the hierarchical structure of each interface, and matching in a database at least comprising the hierarchical structures of all the interfaces in the project to be tested;
and acquiring each group of similar interfaces with the similarity of the hierarchical structure of each interface exceeding a threshold value based on the matching result, wherein the similar interfaces comprise N groups.
8. A smoke test device, the device comprising:
the interface acquisition module is used for acquiring N interfaces corresponding to changed codes in the item to be tested after the codes are changed; n is a positive integer greater than 0;
the test case module is used for generating a group of test cases corresponding to each interface based on the N interfaces; the test cases comprise N groups, and the number of each group of test cases is at least one;
the task generation module is used for generating a smoking test task corresponding to the item to be tested based on the N groups of test cases;
and the result acquisition module is used for indicating the to-be-tested project to execute the smoking test task and acquiring a smoking test result.
9. A computer storage medium, characterized in that it stores a plurality of instructions adapted to be loaded by a processor and to carry out the method steps according to any one of claims 1 to 7.
10. An electronic device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method steps of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110570183.0A CN113282493A (en) | 2021-05-25 | 2021-05-25 | Method and device for smoke test, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110570183.0A CN113282493A (en) | 2021-05-25 | 2021-05-25 | Method and device for smoke test, storage medium and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113282493A true CN113282493A (en) | 2021-08-20 |
Family
ID=77281410
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110570183.0A Withdrawn CN113282493A (en) | 2021-05-25 | 2021-05-25 | Method and device for smoke test, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113282493A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117435514A (en) * | 2023-12-21 | 2024-01-23 | 杭州罗莱迪思科技股份有限公司 | Extraction method for smoke emission test case |
-
2021
- 2021-05-25 CN CN202110570183.0A patent/CN113282493A/en not_active Withdrawn
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117435514A (en) * | 2023-12-21 | 2024-01-23 | 杭州罗莱迪思科技股份有限公司 | Extraction method for smoke emission test case |
CN117435514B (en) * | 2023-12-21 | 2024-03-01 | 杭州罗莱迪思科技股份有限公司 | Extraction method for smoke emission test case |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105094783B (en) | method and device for testing stability of android application | |
CN106940679B (en) | Data processing method and device | |
CN111506444A (en) | Form approval method and device, storage medium and electronic equipment | |
CN103377127A (en) | Development testing system, testing method and device for webpage product | |
CN105320701B (en) | Screening technique, device and the terminal of function point test implementation | |
CN110196795A (en) | Detect the method and relevant apparatus of mobile terminal application operating status | |
CN111475390A (en) | Log collection system deployment method, device, equipment and storage medium | |
AU2018202153A1 (en) | System and method for tool chain data capture through parser for empirical data analysis | |
JP2015508918A (en) | Redundant consumer transaction rule filtering | |
CN110716866A (en) | Code quality scanning method and device, computer equipment and storage medium | |
CN112463568A (en) | Service simulation test method and device and electronic equipment | |
CN112131093A (en) | Chaos test-based test case automatic generation method and device | |
CN112650670A (en) | Application testing method, device, system, electronic equipment and storage medium | |
CN113282493A (en) | Method and device for smoke test, storage medium and electronic equipment | |
CN110473530A (en) | Instruction classification method, apparatus, electronic equipment and computer readable storage medium | |
CN108984374A (en) | A kind of test method and system of database performance | |
CN112069052A (en) | Abnormal object detection method, device, equipment and storage medium | |
CN107908525B (en) | Alarm processing method, equipment and readable storage medium | |
CN112115039A (en) | Test case generation method, device and equipment | |
CN111198902A (en) | Metadata management method and device, storage medium and electronic equipment | |
CN116150029A (en) | Automatic overdue batch testing method and device for loan system | |
CN113238901B (en) | Multi-device automatic testing method and device, storage medium and computer device | |
CN115292178A (en) | Test data searching method, device, storage medium and terminal | |
CN114968960A (en) | Log processing method and device, computer equipment and storage medium | |
CN115357625A (en) | Structured data comparison method and 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 | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20210820 |
|
WW01 | Invention patent application withdrawn after publication |