Disclosure of Invention
The application provides a test case multiplexing method and a multiplexing device. The technical scheme provided by the application can improve the reusability of the test cases, so that the software test efficiency is improved and the test cost is reduced.
In a first aspect, the present application provides a method for multiplexing test cases. The method comprises the following steps: performing source analysis and data decomposition on an existing test script to acquire a design specification which the existing test script conforms to and a test case in the existing test script; interpreting the test case in the existing test script according to the design specification met by the existing test script to obtain the data elements in the test case in the existing test script; generating a new test script according to data elements in the test cases in the existing test script, wherein the design specification met by the new test script is different from the design specification met by the existing test script; and outputting the new test script.
With reference to the first aspect, in a first possible implementation manner, before generating a new test script according to data elements in test cases in the existing test script, the method further includes: displaying various design specification information of the test script; target design specification information selected by a user from the plurality of types of design specification information is received. Correspondingly, the generating a new test script according to the data elements in the test cases in the existing test script includes: and generating the new test script according to the design specification indicated by the target design specification information and the data elements in the test cases in the existing test script. .
With reference to the first aspect, in a second possible implementation manner, before generating a new test script according to data elements in test cases in the existing test script, the method further includes: a target design specification input by a user is received. Correspondingly, the generating a new test script according to the data elements in the test cases in the existing test script includes: and generating the new test script according to the target design specification and the data elements in the test cases in the existing test script.
In a second aspect, the present application provides a device for multiplexing test cases, where the device includes: the processing module is used for carrying out source analysis and data decomposition on the existing test script so as to acquire the design specification which the existing test script conforms to and the test case in the existing test script; the processing module is also used for explaining the test cases in the existing test scripts according to the design specifications met by the existing test scripts so as to obtain data elements in the test cases in the existing test scripts; the processing module is also used for generating a new test script according to the data elements in the test cases in the existing test script, and the design specification met by the new test script is different from the design specification met by the existing test script; and the output module is used for outputting the new test script.
With reference to the second aspect, in a first possible implementation manner, the apparatus further includes a display module and a receiving module; the display module is used for displaying various design specification information of the test script; the receiving module is used for receiving target design specification information selected by a user from the plurality of kinds of design specification information; correspondingly, the processing module is specifically configured to: and generating the new test script according to the design specification indicated by the target design specification information and the data elements in the test cases in the existing test script.
With reference to the second aspect, in a second possible implementation manner, the apparatus further includes a receiving module, configured to receive a target design specification input by a user. Correspondingly, the processing module is specifically configured to: and generating the new test script according to the target design specification and the data elements in the test cases in the existing test script.
In a third aspect, a test case multiplexing apparatus is provided, which includes a processor; the processor is used for executing the program stored in the memory; the processor is adapted to perform the method of the first aspect or any one of its implementations when the program stored in the memory is executed.
Optionally, the apparatus may further comprise the memory.
In a fourth aspect, there is provided a computer readable medium storing program code for execution by a device, the program code for performing the method of the first aspect or any one of its implementations.
In a fifth aspect, there is provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of the first aspect or any one of its implementations.
A sixth aspect provides a chip, where the chip includes a processor and a data interface, and the processor reads instructions stored in a memory through the data interface to execute the method in the first aspect or any one of the implementation manners.
Optionally, as an implementation manner, the chip may further include a memory, where instructions are stored in the memory, and the processor is configured to execute the instructions stored in the memory, and when the instructions are executed, the processor is configured to execute the method in the first aspect or any one of the implementation manners.
In a seventh aspect, a computing device is provided, the computing device comprising: a memory for storing a program; a processor for executing the program stored in the memory, the processor being configured to perform the method of the first aspect or any one of the implementations when the program stored in the memory is executed.
In an eighth aspect, there is provided a test system comprising the computing device of the seventh aspect and a test device of a software product.
Detailed Description
Fig. 1 is a schematic diagram of an application scenario of the technical solution of the embodiment of the present application. The application scenario may include a test tool 1, a test tool 2, a test script 1, a software product 1, and a software product 2.
In the application scenario, the test script 1 is a test script formed by test cases designed by a user of the test tool 1 according to the specification of the test tool 1, and can be used for testing the software product 1 by the test tool 1.
The test case specifications of the test tool 2 and the test tool 1 are different.
Software product 1 and software product 2 have all or part of the same functionality.
As an example, software product 1 and software product 2 are both embedded systems.
Now, a test case multiplexing method needs to be provided, so that the test cases in the test script 1 can be multiplexed into the test tool 2 to test the software product 2, so as to improve the reusability of the test cases, and different test cases are designed from the beginning, so that the test efficiency can be improved, and the test cost can be reduced.
FIG. 2 is a schematic flow chart of a test case multiplexing method according to an embodiment of the present application. As shown in fig. 2, the method may include step 201, step 202, step 203, and step 204. The method may be performed by the test case multiplexing apparatus shown in fig. 3 or fig. 4.
201, performing source analysis and data decomposition on an existing test script to obtain a design specification which the existing test script conforms to and a test case in the existing test script.
The source analysis of the existing test script can be understood as analyzing the test tool corresponding to the existing test script, or analyzing the design specification of the symbol of the existing test script.
The existing test script is subjected to data decomposition, and each test case can be decomposed from the existing test script according to the design specification of the existing test script symbols.
Taking the application scenario shown in fig. 1 as an example, the test script 1 is input into the test case multiplexing device, and the test case multiplexing device performs source analysis and data decomposition on the test script 1 to obtain the design specification corresponding to the test script 1 and each test case in the test script 1.
The existing test script in the present application may be a test script of an embedded system.
202, interpreting the test case in the existing test script according to the design specification met by the existing test script to obtain the data elements in the test case in the existing test script.
As an example, the result of the source analysis includes a design specification that the test case in the existing test script conforms to, the result of the data analysis includes each test case in the existing test script, and the test case multiplexing device parses, from each test case, case information that each test case respectively includes, which may also be referred to as a data element, such as a function parameter, global data, or a call function sequence of each test case design, according to the design specification that the test case in the existing test script conforms to.
And 203, generating a new test script according to the data elements in the test cases in the existing test script, wherein the design specification met by the new test script is different from the design specification met by the existing test script.
For example, the test case multiplexing device generates a new test case corresponding to each test case according to the design specification of the test case of the target test tool and the case information included in each test case. The new test cases conform to the design specifications of the target test appliance and have the same test functions as the corresponding multiplexing test cases or include more test functions than the corresponding multiplexing test cases.
In an example of this embodiment, the test case multiplexing apparatus serves only one target test tool, that is, the test case multiplexing apparatus can only replace an existing test script with a test script of a fixed test tool. In this example, the test case multiplexing device is provided with a design specification of a test case of a target test tool in advance. When the test case multiplexing device carries out test script conversion, the target design specification is only required to be read from the memory.
In another example of this embodiment, the test case multiplexing apparatus may serve multiple target test tools, that is, the test case multiplexing tool may convert an existing test script into a test script of a different target test tool. The method provided by the example can improve the reusability of the test cases, so that the test efficiency is improved.
In an implementation manner of this example, the test case multiplexing device may be preset with design specifications of test cases of multiple target test tools, when the test case multiplexing device performs test script conversion, information of the multiple target test tools or information of the multiple target design specifications may be displayed to a user, and after the user selects a target test tool or a target design specification, the existing test script may be converted into a test script of a target test tool specified by the user according to a selection of the user.
In another implementation manner of this example, the test case multiplexing apparatus may receive a design specification of a target test appliance input by a user, and convert an existing test script into a target test script that symbolizes the target design specification according to the target design specification.
The new test script in this embodiment may be a test script of the embedded system.
And 204, outputting a new test script.
For example, the test case multiplexing device may send the new test script to the target test tool. Or, the test case multiplexing device may also output the new test script to the memory for storage, so that the user may copy the new test script to the target test tool.
After the target test tool receives the new test script, the software product may be tested using the new test script.
Taking the scenario shown in fig. 1 as an example, the testing tool 1 may test the software product 2 based on a new testing script converted from the testing script 1.
In the embodiment, the test case multiplexing device is used for automatically converting the existing test cases, and the used test cases can be multiplexed to test more software products, so that the test efficiency of the software products can be improved, and the test cost of the software products can be reduced.
Fig. 3 is a schematic configuration diagram of a test case multiplexing apparatus 300 according to an embodiment of the present application. The apparatus 300 may comprise a processing module 301 and an output module 302.
The processing module 301 may be implemented by a processor and the output module 302 may be implemented by a communication interface, a data bus or a transmitter.
The apparatus 300 may be configured to perform the method shown in fig. 2, for example, the processing module 301 may be configured to perform steps 201 to 203, and the output module 302 may be configured to perform step 204.
For example, the processing module 301 is configured to perform source analysis and data decomposition on an existing test script to obtain a design specification that the existing test script conforms to and a test case in the existing test script.
The processing module 301 is further configured to interpret the test case in the existing test script according to the design specification met by the existing test script, so as to obtain the data element in the test case in the existing test script.
The processing module 301 is further configured to generate a new test script according to the data elements in the test cases in the existing test script, where the design specification met by the new test script is different from the design specification met by the existing test script.
The output module 302 is used for outputting the new test script.
In one possible implementation, the apparatus 300 further includes a display module and a receiving module. The display module is used for displaying various design specification information of the test script. The receiving module is used for receiving target design specification information selected by a user from the plurality of kinds of design specification information. Correspondingly, the processing module 301 is specifically configured to: and generating the new test script according to the design specification indicated by the target design specification information and the data elements in the test cases in the existing test script.
In one possible implementation, the apparatus 300 further includes a receiving module for receiving a target design specification input by a user. Correspondingly, the processing module is specifically configured to: and generating the new test script according to the target design specification and the data elements in the test cases in the existing test script.
Fig. 4 is a schematic structural diagram of a test case multiplexing apparatus 400 according to an embodiment of the present application. The apparatus 400 includes a processor 402, a communication interface 403, and a memory 404. One example of the apparatus 400 is a chip and another example of the apparatus 400 is a computing device.
The processor 402, the memory 404, and the communication interface 403 may communicate with each other via a bus. The memory 404 stores executable code therein, and the processor 402 reads the executable code in the memory 404 to perform a corresponding method. The memory 404 may also include other software modules required to run processes, such as an operating system. The operating system may be LINUXTM,UNIXTM,WINDOWSTMAnd the like.
For example, executable code in memory 404 is used to implement the steps or operations in FIG. 2; the processor 402 reads the executable code in the memory 404 to perform steps 201 to 203 in fig. 2, and the communication interface 403 may perform step 204.
The processor 402 may be a CPU. The memory 404 may include volatile memory (volatile memory), such as Random Access Memory (RAM). The memory 404 may also include a non-volatile memory (2 NVM), such as a read-only memory (2 ROM), a flash memory, a Hard Disk Drive (HDD) or a Solid State Drive (SSD).
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: u disk, removable hard disk, read only memory, random access memory, magnetic or optical disk, etc. for storing program codes.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.