CN108319547B - Test case generation method, device and system - Google Patents

Test case generation method, device and system Download PDF

Info

Publication number
CN108319547B
CN108319547B CN201710030773.8A CN201710030773A CN108319547B CN 108319547 B CN108319547 B CN 108319547B CN 201710030773 A CN201710030773 A CN 201710030773A CN 108319547 B CN108319547 B CN 108319547B
Authority
CN
China
Prior art keywords
data
scene
test case
rule
service
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
CN201710030773.8A
Other languages
Chinese (zh)
Other versions
CN108319547A (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201710030773.8A priority Critical patent/CN108319547B/en
Publication of CN108319547A publication Critical patent/CN108319547A/en
Application granted granted Critical
Publication of CN108319547B publication Critical patent/CN108319547B/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)

Abstract

The embodiment of the application provides a test case generation method, a device and a system, wherein the method comprises the following steps: acquiring request data and return data from the log information of the server side; providing a service scene rule set, and determining a service scene rule corresponding to a scene specifying instruction when receiving the scene specifying instruction of a user aiming at the service scene rule set; analyzing the request data and the return data according to the business scene rule to construct a data model under a corresponding business scene; and generating a corresponding test case according to the data model and a preset test code template in the corresponding service scene. According to the embodiment of the application, the test cases with richer scenes can be automatically generated based on the log information of the server side, so that the server side can be tested more comprehensively.

Description

Test case generation method, device and system
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method, an apparatus, and a system for generating a test case.
Background
The test case is computer program code for verifying whether the server side provides functionality that meets the designer's expectations. At present, test cases are generally written manually by testers, and the method is high in cost and low in efficiency.
With the continuous development of the technology, a scheme for automatically generating test cases based on logs is provided at present. The method comprises the steps of firstly, acquiring a log file generated when an application program runs on equipment (mainly comprising operation behaviors and operation processes of a user on the application program, such as login behaviors, transaction behaviors and the like); then judging whether the log file is the same as the format supported by the test equipment or not; if the log file is the same as the format supported by the test equipment, directly generating a test case according to the log file; if the log file is different from the format supported by the test equipment, the format of the log file is converted into the format supported by the test equipment, and then the log file after format conversion is used for generating a test case.
Therefore, the scheme can only simply replay user operation recorded in the log, namely the scheme can only generate corresponding test cases depending on the service scene recorded by the log file; for example, when the log file records the operation sequence of the user is: a- > B- > C- > D; the operation sequence generated by the above scheme is: a- > B- > C- > D. Therefore, in the prior art, the test cases that can be automatically generated based on the server side log information are limited, which is not favorable for more comprehensive testing of the server side.
Disclosure of Invention
The embodiment of the application aims to provide a test case generation method, a test case generation device and a test case generation system, so that test cases with richer scenes can be automatically generated based on the log information of a server side, and more comprehensive test can be performed on the server side.
In order to achieve the above object, in one aspect, an embodiment of the present application provides a test case generation method, including the following steps:
acquiring request data and return data from the log information of the server side;
providing a service scene rule set, and determining a service scene rule corresponding to a scene specifying instruction when receiving the scene specifying instruction of a user aiming at the service scene rule set;
analyzing the request data and the return data according to the business scene rule to construct a data model under a corresponding business scene;
and generating a corresponding test case according to the data model and a preset test code template in the corresponding service scene.
On the other hand, an embodiment of the present application further provides a test case generation apparatus, including:
the log reader is used for acquiring request data and return data from the log information of the server side;
the rule provider is used for providing a service scene rule set and determining a service scene rule corresponding to a scene specifying instruction when the scene specifying instruction of a user for the service scene rule set is received;
the data analyzer is used for analyzing the request data and the return data according to the business scene rule so as to construct a data model under a corresponding business scene;
and the test case generator is used for generating a corresponding test case according to the data model and the preset test code template under the corresponding service scene.
On the other hand, an embodiment of the present application further provides a test case generation system, including:
a processor; and
a memory configured to store a test case generation apparatus that, when executed by the processor, performs the steps of:
acquiring request data and return data from the log information of the server side;
providing a service scene rule set, and determining a service scene rule corresponding to a scene specifying instruction when receiving the scene specifying instruction of a user aiming at the service scene rule set;
analyzing the request data and the return data according to the business scene rule to construct a data model under a corresponding business scene;
and generating a corresponding test case according to the data model and a preset test code template in the corresponding service scene.
Therefore, different from the prior art that a corresponding test case is generated by relying on a service scene recorded by a log file, the embodiment of the application provides a service scene rule set, various service scene rules can be pre-defined in the service scene rule set according to needs, and when one service scene rule is specified in the service scene rule set, request data and return data obtained from log information of a server end can be analyzed according to the specified service scene rule so as to construct a data model corresponding to the specified service scene rule; and then, automatically generating a corresponding test case according to the data model and a preset test code template, thereby realizing the automatic generation of the test case with richer scenes based on the log information of the server side, and being beneficial to more comprehensively testing the server side.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the disclosure, are incorporated in and constitute a part of this disclosure. In the drawings:
FIG. 1 is a flowchart of a test case generation method according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a method for generating a data template according to an embodiment of the present application;
fig. 3 is a block diagram of a test case generation apparatus according to an embodiment of the present application;
fig. 4 is a block diagram of a test case generation system according to another embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application more apparent, the embodiments of the present application are described in further detail below with reference to the embodiments and the accompanying drawings. The exemplary embodiments and descriptions of the embodiments are provided to explain the embodiments and should not be construed as limiting the embodiments.
The following describes embodiments of the present application in further detail with reference to the accompanying drawings.
Referring to fig. 1, a test case generation method according to an embodiment of the present application includes the following steps:
s101, acquiring request data and return data from the log information of the server side.
In an embodiment of the present application, the Server may be a Server in a C/S (Client/Server) architecture, an application Server (e.g., a Web Server) in a B/S (Browser/Server) architecture, or a Proxy Server (Proxy Server) deployed in the C/S architecture or the B/S architecture.
In an embodiment of the present application, generally, the server side has functions of generating and storing a log. Taking the Web server side as an example, in the Web service log, each log usually represents one access behavior of the user, and records various original information of the Web service from the request to the end of the service. Such as the IP address of the user or client, the time when the access occurred, the page of the access request, the status information returned by the Web server for the request, the size of the content returned to the client, the reference address of the request, the type of the client browser, etc. Therefore, the Web service log includes request data and return data of the Web service.
In an embodiment of the application, because the log generally has a uniform or fixed format, the required request data and the required return data can be conveniently analyzed from the log file through a parser or a corresponding regular expression.
In some embodiments of the present application, the request data and the return data may be acquired from log information of the server, and the test case may be generated based on the acquired request data and the return data. Therefore, the conditions for automatically generating the test cases are easier to satisfy by the embodiments of the present application. Secondly, the logs of the server side generally have a uniform or fixed format; therefore, in the embodiments of the application, in the process of automatically generating the test case based on the data acquired from the log at the server, the data in the standard format is easier to analyze, thereby being beneficial to reducing the implementation cost. In addition, the records in the log of the server are all real service data, and are not artificially forged; therefore, the test cases generated based on the real service data may be more consistent with the real service scene, thereby being beneficial to improving the accuracy of the server-side test.
S102, providing a service scene rule set, and determining a service scene rule corresponding to a scene specifying instruction when receiving the scene specifying instruction of a user aiming at the service scene rule set.
In one embodiment of the present application, a user can customize various desired business scenario rules as needed, and the business scenario rules form a business scenario rule set. When which service scenario needs to be tested, the corresponding service scenario rule can be specified from the service scenario rule set through the scenario specifying instruction.
In one embodiment of the present application, a business scenario rule may be a quantitative description of a business scenario, for example, composed of a condition and an action part, indicating that an action (action) is executed when the condition is satisfied. The action may be, for example, a request to the server; the condition is satisfied, for example, a user clicks a button of a client (the button may be real or virtual), so as to trigger a callback method of the button, in which a related action to be executed when the button is clicked is programmed; the condition establishment may be automatically triggered by the client program.
In another embodiment of the present application, the business scenario rule may further include information such as the number of concurrent users (e.g., 10, 20, 50, etc.), the number of times the use case is run (e.g., run once, loop many times, etc.), a selection policy for the use case to run (e.g., randomly select an action sequence, sequentially select an action sequence, etc.), and/or a test run time (e.g., 24 hours, one week, etc.).
In an embodiment of the present application, the service scenario rules in the service scenario rule set may be obtained in advance through the following manners:
and receiving a text file, wherein the text file comprises a service scene rule. Wherein the text file is editable in the text document by the user.
In another embodiment of the present application, the business scenario rules in the business scenario rule set may be obtained in advance by:
providing a web interface;
business scenario rules entered through the web interface are then received.
The method provides the web interface, namely provides the web interface for the user, so that the user can remotely or locally access the web interface and then edit the business scene rules on line through the text editing function provided by the web interface.
In another embodiment of the present application, the business scenario rules in the business scenario rule set may be obtained in advance by:
providing a rules engine;
receiving a business scenario rule input through the rule engine.
When a more complex rule needs to be written, a user can edit a business scenario rule through a provided rule engine (such as a drools rule editor, an ILog rule editor, a Ckrule rule editor, and the like). The rule engine is a set of graphical interface tools for editing the rules of the business scene, and provides the functions of business object definition, rule editing, rule management, rule compiling and the like for users visually. Building business scenario rules using a rules engine generally includes the steps of:
(1) and establishing a new rule base.
Wherein, the rule base is a collection of a plurality of rule sets; a rule set is a collection of several rules.
(2) And defining the business object to describe the basic business object of the business scene.
A business object is the smallest unit that constitutes a rule and is the basis for editing the rule. For example, 5 types of business objects are provided in the intelliRule editor: a character string service object, a numerical value type service object, a user-defined service object, an enumeration type service object and a parameterization service object.
(3) Defining a rule set structure and a rule structure.
(4) And referencing the business object on the rule.
The reference comprises an associated business object, a business object alias definition and business object parameter setting. The business objects are referred to control the business objects used in a rule to avoid long lists of attributes or operations when the rule is edited.
(5) And creating and editing rules.
(6) And mapping the business object.
(7) And compiling the business scenario rules.
The generated business scenario rule can be stored in a database, a file or a memory for being read by a data analyzer; or the data is generated and then sent to the data analyzer in a network calling mode.
Therefore, in some embodiments of the present application, a service scenario rule set is provided, and the service scenario rule set includes various predefined service scenario rules; the business scenario rules can be customized by a user through a rule engine, so that the data analyzer can generate test cases with more scenarios and more complex scenarios than actual scenarios through the business scenario rules provided by the business scenario rule set. For example, there is no highly concurrent service scenario in the log information of the server, but the service scenario rule set provided in some embodiments of the present application may define a highly concurrent service scenario rule (e.g., the number of concurrences, the duration, and the like) in advance, so that a test case of the highly concurrent scenario may be generated to implement actual measurement of the load pressure of the server.
S103, analyzing the request data and the return data according to the business scene rule to construct a data model under a corresponding business scene.
Referring to fig. 2, in an embodiment of the present application, the analyzing the request data and the return data according to the business scenario rule to construct a data model under a corresponding business scenario may include the following steps:
and S1031, matching the request data and the return data which meet the requirements of the business scene rule from the request data and the return data, and extracting data structures of the matched request data and return data.
Generally, each business scenario rule in the business scenario rule set is different, such as: a service scenario for testing a single service; a series of operations of a user on each service within a certain period of time are taken as a test scene; or, multiple users concurrently access the same service's business scenario, etc. In order to generate a data model matched with each service scenario rule, corresponding processing needs to be performed on request data and return data acquired from log information of a server according to the corresponding service scenario rule, so as to match the request data and the return data meeting the requirements of the service scenario rule, and generally, both the request data and the return data have fixed data structures. Taking http request and http response as examples, the extensible markup language architecture (XML Schema) describes the data structure of an XML document in detail. Therefore, the data structures of the request data and the return data can be extracted from the matched request data and return data which meet the requirements of the business scenario rule.
In an exemplary embodiment of the present application, the selection may be, for example, a selection according to a user identifier, an action name (action name), or a request identifier.
In an exemplary embodiment of the present application, the data structure for extracting the matched request data and the matched return data is, for example:
requesting data: action1, { "name" { "aaa": bbb "}
Returning data: { "response": response1, "chess": true "}
The data structure of the extracted request data may be: { "action": xxx, { "name": { "aaa": "xxx" }
The data structure of the extracted return data may be: { "response": xxx, "issue": xxx "}
The xxx is the variable or replaceable content, and which of the request data and the return data belongs to the variable or replaceable part depends on the business scenario rule.
S1032, according to the business scenario rule, modifying, sequencing and/or combining the matched data structures of the request data and the return data to generate a data model of the business scenario rule.
In some embodiments of the present application, the data structures of the matched request data and returned data are modified, sorted and/or combined for the purpose of generating a data model meeting the requirements of the corresponding business scenario rules. Therefore, the method is beneficial to generating test cases with more scenes by using the change of one request data and one return data.
In an exemplary embodiment of the present application, the modification may be, for example: and replacing parameter values of the same parameter name in the data structure, such as modifying 'bbb' in { 'action': action1, { 'name': { 'aaa': 'bbb' } into 'ccc'.
In an exemplary embodiment of the present application, the ordering may be, for example: the balance inquiry request data and the balance inquiry return data of the user a and the transfer request data and the transfer return data of the user b can be combined into a series of request actions of the user a on the basis of modifying the name of the user and the like (for example, the user a inquires the balance first and then transfers money, or the user a transfers money first and then inquires the balance, or the user a inquires the balance first and then transfers money and then inquires the balance again).
In an exemplary embodiment of the present application, the combination may be analyzed according to a user identifier (user id), a request identifier (request id) and a request timestamp, for example: the user a, the user b and the user c make requests of action1, action2 and action3 for the same request identifier at different time stamps, and then modify the time stamps to ensure that the actions 1, the action2 and the action3 are concurrent, and the concurrence amount is 3.
In one embodiment of the present application, each business scenario rule may generate a data model. Of course, it is also possible to generate multiple data models per business scenario rule, but since they belong to the same business scenario, it is preferable that one data model is generated per business scenario rule.
In one embodiment of the present application, each data model can be understood as an operation list and parameters required for operation in a specific service scenario. The data model generation process of an embodiment of the present application is described below with reference to an example. The method comprises the following specific steps:
the following table 1 shows the following steps of obtaining request data and return data from the log information of the server side:
TABLE 1
Figure BDA0001211324160000081
The current business scenario rules are:
a user: random & & unique (randomly selecting a user), action _ list: create- > release (operation sequence is create first then release), need _ modification _ para [ { action: create, name: yyyy }, { action: release, name: yyy } (modify the name parameter of the request for create and release to yyy, also can be designated as random).
Thus, the request data and the return data matched according to the current business scenario rule are shown in Table 2 (here, assume that the randomly selected user is: 123):
TABLE 2
Figure BDA0001211324160000082
Figure BDA0001211324160000091
Therefore, according to the current business scenario rule, the obtained data model is:
1. initiating a request, wherein the parameter name is as follows: action, name xxxx;
2. checking whether the data structure of the returned result is the same as { action: create, response: success, timing: xxx };
3. initiating a request, wherein the parameter name is as follows: action, name xxxx;
4. and checking whether the data structure of the returned result is the same as { action: release, response: success, and timing: xxx }.
Wherein: if the request fails, the message can be { response: failed, message: "name invalid" }; the timestamp requested to be successfully returned is a variable value; xxxx is an alternative moiety. Generally, the data structures of the failed return and the successful return are different greatly, the data structure of each successful return of the request is the same, and the data contents are often different.
And S104, generating a corresponding test case according to the data model and the preset test code template in the corresponding service scene.
In an embodiment of the present application, the generating a corresponding test case according to a data model and a preset test code template in a corresponding service scenario may include:
firstly, matching a test code template corresponding to the data model in the corresponding service scene from a preset test code template set.
In the embodiment of the application, various pre-programmed test case code templates are stored in the test code template set, and the test case code templates are matched with the request modes supported by the server side. For example, in a web service, a client may initiate an http request to a web server using six request methods (get, head, post, put, delete, and option) in a hypertext transfer protocol (http), and accordingly, six test case code templates corresponding to the http request may be written, that is, a corresponding test case code template may be written for each method to cover all http requests. Of course, only a part of the test case code templates of common request modes (such as get, post, etc.) may be written according to actual needs.
In the embodiment of the application, the test case code template can be written by adopting scripting languages such as python and ruby, so that the character string processing is facilitated.
In the embodiment of the present application, the request parameters of each data model include request mode parameters, and as described above, each test case code template is matched with the request mode supported by the server, so according to this relationship, a suitable test code template can be matched for each data model in the test code template set; and matching the request mode of the data model with the request mode of the test code template.
And then, rendering the data model under the corresponding service scene according to the matched test code template to generate a corresponding test case.
In the embodiment of the present application, the rendering may be, for example, embedding the data model into the test case code template in a character string splicing manner. For example, a test case code template is shown below:
Figure BDA0001211324160000101
in the test case code template, cases is a memory list object, and in implementation, it may represent a data model or a part of a data model, c is an object in the list, func _ name is a member of c, and func _ name is a variable of a string type. Taking the data model in S103 as an example, according to steps 1 and 2 in the data model, that is:
1. initiating a request, wherein the parameter name is as follows: action, name xxxx;
2. checking whether the data structure of the returned result is the same as { action: create, response: success, timing: xxx };
a case can be rendered according to a test case code template corresponding to a POST request mode: test 1.
According to the 3 rd and 4 th steps in the data model, namely:
3. initiating a request, wherein the parameter name is as follows: action, name xxxx;
4. and checking whether the data structure of the returned result is the same as { action: release, response: success, and timing: xxx }.
Another case can be rendered according to a test case code template corresponding to the POST request mode: test 2.
The data model operation sequence requirements are: create and release, so test1 and test2 are executed in series, and a test case is completed.
It should be noted that, when there are multiple cases in a data model, corresponding test case code templates need to be selected for each case according to the request mode of each case.
Therefore, in some embodiments of the present application, the criterion for determining whether the generated test case passes the test is: whether the data structure of the actual return data is the same as the desired data structure (rather than the data content of the actual return data being the same as the desired data content); if it is desired that the return data includes a data item named body, code, the data item named body, code may be considered to pass the test as long as the actual return data includes a data item named body, and what data content is specific in the code data item is irrelevant as to body. This makes some embodiments of the present application more feasible and easier to implement.
Due to the C/S architecture and the B/S architecture, the interaction mode of the two interaction parties is generally fixed. For example, in a web service, a client typically sends a request data by using a method in http protocol (e.g., get, post, put, etc.), and then a fixed interaction pattern of returning data is obtained. Therefore, the method for using the test case code template in the embodiment of the application is relatively simple and easy to implement. Moreover, as with the test case obtained in the existing manner, the test case generated in the embodiment of the present application can be directly invoked during the subsequent actual test.
Referring to fig. 3, a test case generation apparatus according to an embodiment of the present application includes:
the log reader 31 may be configured to obtain the request data and the return data from the log information of the server.
The rule provider 32 may be configured to provide a service scenario rule set, and when a scenario specification instruction for the service scenario rule set is received from a user, determine a service scenario rule corresponding to the scenario specification instruction.
The data analyzer 33 may be configured to analyze the request data and the return data according to the business scenario rule, so as to construct a data model in a corresponding business scenario.
The test case generator 34 may be configured to generate a corresponding test case according to the data model and the preset test code template in the corresponding service scenario.
The test case generation device of the embodiment of the present application corresponds to the test case generation method of the embodiment, and therefore, for specific contents of the test case generation device of the embodiment of the present application, please refer to the test case generation method of the embodiment, which is not described herein again.
As shown in fig. 4, the test case generation system according to the embodiment of the present application includes:
a processor; and
a memory configured to store a test case generation apparatus, which when executed by the processor, performs the steps of:
acquiring request data and return data from the log information of the server side;
providing a service scene rule set, and determining a service scene rule corresponding to a scene specifying instruction when receiving the scene specifying instruction of a user aiming at the service scene rule set;
analyzing the request data and the return data according to the business scene rule to construct a data model under a corresponding business scene;
and generating a corresponding test case according to the data model and a preset test code template in the corresponding service scene.
The test case generation system of the embodiment of the present application corresponds to the test case generation method of the embodiment, and therefore, for specific contents of the test case generation system of the embodiment of the present application, please refer to the test case generation method of the embodiment, which is not described herein again.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention 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 invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. 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). 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 like elements in a 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 application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is 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 (14)

1. A test case generation method is characterized by comprising the following steps:
acquiring request data and return data from the log information of the server side;
providing a service scene rule set, and determining a service scene rule corresponding to a scene specifying instruction when receiving the scene specifying instruction of a user aiming at the service scene rule set;
analyzing the request data and the return data according to the business scene rule to construct a data model under a corresponding business scene; the data model comprises an operation list and parameters required by operation under the corresponding service scene;
and generating a corresponding test case according to the data model and a preset test code template in the corresponding service scene.
2. The method for generating test cases according to claim 1, wherein the analyzing the request data and the return data according to the business scenario rule to construct a data model under a corresponding business scenario includes:
matching request data and return data meeting the requirements of the business scene rules from the request data and the return data, and extracting data structures of the matched request data and return data;
and modifying, sequencing and/or combining the matched data structures of the request data and the returned data according to the business scenario rule to generate a data model meeting the requirement of the business scenario rule.
3. The method of test case generation of claim 2, wherein the modifying comprises replacing parameter values for the same parameter name in the data structure.
4. The method for generating the test case according to claim 1, wherein the generating the corresponding test case according to the data model and the preset test code template in the corresponding service scenario includes:
matching a test code template corresponding to the data model in the corresponding service scene from a preset test code template set;
and rendering the data model under the corresponding service scene according to the matched test code template to generate a corresponding test case.
5. The method according to claim 4, wherein the matching comprises matching a request pattern of the data model with a request pattern of the test code template.
6. The test case generation method according to claim 1, wherein the service scenario rules in the service scenario rule set are obtained in advance by:
and receiving a text file, wherein the text file comprises a service scene rule.
7. The test case generation method according to claim 1, wherein the service scenario rules in the service scenario rule set are obtained in advance by:
providing a web interface;
receiving a business scenario rule input through a web interface.
8. The test case generation method according to claim 1, wherein the service scenario rules in the service scenario rule set are obtained in advance by:
providing a rules engine;
receiving a business scenario rule input through the rule engine.
9. The method for generating test cases according to claim 1, wherein the server side comprises a web server side.
10. The test case generation method according to claim 1, wherein the server side comprises a web proxy server side.
11. The test case generation method according to claim 1, wherein the obtaining of the request data and the return data from the log information of the server side includes:
reading a server side log;
and filtering the log information of the server side through a preset regular expression, and extracting request data and return data of corresponding services.
12. The test case generation method according to claim 1, wherein the obtaining of the request data and the return data from the log information of the server side includes:
reading a server side log;
and filtering the log information of the server side through a preset grammar parser, and extracting request data and return data of corresponding services.
13. A test case generation apparatus, comprising:
the log reader is used for acquiring request data and return data from the log information of the server side;
the rule provider is used for providing a service scene rule set and determining a service scene rule corresponding to a scene specifying instruction when the scene specifying instruction of a user for the service scene rule set is received;
the data analyzer is used for analyzing the request data and the return data according to the business scene rule so as to construct a data model under a corresponding business scene; the data model comprises an operation list and parameters required by operation under the corresponding service scene;
and the test case generator is used for generating a corresponding test case according to the data model and the preset test code template under the corresponding service scene.
14. A test case generation system, comprising:
a processor; and
a memory configured to store a test case generation apparatus that, when executed by the processor, performs the steps of:
acquiring request data and return data from the log information of the server side;
providing a service scene rule set, and determining a service scene rule corresponding to a scene specifying instruction when receiving the scene specifying instruction of a user aiming at the service scene rule set;
analyzing the request data and the return data according to the business scene rule to construct a data model under a corresponding business scene; the data model comprises an operation list and parameters required by operation under the corresponding service scene;
and generating a corresponding test case according to the data model and a preset test code template in the corresponding service scene.
CN201710030773.8A 2017-01-17 2017-01-17 Test case generation method, device and system Active CN108319547B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710030773.8A CN108319547B (en) 2017-01-17 2017-01-17 Test case generation method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710030773.8A CN108319547B (en) 2017-01-17 2017-01-17 Test case generation method, device and system

Publications (2)

Publication Number Publication Date
CN108319547A CN108319547A (en) 2018-07-24
CN108319547B true CN108319547B (en) 2022-01-21

Family

ID=62890666

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710030773.8A Active CN108319547B (en) 2017-01-17 2017-01-17 Test case generation method, device and system

Country Status (1)

Country Link
CN (1) CN108319547B (en)

Families Citing this family (55)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110825609B (en) * 2018-08-10 2023-05-02 阿里巴巴集团控股有限公司 Service testing method, device and system
CN109460349B (en) * 2018-09-19 2021-09-21 武汉达梦数据库股份有限公司 Test case generation method and device based on log
CN109614319B (en) * 2018-11-14 2022-05-13 金色熊猫有限公司 Automatic testing method and device, electronic equipment and computer readable medium
CN111190808A (en) * 2018-11-14 2020-05-22 北京京东尚科信息技术有限公司 Automated testing method, system, device and computer readable storage medium
CN111209181A (en) * 2018-11-21 2020-05-29 北京京东尚科信息技术有限公司 Regression testing method, system, device and computer storage medium
CN109901990B (en) * 2018-11-22 2022-05-27 创新先进技术有限公司 Method, device and equipment for testing service system
CN109739742B (en) * 2018-11-27 2021-11-02 口碑(上海)信息技术有限公司 Service data checking method, device and equipment
CN111274121B (en) * 2018-12-05 2024-04-05 三六零科技集团有限公司 Test method and device for applying monitoring rule
CN111290905A (en) * 2018-12-07 2020-06-16 北京奇虎科技有限公司 Testing method and device for cloud platform of Internet of things
CN109885474A (en) * 2018-12-14 2019-06-14 平安万家医疗投资管理有限责任公司 Test case edit methods and device, terminal and computer readable storage medium
CN109684209A (en) * 2018-12-17 2019-04-26 北京奇虎科技有限公司 A kind of method for generating test case, device and electronic equipment
CN111382056B (en) * 2018-12-29 2024-02-02 北京字节跳动网络技术有限公司 Service testing method and device, server and storage medium
CN111382058B (en) * 2018-12-29 2024-02-02 北京字节跳动网络技术有限公司 Service testing method and device, server and storage medium
CN109815141B (en) * 2019-01-07 2022-05-03 中国联合网络通信集团有限公司 Test method and device
CN109960653A (en) * 2019-02-18 2019-07-02 天津五八到家科技有限公司 Regression testing method, device, equipment and storage medium
CN110209577A (en) * 2019-05-20 2019-09-06 深圳壹账通智能科技有限公司 A kind of test method and device
CN111984519B (en) * 2019-05-23 2024-05-10 阿里巴巴集团控股有限公司 Test method and device for service system
CN110309064B (en) * 2019-05-30 2024-07-26 邓辉 Unit test method, device, equipment and storage medium based on log record
CN110347589B (en) * 2019-06-11 2022-04-29 烽火通信科技股份有限公司 Software unit test automatic detection method and system
CN110297837B (en) * 2019-06-14 2023-03-21 阿里巴巴集团控股有限公司 Data updating method and device and data query method and device
CN110287120B (en) * 2019-06-28 2023-09-08 深圳前海微众银行股份有限公司 Unit test system and test method
CN110502425A (en) * 2019-06-28 2019-11-26 平安银行股份有限公司 Test data generating method, device, electronic equipment and storage medium
CN110503297B (en) * 2019-07-16 2023-08-25 创新先进技术有限公司 Service scene acquisition method and device, electronic equipment and medium
CN112256554B (en) * 2019-07-22 2023-06-16 腾讯科技(深圳)有限公司 Method and equipment for testing based on scene test cases
CN110456766B (en) * 2019-07-30 2021-03-23 北京经纬恒润科技股份有限公司 Method and device for generating analysis case
CN112564996B (en) * 2019-09-26 2024-09-17 阿里巴巴集团控股有限公司 Pressure test flow scheduling, control method, equipment and computer readable medium
CN110866055A (en) * 2019-10-24 2020-03-06 广州永融科技股份有限公司 Method for rule base management
CN111176979B (en) * 2019-11-20 2023-05-12 四川蜀天梦图数据科技有限公司 Test case generation method and device of graph database
CN112925698B (en) * 2019-11-20 2023-11-28 大唐移动通信设备有限公司 Test script generation method and integrated development environment
CN110874326B (en) * 2019-11-21 2023-10-27 望海康信(北京)科技股份公司 Test case generation method and device, computer equipment and storage medium
CN111124695B (en) * 2019-11-25 2023-05-16 支付宝(杭州)信息技术有限公司 Dynamic effect management method, system and equipment
CN111061249A (en) * 2019-12-16 2020-04-24 卡斯柯信号(北京)有限公司 Automatic test system of enhanced train control system wireless block controller
CN111104328B (en) * 2019-12-20 2023-03-21 北京明略软件系统有限公司 Use case generation method and device, computer equipment and readable storage medium
CN111177007B (en) * 2019-12-31 2023-09-22 中国银行股份有限公司 Method and system for automatically generating BDD test cases based on test data
CN111240976A (en) * 2020-01-07 2020-06-05 上海复深蓝软件股份有限公司 Software testing method and device, computer equipment and storage medium
CN111369359B (en) * 2020-02-10 2022-02-22 中科驭数(北京)科技有限公司 Method and device for testing security transaction risk control hardware
CN113704077B (en) * 2020-05-20 2023-09-19 中国移动通信集团浙江有限公司 Test case generation method and device
CN112162914B (en) * 2020-07-27 2024-06-04 上海金融期货信息技术有限公司 Method and device for automatically generating test cases
CN114205273B (en) * 2020-08-26 2023-09-15 腾讯科技(深圳)有限公司 System test method, device and equipment and computer storage medium
CN112100078B (en) * 2020-09-27 2024-05-03 中国建设银行股份有限公司 Method, device and equipment for generating interface test case
CN112308570B (en) * 2020-11-24 2023-12-19 中国工商银行股份有限公司 Method and device for generating business rule output value
CN112486824B (en) * 2020-11-30 2024-05-03 广州品唯软件有限公司 Case code generation method, device, computer equipment and storage medium
CN112346993B (en) * 2020-11-30 2022-05-17 杭州安恒信息技术股份有限公司 Method, device and equipment for testing information analysis engine
CN112486828A (en) * 2020-12-01 2021-03-12 广州品唯软件有限公司 Test case generation method and device, computer equipment and storage medium
CN112286827B (en) * 2020-12-01 2024-06-28 中国人寿保险股份有限公司 Software testing method, device, electronic device and storage medium
CN112527649A (en) * 2020-12-15 2021-03-19 建信金融科技有限责任公司 Test case generation method and device
CN113590453B (en) * 2021-01-28 2024-07-23 腾讯科技(深圳)有限公司 Method and device for generating test case and storage medium
CN112783799B (en) * 2021-03-19 2024-05-17 中国工商银行股份有限公司 Software daemon testing method and device
CN112749100A (en) * 2021-04-06 2021-05-04 四川新网银行股份有限公司 Method for generating automatic test case based on flow recording
CN113342664B (en) * 2021-06-16 2023-09-01 北京奇艺世纪科技有限公司 Dial testing method, device, storage medium and computer equipment
CN113608995A (en) * 2021-06-30 2021-11-05 未鲲(上海)科技服务有限公司 Number making method and device, computer equipment and storage medium
CN113448869B (en) * 2021-07-16 2022-12-13 中国建设银行股份有限公司 Method and device for generating test case, electronic equipment and computer readable medium
CN113434436B (en) * 2021-07-30 2022-12-16 拉扎斯网络科技(上海)有限公司 Test case generation method and device, electronic equipment and storage medium
CN113722240B (en) * 2021-11-02 2022-02-01 麒麟软件有限公司 Stability testing method and system for linux operating system management platform
CN114661608A (en) * 2022-04-02 2022-06-24 中国民航信息网络股份有限公司 Test case obtaining method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102999320A (en) * 2011-09-15 2013-03-27 阿里巴巴集团控股有限公司 Automatic test case generation method and system
CN103412818A (en) * 2013-08-14 2013-11-27 迈普通信技术股份有限公司 Automation testing method and system
CN104951399A (en) * 2015-06-19 2015-09-30 北京齐尔布莱特科技有限公司 Software test system and method
CN105335278A (en) * 2014-06-16 2016-02-17 阿里巴巴集团控股有限公司 Testing method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FI20115104A0 (en) * 2011-02-02 2011-02-02 Teknologian Tutkimuskeskus Vtt Oy SYSTEM AND METHOD FOR MODEL-BASED TESTING
US9348739B2 (en) * 2014-07-10 2016-05-24 International Business Machines Corporation Extraction of problem diagnostic knowledge from test cases
CN105005532B (en) * 2015-08-05 2017-11-24 广东欧珀移动通信有限公司 A kind of system and method for automatic test application programming interfaces stability

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102999320A (en) * 2011-09-15 2013-03-27 阿里巴巴集团控股有限公司 Automatic test case generation method and system
CN103412818A (en) * 2013-08-14 2013-11-27 迈普通信技术股份有限公司 Automation testing method and system
CN105335278A (en) * 2014-06-16 2016-02-17 阿里巴巴集团控股有限公司 Testing method and device
CN104951399A (en) * 2015-06-19 2015-09-30 北京齐尔布莱特科技有限公司 Software test system and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"基于Web日志的测试集生成方法设计与研究";武晋南;《中国优秀硕士学位论文全文数据库 信息科技辑》;20100715;第6,13-15,34页 *

Also Published As

Publication number Publication date
CN108319547A (en) 2018-07-24

Similar Documents

Publication Publication Date Title
CN108319547B (en) Test case generation method, device and system
CN108415832B (en) Interface automation test method, device, equipment and storage medium
US10705942B1 (en) Simulated testing of API
CN110427331B (en) Method for automatically generating performance test script based on interface test tool
CN108293081B (en) Deep linking of program playback to mobile application state through user interface events
CN107291438B (en) Automatic script generation method and device and electronic equipment
CN108628748B (en) Automatic test management method and automatic test management system
US20200357007A1 (en) Page data acquisition method, apparatus, server, electronic device and computer readable medium
CN106648556B (en) Method and device for front-end and back-end integrated development test
CN112162915B (en) Test data generation method, device, equipment and storage medium
US20210334149A1 (en) Api adapter creation device, api adapter creation method, and api adapter creation program
CN113296653B (en) Simulation interaction model construction method, interaction method and related equipment
CN112035363A (en) Automatic interface testing method and device
CN114595201A (en) Method, equipment and storage medium for inquiring acquisition record of interface access log
CN113408254A (en) Page form information filling method, device, equipment and readable medium
CN116069577A (en) Interface testing method, equipment and medium for RPC service
CN114328250A (en) Automatic self-checking method, medium and device for software system
CN113761863A (en) List page configuration method, device and storage medium
WO2024001594A1 (en) Operator development method and apparatus, operator processing method and apparatus, and electronic device, system and storage medium
CN111078529B (en) Client writing module testing method and device and electronic equipment
CN112564996B (en) Pressure test flow scheduling, control method, equipment and computer readable medium
EP4261692A1 (en) Self-learning application test automation
CN116719735A (en) Test case generation method and device
CN114968741B (en) Performance test method, system, equipment and medium based on scene platformization
US11706164B2 (en) Graph-based natural language generation for conversational systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant