CN110968500A - Test case execution method and device - Google Patents
Test case execution method and device Download PDFInfo
- Publication number
- CN110968500A CN110968500A CN201811162335.8A CN201811162335A CN110968500A CN 110968500 A CN110968500 A CN 110968500A CN 201811162335 A CN201811162335 A CN 201811162335A CN 110968500 A CN110968500 A CN 110968500A
- Authority
- CN
- China
- Prior art keywords
- variable
- test case
- acquired
- variables
- pool
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
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
Abstract
The invention discloses a method and a device for executing a test case. Compared with the script writing, the variable acquiring method and the variable acquiring device have the advantages that the variable to be acquired and the using position of the variable to be acquired are input, and manpower can be reduced.
Description
Technical Field
The present invention relates to the field of data processing, and in particular, to a method and an apparatus for executing a test case.
Background
The scene test is a test mode of combining test cases of each module according to requirements to test according to business or real scenes. The purpose of the scenario test is to verify whether the product is working in an intended way in a specific application scenario. A test case is a set of test inputs, execution conditions, and expected results tailored for a particular target to test a program path or verify that a particular requirement is met.
When testing the scene, it needs to add part of the values in the result of the previous test case into the input of the next test case to combine different test cases. In the prior art, the extraction of the result of the last test case is generally realized by a technical staff in a script writing mode, and the script writing mode is complicated in work.
Disclosure of Invention
In view of the above, the present invention is proposed to provide a method and apparatus for executing a test case, which overcome the above problems or at least partially solve the above problems.
A method for executing a test case comprises the following steps:
acquiring a variable acquisition template used in a test case;
acquiring variables to be acquired and the use positions of the variables to be acquired, which are input in the variable acquisition template by a user;
determining a variable value corresponding to the variable to be acquired based on data stored in a variable pool; the variable pool comprises predefined variables and variable values corresponding to the variables;
and executing the test case according to the using position of the variable to be acquired and the variable value corresponding to the variable to be acquired.
Preferably, determining a variable value corresponding to the variable to be acquired based on data stored in a variable pool includes:
acquiring variable values corresponding to the variables to be acquired based on the variables stored in the variable pool and the variable values corresponding to each variable;
or acquiring variable information corresponding to the variable to be acquired based on the variables stored in the variable pool and the variable value corresponding to each variable;
and analyzing to obtain a variable value corresponding to the variable to be obtained based on the obtained variable information.
Preferably, after executing the test case according to the use position of the variable to be obtained and the variable value corresponding to the variable to be obtained, the method further includes:
acquiring an execution result of the test case;
assigning the execution result to the existing variable in the variable pool;
or, defining a new variable for the execution result, and taking the execution result as a variable value of the new variable;
and saving the new variable and the variable value corresponding to the new variable into the variable pool.
Preferably, before acquiring the variable acquisition template used in the test case, the method further includes:
acquiring a variable definition template;
acquiring variables to be defined input by a user in the variable definition template and variable values corresponding to the variables to be defined;
and storing the variable to be defined and the variable value corresponding to the variable to be defined into the variable pool.
An apparatus for executing a test case, comprising:
the first template acquisition module is used for acquiring a variable acquisition template used in the test case;
the first data acquisition module is used for acquiring the variable to be acquired and the use position of the variable to be acquired, which are input in the variable acquisition template by a user;
the variable determining module is used for determining a variable value corresponding to the variable to be acquired based on data stored in a variable pool; the variable pool comprises predefined variables and variable values corresponding to the variables;
and the case execution module is used for executing the test case according to the using position of the variable to be acquired and the variable value corresponding to the variable to be acquired.
Preferably, the variable determination module includes:
the first obtaining submodule is used for obtaining variable values corresponding to the variables to be obtained based on the variables stored in the variable pool and the variable values corresponding to the variables;
the second obtaining submodule is used for obtaining variable information corresponding to the variable to be obtained based on the variable stored in the variable pool and the variable value corresponding to each variable;
and the analysis submodule is used for analyzing and obtaining a variable value corresponding to the variable to be obtained based on the obtained variable information.
Preferably, the method further comprises the following steps:
the result acquisition module is used for acquiring the execution result of the test case after the test case is executed by the case execution module according to the use position of the variable to be acquired and the variable value corresponding to the variable to be acquired;
the first assignment module is used for assigning the execution result to the existing variable in the variable pool;
the second assignment module is used for defining a new variable for the execution result and taking the execution result as a variable value of the new variable;
and the first saving module is used for saving the new variable and the variable value corresponding to the new variable into the variable pool.
Preferably, the method further comprises the following steps:
the second template acquisition module is used for acquiring the variable definition template before the first template acquisition module acquires the variable acquisition template used in the test case;
the second data acquisition module is used for acquiring variables to be defined input in the variable definition template by a user and variable values corresponding to the variables to be defined;
and the second saving module is used for saving the variable to be defined and the variable value corresponding to the variable to be defined into the variable pool.
A storage medium includes a stored program, wherein the program executes the execution method of the test case.
A processor is used for running a program, wherein the program executes the execution method of the test case when running.
By means of the technical scheme, the test case execution method and the test case execution device provided by the invention have the advantages that the variable acquisition template can be generated in advance, a user only needs to input the variable to be acquired and the using position of the variable to be acquired in the variable acquisition template to extract the result of the last test case, then, the variable value corresponding to the variable to be acquired is determined based on data stored in the variable pool, and the test case is executed according to the using position of the variable to be acquired and the variable value corresponding to the variable to be acquired. Compared with the script writing, the variable acquiring method and the variable acquiring device have the advantages that the variable to be acquired and the using position of the variable to be acquired are input, and manpower can be reduced.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flowchart illustrating a method for executing a test case according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for executing another test case according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method for executing a test case according to another embodiment of the present invention;
FIG. 4 is a flowchart illustrating a method for executing a test case according to another embodiment of the present invention;
fig. 5 is a schematic structural diagram illustrating a device for executing a test case according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
An embodiment of the present invention provides a method for executing a test case, and referring to fig. 1, the method may include:
s11, acquiring a variable acquisition template used in the test case;
specifically, in the process of executing the test case, the operation before the request is executed first, that is, the result of the previous test case is extracted, that is, the variable to be acquired is determined.
The variable acquisition template is generated in advance, and a technician can input the variable to be acquired and the use position of the variable to be acquired in the variable acquisition template.
S12, acquiring the variable to be acquired and the use position of the variable to be acquired, which are input in the variable acquisition template by a user;
specifically, the user may input the variable to be acquired and the use position of the variable to be acquired in the variable acquisition template through an input device, such as a mouse.
The using position of the variable to be acquired is the using position of the variable to be acquired in the test case.
In the embodiment of the invention, the purpose of writing and quoting the variable is achieved by adopting a mode of writing the expression (the variable to be acquired and the using position of the variable to be acquired) by a user. An expression consists of variables, constants, operators, and functions. Data types such as strings, numbers (integer and floating point), boolean, lists and dictionaries are supported.
The key to scenario testing is the assignment of variables and the reference to variables. The variable is a basic component of the expression, and the assignment and reference of the variable are also core functions to be completed by the operation before the case request and the operation after the return.
The data types of variables may be numbers (reshaped and float), strings, dictionaries (bracketed key-value pairs, like { 'a':1}) and lists (bracketed arrays, like [1,2,3 ]).
Variables are named similarly to python, and can only contain numbers, letters, and underlines, and must begin with letters, case-to-case. The names of variables cannot be input, output and url, nor False, True and None; preferably, it is not an existing built-in function name (e.g., max, min, len, and sum) or a built-in constant name (e.g., null, false, true).
In addition to constants of the numeric, string, dictionary and list types, constants include the null values None, True and False values True and False, and their js aliases null, True and False.
At present, operators such as addition, subtraction, multiplication, division, brackets and the like are only supported. For lists and dictionaries, references to them are supported (lists are by number, dictionaries are keys), such as [1,2,3] [0] or { 'a':1} [ 'a' ]. The referenced parts may also be expressions.
Support commonly used functions: sum, max, min (minimum removal), and len (length). For lists, the supported methods: count counts the number of times an element appears), index (number of returned element) for the dictionary, the method supported: get (key value, if no key exists return null).
S13, determining a variable value corresponding to the variable to be acquired based on data stored in a variable pool; the variable pool comprises predefined variables and variable values corresponding to the variables;
the variables to be acquired are variables in a variable pool, and the variable pool is created and destroyed along with the scene. All variables are added into the variable pool when they are assigned for the first time, and no additional statement is needed; when the variable is referred, only the variable existing in the variable pool can be referred to. Only the global variable (temporary support) is kept after the variable pool is destroyed, the variable pool of the later scene is added, and the other variables are destroyed along with the destruction of the variable pool.
The variables to be acquired mainly comprise an input variable and a url variable, and the input and the url are special variables related to the test case.
input is a variable that refers to the request parameter of case, and contains two attributes: data (referring to input body) and header (referring to input header), both attributes being dictionary types. input is created before each case request and destroyed after the case is over.
url is a variable that indicates the request address of case, and is of dictionary type. The url is created before each case request and destroyed after the case is over. When the case executes, the structure enclosed by the curly brackets in the url of the case is replaced according to the key value pair in the url. For example, if the url of case is "http:// xxx. com/{ id }" and the url variable is { 'id':1}, then the url of case would be replaced with http:// xxx. com/1.
In this embodiment, the variables to be acquired mainly include an input variable and a url variable, and variable values of the input variable and the url variable need to be determined.
And S14, executing the test case according to the using position of the variable to be acquired and the variable value corresponding to the variable to be acquired.
Specifically, an input body in a variable value corresponding to an input variable carries data, a variable value corresponding to a url carries an access url link, namely an access interface link, the data is sent to the access interface link, namely a server, so that a corresponding access result can be obtained, and then the access result is compared with an expected access result to determine whether the access result is matched with the expected access result, wherein the process is an execution process of the test case.
In this embodiment, a variable acquisition template may be generated in advance, and a user only needs to input a variable to be acquired and a use position of the variable to be acquired in the variable acquisition template to extract a result of a previous test case, then, based on data stored in a variable pool, determines a variable value corresponding to the variable to be acquired, and executes the test case according to the use position of the variable to be acquired and the variable value corresponding to the variable to be acquired. Compared with the script writing, the variable acquiring method and the variable acquiring device have the advantages that the variable to be acquired and the using position of the variable to be acquired are input, and manpower can be reduced.
Optionally, on the basis of the foregoing embodiment, step S13 may include:
1) acquiring variable values corresponding to the variables to be acquired based on the variables stored in the variable pool and the variable values corresponding to each variable;
specifically, the variable pool includes predefined variables and variable values corresponding to each variable, the variable corresponding to the variable to be acquired in the variable pool is searched, and the variable value corresponding to the searched variable is used as the variable value corresponding to the variable to be acquired.
For example, the variable to be acquired is a company name, the variable of the company name is found from the variable pool, and the variable of the company name is used as the variable value of the variable to be acquired.
Or, 2) obtaining variable information corresponding to the variable to be obtained based on the variables stored in the variable pool and the variable value corresponding to each variable, and analyzing to obtain the variable value corresponding to the variable to be obtained based on the obtained variable information.
Specifically, the variable to be acquired may be an analysis result of a certain variable, such as a length of a table, in this case, it is first necessary to determine the variable from the variable pool as a variable value corresponding to the table, and then analyze the length of the table based on the table value as the variable value of the variable to be acquired.
In this embodiment, the variable value of the variable to be acquired may be directly acquired from the variable value pool, and the analysis result of the variable information may be obtained through analysis based on the variable information corresponding to the variable to be acquired, and may be applied to an application scenario in which the variable value needs to be analyzed.
Optionally, on the basis of any of the foregoing embodiments, after step S14, the method may further include:
s25, obtaining an execution result of the test case;
specifically, the server may directly return the execution result.
output is a special variable related to case, and is a variable that indicates the request return value of case, and includes three attributes: data (refers to return body), header (refers to return header) and status _ code (refers to return status code). Data and header are both dictionary types, and status _ code is an integer type. The output is created after the case returns and is destroyed after the case ends.
S26, assigning the execution result to the existing variable in the variable pool;
specifically, the execution result may be directly assigned to an existing variable in the variable pool, that is, a variable value of the variable in the variable pool is changed.
Further, referring to fig. 3, after step S25, the method may further include:
s27, defining a new variable for the execution result, and taking the execution result as the variable value of the new variable;
specifically, a new variable may be defined at this time, and the execution result may be used as a variable value of the new variable.
And S28, saving the new variable and the variable value corresponding to the new variable into the variable pool.
Note that, after the step S25 is executed, the step S26, or the steps S27 and S28 may be executed.
Steps S25 to 28 are post-return operations, which are operations for assigning the return value of the interface to the variable using an expression after receiving the interface return value. The basic mode of operation after returning is the same as the initialization operation, noting that output cannot appear at the left value of the operation (but not necessarily at the right value), and both input and url are allowed to be used in the right value (not prohibited from being used at the left value, but not meaningful). In addition to assigning a return value to a variable in a post-return operation, direct change of the value of the variable is allowed (e.g., setting a counter, etc.).
In this embodiment, the execution result may also be saved in the variable pool, so that a subsequent test case may be used.
Optionally, on the basis of any of the foregoing embodiments, before step S11, the method may further include:
s41, acquiring a variable definition template;
the variable definition template is also generated in advance and is used for realizing definition of the variable.
S42, acquiring variables to be defined input by the user in the variable definition template and variable values corresponding to the variables to be defined;
and S43, storing the variable to be defined and the variable value corresponding to the variable to be defined into the variable pool.
In this embodiment, a user may write an initialization operation when editing a scene, and the main effect is that a transaction adds some variables to a variable pool. The left value of the initialization operation can only be a variable and the right value is an expression. The initialization operation is performed after the scene is executed and before the first case is executed, so that all the special variables cannot be referenced, but for variables that can be referenced to the imported variable pool.
A complete scenario test generally comprises three operations: initialization operations, pre-request operations, and post-return operations. Their results are essentially the same, both with a left and right value. Both the left and right values are basically expressions, but there are some additional limitations.
In this embodiment, the variable and the variable value of the variable may be predefined and stored in the variable pool, which facilitates the reference of the variable when executing the test case.
In addition, the reference and assignment of the variable can be achieved by defining three operations, and a tester is not required to write codes. And the support for the expression also greatly increases the degree of freedom of the test, and can perform more complex tests.
Optionally, on the basis of the embodiment of the method for executing the test case, another embodiment of the present invention provides an apparatus for executing the test case, and with reference to fig. 5, the apparatus may include:
a first template obtaining module 101, configured to obtain a variable obtaining template used in a test case;
the first data acquisition module 102 is configured to acquire a variable to be acquired and a use position of the variable to be acquired, where the variable is input by a user in the variable acquisition template;
the variable determining module 103 is configured to determine a variable value corresponding to the variable to be acquired based on data stored in a variable pool; the variable pool comprises predefined variables and variable values corresponding to the variables;
the use case execution module 104 is configured to execute the test case according to the use position of the variable to be acquired and the variable value corresponding to the variable to be acquired.
In this embodiment, a variable acquisition template may be generated in advance, and a user only needs to input a variable to be acquired and a use position of the variable to be acquired in the variable acquisition template to extract a result of a previous test case, then, based on data stored in a variable pool, determines a variable value corresponding to the variable to be acquired, and executes the test case according to the use position of the variable to be acquired and the variable value corresponding to the variable to be acquired. Compared with the script writing, the variable acquiring method and the variable acquiring device have the advantages that the variable to be acquired and the using position of the variable to be acquired are input, and manpower can be reduced.
It should be noted that, for the working process of each module in this embodiment, please refer to the corresponding description in the above embodiments, which is not described herein again.
Optionally, on the basis of the embodiment of the device for executing the test case, the variable determining module includes:
the first obtaining submodule is used for obtaining variable values corresponding to the variables to be obtained based on the variables stored in the variable pool and the variable values corresponding to the variables;
the second obtaining submodule is used for obtaining variable information corresponding to the variable to be obtained based on the variable stored in the variable pool and the variable value corresponding to each variable;
and the analysis submodule is used for analyzing and obtaining a variable value corresponding to the variable to be obtained based on the obtained variable information.
In this embodiment, the variable value of the variable to be acquired may be directly acquired from the variable value pool, and the analysis result of the variable information may be obtained through analysis based on the variable information corresponding to the variable to be acquired, and may be applied to an application scenario in which the variable value needs to be analyzed.
It should be noted that, for the working processes of each module and sub-module in this embodiment, please refer to the corresponding description in the above embodiments, which is not described herein again.
Optionally, on the basis of any embodiment of the execution device of the test case, the method further includes:
the result acquisition module is used for acquiring the execution result of the test case after the test case is executed by the case execution module according to the use position of the variable to be acquired and the variable value corresponding to the variable to be acquired;
the first assignment module is used for assigning the execution result to the existing variable in the variable pool;
the second assignment module is used for defining a new variable for the execution result and taking the execution result as a variable value of the new variable;
and the first saving module is used for saving the new variable and the variable value corresponding to the new variable into the variable pool.
In this embodiment, the execution result may also be saved in the variable pool, so that a subsequent test case may be used.
It should be noted that, for the working process of each module in this embodiment, please refer to the corresponding description in the above embodiments, which is not described herein again.
Optionally, on the basis of any embodiment of the execution device of the test case, the method further includes:
the second template acquisition module is used for acquiring the variable definition template before the first template acquisition module acquires the variable acquisition template used in the test case;
the second data acquisition module is used for acquiring variables to be defined input in the variable definition template by a user and variable values corresponding to the variables to be defined;
and the second saving module is used for saving the variable to be defined and the variable value corresponding to the variable to be defined into the variable pool.
In this embodiment, the variable and the variable value of the variable may be predefined and stored in the variable pool, which facilitates the reference of the variable when executing the test case.
In addition, the reference and assignment of the variable can be achieved by defining three operations, and a tester is not required to write codes. And the support for the expression also greatly increases the degree of freedom of the test, and can perform more complex tests.
It should be noted that, for the working process of each module in this embodiment, please refer to the corresponding description in the above embodiments, which is not described herein again.
Optionally, an embodiment of the present invention further provides an execution device of a test case, where the execution device of a test case includes a processor and a memory, and the first template obtaining module, the first data obtaining module, the variable determining module, the case execution module, and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to one or more, and manpower is reduced by adjusting kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a storage medium, on which a program is stored, where the program, when executed by a processor, implements an execution method of the test case.
The embodiment of the invention provides a processor, which is used for running a program, wherein the program runs to execute the execution method of the test case.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program which is stored on the memory and can run on the processor, wherein the processor executes the program and realizes the following steps:
a method for executing a test case comprises the following steps:
acquiring a variable acquisition template used in a test case;
acquiring variables to be acquired and the use positions of the variables to be acquired, which are input in the variable acquisition template by a user;
determining a variable value corresponding to the variable to be acquired based on data stored in a variable pool; the variable pool comprises predefined variables and variable values corresponding to the variables;
and executing the test case according to the using position of the variable to be acquired and the variable value corresponding to the variable to be acquired.
Further, determining a variable value corresponding to the variable to be acquired based on data stored in a variable pool, including:
acquiring variable values corresponding to the variables to be acquired based on the variables stored in the variable pool and the variable values corresponding to each variable;
or acquiring variable information corresponding to the variable to be acquired based on the variables stored in the variable pool and the variable value corresponding to each variable;
and analyzing to obtain a variable value corresponding to the variable to be obtained based on the obtained variable information.
Further, after executing the test case according to the use position of the variable to be obtained and the variable value corresponding to the variable to be obtained, the method further includes:
acquiring an execution result of the test case;
assigning the execution result to the existing variable in the variable pool;
or, defining a new variable for the execution result, and taking the execution result as a variable value of the new variable;
and saving the new variable and the variable value corresponding to the new variable into the variable pool.
Further, before acquiring the variable acquisition template used in the test case, the method further includes:
acquiring a variable definition template;
acquiring variables to be defined input by a user in the variable definition template and variable values corresponding to the variables to be defined;
and storing the variable to be defined and the variable value corresponding to the variable to be defined into the variable pool.
The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
a method for executing a test case comprises the following steps:
acquiring a variable acquisition template used in a test case;
acquiring variables to be acquired and the use positions of the variables to be acquired, which are input in the variable acquisition template by a user;
determining a variable value corresponding to the variable to be acquired based on data stored in a variable pool; the variable pool comprises predefined variables and variable values corresponding to the variables;
and executing the test case according to the using position of the variable to be acquired and the variable value corresponding to the variable to be acquired.
Further, determining a variable value corresponding to the variable to be acquired based on data stored in a variable pool, including:
acquiring variable values corresponding to the variables to be acquired based on the variables stored in the variable pool and the variable values corresponding to each variable;
or acquiring variable information corresponding to the variable to be acquired based on the variables stored in the variable pool and the variable value corresponding to each variable;
and analyzing to obtain a variable value corresponding to the variable to be obtained based on the obtained variable information.
Further, after executing the test case according to the use position of the variable to be obtained and the variable value corresponding to the variable to be obtained, the method further includes:
acquiring an execution result of the test case;
assigning the execution result to the existing variable in the variable pool;
or, defining a new variable for the execution result, and taking the execution result as a variable value of the new variable;
and saving the new variable and the variable value corresponding to the new variable into the variable pool.
Further, before acquiring the variable acquisition template used in the test case, the method further includes:
acquiring a variable definition template;
acquiring variables to be defined input by a user in the variable definition template and variable values corresponding to the variables to be defined;
and storing the variable to be defined and the variable value corresponding to the variable to be defined into the variable pool.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, 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, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
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 flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, 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, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims (10)
1. A method for executing a test case is characterized by comprising the following steps:
acquiring a variable acquisition template used in a test case;
acquiring variables to be acquired and the use positions of the variables to be acquired, which are input in the variable acquisition template by a user;
determining a variable value corresponding to the variable to be acquired based on data stored in a variable pool; the variable pool comprises predefined variables and variable values corresponding to the variables;
and executing the test case according to the using position of the variable to be acquired and the variable value corresponding to the variable to be acquired.
2. The method for executing the test case according to claim 1, wherein determining a variable value corresponding to the variable to be acquired based on data stored in a variable pool comprises:
acquiring variable values corresponding to the variables to be acquired based on the variables stored in the variable pool and the variable values corresponding to each variable;
or acquiring variable information corresponding to the variable to be acquired based on the variables stored in the variable pool and the variable value corresponding to each variable;
and analyzing to obtain a variable value corresponding to the variable to be obtained based on the obtained variable information.
3. The method for executing the test case according to claim 1, wherein after executing the test case according to the use position of the variable to be acquired and the variable value corresponding to the variable to be acquired, the method further comprises:
acquiring an execution result of the test case;
assigning the execution result to the existing variable in the variable pool;
or, defining a new variable for the execution result, and taking the execution result as a variable value of the new variable;
and saving the new variable and the variable value corresponding to the new variable into the variable pool.
4. The method for executing a test case according to claim 1, wherein before acquiring the variable acquisition template used in the test case, the method further comprises:
acquiring a variable definition template;
acquiring variables to be defined input by a user in the variable definition template and variable values corresponding to the variables to be defined;
and storing the variable to be defined and the variable value corresponding to the variable to be defined into the variable pool.
5. An apparatus for executing a test case, comprising:
the first template acquisition module is used for acquiring a variable acquisition template used in the test case;
the first data acquisition module is used for acquiring the variable to be acquired and the use position of the variable to be acquired, which are input in the variable acquisition template by a user;
the variable determining module is used for determining a variable value corresponding to the variable to be acquired based on data stored in a variable pool; the variable pool comprises predefined variables and variable values corresponding to the variables;
and the case execution module is used for executing the test case according to the using position of the variable to be acquired and the variable value corresponding to the variable to be acquired.
6. The apparatus for executing a test case according to claim 5, wherein the variable determination module comprises:
the first obtaining submodule is used for obtaining variable values corresponding to the variables to be obtained based on the variables stored in the variable pool and the variable values corresponding to the variables;
the second obtaining submodule is used for obtaining variable information corresponding to the variable to be obtained based on the variable stored in the variable pool and the variable value corresponding to each variable;
and the analysis submodule is used for analyzing and obtaining a variable value corresponding to the variable to be obtained based on the obtained variable information.
7. The apparatus for executing a test case according to claim 5, further comprising:
the result acquisition module is used for acquiring the execution result of the test case after the test case is executed by the case execution module according to the use position of the variable to be acquired and the variable value corresponding to the variable to be acquired;
the first assignment module is used for assigning the execution result to the existing variable in the variable pool;
the second assignment module is used for defining a new variable for the execution result and taking the execution result as a variable value of the new variable;
and the first saving module is used for saving the new variable and the variable value corresponding to the new variable into the variable pool.
8. The apparatus for executing a test case according to claim 5, further comprising:
the second template acquisition module is used for acquiring the variable definition template before the first template acquisition module acquires the variable acquisition template used in the test case;
the second data acquisition module is used for acquiring variables to be defined input in the variable definition template by a user and variable values corresponding to the variables to be defined;
and the second saving module is used for saving the variable to be defined and the variable value corresponding to the variable to be defined into the variable pool.
9. A storage medium characterized by comprising a stored program, wherein the program executes the method of executing a test case according to any one of claims 1 to 4.
10. A processor, configured to execute a program, wherein the program executes the method for executing the test case according to any one of claims 1 to 4 when the program is executed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811162335.8A CN110968500A (en) | 2018-09-30 | 2018-09-30 | Test case execution method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811162335.8A CN110968500A (en) | 2018-09-30 | 2018-09-30 | Test case execution method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110968500A true CN110968500A (en) | 2020-04-07 |
Family
ID=70029430
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811162335.8A Pending CN110968500A (en) | 2018-09-30 | 2018-09-30 | Test case execution method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110968500A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113127347A (en) * | 2021-04-14 | 2021-07-16 | 广联达科技股份有限公司 | Interface testing method, device, equipment and readable storage medium |
CN115687140A (en) * | 2022-11-10 | 2023-02-03 | 江苏衫数科技集团有限公司 | Test case compiling method and system based on automatic test |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104253718A (en) * | 2013-06-29 | 2014-12-31 | 北京新媒传信科技有限公司 | Network test method and device |
US20150007138A1 (en) * | 2013-06-26 | 2015-01-01 | Sap Ag | Method and system for incrementally updating a test suite utilizing run-time application executions |
CN106021112A (en) * | 2016-05-31 | 2016-10-12 | 腾讯科技(深圳)有限公司 | Program testing system, method and device |
WO2018076739A1 (en) * | 2016-10-26 | 2018-05-03 | 华为技术有限公司 | Data processing method and data processing device |
CN108563539A (en) * | 2018-03-21 | 2018-09-21 | 广州视源电子科技股份有限公司 | Interface test method, server, readable storage medium storing program for executing and system |
-
2018
- 2018-09-30 CN CN201811162335.8A patent/CN110968500A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150007138A1 (en) * | 2013-06-26 | 2015-01-01 | Sap Ag | Method and system for incrementally updating a test suite utilizing run-time application executions |
CN104253718A (en) * | 2013-06-29 | 2014-12-31 | 北京新媒传信科技有限公司 | Network test method and device |
CN106021112A (en) * | 2016-05-31 | 2016-10-12 | 腾讯科技(深圳)有限公司 | Program testing system, method and device |
WO2018076739A1 (en) * | 2016-10-26 | 2018-05-03 | 华为技术有限公司 | Data processing method and data processing device |
CN108563539A (en) * | 2018-03-21 | 2018-09-21 | 广州视源电子科技股份有限公司 | Interface test method, server, readable storage medium storing program for executing and system |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113127347A (en) * | 2021-04-14 | 2021-07-16 | 广联达科技股份有限公司 | Interface testing method, device, equipment and readable storage medium |
CN113127347B (en) * | 2021-04-14 | 2024-02-13 | 广联达科技股份有限公司 | Interface testing method, device, equipment and readable storage medium |
CN115687140A (en) * | 2022-11-10 | 2023-02-03 | 江苏衫数科技集团有限公司 | Test case compiling method and system based on automatic test |
CN115687140B (en) * | 2022-11-10 | 2024-01-30 | 江苏衫数科技集团有限公司 | Test case writing method and system based on automatic test |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107644286B (en) | Workflow processing method and device | |
US20160283357A1 (en) | Call stack relationship acquiring method and apparatus | |
CN109918296B (en) | Software automation test method and device | |
CN107015841B (en) | Preprocessing method for program compiling and program compiling device | |
CN111680253A (en) | Page application data packet generation method and device, computer equipment and storage medium | |
CN111124480A (en) | Application package generation method and device, electronic equipment and storage medium | |
CN109284115A (en) | A kind of method and device generating tracker script | |
CN108874379B (en) | Page processing method and device | |
JP2017174418A (en) | Data structure abstraction for model checking | |
CN110334012B (en) | Risk assessment method and device | |
CN110968500A (en) | Test case execution method and device | |
CN110825764B (en) | SQL script generation method, system, storage medium and processor | |
CN109388568B (en) | Code testing method and device | |
US8769498B2 (en) | Warning of register and storage area assignment errors | |
CN112199261A (en) | Application program performance analysis method and device and electronic equipment | |
US9064042B2 (en) | Instrumenting computer program code by merging template and target code methods | |
CN110928941B (en) | Data fragment extraction method and device | |
CN113094252B (en) | Test case generation method and device, computer equipment and storage medium | |
CN111694992A (en) | Data processing method and device | |
CN114691496A (en) | Unit testing method, unit testing device, computing equipment and medium | |
CN112835903A (en) | Sensitive data identification method and equipment | |
CN108255802B (en) | Universal text parsing architecture and method and device for parsing text based on architecture | |
CN112564996A (en) | Pressure test flow scheduling method, pressure test flow control device and computer readable medium | |
CN116700840B (en) | File execution method, device, electronic equipment and readable storage medium | |
CN117130946B (en) | Test scene generation method and device, electronic equipment and readable 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 |