CN109062788B - Test case generation method and device, computer equipment and storage medium - Google Patents

Test case generation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN109062788B
CN109062788B CN201810783847.XA CN201810783847A CN109062788B CN 109062788 B CN109062788 B CN 109062788B CN 201810783847 A CN201810783847 A CN 201810783847A CN 109062788 B CN109062788 B CN 109062788B
Authority
CN
China
Prior art keywords
value
test
interface
boundary
expected
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
Application number
CN201810783847.XA
Other languages
Chinese (zh)
Other versions
CN109062788A (en
Inventor
邹俊
杨兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CMB Yunchuang Information Technology Co Ltd
Original Assignee
CMB Yunchuang Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CMB Yunchuang Information Technology Co Ltd filed Critical CMB Yunchuang Information Technology Co Ltd
Priority to CN201810783847.XA priority Critical patent/CN109062788B/en
Publication of CN109062788A publication Critical patent/CN109062788A/en
Application granted granted Critical
Publication of CN109062788B publication Critical patent/CN109062788B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test 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)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The application relates to a test case generation method, a test case generation device, computer equipment and a storage medium. The method comprises the following steps: acquiring an interface message; analyzing the interface message to obtain a boundary value; obtaining a test value according to the boundary value; generating an expected result corresponding to the test value; generating an interface test case; the interface test case includes the test value and the expected result. According to the embodiment of the application, the labor and the time are saved, and the testing efficiency of the data interface is improved.

Description

Test case generation method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a test case generation method and apparatus for interface testing, a computer device, and a storage medium.
Background
At present, in order to ensure the normal operation of a data processing system, a data interface of the system needs to be tested, which mainly tests interaction points between an external system and a local system and between subsystems of the local system, and detects whether an error exists in a logical dependency relationship between data interaction, transmission, a control management process and the system. For example, in a user system for user registration, a registration interface is required to be invoked to process the account name requested to be registered by the user. If the registration interface is designed incorrectly, a registration failure problem may occur.
In the current interface test method, interface testers mainly design a plurality of test cases for data interfaces. Such as account names of different character lengths, input values of different numerical values, etc.
However, as the complexity of the data processing system is increased, the data interface is updated frequently, and each update requires a tester to redesign the test case, which consumes a lot of labor and time and seriously affects the efficiency of the interface test.
Therefore, the test case generation method in the prior art has the problem of low test efficiency.
Disclosure of Invention
In view of the above, it is necessary to provide a test case method, an apparatus, a computer device, and a storage medium, which can improve the test efficiency of the interface test.
A test case generation method for interface testing comprises the following steps:
acquiring an interface message;
analyzing the interface message to obtain a boundary value;
obtaining a test value according to the boundary value;
generating an expected result corresponding to the test value;
generating an interface test case; the interface test case includes the test value and the expected result.
In one embodiment, said obtaining a test value from said boundary value comprises:
generating an inside test value and an outside test value; the in-bound test value meets the boundary value; the outlier test value does not meet the boundary value;
and taking the in-bound test value and the out-bound test value as the test values.
In one embodiment, the generating the expected result corresponding to the test value includes:
generating an expected success result for the in-bound test value;
generating an expected failure result for the outlier test value;
taking the expected success result and the expected failure result as the expected result.
In one embodiment, before said obtaining the test value according to the boundary value, the method further comprises:
extracting an interface type from the interface message, and determining a value type corresponding to the interface type;
the generating of the in-bound test value and the out-bound test value includes:
determining an in-bound dereferenceable value within the boundary value and an out-of-bound dereferenceable value outside the boundary value;
determining a target boundary internal dereferencing matched with the dereferencing type, and determining a target boundary external dereferencing matched with the dereferencing type;
and selecting the in-bound test value from the target in-bound retrievable values, and selecting the out-bound test value from the target out-bound retrievable values.
In one embodiment, the generating an interface test case includes:
and adding the test value and the expected result to a preset case template to obtain the interface test case.
In one embodiment, further comprising:
inputting the interface test case to a test interface; the test interface is used for returning an actual result according to the interface test case;
judging whether the actual result is the same as the expected result;
if so, judging that the test interface is normal;
if not, judging that the test interface is abnormal.
A test case generation apparatus comprising:
the message acquisition module is used for acquiring an interface message;
the message analysis module is used for analyzing the interface message to obtain a boundary value;
the test value module is used for obtaining a test value according to the boundary value;
the result generating module is used for generating an expected result corresponding to the test value;
and the case generating module is used for generating an interface test case according to the test value and the expected result.
In one embodiment, further comprising:
the input module is used for inputting the interface test case to the test interface; the test interface is used for returning an actual result according to the interface test case;
the judging module is used for judging whether the actual result is the same as the expected result or not;
the normal judging module is used for judging that the test interface is normal;
and the abnormity judging module is used for judging that the test interface is abnormal.
A computer device comprising a memory storing a computer program and a processor implementing the following steps when the computer program is executed:
acquiring an interface message;
analyzing the interface message to obtain a boundary value;
obtaining a test value according to the boundary value;
generating an expected result corresponding to the test value;
generating an interface test case; the interface test case includes the test value and the expected result.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring an interface message;
analyzing the interface message to obtain a boundary value;
obtaining a test value according to the boundary value;
generating an expected result corresponding to the test value;
generating an interface test case; the interface test case includes the test value and the expected result.
According to the case generation method, the case generation device, the computer equipment and the storage medium, the boundary value is analyzed in the interface message, the test value is obtained according to the boundary value, the expected result corresponding to the test value is generated, the test value and the expected result are adopted to generate the interface test cases, the automatic generation of a batch of interface test cases is realized, even if the data interface is frequently updated, a tester does not need to redesign the test cases, the labor and the time are saved, and the test efficiency of the data interface is improved.
Moreover, the batch interface test cases have higher case coverage rate, and can be tested aiming at extreme case conditions, so that the abnormity of the data interface is more accurately tested, and the test accuracy rate of the data interface is improved.
Drawings
FIG. 1 is a flow diagram of a test case generation method of an embodiment;
FIG. 2 is a block diagram of a test case generation apparatus according to an embodiment;
FIG. 3 is an internal block diagram of a computer device of an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Fig. 1 is a test case generation method for a test interface according to an embodiment, including the following steps:
step S110, obtaining an interface message.
The interface message may be a message having a standard message format. For example, a message in JSON (JavaScript Object Notation) format.
It should be noted that the test case generation method in the embodiment of the present application may be applied to a test server. The test server is used for generating a test case. The test server may be implemented as a stand-alone server or as a server cluster of multiple servers.
In specific implementation, the interface message may be acquired according to a data interface to be tested, and the interface message may be input to the test server, so that the test server acquires the interface message.
For example, the acquired interface message is { "username": "string": "0": "100", "userid": "integer": "0": "20"}.
And step S120, analyzing the interface message to obtain a boundary value.
The boundary value may be a minimum threshold and a maximum threshold of the data interface for limiting the input value. For example, the minimum and maximum threshold for the registration interface is 0, 20 characters, and the registration interface can only enter account names within 0-20 characters.
In a specific implementation, the test server may parse the interface message to obtain one or more interface parameters, where the interface parameters may include a boundary value.
For example, parsing the interface message { "username": "string": "0": "100", "userid": "integer": "0": "20" }, two interface parameters are obtained, the interface parameter 01 is [ "username": "string": "0": "100" ], the interface parameter 02 is [ "integer": "0": "20"]. The boundary value of the interface parameter 01 is [0, 100], and the boundary value of the interface parameter 02 is [0, 20 ].
And step S130, obtaining a test value according to the boundary value.
The test value may be a numerical value for testing the data interface.
In a specific implementation, the test server may determine, according to the boundary value, a selectable value within the boundary value and a selectable value outside the boundary value, select a plurality of values from the selectable values within the boundary value, select a plurality of values from the selectable values outside the boundary value, and take the selected values within the boundary value and outside the boundary value as the test values.
For example, a border value of [0, 100], a minimum border value of 0, may be taken to be a value less than 0, such as-5; the maximum boundary value is 100 and may take values greater than 100, such as 150; values within the limits, e.g. 40, 60, etc., are possible. Thus, -5, 150, 40 and 60 were obtained as test values.
Step S140, generating an expected result corresponding to the test value.
The expected result may be a result expected to be returned by the data interface after the test value is input into the data interface.
In a specific implementation, a corresponding test result may be generated for each test value as an expected result. For example, for a test value of "50" within the boundary values, the corresponding expected result is an expected successful result; for a test value of "-5" outside the boundary value, the corresponding expected result is the expected failure result.
Step S150, generating an interface test case; the interface test case includes the test value and the expected result.
In specific implementation, the test values and the corresponding expected results may be added to a preset case template to form a plurality of interface test cases.
According to the technical scheme provided by the embodiment of the application, the boundary value is analyzed in the interface message, the test value is obtained according to the boundary value, the expected result corresponding to the test value is generated, the test value and the expected result are adopted to generate the interface test case, the automatic generation of the batch of interface test cases is realized, even if the data interface is frequently updated, a tester does not need to redesign the test case, the labor and the time are saved, and the test efficiency of the data interface is improved.
Moreover, the batch interface test cases have higher case coverage rate, and can be tested aiming at extreme case conditions, so that the abnormity of the data interface is more accurately tested, and the test accuracy rate of the data interface is improved.
In another embodiment, the step S130 includes:
generating an inside test value and an outside test value; the in-bound test value meets the boundary value; the outlier test value does not meet the boundary value; and taking the in-bound test value and the out-bound test value as the test values.
For example, the boundary values are [0, 100], the minimum boundary value is 0, and the maximum boundary value is 100. The value range conforming to the boundary value is a value between 0 and 100, and a value selected within the value range conforming to the boundary value is used as an in-boundary test value, for example, 40, 60; the range of values that do not fit the boundary values is [ - ∞, 0] and [100, + ∞ ], and the value selected within the range of values that do not fit the boundary values is used as the outlier test value, e.g., -5, 150.
In another embodiment, before said obtaining the test value according to the boundary value, further comprising:
extracting an interface type from the interface message, and determining a value type corresponding to the interface type;
wherein, the value type can be the type of the test value. For example, the value type may be an integer type or a character string type.
In a specific implementation, when the interface packet is parsed, a value type may be extracted from the interface parameter parsed from the interface packet.
For example, parsing the interface message { "username": "string": "0": "100", "userid": "integer": "0": "20" }, two interface parameters are obtained, the interface parameter 01 is [ "username": "string": "0": "100" ], the interface parameters 02 are [ "integer": "0": "20"]. The value type of the interface parameter 01 is string, that is, a character string type. The value type of the interface parameter 02 is integer, i.e. integer type.
The generating of the in-bound test value and the out-bound test value includes:
determining an in-bound dereferenceable value within the boundary value and an out-of-bound dereferenceable value outside the boundary value; determining a target boundary internal dereferencing matched with the dereferencing type, and determining a target boundary external dereferencing matched with the dereferencing type; and selecting the in-bound test value from the target in-bound retrievable values, and selecting the out-bound test value from the target out-bound retrievable values.
In a specific implementation, after the value type is determined, the target intra-range dereferencing matched with the value type can be determined in the intra-range dereferencing, and the target extra-range dereferencing matched with the value type can be determined in the extra-range dereferencing. For example, the boundary value [0, 20] may take any value from 0 to 20, and the value type is an integer type, so the target boundary value [0, 20] may take any integer value from 0 to 20, such as 10, 15, etc.
After the target boundary internal dereferencing value and the target boundary external dereferencing value are determined, values can be randomly selected from the target boundary internal dereferencing value and the target boundary external dereferencing value respectively to serve as an internal testing value and an external testing value.
In another embodiment, the generating the expected result corresponding to the test value includes:
generating an expected success result for the in-bound test value; generating an expected failure result for the outlier test value; taking the expected success result and the expected failure result as the expected result.
The expected result may adopt a custom format, for example, the expected success result is defined as CMB00001, and the expected failure result is defined as CMB 00002.
In particular implementations, expected success results may be generated for the in-bound test values as corresponding expected results. For the outlier test value, an expected failure result may be generated as a corresponding expected result. For example, for an in-bound test value of "-5", CMB00002 is generated as the corresponding expected result.
In practical applications, a result set may be formed by expected results corresponding to a plurality of test values.
In another embodiment, the step S150 includes:
and adding the test value and the expected result to a preset case template to obtain the interface test case.
In practical application, a result set formed by a test value and an expected result can be input into an Automatic Interface Case Design System (AICDS), the test value and the expected result corresponding to the test value are added to a Case template by the AICDS, and Interface test cases are generated in batch.
In another embodiment, the method further comprises:
inputting the interface test case to a test interface; the test interface is used for returning an actual result according to the interface test case; judging whether the actual result is the same as the expected result; if so, judging that the test interface is normal; if not, judging that the test interface is abnormal.
The test interface can be a data interface to be tested.
The actual result may be a test result actually returned by the test interface for the test value.
In specific implementation, the test server can input the interface test case to the test interface, and the automatic test of the data interface can be realized by combining an automatic test framework. The test interface may return a processing result as an actual result for a test value in the interface test case. The test server can compare the actual result with the expected result corresponding to the test value, and if the actual result is the same as the expected result, the test result returned by the test interface for the test value is in accordance with the expectation, and no exception exists. If the two are different, it is indicated that the test result returned by the test interface for the test value is not in accordance with the expectation, and the test interface may have abnormal conditions such as design errors.
According to the technical scheme provided by the embodiment of the application, the interface test is carried out based on the automatically generated batch interface test cases, whether the test interface is abnormal or not is judged according to the comparison result of the actual result and the expected result of the test interface, the test result of the test interface can be quickly obtained without manual intervention in the whole interface test process, and the test efficiency of the interface test is further improved.
It should be understood that, although the steps in the flowchart of fig. 1 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in a strict order unless explicitly stated herein, and may be performed in other orders. Moreover, at least a portion of the steps in fig. 1 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed alternately or at least partially with other steps or sub-steps or stages of other steps.
In one embodiment, as shown in fig. 2, a test case generating apparatus is provided, including: a message obtaining module 210, a message analyzing module 220, a test value module 230, a result generating module 240 and a case generating module 250, wherein:
a message obtaining module 210, configured to obtain an interface message;
a message parsing module 220, configured to parse the interface message to obtain a boundary value;
a test value module 230, configured to obtain a test value according to the boundary value;
a result generating module 240, configured to generate an expected result corresponding to the test value;
and a use case generating module 250, configured to generate an interface test case according to the test value and the expected result.
According to the technical scheme provided by the embodiment of the application, the boundary value is analyzed in the interface message, the test value is obtained according to the boundary value, the expected result corresponding to the test value is generated, the interface test cases are generated by adopting the test value and the expected result, the automatic generation of the batch of interface test cases is realized, even if the data interface is frequently updated, testers do not need to redesign the test cases, the labor and the time are saved, and the test efficiency of the data interface is improved.
Moreover, the batch interface test cases have higher case coverage rate, and can be tested aiming at extreme case conditions, so that the abnormity of the data interface is more accurately tested, and the test accuracy rate of the data interface is improved.
In another embodiment, the test value module 230 includes:
the test value generation submodule is used for generating an in-bound test value and an out-bound test value; the in-bound test value meets the boundary value; the outlier test value does not meet the boundary value;
and the test value combining sub-module is used for taking the in-bound test value and the out-bound test value as the test values.
In another embodiment, the result generation module 240 includes:
a success result submodule for generating an expected success result for the in-bound test value;
a failure result submodule for generating an expected failure result of the outlier test value;
a result set submodule for using the expected success result and the expected failure result as the expected result.
In another embodiment, the method further comprises:
the type determining module is used for extracting the interface type from the interface message and determining the value type corresponding to the interface type;
the test value generation submodule includes:
an dereferencing unit for determining an in-bound dereferencing within the boundary value and an out-bound dereferencing outside the boundary value;
the target determining unit is used for determining the target boundary internal dereferencing matched with the dereferencing type and determining the target boundary external dereferencing matched with the dereferencing type;
and the test value selecting unit is used for selecting the in-bound test value from the target in-bound retrievable values and selecting the out-bound test value from the target out-bound retrievable values.
In another embodiment, the use case generation module 250 includes:
and the template adding submodule is used for adding the test value and the expected result to a preset case template to obtain the interface test case.
In another embodiment, further comprising:
the input module is used for inputting the interface test case to the test interface; the test interface is used for returning an actual result according to the interface test case;
the judging module is used for judging whether the actual result is the same as the expected result or not;
the normal judgment module is used for judging that the test interface is normal;
and the abnormity judging module is used for judging that the test interface is abnormal.
According to the technical scheme provided by the embodiment of the application, the interface test is carried out based on the automatically generated batch of interface test cases, whether the test interface is abnormal or not is judged according to the comparison result of the actual result and the expected result of the test interface, the test result of the test interface can be quickly obtained without manual intervention in the whole interface test process, and the test efficiency of the interface test is further improved.
For specific limitations of the test case generation apparatus, see the above limitations on the test case generation method, which are not described herein again. All or part of each module in the test case generation device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, or can be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 3. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operating system and the computer program to run in the non-volatile storage medium. The database of the computer equipment is used for storing data such as interface messages, boundary values, test values, expected results, actual results, interface test cases and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a test case generation method.
Those skilled in the art will appreciate that the configuration shown in fig. 3 is a block diagram of only a portion of the configuration associated with the present application, and does not constitute a limitation on the computing device to which the present application applies, and that a particular computing device may include more or fewer components than shown, or combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring an interface message;
analyzing the interface message to obtain a boundary value;
obtaining a test value according to the boundary value;
generating an expected result corresponding to the test value;
generating an interface test case; the interface test case includes the test value and the expected result.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
generating an inside test value and an outside test value; the within-bound test value meets the boundary value; the outlier test value does not meet the boundary value;
and taking the in-bound test value and the out-bound test value as the test values.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
generating an expected success result for the in-bound test value;
generating an expected failure result for the outlier test value;
taking the expected success result and the expected failure result as the expected result.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
extracting an interface type from the interface message, and determining a value type corresponding to the interface type;
the generating of the in-bound test value and the out-bound test value includes:
determining an in-bound dereferenceable value within the boundary value and an out-of-bound dereferenceable value outside the boundary value;
determining a target boundary internal dereferencing matched with the dereferencing type, and determining a target boundary external dereferencing matched with the dereferencing type;
and selecting the in-bound test value from the target in-bound retrievable values, and selecting the out-bound test value from the target out-bound retrievable values.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and adding the test value and the expected result to a preset case template to obtain the interface test case.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
inputting the interface test case to a test interface; the test interface is used for returning an actual result according to the interface test case;
judging whether the actual result is the same as the expected result;
if so, judging that the test interface is normal;
if not, judging that the test interface is abnormal.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring an interface message;
analyzing the interface message to obtain a boundary value;
obtaining a test value according to the boundary value;
generating an expected result corresponding to the test value;
generating an interface test case; the interface test case includes the test value and the expected result.
In one embodiment, the computer program when executed by the processor further performs the steps of:
generating an inside test value and an outside test value; the in-bound test value meets the boundary value; the outlier test value does not meet the boundary value;
and taking the in-bound test value and the out-bound test value as the test values.
In one embodiment, the computer program when executed by the processor further performs the steps of:
generating an expected success result for the in-bound test value;
generating an expected failure result for the outlier test value;
taking the expected success result and the expected failure result as the expected result.
In one embodiment, the computer program when executed by the processor further performs the steps of:
extracting an interface type from the interface message, and determining a value type corresponding to the interface type;
determining an in-bound dereferenceable value within the boundary value and an out-of-bound dereferenceable value outside the boundary value;
determining a target boundary internal dereferencing matched with the dereferencing type, and determining a target boundary external dereferencing matched with the dereferencing type;
and selecting the in-bound test value from the target in-bound retrievable value, and selecting the out-bound test value from the target out-bound retrievable value.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and adding the test value and the expected result to a preset case template to obtain the interface test case.
In one embodiment, the computer program when executed by the processor further performs the steps of:
inputting the interface test case to a test interface; the test interface is used for returning an actual result according to the interface test case;
judging whether the actual result is the same as the expected result;
if so, judging that the test interface is normal;
if not, judging that the test interface is abnormal.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent should be subject to the appended claims.

Claims (10)

1. A test case generation method for interface testing is characterized by comprising the following steps:
acquiring an interface message;
analyzing the interface message to obtain at least one interface parameter, and extracting a boundary value from each interface parameter; the boundary values represent a maximum value and a minimum value of an input value limit of the data interface;
extracting an interface type from the interface message, and determining a value type corresponding to the interface type; the value type represents a test value type;
according to the boundary value, determining an intra-boundary dereferencing value within the boundary value and determining an extra-boundary dereferencing value outside the boundary value; determining a target boundary internal dereferencing matched with the dereferencing type, determining a target boundary external dereferencing matched with the dereferencing type, selecting an internal testing value from the target boundary internal dereferencing, and selecting an external testing value from the target boundary external dereferencing; the in-bound test value is coincident with the boundary value and the out-bound test value is not coincident with the boundary value; taking the in-bound test value and the out-bound test value as test values;
generating an expected result corresponding to the test value according to the test value and the test value type; the expected results include expected success results and expected failure results;
generating an interface test case; the interface test case includes the test value and the expected result.
2. The method of claim 1, wherein generating the expected result for the test value comprises:
generating an expected success result for the in-bound test value;
generating an expected failure result for the outlier test value;
taking the expected success result and the expected failure result as the expected result.
3. The method of claim 1, wherein generating the interface test case comprises:
and adding the test value and the expected result to a preset case template to obtain the interface test case.
4. The method of claim 1, further comprising:
inputting the interface test case to a test interface; the test interface is used for returning an actual result according to the interface test case;
judging whether the actual result is the same as the expected result;
if so, judging that the test interface is normal;
if not, judging that the test interface is abnormal.
5. A test case generation apparatus, comprising:
the message acquisition module is used for acquiring an interface message;
the message analysis module is used for analyzing the interface message to obtain at least one interface parameter and extracting a boundary value from the interface parameter; the boundary values represent a maximum value and a minimum value of a data interface input value limit;
the type determining module is used for extracting an interface type from the interface message and determining a value type corresponding to the interface type; the value type represents a test value type;
the test value module is used for determining an in-bound dereferencing value within the boundary value and determining an out-bound dereferencing value outside the boundary value according to the boundary value; determining a target boundary internal dereferencing matched with the dereferencing type, determining a target boundary external dereferencing matched with the dereferencing type, selecting an internal testing value from the target boundary internal dereferencing, and selecting an external testing value from the target boundary external dereferencing; the in-bound test value meets the boundary value; the outlier test value does not meet the boundary value; taking the in-bound test value and the out-bound test value as the test values;
a result generating module, configured to generate an expected result corresponding to the test value according to the test value and the test value type; the expected results include expected success results and expected failure results;
and the case generating module is used for generating an interface test case according to the test value and the expected result.
6. The apparatus of claim 5, further comprising:
the input module is used for inputting the interface test case to the test interface; the test interface is used for returning an actual result according to the interface test case;
the judging module is used for judging whether the actual result is the same as the expected result or not;
the normal judging module is used for judging that the test interface is normal;
and the abnormity judging module is used for judging the abnormity of the test interface.
7. The apparatus of claim 5, wherein the test value module comprises:
the test value generation submodule is used for generating an in-bound test value and an out-bound test value; the within-bound test value meets the boundary value; the outlier test value does not meet the boundary value;
and the test value combining sub-module is used for taking the in-bound test value and the out-bound test value as the test values.
8. The apparatus of claim 5, wherein the message obtaining module comprises:
and the template adding submodule is used for adding the test value and the expected result to a preset case template to obtain the interface test case.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 4 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 4.
CN201810783847.XA 2018-07-17 2018-07-17 Test case generation method and device, computer equipment and storage medium Active CN109062788B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810783847.XA CN109062788B (en) 2018-07-17 2018-07-17 Test case generation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810783847.XA CN109062788B (en) 2018-07-17 2018-07-17 Test case generation method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109062788A CN109062788A (en) 2018-12-21
CN109062788B true CN109062788B (en) 2022-09-23

Family

ID=64816842

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810783847.XA Active CN109062788B (en) 2018-07-17 2018-07-17 Test case generation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109062788B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109582588B (en) * 2018-12-25 2022-02-22 迈普通信技术股份有限公司 Test case generation method and device and electronic equipment
CN110134594B (en) * 2019-04-19 2023-08-22 平安科技(深圳)有限公司 Function test method and device for application comprising account name and computer equipment
CN110287093A (en) * 2019-05-20 2019-09-27 平安普惠企业管理有限公司 Mobile terminal, data-interface test method and storage medium
CN110532169A (en) * 2019-07-08 2019-12-03 平安科技(深圳)有限公司 Interface testing case generation method, device, computer equipment and storage medium
CN111163067B (en) * 2019-12-18 2022-05-03 支付宝(杭州)信息技术有限公司 Safety testing method and device and electronic equipment
CN111159025B (en) * 2019-12-23 2022-10-18 武汉联影医疗科技有限公司 Application program interface testing method and device, computer equipment and storage medium
CN111309619A (en) * 2020-02-24 2020-06-19 苏宁云计算有限公司 Method and device for automatically generating test case
CN111352782A (en) * 2020-02-28 2020-06-30 北京字节跳动网络技术有限公司 Interface testing method and device, computer equipment and storage medium
CN113407446B (en) * 2021-06-04 2022-05-03 荣耀终端有限公司 Test case generation method and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101271423A (en) * 2008-05-19 2008-09-24 中兴通讯股份有限公司 Software interface test approach and system
CN106933745A (en) * 2017-03-30 2017-07-07 携程计算机技术(上海)有限公司 WEB automatic interface testing methods and system
CN107239398A (en) * 2017-05-24 2017-10-10 四川长虹电器股份有限公司 A kind of interface testing use-case automatic creation system and method based on Postman
CN107729228A (en) * 2017-08-24 2018-02-23 北京网众共创科技有限公司 Interface test method, device, storage medium and processor

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103488482A (en) * 2013-09-16 2014-01-01 深圳市龙视传媒有限公司 Method and device for generating test cases
US9842043B2 (en) * 2014-02-18 2017-12-12 Hariprakash Agrawal System and method to implement an electronic document based automated testing of a software application
CN105528294B (en) * 2015-12-29 2018-05-25 广东金赋科技股份有限公司 The method and system that a kind of interface testing use-case automatically generates
CN106021090A (en) * 2016-05-04 2016-10-12 上海瀚银信息技术有限公司 Software interface test system and method
CN106201899B (en) * 2016-07-29 2019-01-08 普元信息技术股份有限公司 The system and method for automatically generating test cases are realized based on business diagnosis
KR101945229B1 (en) * 2016-11-30 2019-02-08 한국철도기술연구원 Embedded software testing system with test coverage funstion

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101271423A (en) * 2008-05-19 2008-09-24 中兴通讯股份有限公司 Software interface test approach and system
CN106933745A (en) * 2017-03-30 2017-07-07 携程计算机技术(上海)有限公司 WEB automatic interface testing methods and system
CN107239398A (en) * 2017-05-24 2017-10-10 四川长虹电器股份有限公司 A kind of interface testing use-case automatic creation system and method based on Postman
CN107729228A (en) * 2017-08-24 2018-02-23 北京网众共创科技有限公司 Interface test method, device, storage medium and processor

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
WSDL-based automatic test case generation for Web services testing;Xiaoying Bai等;《IEEE International Workshop on Service-Oriented System Engineering (SOSE"05)》;20051212;第207 - 212页 *
协议可扩展的软件接口测试工具的研究与实现;吴振宇等;《数字技术与应用》;20171215;第58-60+62页 *

Also Published As

Publication number Publication date
CN109062788A (en) 2018-12-21

Similar Documents

Publication Publication Date Title
CN109062788B (en) Test case generation method and device, computer equipment and storage medium
CN109639450B (en) Fault alarm method, system, computer equipment and medium based on neural network
CN110851159B (en) Business rule updating method and device, computer equipment and storage medium
CN110377454B (en) Data verification method and device, computer equipment and storage medium
WO2019095580A1 (en) Test method and apparatus, computer device, and readable storage medium
CN109948276B (en) Failure analysis method, device, equipment and storage medium
CN110908895A (en) Page automatic testing method and device, computer equipment and storage medium
CN111078665B (en) Method, apparatus, computer device, and medium for determining optimization information for HIVE task
CN112162924A (en) Interface automation test method and device, computer equipment and storage medium
CN110880014A (en) Data processing method and device, computer equipment and storage medium
WO2023000359A1 (en) Method and apparatus for configuring test flow, and storage medium and device
CN110750443A (en) Webpage testing method and device, computer equipment and storage medium
CN111797026A (en) Test case generation method and device, computer equipment and storage medium
CN112631686A (en) Data processing method, data processing device, computer equipment and storage medium
CN110704312A (en) Pressure testing method and device, computer equipment and storage medium
CN113709126A (en) Network protocol security fuzzy test method, device, equipment and storage medium
CN114385485A (en) Interface test method, device, equipment and storage medium
CN114610635A (en) Interface test case generation method and device, computer equipment and storage medium
CN112363937A (en) Method and device for testing differential coverage rate, computer equipment and storage medium
CN108776642B (en) Test report generation method and device, computer equipment and storage medium
CN112988606A (en) Test case generation method, device, equipment and storage medium
CN113360300A (en) Interface calling link generation method, device, equipment and readable storage medium
CN112612706A (en) Automated testing method, computer device and storage medium
CN111399732B (en) Webpage screenshot method and device, computer equipment and storage medium
CN112540916A (en) Automatic rerun method and device for failed case, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Room 1901, building 5, Shenzhen new generation industrial park, 136 Zhongkang Road, Meidu community, Meilin street, Futian District, Shenzhen, Guangdong 518000

Applicant after: Zhaoyin yunchuang Information Technology Co.,Ltd.

Address before: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.)

Applicant before: MBCLOUD (SHENZHEN) INFORMATION TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Test case generation method, device, computer equipment, and storage medium

Effective date of registration: 20231117

Granted publication date: 20220923

Pledgee: Shenzhen Branch of China Merchants Bank Co.,Ltd.

Pledgor: Zhaoyin yunchuang Information Technology Co.,Ltd.

Registration number: Y2023980065913