CN113535581B - Test script generation method, device, equipment and computer readable storage medium - Google Patents
Test script generation method, device, equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN113535581B CN113535581B CN202110874578.XA CN202110874578A CN113535581B CN 113535581 B CN113535581 B CN 113535581B CN 202110874578 A CN202110874578 A CN 202110874578A CN 113535581 B CN113535581 B CN 113535581B
- Authority
- CN
- China
- Prior art keywords
- information
- message instruction
- test
- state
- event
- 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.)
- Active
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 222
- 238000000034 method Methods 0.000 title claims abstract description 43
- 239000011159 matrix material Substances 0.000 claims abstract description 27
- 238000013507 mapping Methods 0.000 claims abstract description 20
- 238000006243 chemical reaction Methods 0.000 claims description 11
- 230000007704 transition Effects 0.000 claims description 7
- 238000010276 construction Methods 0.000 claims description 3
- 238000004590 computer program Methods 0.000 description 16
- 230000008569 process Effects 0.000 description 11
- 230000006870 function Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 7
- 238000012986 modification Methods 0.000 description 6
- 230000004048 modification Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 3
- 238000010998 test method Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000013142 basic testing Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000013522 software testing Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
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/3684—Test management for test design, e.g. generating new test cases
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application relates to a test script generation method, a device, equipment and a computer readable storage medium, which relate to the technical field of computers and comprise the steps of constructing a test script to be filled, wherein the test script to be filled comprises test step information; creating a test matrix table, wherein the test matrix table comprises information to be converted, and the information to be converted has a mapping relation with a corresponding test step in the test step information; obtaining information to be converted corresponding to a corresponding test step in the test step information according to the mapping relation; converting and identifying the information to be converted based on a preset message instruction information table to obtain a message instruction corresponding to the information to be converted; and filling the message instruction to the corresponding to-be-filled position in the test step information, and generating a test script. The application can directly convert the test matrix into the automatic test script, improves the writing efficiency of the test script and the maintainability of codes, and reduces the manual writing workload.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a computer readable storage medium for generating a test script.
Background
The rapid development of the information age has contributed to the rapid rise of the software industry, so that software is visible everywhere in life, namely, the software gradually becomes an indispensable part of mobile phones, computers, automobiles and the like. However, errors will not be avoided in the process of software development, so that the reliability of the software needs to be tested, namely, the software is checked layer by layer in a test link, the function and performance of the product are tested according to a test scheme by using a test means, faults occurring in the test process are tracked, the developed product is ensured to meet the requirements specified by users, and the quality and reliability of the software are further improved.
It follows that software testing runs through the whole process of a software project, but its implementation is not the same as software development. The software development is a top-down and step-by-step refinement process, namely, a software planning stage defines a software scope, a software demand analysis stage establishes a software information domain, functions, performance demands and the like, and a software design stage selects programming languages, design module interfaces and the like; the software test and the software development process are just opposite, namely, the process of gradually integrating from bottom to top is firstly performed, namely, the unit test is performed, the defects on the logic and the functions in the module are eliminated, then the module is integrated and integrated according to the software design requirement, the error on the subsystem or the system structure is detected, and finally, the complete system is operated to perform the system test, and whether the system meets the software requirement is checked.
A test script refers to a series of instructions for a particular test that can be executed by an automated test tool, i.e., a script written for performing an automated test, which is the basic element for implementing a software test. It can be seen that the generation of the test script affects the success or failure of the software test.
In the related art, generally, by writing a test matrix first and then manually writing an automatic test code according to the test matrix, the method can generate a test script, but can only be used for testing work with simple logic, and for testing work with complex software logic, the problems of large test script writing workload and inconvenient later test script modification exist.
Disclosure of Invention
The application provides a test script generation method, a device, equipment and a computer readable storage medium, which are used for solving the problems of large writing workload and inconvenient modification caused by manually writing a test script in the related technology.
In a first aspect, a test script generation method is provided, including the following steps:
constructing a test script to be filled, wherein the test script to be filled comprises test step information;
creating a test matrix table, wherein the test matrix table comprises information to be converted, and the information to be converted has a mapping relation with a corresponding test step in the test step information;
obtaining information to be converted corresponding to a corresponding test step in the test step information according to the mapping relation;
converting and identifying the information to be converted based on a preset message instruction information table to obtain a message instruction corresponding to the information to be converted;
and filling the message instruction to a corresponding position to be filled in the test step information to generate a test script.
On the basis of the technical scheme, the information to be converted comprises initial state information, event information and expected state information.
On the basis of the technical scheme, the initial state information comprises that the door lock is in an open state; the event information comprises remote control of closing a door lock; the desired state information includes a door lock being in a closed state.
On the basis of the technical scheme, the message instruction information table comprises preset state information, a state message instruction corresponding to the preset state information, preset event information and an event message instruction corresponding to the preset event information.
On the basis of the above technical solution, the converting and identifying the to-be-converted information based on the preset message instruction information table to obtain the message instruction corresponding to the to-be-converted information, including:
comparing and identifying the initial state information with the preset state information to obtain a first state message instruction corresponding to the initial state information;
comparing and identifying the event information with the preset event information to obtain an event message instruction corresponding to the event information;
comparing and identifying the expected state information with the preset state information to obtain a second state message instruction corresponding to the expected state information;
and taking the first state message instruction, the event message instruction and the second state message instruction as message instructions corresponding to the information to be converted.
On the basis of the technical scheme, the second state message instruction is used for checking whether the first state message instruction and the event message instruction are correct or not.
On the basis of the technical scheme, before the step of converting and identifying the information to be converted based on the preset message instruction information table, the method further comprises the following steps:
acquiring first data, wherein the first data comprises historical state information and a historical state message instruction corresponding to the historical state information;
acquiring second data, wherein the second data comprises historical event information and a historical event message instruction corresponding to the historical event information;
and creating a message instruction information table according to the first data and the second data.
In a second aspect, there is provided a test script generating apparatus, comprising:
the construction unit is used for constructing a test script to be filled, and the test script to be filled comprises test step information;
the creating unit is used for creating a test matrix table, the test matrix table comprises information to be converted, and the information to be converted has a mapping relation with a corresponding test step in the test step information;
the acquisition unit is used for acquiring information to be converted corresponding to a corresponding test step in the test step information according to the mapping relation;
the conversion unit is used for carrying out conversion identification on the information to be converted based on a preset message instruction information table to obtain a message instruction corresponding to the information to be converted;
and the filling unit is used for filling the message instruction to the corresponding part to be filled in the test step information to generate a test script.
In a third aspect, there is provided a test script generating apparatus comprising: the test script generation system comprises a memory and a processor, wherein at least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor so as to realize the test script generation method.
In a fourth aspect, a computer-readable storage medium is provided, the computer storage medium storing computer instructions that, when executed by a computer, cause the computer to perform the foregoing test script generation method.
The technical scheme provided by the application has the beneficial effects that: the writing efficiency of the test script and the maintainability of codes can be improved, and the manual writing workload is reduced.
The application provides a test script generation method, a device, equipment and a computer readable storage medium, comprising the following steps: constructing a test script to be filled, wherein the test script to be filled comprises test step information; creating a test matrix table, wherein the test matrix table comprises information to be converted, and the information to be converted has a mapping relation with a corresponding test step in the test step information; obtaining information to be converted corresponding to a corresponding test step in the test step information according to the mapping relation; converting and identifying the information to be converted based on a preset message instruction information table to obtain a message instruction corresponding to the information to be converted; and filling the message instruction to a corresponding position to be filled in the test step information to generate a test script. According to the application, the test matrix can be directly converted into the automatic test script without manually compiling the test script, so that the compiling efficiency of the test script is improved, the manual compiling workload is reduced, and the compiling work of the corresponding test script can be rapidly completed according to the testing requirements of different complexity degrees, the modification is convenient, and the maintainability of codes is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a test script generation method according to an embodiment of the present application;
FIG. 2 is a schematic structural diagram of a test script generating device according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a test script generating device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The embodiment of the application provides a test script generation method, a device, equipment and a computer readable storage medium, which can solve the problems of large writing workload and inconvenient modification caused by manually writing a test script in the related technology.
Fig. 1 is a flow chart of a test script generating method according to an embodiment of the present application, including the following steps:
step S10: constructing a test script to be filled, wherein the test script to be filled comprises test step information;
illustratively, in an embodiment of the present application, the test script is computer readable instructions for automatically executing a test procedure (or a portion of a test procedure), and the test script to be filled includes relevant basic test step information and blank to be filled that have been written, and the test step information includes test steps and basic execution code of each step, etc. For example, the test steps include test step 1.1, test step 1.2, test step 1.3, and the like.
Step S20: creating a test matrix table, wherein the test matrix table comprises information to be converted, and the information to be converted has a mapping relation with a corresponding test step in the test step information;
in the embodiment of the present application, the test matrix table includes information to be converted, preferably, taking table 1 as an example, the information to be converted may include a test step, initial state information, event information, and expected state information, where the test step corresponds to a test step in the test step information in step S10 one by one, and has a mapping relationship.
Table 1 test matrix table
Test procedure | Initial state | Event(s) | Desired state |
1.1 | A | Event 1 | A |
1.2 | A | Event 2 | B |
1.3 | B | Event 3 | C |
2.1 | A | Event 4 | C |
2.2 | C | Event 5 | A |
2.3 | A | Event 6 | B |
Further, in the embodiment of the present application, taking the test step as 1.1 as an example, the information to be converted in the test step 1.1 (i.e. the object to be executed in the test step 1.1, i.e. the object to be filled in the to-be-filled place in the test step 1.1) includes an initial state, an event and an expected state, where the event is a condition for triggering the state transition; for example, initial state a represents the door lock state being open, event 1 represents keeping the door lock state unchanged, and desired state a represents the door lock state being open; taking the test step 1.2 as an example, the initial state a represents that the door lock is opened, the event 2 represents that the door lock is closed by remote control, and the expected state B represents that the door lock is closed, and the test steps 1.3 to 2.3 have the same or similar explanation as the above, and are not repeated herein.
Wherein the foregoing table 1 is merely an exemplary presentation, and different initial state information, event information, and desired state information may also be defined according to specific requirements.
Step S30: obtaining information to be converted corresponding to a corresponding test step in the test step information according to the mapping relation;
exemplary, in the embodiment of the present application, according to the mapping relationship between the information to be converted and the corresponding test step in the test step information, the information to be converted corresponding to the corresponding test step in the test step information is obtained; for example, according to the test step 1.1 in the test step information, the initial state a, the event 1 and the expected state a corresponding to the test step 1.1 in the test matrix table are obtained.
Step S40: converting and identifying the information to be converted based on a preset message instruction information table to obtain a message instruction corresponding to the information to be converted;
exemplary, in the embodiment of the present application, the message instruction information table includes preset state information, a state message instruction corresponding to the preset state information, preset event information, and an event message instruction corresponding to the preset event information. For example, the preset state information includes that an initial state A-door Lock state is opened and an expected state B-door Lock state is closed, an initial state message instruction corresponding to the initial state A is Lock-open, and an expected state message instruction corresponding to the expected state B is Lock-close; the preset event information comprises an event 2-remote control door LOCK closing, and an event message instruction corresponding to the event 2 is RKE-LOCK.
Specifically, the information to be converted is converted and identified based on a preset message instruction information table, so as to obtain a message instruction corresponding to the information to be converted, and the method comprises the following steps: comparing and identifying the initial state information with the preset state information to obtain a first state message instruction corresponding to the initial state information; comparing and identifying the event information with the preset event information to obtain an event message instruction corresponding to the event information; comparing and identifying the expected state information with the preset state information to obtain a second state message instruction corresponding to the expected state information; and taking the first state message instruction, the event message instruction and the second state message instruction as message instructions corresponding to the information to be converted.
Therefore, based on the message instruction information table, instruction conversion of the information to be converted can be performed, for example, the initial state a of the test step 1.2 in the test matrix table in the step S30 is compared with each preset initial state in the message instruction information table, and it can be found that the initial state a of the test step 1.2 is identical to the initial state a in the message instruction information table, so that the initial state a in the test step 1.2 can be converted into an initial state message instruction: lock-open; similarly, the event 2 in the test step 1.2 can be converted into an event message instruction: the RKE-LOCK converts the expected state B in the test step 1.2 into an expected state message instruction: lock-close.
Furthermore, in the embodiment of the present application, before the step of performing conversion identification on the information to be converted based on the preset message instruction information table, the method further includes the following steps: acquiring first data, wherein the first data comprises historical state information and a historical state message instruction corresponding to the historical state information; acquiring second data, wherein the second data comprises historical event information and a historical event message instruction corresponding to the historical event information; and creating a message instruction information table according to the first data and the second data.
Step S50: and filling the message instruction to a corresponding position to be filled in the test step information to generate a test script.
Exemplary, in the embodiment of the present application, the initial state packet instruction obtained in step S40 is as follows: lock-open, event message instruction: RKE-LOCK, expected state message instruction: the Lock-close is respectively filled in the corresponding blank to be filled in the test step 1.2 in the step S10; repeating the steps, and generating a test script after filling the blank to be filled corresponding to each step in the test step information in the step S10.
Further, in the embodiment of the present application, the second status message instruction is used to check whether the first status message instruction and the event message instruction are correct.
Exemplary, after steps S10 to S50, a test script is automatically generated, taking test step 1.2 in the test script as an example, and each blank to be filled in test step 1.2 is correspondingly filled with an initial state message instruction respectively: lock-open, event message instruction: RKE-LOCK, expected state message instruction: lock-close; firstly, automatically executing the test script through a test tool, when the test step 1.2 is executed, triggering the initial state A through the event 2 to obtain a transition result of the initial state A, and if the transition result is the same as the expected state B, describing an initial state message instruction in the step: lock-open and event message instruction: the RKE-LOCK is correct, and the test step 1.3 is continuously executed; if the transition result is different from the expected state B, the initial state message instruction in this step is described: lock-open and event message instruction: the RKE-LOCK is wrong, and an initial state message instruction and an event message instruction need to be checked and modified at the moment, so that the accuracy of the test script is effectively improved.
According to the application, the test matrix can be directly converted into the automatic test script without manually compiling the test script, so that the compiling efficiency of the test script is improved, the manual compiling workload is reduced, and the compiling work of the corresponding test script can be rapidly completed according to the testing requirements of different complexity degrees, the modification is convenient, and the maintainability of codes is improved.
Referring to fig. 2, the embodiment of the application further provides a test script generating device, which includes:
the construction unit is used for constructing a test script to be filled, and the test script to be filled comprises test step information;
the creating unit is used for creating a test matrix table, the test matrix table comprises information to be converted, and the information to be converted has a mapping relation with a corresponding test step in the test step information;
the acquisition unit is used for acquiring information to be converted corresponding to a corresponding test step in the test step information according to the mapping relation;
the conversion unit is used for carrying out conversion identification on the information to be converted based on a preset message instruction information table to obtain a message instruction corresponding to the information to be converted;
and the filling unit is used for filling the message instruction to the corresponding part to be filled in the test step information to generate a test script.
Further, in the embodiment of the present application, the information to be converted includes initial state information, event information, and expected state information.
Further, in an embodiment of the present application, the initial state information includes that the door lock is in an open state; the event information comprises remote control of closing a door lock; the desired state information includes a door lock being in a closed state.
Further, in an embodiment of the present application, the message instruction information table includes preset state information, a state message instruction corresponding to the preset state information, preset event information, and an event message instruction corresponding to the preset event information.
Further, in an embodiment of the present application, the conversion unit is specifically configured to:
comparing and identifying the initial state information with the preset state information to obtain a first state message instruction corresponding to the initial state information;
comparing and identifying the event information with the preset event information to obtain an event message instruction corresponding to the event information;
comparing and identifying the expected state information with the preset state information to obtain a second state message instruction corresponding to the expected state information;
and taking the first state message instruction, the event message instruction and the second state message instruction as message instructions corresponding to the information to be converted.
Further, in the embodiment of the present application, the second status message instruction is used to check whether the first status message instruction and the event message instruction are correct.
Still further, in an embodiment of the present application, the creating unit is further configured to:
acquiring first data, wherein the first data comprises historical state information and a historical state message instruction corresponding to the historical state information;
acquiring second data, wherein the second data comprises historical event information and a historical event message instruction corresponding to the historical event information;
and creating a message instruction information table according to the first data and the second data.
It should be noted that, for convenience and brevity of description, specific working processes of the above-described apparatus and units may refer to corresponding processes in the foregoing test script generation method embodiment, and are not repeated herein.
The test script generating apparatus provided by the above-described embodiment may be implemented in the form of a computer program that can be run on a test script generating device as shown in fig. 3.
The embodiment of the application also provides test script generating equipment, which comprises the following steps: the system comprises a memory, a processor and a network interface which are connected through a system bus, wherein at least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor so as to realize all or part of the steps of the test script generation method.
Wherein the network interface is used for network communication, such as sending assigned tasks, etc. It will be appreciated by those skilled in the art that the structure shown in FIG. 3 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
The processor may be a CPU, but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (FieldProgrammable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic device discrete hardware components, or the like. A general purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like, that is a control center of a computer device, with various interfaces and lines connecting various parts of the entire computer device.
The memory may be used to store computer programs and/or modules, and the processor implements various functions of the computer device by running or executing the computer programs and/or modules stored in the memory, and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, application programs required for at least one function (such as a video playing function, an image playing function, etc.), and the like; the storage data area may store data (such as video data, image data, etc.) created according to the use of the cellular phone, etc. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart Media Card (SMC), secure Digital (SD) Card, flash Card (Flash Card), at least one disk storage device, flash memory device, or other volatile solid state storage device.
Wherein in one embodiment the processor is configured to run a computer program stored in the memory to implement the steps of:
constructing a test script to be filled, wherein the test script to be filled comprises test step information;
creating a test matrix table, wherein the test matrix table comprises information to be converted, and the information to be converted has a mapping relation with a corresponding test step in the test step information;
obtaining information to be converted corresponding to a corresponding test step in the test step information according to the mapping relation;
converting and identifying the information to be converted based on a preset message instruction information table to obtain a message instruction corresponding to the information to be converted;
and filling the message instruction to a corresponding position to be filled in the test step information to generate a test script.
Still further, in one embodiment, the information to be converted includes initial state information, event information, and desired state information.
Still further, in one embodiment, the initial state information includes that the door lock is in an open state; the event information comprises remote control of closing a door lock; the desired state information includes a door lock being in a closed state.
Further, in an embodiment, the message instruction information table includes preset state information, a state message instruction corresponding to the preset state information, preset event information, and an event message instruction corresponding to the preset event information.
Further, in an embodiment, when the processor performs conversion and identification on the to-be-converted information based on the preset message instruction information table to obtain a message instruction corresponding to the to-be-converted information, the processor is specifically configured to implement:
comparing and identifying the initial state information with the preset state information to obtain a first state message instruction corresponding to the initial state information;
comparing and identifying the event information with the preset event information to obtain an event message instruction corresponding to the event information;
comparing and identifying the expected state information with the preset state information to obtain a second state message instruction corresponding to the expected state information;
and taking the first state message instruction, the event message instruction and the second state message instruction as message instructions corresponding to the information to be converted.
Further, in an embodiment, the second status message instruction is used to check whether the first status message instruction and the event message instruction are correct.
In a further embodiment, before implementing the step of converting and identifying the information to be converted based on the preset message instruction information table, the processor is further configured to implement:
acquiring first data, wherein the first data comprises historical state information and a historical state message instruction corresponding to the historical state information;
acquiring second data, wherein the second data comprises historical event information and a historical event message instruction corresponding to the historical event information;
and creating a message instruction information table according to the first data and the second data.
The embodiment of the application also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements all or part of the steps of the test script generation method described above.
The foregoing embodiments of the present application may be implemented in whole or in part by computer program instructions for implementing the relevant hardware, and the computer program may be stored in a computer readable storage medium, where the computer program when executed by a processor may implement the steps of the methods described above. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, executable files or in some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying computer program code, record medium, USB flash disk, removable hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RandomAccess memory, RAM), electrical carrier wave signals, telecommunications signals, and software distribution media. It should be noted that the content of the computer readable medium can be appropriately increased or decreased according to the requirements of the jurisdiction's jurisdiction and the patent practice, for example, in some jurisdictions, the computer readable medium does not include electrical carrier signals and telecommunication signals according to the jurisdiction and the patent practice.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, server, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, magnetic disk storage, optical storage, and the like) having computer-usable program code embodied therein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above numbers in the embodiments of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The foregoing is only a specific embodiment of the application to enable those skilled in the art to understand or practice the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (5)
1. A test script generation method, comprising the steps of:
constructing a test script to be filled, wherein the test script to be filled comprises test step information, and the test step information comprises test steps and basic execution codes of each step;
creating a test matrix table, wherein the test matrix table comprises information to be converted, and the information to be converted has a mapping relation with a corresponding test step in the test step information;
obtaining information to be converted corresponding to a corresponding test step in the test step information according to the mapping relation, wherein the information to be converted comprises initial state information, event information and expected state information;
converting and identifying the information to be converted based on a preset message instruction information table to obtain a message instruction corresponding to the information to be converted, wherein the message instruction information table comprises preset state information, a state message instruction corresponding to the preset state information, preset event information and an event message instruction corresponding to the preset event information;
the method is sequentially executed for each testing step, the message instruction is filled into the corresponding part to be filled in the testing step information, and a testing script is generated; the converting and identifying the information to be converted based on the preset message instruction information table to obtain a message instruction corresponding to the information to be converted, which comprises the following steps:
comparing and identifying the initial state information with the preset state information to obtain a first state message instruction corresponding to the initial state information;
comparing and identifying the event information with the preset event information to obtain an event message instruction corresponding to the event information;
comparing and identifying the expected state information with the preset state information to obtain a second state message instruction corresponding to the expected state information, wherein the second state message instruction is used for checking whether the first state message instruction and the event message instruction are correct or not;
the first state message instruction, the event message instruction and the second state message instruction are used as message instructions corresponding to the information to be converted;
the second status message instruction is used for checking whether the first status message instruction and the event message instruction correctly include the following steps:
automatically executing a first state message instruction and an event message instruction filled in a current test step through a test tool, when the current test step is executed, triggering an initial state through an event to obtain a transition result of the initial state, and if the transition result is the same as an expected state, indicating that the first state message instruction and the event message instruction in the current test step are correct, and continuing to execute a next test step; if the transition result is different from the expected state, the first state message instruction and the event message instruction in the current test step are wrong and need to be checked and modified;
before the step of converting and identifying the information to be converted based on the preset message instruction information table, the method further comprises the following steps:
acquiring first data, wherein the first data comprises historical state information and a historical state message instruction corresponding to the historical state information;
acquiring second data, wherein the second data comprises historical event information and a historical event message instruction corresponding to the historical event information;
and creating a message instruction information table according to the first data and the second data.
2. The test script generation method of claim 1, wherein: the initial state information comprises that a door lock is in an open state; the event information comprises remote control of closing a door lock; the desired state information includes a door lock being in a closed state.
3. A test script generating device based on the test script generating method of claim 1, comprising:
the construction unit is used for constructing a test script to be filled, and the test script to be filled comprises test step information;
the creating unit is used for creating a test matrix table, the test matrix table comprises information to be converted, and the information to be converted has a mapping relation with a corresponding test step in the test step information;
the acquisition unit is used for acquiring information to be converted corresponding to a corresponding test step in the test step information according to the mapping relation, wherein the information to be converted comprises initial state information, event information and expected state information;
the conversion unit is used for carrying out conversion identification on the information to be converted based on a preset message instruction information table to obtain a message instruction corresponding to the information to be converted, wherein the message instruction information table comprises preset state information, a state message instruction corresponding to the preset state information, preset event information and an event message instruction corresponding to the preset event information;
the filling unit is used for filling the message instruction to the corresponding part to be filled in the test step information to generate a test script;
wherein, the conversion unit is specifically configured to:
comparing and identifying the initial state information with the preset state information to obtain a first state message instruction corresponding to the initial state information;
comparing and identifying the event information with the preset event information to obtain an event message instruction corresponding to the event information;
comparing and identifying the expected state information with the preset state information to obtain a second state message instruction corresponding to the expected state information, wherein the second state message instruction is used for checking whether the first state message instruction and the event message instruction are correct or not;
and taking the first state message instruction, the event message instruction and the second state message instruction as message instructions corresponding to the information to be converted.
4. A test script generating apparatus, comprising: a memory and a processor, the memory storing at least one instruction that is loaded and executed by the processor to implement the test script generation method of claim 1 or 2.
5. A computer-readable storage medium, characterized by: the computer storage medium stores computer instructions that, when executed by a computer, cause the computer to perform the test script generation method of claim 1 or 2.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110874578.XA CN113535581B (en) | 2021-07-30 | 2021-07-30 | Test script generation method, device, equipment and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110874578.XA CN113535581B (en) | 2021-07-30 | 2021-07-30 | Test script generation method, device, equipment and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113535581A CN113535581A (en) | 2021-10-22 |
CN113535581B true CN113535581B (en) | 2023-12-12 |
Family
ID=78121690
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110874578.XA Active CN113535581B (en) | 2021-07-30 | 2021-07-30 | Test script generation method, device, equipment and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113535581B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115567340B (en) * | 2022-09-22 | 2024-04-26 | 重庆长安汽车股份有限公司 | CAN bus test engineering generation method, device, equipment and medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102404168A (en) * | 2011-11-15 | 2012-04-04 | 北京天融信科技有限公司 | Method and device for comprehensively testing NUD |
WO2016015511A1 (en) * | 2014-07-31 | 2016-02-04 | 中兴通讯股份有限公司 | Method, apparatus and computer storage medium for simulating data packet in network management test event |
CN107547299A (en) * | 2017-06-01 | 2018-01-05 | 新华三信息安全技术有限公司 | A kind of method of testing and system |
CN108763084A (en) * | 2018-05-30 | 2018-11-06 | 郑州云海信息技术有限公司 | A kind of generation method of test case, device and electronic equipment |
CN109815127A (en) * | 2018-12-21 | 2019-05-28 | 浙江数链科技有限公司 | Automatized script conversion method, device, computer equipment and storage medium |
CN112559372A (en) * | 2020-12-24 | 2021-03-26 | 南方电网深圳数字电网研究院有限公司 | Interface test case generation method, system and storage medium |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP5613721B2 (en) * | 2012-05-18 | 2014-10-29 | 株式会社日立製作所 | Test support system, test support method, and program |
US9753842B2 (en) * | 2014-05-09 | 2017-09-05 | Wipro Limited | System and method for creating universal test script for testing variants of software application |
US10108535B2 (en) * | 2016-07-08 | 2018-10-23 | Accenture Global Solutions Limited | Web application test script generation to test software functionality |
US10581717B2 (en) * | 2017-09-29 | 2020-03-03 | Verizon Patent And Licensing Inc. | Automated virtual network function test controller |
US11074162B2 (en) * | 2019-04-15 | 2021-07-27 | Cognizant Technology Solutions India Pvt. Ltd. | System and a method for automated script generation for application testing |
-
2021
- 2021-07-30 CN CN202110874578.XA patent/CN113535581B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102404168A (en) * | 2011-11-15 | 2012-04-04 | 北京天融信科技有限公司 | Method and device for comprehensively testing NUD |
WO2016015511A1 (en) * | 2014-07-31 | 2016-02-04 | 中兴通讯股份有限公司 | Method, apparatus and computer storage medium for simulating data packet in network management test event |
CN107547299A (en) * | 2017-06-01 | 2018-01-05 | 新华三信息安全技术有限公司 | A kind of method of testing and system |
CN108763084A (en) * | 2018-05-30 | 2018-11-06 | 郑州云海信息技术有限公司 | A kind of generation method of test case, device and electronic equipment |
CN109815127A (en) * | 2018-12-21 | 2019-05-28 | 浙江数链科技有限公司 | Automatized script conversion method, device, computer equipment and storage medium |
CN112559372A (en) * | 2020-12-24 | 2021-03-26 | 南方电网深圳数字电网研究院有限公司 | Interface test case generation method, system and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113535581A (en) | 2021-10-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101339534B (en) | Software test apparatus and test method | |
CN110941546A (en) | Automatic test method, device, equipment and storage medium for WEB page case | |
CN109933521A (en) | Automated testing method, device, computer equipment and storage medium based on BDD | |
CN110764998B (en) | Data comparison method, device, equipment and storage medium based on Django framework | |
CN107179971B (en) | Automatic coding method and system for CAN bus fault processing | |
CN112181854B (en) | Method, device, equipment and storage medium for generating process automation script | |
CN105786695A (en) | Data test method and system | |
CN113282513B (en) | Interface test case generation method and device, computer equipment and storage medium | |
CN109558328B (en) | Method, system and device for testing code coverage rate and readable storage medium | |
CN111597110A (en) | Page testing method and device, electronic equipment and storage medium | |
CN113535581B (en) | Test script generation method, device, equipment and computer readable storage medium | |
CN111427582B (en) | RTL code management method, device, equipment and computer readable storage medium | |
CN116955207A (en) | Automatic test method, system and medium for identifying software and hardware completed by test case | |
CN110147313B (en) | Log output method and device | |
CN116431522A (en) | Automatic test method and system for low-code object storage gateway | |
CN116150020A (en) | Test case conversion method and device | |
CN115934129A (en) | Software project updating method and device, computer equipment and storage medium | |
CN115934559A (en) | Testing method of intelligent form testing system | |
CN115687108A (en) | Verification method, platform, terminal and storage medium based on combination of UVM and FPV | |
CN113986263A (en) | Code automation test method, device, electronic equipment and storage medium | |
CN113722213A (en) | Automated testing method and computer-readable storage medium | |
CN113485919A (en) | Test method, test device and computer readable storage medium | |
CN114448851B (en) | Automatic data testing method and system | |
CN115542882B (en) | Controller interface configuration method and device | |
CN109800155B (en) | Method and device for testing QTE interlocking application software based on Probe |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |