CN117093468A - Test case generation method, device, equipment, medium and computer program product - Google Patents

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

Info

Publication number
CN117093468A
CN117093468A CN202210516695.3A CN202210516695A CN117093468A CN 117093468 A CN117093468 A CN 117093468A CN 202210516695 A CN202210516695 A CN 202210516695A CN 117093468 A CN117093468 A CN 117093468A
Authority
CN
China
Prior art keywords
tag
parameter
target
interface
group
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210516695.3A
Other languages
Chinese (zh)
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210516695.3A priority Critical patent/CN117093468A/en
Publication of CN117093468A publication Critical patent/CN117093468A/en
Pending legal-status Critical Current

Links

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
    • 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/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a test case generation method, a device, equipment, a medium and a computer program product, and related embodiments of the method, the device, the equipment, the medium and the computer program product can be applied to cloud technology and other scenes. The method comprises the following steps: traversing the acquired multiple interface tag groups and multiple parameter tag groups, and determining a currently traversed target tag group from the multiple interface tag groups and the multiple parameter tag groups; any one of the plurality of interface tag groups includes at least one interface tag, any one of the plurality of parameter tag groups includes at least one parameter tag, and the target tag group includes: a target interface label determined from each interface label group and a target parameter label determined from each parameter label group; obtaining test parameters corresponding to each target parameter label; calling the test parameters corresponding to the target parameter labels in the target label group based on the interface calling methods corresponding to the target interface labels, and generating target test cases corresponding to the target label group; the test cases with full coverage can be generated efficiently.

Description

Test case generation method, device, equipment, medium and computer program product
Technical Field
The present application relates to the field of computer technologies, and in particular, to a test case generating method, apparatus, device, medium, and computer program product.
Background
In the related scene of software development, the developed or modified software is usually required to be tested, and when the test result accords with the expectation, the software is released online; when testing software, test cases are generally required to be written to test the software; in the existing method, the test cases are usually written manually by related technicians, the efficiency is low, and the test cases may be missed in the manual writing, so that the test cases of the software are not covered comprehensively, namely, the test cases required by the software in certain specific scenes can not be written, and the software cannot be tested in certain specific scenes.
Disclosure of Invention
The embodiment of the application provides a test case generation method, a device, equipment, a medium and a computer program product, which can efficiently generate a fully covered test case.
In one aspect, an embodiment of the present application provides a test case generating method, including:
acquiring a plurality of interface tag groups and a plurality of parameter tag groups; any one of the plurality of interface tag groups includes at least one interface tag, and any one of the plurality of parameter tag groups includes at least one parameter tag;
Traversing the plurality of interface tag groups and the plurality of parameter tag groups, and determining a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; the target tag group includes: a target interface tag determined from each of the plurality of interface tag groups and a target parameter tag determined from each of the plurality of parameter tag groups;
obtaining test parameters corresponding to each target parameter label in the target label group;
and generating a target test case corresponding to the target tag group based on the call of the interface call method corresponding to each target interface tag in the target tag group to the test parameter corresponding to the target parameter tag in the target tag group.
In one aspect, an embodiment of the present application provides a test case generating device, including:
the acquisition unit is used for acquiring a plurality of interface tag groups and a plurality of parameter tag groups; any one of the plurality of interface tag groups includes at least one interface tag, and any one of the plurality of parameter tag groups includes at least one parameter tag;
the processing unit is used for traversing the plurality of interface tag groups and the plurality of parameter tag groups and determining a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; the target tag group includes: a target interface tag determined from each of the plurality of interface tag groups and a target parameter tag determined from each of the plurality of parameter tag groups;
The processing unit is further used for acquiring test parameters corresponding to each target parameter label in the target label group;
the processing unit is further configured to generate a target test case corresponding to the target tag group based on a call of the interface call method corresponding to each target interface tag in the target tag group to the test parameter corresponding to the target parameter tag in the target tag group.
In one aspect, an embodiment of the present application provides a test case generating device, which is characterized in that the test case generating device includes an input interface and an output interface, and further includes:
a processor adapted to implement one or more instructions; the method comprises the steps of,
a computer storage medium storing one or more instructions adapted to be loaded by the processor and to perform the test case generation method described above.
In one aspect, an embodiment of the present application provides a computer storage medium, where computer program instructions are stored in the computer storage medium, where the computer program instructions, when executed by a processor, are configured to perform the test case generating method described above.
In one aspect, embodiments of the present application provide a computer program product or computer program, the computer program product comprising a computer program stored in a computer storage medium; the processor of the test case generating device reads the computer program from the computer storage medium, and the processor executes the computer program, so that the test case generating device executes the test case generating method.
In the embodiment of the application, after a plurality of interface tag groups and a plurality of parameter tag groups are acquired, traversing the plurality of interface tag groups and the plurality of parameter tag groups, and determining a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; wherein any one of the plurality of interface tag groups includes at least one interface tag, any one of the plurality of parameter tag groups includes at least one parameter tag, and the target tag group includes: a target interface tag determined from each of the plurality of interface tag groups and a target parameter tag determined from each of the plurality of parameter tag groups; the test parameters corresponding to the target parameter labels in the target label group can be obtained, and the target test cases corresponding to the target label group are generated based on the calling of the test parameters corresponding to the target parameter labels in the target label group by the interface calling method corresponding to the target interface labels in the target label group; the method comprises the steps that one interface label corresponds to one functional module in a code to be tested, an interface calling method corresponding to a target interface label is used for generating an interface test case for testing the functional module corresponding to the target interface label, and a target test case corresponding to a target label group is used for testing the code to be tested on the basis of test parameters corresponding to each target parameter label in the target label group; based on the method, a plurality of target tag groups which are used for fully covering each interface tag in a plurality of interface tag groups and each parameter tag in a plurality of parameter tag groups can be generated, further target test cases corresponding to each target tag group can be generated and used as test cases for testing the code to be tested, namely the test cases which are used for fully covering the code to be tested can be generated, the test accuracy can be further improved, the test cases do not need to be written manually, and the efficiency is higher.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a test case generation model according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of a test case generating method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of generating a target test case corresponding to a target tag group according to an embodiment of the present application;
FIG. 4 is a flowchart of another test case generating method according to an embodiment of the present application;
FIG. 5 is a flowchart of another test case generating method according to an embodiment of the present application;
FIG. 6 is a schematic diagram of another test case generating model according to an embodiment of the present application;
FIG. 7 is a flowchart of another test case generating method according to an embodiment of the present application;
FIG. 8a is a flowchart illustrating another method for generating test cases according to an embodiment of the present application;
FIG. 8b is a schematic diagram of test case generation in an existing test case generation method according to an embodiment of the present application;
FIG. 9 is a schematic diagram of a test case generating device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of test case generating equipment provided in an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The embodiment of the application provides a test case generation scheme, which can traverse a plurality of interface tag groups and a plurality of parameter tag groups after acquiring the plurality of interface tag groups and the plurality of parameter tag groups, and determine a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; wherein any one of the plurality of interface tag groups includes at least one interface tag, any one of the plurality of parameter tag groups includes at least one parameter tag, and the target tag group includes: a target interface tag determined from each of the plurality of interface tag groups and a target parameter tag determined from each of the plurality of parameter tag groups; the test parameters corresponding to the target parameter labels in the target label group can be obtained, and the target test cases corresponding to the target label group are generated based on the calling of the test parameters corresponding to the target parameter labels in the target label group by the interface calling method corresponding to the target interface labels in the target label group; and then a plurality of target tag groups which are fully covered by each interface tag in the plurality of interface tag groups and each parameter tag in the plurality of parameter tag groups can be generated, and further target test cases corresponding to each target tag group can be generated.
For example, if two interface tag groups are obtained, namely an interface tag group 1 and an interface tag group 2, if the interface tag group 1 comprises 3 interface tags, namely A1, A2 and A3, the interface tag group 2 comprises 3 interface tags, namely B1, B2 and B3; if 3 parameter tag groups are obtained, the parameter tag groups are respectively 1, 2 and 3, if the parameter tag group 1 comprises 2 parameter tags which are respectively a1 and a2, the parameter tag group 2 comprises 3 parameter tags which are respectively b1, b2 and b3, and if the parameter tag group 3 comprises 4 parameter tags which are respectively c1, c2, c3 and c4; traversing the 2 interface tag groups and the 3 parameter tag groups can obtain the corresponding interfaces in the 2 interface tag groupsLabels and full coverage of individual parameter labels in 3 parameter label setsAnd the target label groups are used for generating target test cases corresponding to the target label groups.
In a specific implementation, the test case generation scheme provided by the application can be executed by test case generation equipment, and the test case generation equipment can be terminal equipment or a server; the terminal devices herein may include, but are not limited to: computers, smart phones, tablet computers, notebook computers, intelligent voice interaction equipment, intelligent household appliances, vehicle-mounted terminals, intelligent wearable equipment and the like; the server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), basic cloud computing services such as big data and artificial intelligent platforms, and the like.
In one embodiment, the test case generation scheme provided by the application can be used for generating a test case for testing the code to be tested, and the code to be tested can be a code for realizing any legal function, for example, a code for realizing a resource transfer function (namely an electronic payment function) in a resource transfer scene (namely an electronic payment scene), and a code for realizing a face recognition function in a face recognition scene, and for convenience of explanation, the code to be tested is used as the code for realizing the resource transfer function in the resource transfer scene in the embodiment of the application. Further, the plurality of interface tag groups and the plurality of parameter tag groups acquired by the test case generating device may be a plurality of interface tag groups and a plurality of parameter tag groups obtained by analyzing each functional module of the code to be tested in advance by the test case generating device, that is, the plurality of interface tag groups and the plurality of parameter tag groups corresponding to the code to be tested may be obtained by analyzing each functional module of the code to be tested, so that a test case for performing full coverage test on the code to be tested may be generated based on the plurality of interface tag groups and the plurality of parameter tag groups corresponding to the code to be tested. Optionally, the obtained plurality of interface tag groups and the obtained plurality of parameter tag groups may be input by the target object, that is, after the test case generating device obtains the plurality of interface tag groups and the plurality of parameter tag groups corresponding to the code to be tested based on analysis of each functional module of the code to be tested, the plurality of interface tag groups and the plurality of parameter tag groups corresponding to the code to be tested may be output, so that the target object may know each interface tag in the plurality of interface tag groups and each parameter tag in the plurality of parameter tag groups corresponding to the code to be tested, and input test parameters corresponding to each parameter tag based on each parameter tag in the plurality of parameter tag groups, so that the test case generating device may generate a test case for testing the code to be tested based on the test parameters corresponding to each parameter tag in the obtained plurality of parameter tag groups; wherein the target object may be any legitimate user.
In one embodiment, among the functional modules of the code to be tested, one functional module corresponds to one interface tag and one functional module corresponds to one interface calling method; the interface calling method corresponding to the functional module can be used for indicating: the logic for generating the interface test case corresponding to the functional module can be used for generating the interface test case for testing the functional module, and optionally, the interface calling method corresponding to the functional module can be written by technicians; the interface label corresponding to the functional module may be set by a technician or may be created by the test case generating device. Code modules corresponding to the interface tags included in any one of the plurality of interface tag groups are used for realizing the same function; for example, if the code to be tested is a code for implementing a resource transfer function, the code to be tested includes 6 functional modules, namely, functional module 1, functional module 2, functional module 3, functional module 4, functional module 5, and functional module 6, respectively, and if functional module 1, functional module 2, and functional module 3 are used for implementing functions for implementing resource transfer from different paths, functional module 4, functional module 5, and functional module 6 are used for implementing functions for generating orders from different paths, functional module 1, functional module 2, and functional module 3 may be considered to implement the same function, and only the implemented paths may be different, and functional module 4, functional module 5, and functional module 6 may be considered to implement the same function, namely, the order generation function, and only the paths for generating orders may be different.
In one embodiment, parameter labels corresponding to the same interface label group can be obtained based on parameter analysis of the functional modules corresponding to the interface labels in the same interface label group; in a possible implementation manner, the same parameter of the functional module corresponding to each interface tag in the same interface tag group can be used as the common parameter of the functional module corresponding to each interface tag in the same interface tag group, and the parameter tag of the common parameter is determined so as to identify each common parameter. Further, the parameter labels corresponding to the same interface label group can be classified according to the parameter types to obtain one or more parameter label groups corresponding to the same interface label group, wherein the parameter types of the parameter labels included in different parameter label groups are different. That is, in the process of generating the test case of the code to be tested based on the test parameters, the test parameters required for the functional modules corresponding to different interface tags in a certain interface tag group are the same.
In one embodiment, the present application provides a test case generation model for implementing the test case generation scheme provided by the present application, where the test case generation model provided by the present application may include a call layer, a scene series layer, and a service logic layer. The call layer is used for traversing the plurality of interface tag groups and the plurality of parameter tag groups, and determining a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; the business logic layer is used for acquiring test parameters corresponding to each target parameter label in the target label group and sending the test parameters corresponding to each target parameter label in the target label group to the scene serial layer; the scene tandem layer is used for receiving the target label group sent by the calling layer, and calling the test parameters corresponding to the target parameter labels in the target label group acquired from the service logic layer through the interface calling method corresponding to the target interface labels in the target label group in the scene tandem layer, so as to generate the target test case corresponding to the target label group. That is, after receiving the plurality of interface tag groups and the plurality of parameter tag groups, the test case generating device may traverse the plurality of interface tag groups and the plurality of parameter tag groups through a call layer in the test case generating model to obtain a target tag group currently traversed, and send the target tag group to the scene tandem layer; after the scene serial layer receives the target tag group sent by the calling layer, the test parameters corresponding to the target parameter tags in the target tag group acquired from the service logic layer can be called through an interface calling method corresponding to each target interface tag in the target tag group included in the scene serial layer, so that a target test case corresponding to the target tag group is generated. In this case, the test parameters corresponding to the target parameter tags in the target tag group may be input by the target object, and the service logic layer plays a role in parameter transfer.
Further, when the test case generation scheme provided by the application is applied in a complex scene such as a resource transfer scene, each functional module in the code to be tested may be a parameter obtained after parameter conversion of a parameter input by a user, for example, may be a parameter obtained after encrypting a parameter input by a user, and then, based on the characteristic of the code to be tested in the resource transfer scene, in the process of generating a test case of the code to be tested, the test parameter corresponding to each target parameter label in the obtained target label group should be a parameter obtained after encrypting an original parameter input by the target object, and at this time, the operation of parameter encryption may be implemented by the service logic layer, at this time, the service logic layer may include a parameter encryption method corresponding to each parameter label in the plurality of parameter label groups, where the parameter encryption method corresponding to one parameter label is used for encrypting an original parameter corresponding to the parameter label input by the target object, and optionally, the parameter encryption method corresponding to each parameter label may be written by a technician.
Referring to fig. 1, a schematic structural diagram of a test case generation model provided in an embodiment of the present application is provided, after a service logic layer receives original parameters corresponding to each parameter tag in a plurality of parameter tag groups input by a target object, the service logic layer may further encrypt the original parameters corresponding to each parameter tag in the plurality of parameter tag groups by a parameter encryption method corresponding to each parameter tag in the plurality of parameter tag groups, so as to obtain test parameters corresponding to each parameter tag in the plurality of parameter tag groups, after an interface layer receives a plurality of interface tag groups and a plurality of parameter tag groups, the service logic layer may traverse the plurality of interface tag groups and the plurality of parameter tag groups by a calling layer, so as to obtain a currently traversed target tag group, and send the target tag group to a scene serial layer; after the scene serial layer receives the target tag group sent by the calling layer, the test parameters corresponding to the target parameter tags in the target tag group acquired from the service logic layer can be called through an interface calling method corresponding to each target interface tag in the target tag group included in the scene serial layer, so that a target test case corresponding to the target tag group is generated.
In another possible implementation manner, after the interface layer receives the plurality of interface tag groups and the plurality of parameter tag groups, the interface layer may traverse the plurality of interface tag groups and the plurality of parameter tag groups to obtain a currently traversed target tag group, and send the target tag group to the scene tandem layer; after receiving the target tag group sent by the calling layer, the scene tandem layer can send a test parameter acquisition request to the service logic layer through an interface calling method corresponding to each target interface tag in the target tag group included in the scene tandem layer so as to request to return test parameters corresponding to each target parameter tag in the target tag group; after the service logic layer receives the test parameter acquisition request, the service logic layer can encrypt original parameters corresponding to each target parameter label in the target label group through a parameter encryption method corresponding to each target parameter label in the target label group included in the service logic layer, so as to obtain test parameters corresponding to each target parameter label in the target label group, and return the test parameters corresponding to each target parameter label in the target label group to an interface calling method corresponding to each target interface label in the target label group included in the scene serial layer, so that the test parameters corresponding to the target parameter labels in the target label group obtained by the service logic layer are called, and further, the target test cases corresponding to the target label group can be generated. The high-cohesion low-coupling is realized through the layered design of the test case generation model, the service logic is maintained at one place only, and is called at a plurality of places, namely, the test parameters are maintained at one place only, and the maintenance cost is reduced.
It should be noted that the test case generating model proposed above is just one implementation manner of the test case generating method proposed by the present application, each layer in the test case generating model shown in fig. 1 may be combined into one or several other layers respectively or all layers may be further split into a plurality of layers with smaller functions to form a layer(s), which may implement the same operation, and the implementation of the technical effects of the embodiment of the present application is not affected, for example, the test case generating method proposed by the present application may be implemented by only one scene serial layer.
It should be noted that, in the specific embodiment of the present application, data related to the user (such as test parameters input by the target object) needs to be licensed or agreed by the user when the embodiment of the present application is applied to a specific product or technology, and the collection, use and processing of the related data need to comply with local laws and regulations and standards.
Based on the test case generation scheme, the embodiment of the application provides a test case generation method. Referring to fig. 2, a flow chart of a test case generating method according to an embodiment of the present application is shown. The test case generating method shown in fig. 2 may be performed by the test case generating apparatus. The test case generation method shown in fig. 2 may include the following steps:
S201, a plurality of interface tag groups and a plurality of parameter tag groups are obtained.
In one embodiment, any one of the plurality of interface tag groups includes at least one interface tag, and any one of the plurality of parameter tag groups includes at least one parameter tag; the plurality of interface tag groups and the plurality of parameter tag groups are used for generating test cases for testing the code to be tested, the plurality of interface tag groups and the plurality of parameter tag groups correspond to the code to be tested, and the plurality of interface tag groups and the plurality of parameter tag groups corresponding to different codes to be tested can be different; among the functional modules of the code to be tested, one functional module corresponds to an interface tag, one functional module corresponds to an interface calling method, and the interface calling method corresponding to the functional module can be used for indicating: the generating logic of the interface test case corresponding to the functional module, namely the generating logic of the interface test case for testing the functional module, is also used for maintaining the interface calling method corresponding to the functional module through the interface label corresponding to the functional module; code modules corresponding to the interface tags included in any one of the plurality of interface tag groups are used for realizing the same function; one of the plurality of interface tag groups corresponds to one or more parameter tag groups, that is, in the process of generating a test case of a code to be tested based on the test parameters, the test parameters required for the functional modules corresponding to different interface tags in one of the plurality of interface tag groups are the same. Alternatively, the plurality of interface tag sets and the plurality of parameter tag sets may be input by a target object, which may be any legitimate user.
S202, traversing a plurality of interface tag groups and a plurality of parameter tag groups, and determining a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups.
Wherein, the target tag group includes: target interface tag determined from each of a plurality of interface tag groupsAnd a target parameter tag determined from each of the plurality of parameter tag sets; for example, if two interface tag groups are obtained, namely an interface tag group 1 and an interface tag group 2, if the interface tag group 1 comprises 3 interface tags, namely A1, A2 and A3, the interface tag group 2 comprises 3 interface tags, namely B1, B2 and B3; if 3 parameter tag groups are obtained, the parameter tag groups are respectively 1, 2 and 3, if the parameter tag group 1 comprises 2 parameter tags which are respectively a1 and a2, the parameter tag group 2 comprises 3 parameter tags which are respectively b1, b2 and b3, and if the parameter tag group 3 comprises 4 parameter tags which are respectively c1, c2, c3 and c4; traversing the 2 interface tag groups and the 3 parameter tag groups to obtain full coverage of each interface tag in the 2 interface tag groups and each parameter tag in the 3 parameter tag groups The target tag groups currently traversed may be "A1, B1, c1", "A2, B1, A1, B1, c1", "A3, B1, A1, B1, c1", "A1, B2, A1, B1, c1", and so on.
S203, test parameters corresponding to the target parameter labels in the target label group are obtained.
In one embodiment, the test parameters corresponding to each target parameter tag in the target tag group may be input by the target object; specifically, the test case generating device may screen and obtain test parameters corresponding to each target parameter label in the target label group from test parameters corresponding to each parameter label in the plurality of parameter label groups input by the target object.
In one embodiment, when the test case generating method provided by the application is applied in complex scenes such as a resource transfer scene, each functional module in the code to be tested may be a parameter obtained after the parameter input by the user is converted, for example, a parameter obtained after the parameter input by the user is encrypted, and then, based on the characteristic of the code to be tested in the resource transfer scene, in the process of generating the test case of the code to be tested, the test parameter corresponding to each target parameter label in the obtained target label group should be a parameter obtained after the original parameter input by the target object is encrypted. Based on this, in a possible implementation manner, before obtaining the test parameters corresponding to each target parameter tag in the target tag group, the test case generating device may obtain the original parameters corresponding to each parameter tag in the multiple parameter tag groups; based on a parameter encryption method corresponding to each parameter label in the plurality of parameter label groups, respectively carrying out encryption processing on original parameters corresponding to each parameter label in the plurality of parameter label groups to obtain test parameters corresponding to each parameter label in the plurality of parameter label groups; and then, when the test case generating device acquires the test parameters corresponding to each target parameter label in the target label group, the test parameters corresponding to each target parameter label in the target label group can be screened from the obtained test parameters corresponding to each parameter label in the plurality of parameter label groups.
In another possible implementation manner, the test case generating device obtains test parameters corresponding to each target parameter label in the target label group, which may include: acquiring original parameters corresponding to each target parameter label in a target label group; and respectively carrying out encryption processing on original parameters corresponding to each target parameter label in the target label group based on a parameter encryption method corresponding to each target parameter label in the target label group to obtain test parameters corresponding to each target parameter label in the target label group. That is, after the test case generating device obtains the original parameters corresponding to each parameter tag in the plurality of parameter tag groups input by the target object, the original parameters corresponding to each target parameter tag in the target tag group can be determined from the original parameters corresponding to each parameter tag in the plurality of parameter tag groups, and the original parameters corresponding to each target parameter tag in the target tag group are respectively encrypted based on the corresponding parameter encryption method, so as to obtain the test parameters corresponding to each target parameter tag in the target tag group.
S204, based on the calling of the interface calling method corresponding to each target interface label in the target label group to the test parameter corresponding to the target parameter label in the target label group, generating the target test case corresponding to the target label group.
In one embodiment, an interface calling method corresponding to a target interface tag may be used to indicate: the logic for generating the interface test cases of the functional modules corresponding to the target interface tags can be used for generating the interface test cases for testing the functional modules corresponding to the target interface tags; in a specific implementation, the test case generating device generates a target test case corresponding to a target tag group based on the call of the interface call method corresponding to each target interface tag in the target tag group to the test parameter corresponding to the target parameter tag in the target tag group, which may include: determining a parameter tag group corresponding to any target interface tag in the target tag groups based on the corresponding relation between the plurality of interface tag groups and the plurality of parameter tag groups; acquiring target parameter labels determined from a parameter label group corresponding to any target interface label from all target parameter labels of the target label group; calling the test parameters corresponding to the obtained target parameter labels based on an interface calling method corresponding to any target interface label, and generating an interface test case corresponding to any target interface label; and combining the interface test cases corresponding to the target interface tags in the target tag group to obtain the target test cases corresponding to the target tag group. That is, since one of the plurality of interface tag groups corresponds to one or more parameter tag groups, in the process of generating a test case of a code to be tested based on test parameters, test parameters required for a functional module corresponding to a different interface tag in a certain interface tag group are the same, and then, in the process of generating a target test case corresponding to the target tag group based on the target tag group, test parameters required to be invoked by an interface invoking method corresponding to a different target interface tag in the target tag group are required to be obtained from test parameters corresponding to each target parameter tag in the target tag group, and further, based on an interface invoking method corresponding to each target interface tag in the target tag group, the test parameters corresponding to the corresponding obtained target parameter tag are invoked, so that the interface test case corresponding to each target interface tag is generated.
For example, referring to fig. 3, a schematic diagram of generating a target test case corresponding to a target tag group according to an embodiment of the present application is shown; if two interface tag groups are obtained, namely an interface tag group 1 and an interface tag group 2, if the interface tag group 1 comprises 3 interface tags, namely A1, A2 and A3, the interface tag group 2 comprises 3 interface tags, namely B1, B2 and B3; if 3 parameter tag groups are obtained, namely, a parameter tag group 1, a parameter tag group 2 and a parameter tag group 3, if the parameter tag group 1 comprises 2 parameter tags, namely, A1 and A2 respectively, the parameter tag group 2 comprises 3 parameter tags, namely B1, B2 and B3 respectively, and if the parameter tag group 3 comprises 4 parameter tags, namely c1, c2, c3 and c4 respectively, the obtained interface tag groups and the obtained parameter tag groups are shown as { [ A1, A2 and A3], [ B1, B2 and B3], [ A1, A2], [ B1, B2, B3], [ c1, c2, c3 and c4] }; if the correspondence between the plurality of interface tag groups and the plurality of parameter tag groups indicates: the interface tag group 1 corresponds to the parameter tag group 1, the interface tag group 2 corresponds to the parameter tag group 2 and the parameter tag group 3, if the currently traversed target tag group is "A1, B1, c1", which is denoted by [ a1+b1+a1+b1+c1] in fig. 3, for the target interface tag A1, the obtained target parameter tag determined from the parameter tag group corresponding to the target interface tag A1 is A1, for the target interface tag A2, the obtained target parameter tag determined from the parameter tag group corresponding to the target interface tag A2 is B1, c1, further, the test case generating device may generate an interface test case corresponding to the obtained target parameter tag based on the call method of the obtained target parameter tag, specifically, the test case generating device may call the test tag B1 based on the interface call method of the corresponding to the target interface tag A1, that is the test case generating the test case corresponding to the test parameter B1, and the test case corresponding to the test case B1. The method comprises the steps that the interface calling method corresponding to each target interface label in the target label group is used for calling the test parameters corresponding to the target parameter labels in the target label group, and the generated interface test cases corresponding to each target interface label are obtained through combination, so that when the target interface labels in different target label groups are identical but the target parameter labels are different, codes of the target test cases corresponding to different target label groups obtained under the condition of different target parameter labels are similar, the code styles are uniform, and only the test parameter parts are involved.
In the embodiment of the application, after a plurality of interface tag groups and a plurality of parameter tag groups are acquired, traversing the plurality of interface tag groups and the plurality of parameter tag groups, and determining a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; wherein any one of the plurality of interface tag groups includes at least one interface tag, any one of the plurality of parameter tag groups includes at least one parameter tag, and the target tag group includes: a target interface tag determined from each of the plurality of interface tag groups and a target parameter tag determined from each of the plurality of parameter tag groups; the test parameters corresponding to the target parameter labels in the target label group can be obtained, and the target test cases corresponding to the target label group are generated based on the calling of the test parameters corresponding to the target parameter labels in the target label group by the interface calling method corresponding to the target interface labels in the target label group; the method comprises the steps that one interface label corresponds to one functional module in a code to be tested, an interface calling method corresponding to a target interface label is used for generating an interface test case for testing the functional module corresponding to the target interface label, and a target test case corresponding to a target label group is used for testing the code to be tested on the basis of test parameters corresponding to each target parameter label in the target label group; based on the method, a plurality of target tag groups which are used for fully covering each interface tag in a plurality of interface tag groups and each parameter tag in a plurality of parameter tag groups can be generated, further target test cases corresponding to each target tag group can be generated and used as test cases for testing the code to be tested, namely the test cases which are used for fully covering the code to be tested can be generated, the test accuracy can be further improved, the test cases do not need to be written manually, and the efficiency is higher.
Based on the above embodiments, the embodiment of the present application provides another test case generating method. Referring to fig. 4, a flowchart of another test case generating method according to an embodiment of the present application is shown. The test case generating method shown in fig. 4 may be performed by the test case generating device. The test case generation method shown in fig. 4 may include the steps of:
s401, a plurality of interface tag groups and a plurality of parameter tag groups are obtained.
Any one of the plurality of interface tag groups includes at least one interface tag, and any one of the plurality of parameter tag groups includes at least one parameter tag.
In one embodiment, the plurality of interface tag groups and the plurality of parameter tag groups may be input by the target object, and the tag format of each interface tag in the plurality of interface tag groups and each parameter tag in the plurality of parameter tag groups may be the first format, that is, the target object may input the plurality of interface tag groups and the plurality of parameter tag groups in the first format. In a possible implementation manner, in order to adapt to users with different language habits, the conversion may be performed on the plurality of initial interface tag groups and the plurality of initial parameter tag groups in the second format input by the user, so as to obtain the plurality of interface tag groups and the plurality of parameter tag groups in the first format, where in this case, the test case generating device obtains the plurality of interface tag groups and the plurality of parameter tag groups, and may include: acquiring a plurality of initial interface tag groups and a plurality of initial parameter tag groups; any one of the plurality of initial interface tag groups comprises at least one initial interface tag, any one of the plurality of initial parameter tag groups comprises at least one initial parameter tag, and the tag formats of each initial interface tag in the plurality of initial interface tag groups and each initial parameter tag in the plurality of initial parameter tag groups are in a second format; based on a preset mapping relation, mapping each initial interface tag in a plurality of initial interface tag groups in a second format into an interface tag in a first format, and mapping each initial parameter tag in a plurality of initial parameter tag groups in the second format into a parameter tag in the first format to obtain an interface tag group corresponding to each initial interface tag group in the plurality of initial interface tag groups and a parameter tag group corresponding to each initial parameter tag group in the plurality of initial parameter tag groups. The first format and the second format may be different language formats, and the first format and the second format may be set according to specific requirements, and a mapping relationship between each initial interface tag in the plurality of initial interface tag groups of the second format and each interface tag in the plurality of interface tag groups of the first format, and a mapping relationship between each initial parameter tag in the plurality of initial parameter tag groups of the second format and each parameter tag in the plurality of parameter tag groups of the first format are set. For example, if one function module of the code to be tested is a function module for realizing change payment, the interface tag of the first format corresponding to the function module is set to be "banpoay", the initial interface tag of the second format corresponding to the function module is set to be "change payment", and after receiving the initial interface tag "change payment" input by the user, the test case generating device maps the initial interface tag "change payment" to be "banpoay", and generates the test case based on the interface tag of the second format. By setting the initial interface label of the second format corresponding to each interface label in the plurality of interface label groups of the first format and setting the initial parameter label corresponding to each parameter label in the plurality of parameter label groups of the first format, users with different language habits can use the interface label conveniently.
S402, traversing the plurality of interface tag groups and the plurality of parameter tag groups, and determining the currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups.
Wherein, the target tag group includes: a target interface tag determined from each of the plurality of interface tag groups and a target parameter tag determined from each of the plurality of parameter tag groups; the related process of step S402 is similar to the related process of step S202, and will not be described here.
S403, detecting each target interface label in the target label group and the operation logic indicated by each target parameter label.
S404, if the operation logic indicated by each target interface label and each target parameter label in the target label group is normal, triggering and executing to acquire the test parameters corresponding to each target parameter label in the target label group.
In step S403 to step S404, the operation logic indicated by each target interface tag and each target parameter tag in the target tag group is normally represented, and the functional module corresponding to each target interface tag in the target tag group will not generate logic conflict when processing the test parameters corresponding to each target parameter tag in the target tag group. For example, if two interface tag groups are obtained, namely an interface tag group 1 and an interface tag group 2, if the interface tag group 1 comprises 3 interface tags, namely A1, A2 and A3, the interface tag group 2 comprises 3 interface tags, namely B1, B2 and B3; if 3 parameter tag groups are obtained, namely a parameter tag group 1, a parameter tag group 2 and a parameter tag group 3 respectively, if the parameter tag group 1 comprises 2 parameter tags, namely A1 and A2 respectively, the parameter tag group 2 comprises 3 parameter tags, namely B1, B2 and B3 respectively, and if the parameter tag group 3 comprises 4 parameter tags, namely c1, c2, c3 and c4 respectively, the obtained interface tag groups and the obtained parameter tag groups are expressed as { [ A1, A2 and A3], [ B1, B2 and B3], [ A1 and A2], [ B1, B2 and B3], [ c1, c2, c3 and c4] }; if the correspondence between the plurality of interface tag groups and the plurality of parameter tag groups indicates: if the interface tag group 1 corresponds to the parameter tag group 1, the interface tag group 2 corresponds to the parameter tag group 2 and the parameter tag group 3, if the running logic of the code to be tested indicates that the code to be tested is to be considered abnormal when the test parameter corresponding to the parameter tag B3 and the test parameter corresponding to the parameter tag c4 are processed at the same time, if the combination of the target parameter tags in the currently traversed target tag group includes the combination of B3 and c4 (for example, the target tag groups "A1, B1, A1, B3, c4", "A2, B1, A3, c4", "A1, B2, A1, B3, c4", etc.), the test case generating device may output prompt information to prompt that the target test case for the target tag group is not generated. In a specific implementation, the test case generating device may determine whether the operation logic indicated by each target interface tag and each target parameter tag in the target tag group is normal according to a preset determination rule, where the preset determination rule may be set according to the operation logic of the code to be tested.
S405, based on the calling of the interface calling method corresponding to each target interface label in the target label group to the test parameter corresponding to the target parameter label in the target label group, generating the target test case corresponding to the target label group.
The related process of step S405 is similar to the related process of step S204, and will not be described herein.
In one embodiment, after the test case generating device generates the target test case corresponding to the target tag group, the target test case corresponding to the target tag group may be output, so that the target object may learn about the target test case corresponding to the target tag group; furthermore, the test case generating device can test the code to be tested by adopting the target test case corresponding to the target tag group to obtain the test result of the code to be tested based on the target tag group, and further can output the test result of the code to be tested based on the target tag group so that the target object can know the test result of the code to be tested based on the target tag group.
In one embodiment, the target object may also perform partial input on the plurality of interface tag groups and the plurality of parameter tag groups, so that the test case generating device generates the test case based on the specific input of the target object. For example, if two interface tag groups are obtained based on analysis of each functional module in the code to be tested, the two interface tag groups are respectively an interface tag group 1 and an interface tag group 2, the interface tag group 1 comprises 3 interface tags respectively an A1, an A2 and an A3, and the interface tag group 2 comprises 3 interface tags respectively a B1, a B2 and a B3; if 3 parameter tag groups are obtained based on analysis of each functional module in the code to be tested, namely a parameter tag group 1, a parameter tag group 2 and a parameter tag group 3 respectively, if the parameter tag group 1 comprises 2 parameter tags, namely A1 and A2 respectively, the parameter tag group 2 comprises 3 parameter tags, namely B1, B2 and B3 respectively, and if the parameter tag group 3 comprises 4 parameter tags, namely c1, c2, c3 and c4 respectively, the target object can input a part of interface tag groups such as { [ A1, A2], [ B1, B3], [ A1, A2], [ B1, B2], [ c1, c2, c3] }, { [ A1, A2, A3], [ A1, A2], [ B1, B2, B3], [ c1, c2] }, and the like and a part of parameter tag groups; and the test case generating device can generate the test case according to the specific input of the target object.
In one embodiment, the test case generating device may generate a target test case corresponding to a specified tag group based on the specified tag group input by the target object, and in a specific implementation, the test case generating device may receive a test request input by the target object; the test request carries a specified tag group comprising: a specified interface tag determined from each of the plurality of interface tag groups and a specified parameter tag determined from each of the plurality of parameter tag groups; acquiring a target test case corresponding to a specified tag group; and testing the code to be tested by adopting a target test case corresponding to the specified tag group to obtain a test result of the code to be tested based on the specified tag group. The process that the test case generating device obtains the target test case corresponding to the specified tag group is similar to the process that the test case generating device generates the target test case corresponding to the target tag group which is traversed currently, and is not repeated here; optionally, if the test case generating device receives the test request input by the target object after traversing the plurality of interface tag groups and the plurality of parameter tag groups to obtain the target test cases corresponding to the plurality of target tag groups, the test case generating device may obtain the target test case corresponding to the specified tag group from the target test cases corresponding to the plurality of target tag groups.
In the embodiment of the application, after a plurality of interface tag groups and a plurality of parameter tag groups are acquired, traversing the plurality of interface tag groups and the plurality of parameter tag groups, and determining a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; wherein any one of the plurality of interface tag groups includes at least one interface tag, any one of the plurality of parameter tag groups includes at least one parameter tag, and the target tag group includes: a target interface tag determined from each of the plurality of interface tag groups and a target parameter tag determined from each of the plurality of parameter tag groups; the method comprises the steps of detecting each target interface label in a target label group and operation logic indicated by each target parameter label, acquiring test parameters corresponding to each target parameter label in the target label group under the condition that each target interface label in the target label group and the operation logic indicated by each target parameter label are normal, and further calling the test parameters corresponding to the target parameter labels in the target label group based on an interface calling method corresponding to each target interface label in the target label group to generate a target test case corresponding to the target label group; the method and the device can avoid that under the condition that the operation logic indicated by each target interface label and each target parameter label in the target label group is abnormal, the related process of generating the target test case corresponding to the target label group is still executed aiming at the target label group, so that the computing resource can be saved, and the test case generation efficiency and the generation rate can be improved.
Based on the above embodiments, the embodiment of the present application provides another test case generating method. Referring to fig. 5, a flowchart of another test case generating method according to an embodiment of the present application is shown. The test case generating method shown in fig. 5 may be performed by the test case generating device. The test case generation method shown in fig. 5 may include the steps of:
s501, constructing interface labels of all functional modules in the code to be tested, and constructing a plurality of interface label groups based on the interface labels of all functional modules in the code to be tested.
The code module corresponding to each interface tag included in any one of the plurality of interface tag groups is used for realizing the same function.
In one embodiment, if the code to be tested is a code for implementing a resource transfer function, the function modules for implementing the resource transfer function from different paths can be grouped into one group by analyzing the code to be tested, and then interface tags corresponding to the function modules for implementing the resource transfer function from different paths are built into one interface tag group; the functional modules for realizing the order function generated from different ways can be grouped into one group, and then the interface labels corresponding to the functional modules for realizing the order function generated from different ways are assembled into one interface label group; for example, if the functional modules for implementing the resource transfer function from different paths are respectively: the change payment function module, the quick payment function module and the change general payment function module are respectively provided with interface labels corresponding to the function modules: banpay, fpay, lqtpay; the functional modules for realizing the function of generating orders from different paths are respectively as follows: the large order placing function module, the public order placing function module and the closing order placing function module are respectively provided with interface labels corresponding to the function modules: plant_public_api, public_api, plant_reorder; the interface tag group 1 of the two interface tag groups is constructed to include: banpay, fpay, lqtpay the interface tag group 2 includes a plant_public_api, a public_api, a plant_reorder. Further, in order to adapt to users with different language habits, a mapping relationship between the interface tag of the first format and the initial interface tag of the second format may be constructed, if the second format is set to be chinese, each interface tag banpay, fpay, lqtpay in the interface tag group 1, the corresponding initial interface tag of the second format may be: change payment, quick payment and change general payment, wherein the initial interface labels of the corresponding second format in each interface label set 2, including the label set_public_api, public_api and the label set_pre, can be: big order, public order, and closing order.
S502, aiming at any one of a plurality of interface tag groups, obtaining a parameter tag corresponding to any one interface tag group based on parameter analysis of a functional module corresponding to each interface tag in any one interface tag group.
In one embodiment, the test case generating device determines, for any one of the plurality of interface tag groups, a parameter tag of the common reference based on parameter analysis of a function module corresponding to each interface tag in the interface tag group, so as to identify each common reference when obtaining a parameter tag corresponding to the interface tag group. Further, in order to adapt to users with different language habits, a mapping relationship between a parameter tag in a first format and an initial parameter tag in a second format may be constructed, if the second format is set to be chinese, if a code to be tested is a code for implementing a resource transfer function, for interface tag group 1 in a plurality of determined interface tag groups, that is, for a functional module for implementing a resource transfer function from different ways, the interface tag group formed by the corresponding interface tag is taken as an example, and if common parameters of a change payment functional module, a quick payment functional module and a change pass payment functional module are respectively: the parameter type is of the verification type: parameters for verifying passwords, parameters for verifying fingerprints in ios systems, parameters for verifying fingerprints in android systems, parameters for verifying facial information, parameters for secret-free payments; the parameter type is the verification short message type: parameters for short message verification and parameters for payment free of short message verification, wherein the parameters are of a close payment type: parameters for intimate contact, parameters for non-intimate contact, the parameter types are user types: parameters for characterizing a user as an unregistered user, parameters for characterizing a user unbound card, parameters for characterizing a user bound card, parameters for characterizing a user as a foreign unregistered user, parameters for characterizing a user as a foreign unbound card user, parameters for characterizing a user as a foreign bound card user; the resulting parameter tags of the first format corresponding to the interface tag group, and the corresponding initial parameter tags of the second format, may be shown in table 1 below.
TABLE 1
S503, classifying the parameter labels corresponding to any interface label group according to the parameter types to obtain one or more parameter label groups corresponding to any interface label group.
In step S502 to step S503, the parameter types of the parameter labels included in the different parameter label groups are different; for each interface tag shown in table 1, each parameter tag may be classified according to the parameter type as the verification type, the verification message type, the intimacy type, and the user type, to obtain 4 parameter tag groups corresponding to the interface tag group.
In one embodiment, after the test case generating device obtains the interface calling methods corresponding to each functional module in the code to be tested, the interface calling methods of each functional module can be packaged, the interface calling methods obtained by packaging each functional module can be stored in a scene serial layer of the test case generating model, and the interface calling methods obtained by packaging each functional module can be maintained based on the interface labels corresponding to each functional module; after the test case generating device obtains the parameter encryption methods corresponding to the parameter labels, the parameter encryption methods corresponding to the parameter labels can be packaged, the parameter encryption methods corresponding to the parameter labels obtained through packaging can be stored in a business logic layer of the test case generating model, the parameter encryption methods corresponding to the parameter labels obtained through packaging can be maintained based on the parameter labels, wherein the parameter encryption methods corresponding to the parameter labels can be used for encrypting original parameters corresponding to the input parameter labels, and test parameters corresponding to the parameter labels and capable of being called by the interface calling method are obtained. Optionally, the scene tandem layer may be divided into a service layer (i.e. a service layer) and a terminal layer (i.e. a client layer), the interface calling method corresponding to each functional module may be stored in the terminal layer (i.e. the client layer) in the scene tandem layer, and is called by the service layer in the scene tandem layer, specifically, the interface calling method corresponding to each target interface tag in the target tag group included in the scene tandem layer calls the test parameters acquired from the service logic layer, and the generated interface test cases corresponding to each target interface tag are combined to obtain the target test case corresponding to the target tag group. Further optionally, the parameter encryption method corresponding to each parameter label may further encapsulate other functions on the basis of implementing encryption of the original parameter corresponding to each parameter label, for example, may encapsulate a parameter verification method for performing parameter verification on the original parameter corresponding to each input parameter label, and may encapsulate a packet sending method for sending, to the scene tandem layer, the test parameter corresponding to each parameter label obtained by encrypting the original parameter corresponding to each parameter label; alternatively, the method parts common to the parameter encryption method, the parameter verification method, and the packet sending method may be automatically generated by the test case generating device. The business logic layer comprising the parameter encryption method for encrypting the original parameters input by the user is split, and the parameter encryption methods corresponding to the parameter labels are divided according to the parameter types, so that the parameters can be rapidly expanded; for example, if the test parameters need to be newly added, only a corresponding parameter encryption method needs to be newly added in the service logic layer, and a parameter label is newly added for maintenance, so that the modification cost is reduced.
Referring to fig. 6, a schematic structural diagram of another test case generation model provided by an embodiment of the present application, where the test case generation model is adaptive and applicable to a resource transfer scenario; the test case generation model can comprise a calling layer, a scene series layer and a service logic layer, wherein the scene series layer is specifically divided into a service layer and a terminal layer; the call layer is used for traversing the plurality of interface tag groups and the plurality of parameter tag groups, and determining a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; the service logic layer comprises a parameter encryption method corresponding to each parameter label in a plurality of parameter label groups, the original parameters corresponding to each target parameter label in the obtained target label groups can be subjected to parameter encryption processing through the parameter encryption method corresponding to each target parameter label in the target label groups, test parameters corresponding to each target parameter label in the target label groups are obtained, and the test parameters corresponding to each target parameter label in the target label groups are sent to the scene serial layer; the terminal layer of the scene tandem layer can comprise interface calling methods corresponding to all interface labels in a plurality of interface label groups, the scene tandem layer is used for receiving the target label groups sent by the calling layer, and calling the test parameters corresponding to the target parameter labels in the target label groups acquired from the service logic layer through the interface calling methods corresponding to all the target interface labels in the target label groups in the terminal layer of the scene tandem layer to generate interface test cases corresponding to all the target interface labels, and then combining the interface test cases corresponding to all the target interface labels generated in the terminal layer through the service layer of the scene tandem layer to obtain the target test cases corresponding to the target label groups.
Further, the test case generation model may further include a data persistence layer, a public method layer, a request sending layer, a protocol layer (also referred to as an outer link layer), and a service domain layer; the protocol layer may include an interface protocol, which is used for reading original parameters corresponding to each parameter tag in a plurality of parameter tag groups input by a target object, the request sending layer includes an initialization method of a request class, a response class, and the like, which is used for initializing the original parameters corresponding to each parameter tag in the read plurality of parameter tag groups into a request class or a response class, so that the original parameters corresponding to each parameter tag in the read plurality of parameter tag groups are called by a service logic layer through the request class or the response class, the common method layer includes a common method of a specific service scenario, for example, a common service method included in a resource transfer scenario is a common service method in a resource transfer field (i.e. an electronic payment field), including a service common result verification method, a service parameter processing method, and the like, the data persistence layer carries the capability of data storage and access, and can exchange with underlying data, obtain service information data, and can interact with other dependent components (e.g. a service logic layer), the service domain layer includes a global variable required in the whole process flow is defined, and is a layer of a service system most frequently occurring throughout the whole flow.
In the process of generating the test case of the code to be tested based on the plurality of interface tag groups and the plurality of parameter tag groups through the test case generation model shown in fig. 6, the test case generation device can read the interface protocol through the protocol layer, and read the original parameters corresponding to each parameter tag in the plurality of parameter tag groups input by the target user based on the interface protocol, and initialize the read original parameters corresponding to each parameter tag in the plurality of parameter tag groups to a request class or a response class through the request sending layer, so that the service logic layer can conveniently realize the calling of the original parameters corresponding to each parameter tag in the plurality of parameter tag groups through the calling of the request class or the response class.
Further, the original parameters corresponding to each parameter label in the plurality of parameter label groups can be respectively encrypted through a parameter encryption method corresponding to each parameter label in the plurality of parameter label groups included in the service logic layer to obtain test parameters corresponding to each parameter label in the plurality of parameter label groups, after the interface layer receives the plurality of interface label groups and the plurality of parameter label groups, the plurality of interface label groups and the plurality of parameter label groups can be traversed through the calling layer to obtain a currently traversed target label group, and the target label group is sent to the scene serial layer; after receiving the target tag group sent by the calling layer, the scene tandem layer can call the test parameters corresponding to the target parameter tags in the target tag group acquired from the service logic layer through the interface calling method corresponding to each target interface tag in the target tag group included in the terminal layer of the scene tandem layer, generate interface test cases corresponding to each target interface tag, and combine the interface test cases corresponding to each target interface tag based on the service layer in the scene tandem layer to obtain the target test cases corresponding to the target tag group.
In another possible implementation manner, after the interface layer receives the plurality of interface tag groups and the plurality of parameter tag groups, the interface layer may traverse the plurality of interface tag groups and the plurality of parameter tag groups to obtain a currently traversed target tag group, and send the target tag group to the scene tandem layer; after receiving the target tag group sent by the calling layer, the scene tandem layer can send a test parameter acquisition request to the service logic layer through an interface calling method corresponding to each target interface tag in the target tag group included in the terminal layer of the scene tandem layer so as to request to return test parameters corresponding to each target parameter tag in the target tag group; after the service logic layer receives the test parameter acquisition request, the service logic layer can encrypt original parameters corresponding to each target parameter label in the target label group through a parameter encryption method corresponding to each target parameter label in the target label group, so as to obtain test parameters corresponding to each target parameter label in the target label group, and return the test parameters corresponding to each target parameter label in the target label group to an interface calling method corresponding to each target interface label in the target label group in the terminal layer in the scene serial layer, so that the test parameters corresponding to the target parameter label in the target label group acquired by the service logic layer are called, interface test cases corresponding to each target interface label are generated, and the interface test cases corresponding to each target interface label are combined based on the service layer in the scene serial layer, so as to obtain the target test cases corresponding to the target label group.
S504, a plurality of interface tag groups and a plurality of parameter tag groups are obtained.
Wherein any one of the plurality of interface tag groups comprises at least one interface tag, and any one of the plurality of parameter tag groups comprises at least one parameter tag; the related process of step S504 is similar to the related process of step S201, and will not be described here.
S505, traversing the plurality of interface tag groups and the plurality of parameter tag groups, and determining the currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups.
Wherein, the target tag group includes: a target interface tag determined from each of the plurality of interface tag groups and a target parameter tag determined from each of the plurality of parameter tag groups.
In one embodiment, if the function modules for realizing the function of generating orders from different paths are the following common parameters: the parameter type is the following type: parameters for characterizing delegated proxy buckles, parameters for characterizing non-delegated proxy buckles (i.e., parameters for characterizing cash register payments), then traversing multiple interface tag sets and multiple parameter tag sets may result in A target tag group; the target tag group can be used for indicating the running logic of the code to be tested in a specific scene, and by traversing the interface tag groups and the parameter tag groups, the fully covered target tag group for the code to be tested can be generated, and further, the test case for testing the code to be tested in the fully covered scene can be generated.
S506, test parameters corresponding to the target parameter labels in the target label group are obtained.
S507, based on the calling of the test parameters corresponding to the target parameter labels in the target label group by the interface calling method corresponding to each target interface label in the target label group, generating the target test case corresponding to the target label group.
The related processes of step S506 to step S507 are similar to those of step S203 to step S204, and are not described herein.
Referring to fig. 7, a flow chart of another test case generating method according to an embodiment of the present application is provided, if a plurality of initial interface tag groups and a plurality of initial parameter tag groups obtained by a test case generating device are: { [ Change Payment, quick Payment, change Payment ], [ big order, public order, close order ], [ secret, ios fingerprint, android, face inspection, secret free ], [ short, short free ], [ intimate, non-intimate ], [ unregistered, unbound card, bound card, unregistered abroad, unbound card abroad, bound card abroad ], [ commissioned substitute button, non-commissioned substitute button ] }, wherein commissioned substitute button is an original parameter label in a second format corresponding to interface label group [ big order, public order, close order ]; further, the test case generating device may map each initial interface tag in the plurality of initial interface tag groups in the second format to an interface tag in the first format based on a preset mapping relationship, and map each initial parameter tag in the plurality of initial parameter tag groups in the second format to a parameter tag in the first format, so as to obtain an interface tag group corresponding to each initial interface tag group in the plurality of initial interface tag groups and a parameter tag group corresponding to each initial parameter tag group in the plurality of initial parameter tag groups; the test case generating device can traverse a plurality of interface tag groups and a plurality of parameter tag groups, and the currently traversed target tag group is determined from the plurality of interface tag groups and the plurality of parameter tag groups.
In another possible implementation manner, the test case generating device may traverse a plurality of initial interface tag groups and a plurality of initial parameter tag groups, determine an initial target tag group currently traversed from the plurality of initial interface tag groups and the plurality of initial parameter tag groups, and map the initial target tag group in the second format to the target tag group in the first format based on a preset mapping relationship. If the initial target label group traversed currently is [ change payment, big order ordering, secret verification, short-free, non-intimate payment, bound card and non-entrusted substitute button ]; the test case generating device can call the test parameters corresponding to the non-entrusted substitute deduction based on the interface calling method corresponding to the large order to generate the interface test case corresponding to the large order, and can call the test parameters corresponding to the short-free, non-intimate and bound card based on the interface calling method corresponding to the change payment to generate the interface test case corresponding to the change payment; and combining the interface test case corresponding to the large order with the interface test case corresponding to the change payment to obtain a target test case.
In one embodiment, the parameter encryption methods corresponding to different parameter labels can be packaged into different plug-ins, the test parameters are extracted from the plug-ins, and the test parameters can be called in a plurality of interface calling methods only by setting one time; referring to fig. 8a, a flowchart of another test case generating method according to an embodiment of the present application is shown; if two interface tag groups are obtained, namely an interface tag group 1 and an interface tag group 2, if the interface tag group 1 comprises 3 interface tags, namely A1, A2 and A3, the interface tag group 2 comprises 3 interface tags, namely B1, B2 and B3; if 3 parameter tag groups are obtained, namely, a parameter tag group 1, a parameter tag group 2 and a parameter tag group 3, if the parameter tag group 1 comprises 2 parameter tags, namely, A1 and A2 respectively, the parameter tag group 2 comprises 3 parameter tags, namely B1, B2 and B3 respectively, and if the parameter tag group 3 comprises 4 parameter tags, namely c1, c2, c3 and c4 respectively, the obtained interface tag groups and the obtained parameter tag groups are shown as { [ A1, A2 and A3], [ B1, B2 and B3], [ A1, A2], [ B1, B2, B3], [ c1, c2, c3 and c4] }; the interface layer may traverse the plurality of interface tag groups and the plurality of parameter tag groups to obtain a plurality of target tag groups, where the plurality of target tag groups may include: 216 target tag groups such as [ a1+b1+b1+c1 ], [ a2+b1+a1+b1+c1], [ a3+b1+a1+b1+c1], [ a1+b2+a1+b1+c1], [ a1+b3+a1+b1+c1], and the like, and if the correspondence between the plurality of interface tag groups and the plurality of parameter tag groups indicates: the interface tag group 1 corresponds to the parameter tag group 1, and the interface tag group 2 corresponds to the parameter tag group 2 and the parameter tag group 3; when generating target test cases corresponding to different target tag groups, repeated input of test parameters needed to be used by the different target tag groups is not needed, and only parameter plug-ins corresponding to parameter tags a1 and a2, parameter plug-ins corresponding to parameter tags b1, b2 and b3 and parameter plug-ins corresponding to parameter tags c1, c2 and c3 are needed to be utilized in a business logic layer, so that the corresponding test parameters can be called in interface calling methods corresponding to different interface tags in a plurality of interface tag groups; and further combining the interface test cases corresponding to the target interface tags in any one of the obtained target tag groups in the scene series layer to obtain the test cases corresponding to any one of the target tag groups, thereby obtaining the test cases corresponding to all the target tag groups.
Referring to fig. 8b, a schematic diagram of a test case generated in an existing test case generating method according to an embodiment of the present application is shown; in the existing test case generation method, target objects need to sequentially input all target tag groups and test parameters corresponding to all target tag groups; taking a target test case of one target tag group input by a target object as an example, in the existing test case generation method, after receiving each target tag group and test parameters corresponding to each target tag group, test case generation equipment can call different target interface tags in the target tag group, and call the test parameters corresponding to the specific parameter tag group indicated by the target tag group by using an interface call method under the specific parameter tag group indicated by the target tag group, so as to generate a target test case corresponding to the target tag group; that is, for the target tag group [ a1+b1+a1+b1+c1], the target interface tag A1 has an interface calling method when the corresponding target parameter tag is A1, the target interface tag B1 has an interface calling method when the corresponding target parameter tag is b1+c1, the target tag A1 has an interface calling method when the corresponding target parameter tag is a2, and the target interface tag B1 has an interface calling method when the corresponding target parameter tag is b2+c1, so that multiple interface calling methods for the same interface tag need to be written, that is, multiple interface calling methods for the same functional module need to be written, the workload is huge, and the written multiple interface calling methods may increase difficulty in modifying and maintaining the interface calling method due to the problems of non-uniform writing style and the like. In the test case generation method provided by the application, only one interface calling method is required to be written aiming at the same interface label, namely, only one interface calling method is required to be written for the same functional module, the workload is small, the code quantity of the interface calling method is small, and the maintenance is convenient.
In one embodiment, by comparing the test case generating method provided by the present application with the existing test case generating method, it is found that the test case generating method provided by the present application has better effects on multiple dimensions than the existing test case generating method, and the specific comparison result can be shown in the following table 2:
TABLE 2
/>
As can be seen from Table 2, compared with the existing test case generation method, the test case generation method provided by the application has the advantages of improving the code repetition rate, the code quantity, the change cost and the like, and improving the writing time (wherein, writing time (new scene) is the time consumed by code modification of the corresponding test case generation method when the pointer is used for the new function of the code to be tested, and writing time (old scene) is the time consumed by code modification of the corresponding test case generation method when the pointer is used for the existing function of the code to be tested). For example, when a function module for implementing the same function as the function module indicated by an interface tag group is added on the basis of the function module indicated by the interface tag group, for example, a function module for generating an order function from another path is added on the basis of the function module for implementing the function of generating an order from a different path, only the interface calling method corresponding to the newly added function module is needed to be newly added in the interface calling method corresponding to the interface tag group, and the parameter encryption method corresponding to the newly added function module is needed to be newly added in the parameter tag group corresponding to the interface tag group, without changing other parts; for another example, when the test parameters are needed to be newly added, only a corresponding parameter encryption method is needed to be newly added in the service logic layer, and a parameter label is newly added for maintenance, so that the modification cost is reduced.
In the embodiment of the application, the interface label of each functional module in the code to be tested can be constructed by analyzing each functional module in the code to be tested, a plurality of interface label groups are constructed based on the interface label of each functional module in the code to be tested, and the code module corresponding to each interface label included in any one of the plurality of interface label groups is used for realizing the same function; aiming at any one of a plurality of interface tag groups, obtaining a parameter tag corresponding to any one interface tag group based on parameter analysis of a functional module corresponding to each interface tag in any one interface tag group, and classifying the parameter tag corresponding to any one interface tag group according to a parameter type to obtain one or more parameter tag groups corresponding to any one interface tag group; the parameter types of the parameter labels included in the different parameter label groups are different; after the interface calling methods corresponding to the functional modules in the code to be tested are obtained, the interface calling methods of the functional modules can be packaged and stored in a scene serial layer of the test case generation model, and after the parameter encryption methods corresponding to the parameter labels are obtained, the parameter encryption methods corresponding to the parameter labels can be packaged and stored in a business logic layer of the test case generation model; further, after a plurality of interface tag groups, a plurality of parameter tag groups and test parameters corresponding to each parameter tag in the plurality of parameter tag groups are obtained, a test case is generated based on the calling of the corresponding test parameters by the interface calling method corresponding to each interface tag in the plurality of interface tag groups; by analyzing each functional module in the code to be tested, interface labels corresponding to each functional module and parameter labels corresponding to each functional module can be generated, and then test cases with full coverage of the code to be tested can be generated based on the acquired interface labels in the plurality of interface label groups and the acquired parameter labels in the plurality of parameter label groups.
Based on the related embodiments of the test case generation method, the embodiment of the application provides a test case generation device. Referring to fig. 9, a schematic structural diagram of a test case generating device according to an embodiment of the present application may include an obtaining unit 901 and a processing unit 902. The test case generating device shown in fig. 9 may operate the following units:
an acquiring unit 901, configured to acquire a plurality of interface tag groups and a plurality of parameter tag groups; any one of the plurality of interface tag groups includes at least one interface tag, and any one of the plurality of parameter tag groups includes at least one parameter tag;
a processing unit 902, configured to traverse the plurality of interface tag groups and the plurality of parameter tag groups, and determine a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; the target tag group includes: a target interface tag determined from each of the plurality of interface tag groups and a target parameter tag determined from each of the plurality of parameter tag groups;
the processing unit 902 is further configured to obtain test parameters corresponding to each target parameter tag in the target tag group;
The processing unit 902 is further configured to generate a target test case corresponding to the target tag group based on a call of the interface call method corresponding to each target interface tag in the target tag group to the test parameter corresponding to the target parameter tag in the target tag group.
In one embodiment, the processing unit 902 is further configured to:
acquiring original parameters corresponding to each parameter label in the plurality of parameter label groups;
and respectively carrying out encryption processing on original parameters corresponding to each parameter label in the parameter label groups based on the parameter encryption method corresponding to each parameter label in the parameter label groups to obtain test parameters corresponding to each parameter label in the parameter label groups.
In one embodiment, when the processing unit 902 obtains the test parameters corresponding to each target parameter tag in the target tag group, the following operations are specifically executed:
acquiring original parameters corresponding to each target parameter label in the target label group;
and respectively carrying out encryption processing on original parameters corresponding to each target parameter label in the target label group based on a parameter encryption method corresponding to each target parameter label in the target label group to obtain test parameters corresponding to each target parameter label in the target label group.
In one embodiment, the processing unit 902 specifically performs the following operations when generating the target test case corresponding to the target tag group based on the call of the interface call method corresponding to each target interface tag in the target tag group to the test parameter corresponding to the target parameter tag in the target tag group:
determining a parameter tag group corresponding to any one of the target interface tags based on the corresponding relation between the plurality of interface tag groups and the plurality of parameter tag groups aiming at any one of the target interface tags;
acquiring a target parameter label determined from a parameter label group corresponding to any target interface label from all target parameter labels of the target label group;
generating an interface test case corresponding to any target interface label based on the call of the interface call method corresponding to the any target interface label to the test parameter corresponding to the obtained target parameter label;
and combining the interface test cases corresponding to the target interface tags in the target tag group to obtain the target test cases corresponding to the target tag group.
In one embodiment, a tag format of each interface tag in the plurality of interface tag groups and each parameter tag in the plurality of parameter tag groups is a first format;
When the obtaining unit 901 obtains the plurality of interface tag groups and the plurality of parameter tag groups, the following operations are specifically executed:
acquiring a plurality of initial interface tag groups and a plurality of initial parameter tag groups; any one of the plurality of initial interface tag groups comprises at least one initial interface tag, any one of the plurality of initial parameter tag groups comprises at least one initial parameter tag, and each initial interface tag in the plurality of initial interface tag groups and each initial parameter tag in the plurality of initial parameter tag groups have a tag format of a second format;
based on a preset mapping relation, mapping each initial interface tag in a plurality of initial interface tag groups in a second format into an interface tag in a first format, and mapping each initial parameter tag in a plurality of initial parameter tag groups in the second format into a parameter tag in the first format to obtain an interface tag group corresponding to each initial interface tag group in the plurality of initial interface tag groups and a parameter tag group corresponding to each initial parameter tag group in the plurality of initial parameter tag groups.
In one embodiment, the processing unit 902 is further configured to:
Detecting operation logic indicated by each target interface label and each target parameter label in the target label group;
and if the operation logic indicated by each target interface label and each target parameter label in the target label group is normal, triggering and executing to acquire the test parameters corresponding to each target parameter label in the target label group.
In one embodiment, the processing unit 902 is further configured to:
constructing interface labels of all functional modules in a code to be tested, and constructing a plurality of interface label groups based on the interface labels of all functional modules in the code to be tested; code modules corresponding to the interface tags included in any one of the plurality of interface tag groups are used for realizing the same function;
aiming at any one interface tag group in the plurality of interface tag groups, obtaining a parameter tag corresponding to the any one interface tag group based on parameter analysis of a functional module corresponding to each interface tag in the any one interface tag group;
classifying the parameter labels corresponding to any interface label group according to the parameter types to obtain one or more parameter label groups corresponding to any interface label group; the parameter tag groups include parameter tags of different parameter types.
In one embodiment, the obtaining unit 901 is further configured to: receiving a test request input by a target object; the test request carries a specified tag group, the specified tag group comprising: a specified interface tag determined from each of the plurality of interface tag groups and a specified parameter tag determined from each of the plurality of parameter tag groups;
the processing unit 902 is further configured to obtain a target test case corresponding to the specified tag group;
the processing unit 902 is further configured to test a code to be tested by using a target test case corresponding to the specified tag group, so as to obtain a test result of the code to be tested based on the specified tag group; the code to be tested is used for realizing the resource transfer function.
In one embodiment, the test case generation method is implemented through a test case generation model, and the test case generation model comprises a calling layer, a scene series layer and a business logic layer; the calling layer is used for traversing the plurality of interface tag groups and the plurality of parameter tag groups, and determining a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; the service logic layer is used for acquiring test parameters corresponding to each target parameter label in the target label group and sending the test parameters corresponding to each target parameter label in the target label group to the scene serial layer; the scene serial layer is used for receiving the target tag group sent by the calling layer, and calling the test parameters corresponding to the target parameter tags in the target tag group obtained from the service logic layer through the interface calling method corresponding to each target interface tag in the target tag group included in the scene serial layer, so as to generate the target test case corresponding to the target tag group.
According to one embodiment of the present application, the steps involved in the test case generating methods shown in fig. 2, 4, and 5 may be performed by the respective units in the test case generating apparatus shown in fig. 9. For example, step S201 shown in fig. 2 may be performed by the acquisition unit 901 in the test case generating device shown in fig. 9, and steps S202 to S204 shown in fig. 2 may be performed by the processing unit 902 in the test case generating device shown in fig. 9. As another example, step S401 shown in fig. 4 may be performed by the acquisition unit 901 in the test case generating device shown in fig. 9, and steps S402 to S405 shown in fig. 4 may be performed by the processing unit 902 in the test case generating device shown in fig. 9. For another example, step S504 shown in fig. 5 may be performed by the acquisition unit 901 in the test case generating device shown in fig. 9, and steps S501 to S503 and steps S505 to S507 shown in fig. 5 may be performed by the processing unit 902 in the test case generating device shown in fig. 9.
According to another embodiment of the present application, each unit in the test case generating device shown in fig. 9 may be separately or completely combined into one or several other units, or some unit(s) thereof may be further split into a plurality of units with smaller functions, which may achieve the same operation without affecting the implementation of the technical effects of the embodiments of the present application. The above units are divided based on logic functions, and in practical applications, the functions of one unit may be implemented by a plurality of units, or the functions of a plurality of units may be implemented by one unit. In other embodiments of the present application, the test case generating device based on logic function division may also include other units, and in practical applications, these functions may also be implemented with assistance of other units, and may be implemented by cooperation of multiple units.
According to another embodiment of the present application, a test case generating apparatus as shown in fig. 9 may be constructed by running a computer program (including program code) capable of executing the steps involved in the respective methods shown in fig. 2, 4 and 5 on a general-purpose computing device such as a computer including a processing element such as a Central Processing Unit (CPU), a random access storage medium (RAM), a read only storage medium (ROM), and the like, and a storage element, and implementing the test case generating method of the embodiment of the present application. The computer program may be recorded on, for example, a computer readable storage medium, and loaded into and executed by the computing device described above.
Based on the related embodiment of the test case generation method and the test case generation device embodiment, the application also provides test case generation equipment. Referring to fig. 10, a schematic structural diagram of a test case generating device according to an embodiment of the present application is provided. The test case generating apparatus shown in fig. 10 may include at least a processor 1001, an input interface 1002, an output interface 1003, and a computer storage medium 1004. Wherein the processor 1001, input interface 1002, output interface 1003, and computer storage medium 1004 may be connected by a bus or other means.
The computer storage medium 1004 may be stored in a memory of the test case generating device, the computer storage medium 1004 is used to store a computer program, the computer program includes program instructions, and the processor 1001 is used to execute the program instructions stored in the computer storage medium 1004. The processor 1001 (or CPU (Central Processing Unit, central processing unit)) is a computing core and a control core of the test case generating device, which are adapted to implement one or more instructions, in particular to load and execute one or more instructions to implement the above-described test case generating method flow or corresponding functions.
The embodiment of the application also provides a computer storage medium (Memory), which is a Memory device in the test case generating device and is used for storing programs and data. It will be appreciated that the computer storage medium herein may include both a built-in storage medium in the terminal and an extended storage medium supported by the terminal. The computer storage medium provides a storage space that stores an operating system of the terminal. Also stored in this memory space are one or more instructions, which may be one or more computer programs (including program code), adapted to be loaded and executed by the processor 1001. Note that the computer storage medium may be a high-speed random access memory (random access memory, RAM) or a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory; optionally, at least one computer storage medium remote from the processor may be present.
In one embodiment, one or more instructions stored in a computer storage medium may be loaded and executed by the processor 1001 and the input interface 1002 to implement the corresponding steps of the methods described above in connection with the test case generation method embodiments of fig. 2, 4, and 5, and in a specific implementation, the one or more instructions in a computer storage medium are loaded and executed by the processor 1001 and the input interface 1002 as follows:
an input interface 1002, configured to obtain a plurality of interface tag groups and a plurality of parameter tag groups; any one of the plurality of interface tag groups includes at least one interface tag, and any one of the plurality of parameter tag groups includes at least one parameter tag;
a processor 1001, configured to traverse the plurality of interface tag groups and the plurality of parameter tag groups, and determine a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; the target tag group includes: a target interface tag determined from each of the plurality of interface tag groups and a target parameter tag determined from each of the plurality of parameter tag groups;
The processor 1001 is further configured to obtain test parameters corresponding to each target parameter tag in the target tag group;
the processor 1001 is further configured to generate a target test case corresponding to the target tag group based on a call of the interface call method corresponding to each target interface tag in the target tag group to the test parameter corresponding to the target parameter tag in the target tag group.
In one embodiment, the processor 1001 is further configured to:
acquiring original parameters corresponding to each parameter label in the plurality of parameter label groups;
and respectively carrying out encryption processing on original parameters corresponding to each parameter label in the parameter label groups based on the parameter encryption method corresponding to each parameter label in the parameter label groups to obtain test parameters corresponding to each parameter label in the parameter label groups.
In one embodiment, when the processor 1001 obtains the test parameters corresponding to each target parameter tag in the target tag group, the following operations are specifically executed:
acquiring original parameters corresponding to each target parameter label in the target label group;
and respectively carrying out encryption processing on original parameters corresponding to each target parameter label in the target label group based on a parameter encryption method corresponding to each target parameter label in the target label group to obtain test parameters corresponding to each target parameter label in the target label group.
In one embodiment, the processor 1001 specifically executes the following operations when generating the target test case corresponding to the target tag group based on the call of the test parameter corresponding to the target parameter tag in the target tag group by the interface call method corresponding to each target interface tag in the target tag group:
determining a parameter tag group corresponding to any one of the target interface tags based on the corresponding relation between the plurality of interface tag groups and the plurality of parameter tag groups aiming at any one of the target interface tags;
acquiring a target parameter label determined from a parameter label group corresponding to any target interface label from all target parameter labels of the target label group;
generating an interface test case corresponding to any target interface label based on the call of the interface call method corresponding to the any target interface label to the test parameter corresponding to the obtained target parameter label;
and combining the interface test cases corresponding to the target interface tags in the target tag group to obtain the target test cases corresponding to the target tag group.
In one embodiment, a tag format of each interface tag in the plurality of interface tag groups and each parameter tag in the plurality of parameter tag groups is a first format;
When the input interface 1002 obtains the plurality of interface tag groups and the plurality of parameter tag groups, the following operations are specifically executed:
acquiring a plurality of initial interface tag groups and a plurality of initial parameter tag groups; any one of the plurality of initial interface tag groups comprises at least one initial interface tag, any one of the plurality of initial parameter tag groups comprises at least one initial parameter tag, and each initial interface tag in the plurality of initial interface tag groups and each initial parameter tag in the plurality of initial parameter tag groups have a tag format of a second format;
based on a preset mapping relation, mapping each initial interface tag in a plurality of initial interface tag groups in a second format into an interface tag in a first format, and mapping each initial parameter tag in a plurality of initial parameter tag groups in the second format into a parameter tag in the first format to obtain an interface tag group corresponding to each initial interface tag group in the plurality of initial interface tag groups and a parameter tag group corresponding to each initial parameter tag group in the plurality of initial parameter tag groups.
In one embodiment, the processor 1001 is further configured to:
Detecting operation logic indicated by each target interface label and each target parameter label in the target label group;
and if the operation logic indicated by each target interface label and each target parameter label in the target label group is normal, triggering and executing to acquire the test parameters corresponding to each target parameter label in the target label group.
In one embodiment, the processor 1001 is further configured to:
constructing interface labels of all functional modules in a code to be tested, and constructing a plurality of interface label groups based on the interface labels of all functional modules in the code to be tested; code modules corresponding to the interface tags included in any one of the plurality of interface tag groups are used for realizing the same function;
aiming at any one interface tag group in the plurality of interface tag groups, obtaining a parameter tag corresponding to the any one interface tag group based on parameter analysis of a functional module corresponding to each interface tag in the any one interface tag group;
classifying the parameter labels corresponding to any interface label group according to the parameter types to obtain one or more parameter label groups corresponding to any interface label group; the parameter tag groups include parameter tags of different parameter types.
In one embodiment, the input interface 1002 is further configured to receive a test request input by a target object; the test request carries a specified tag group, the specified tag group comprising: a specified interface tag determined from each of the plurality of interface tag groups and a specified parameter tag determined from each of the plurality of parameter tag groups;
the processor 1001 is further configured to obtain a target test case corresponding to the specified tag group;
the processor 1001 is further configured to test a code to be tested by using a target test case corresponding to the specified tag group, so as to obtain a test result of the code to be tested based on the specified tag group; the code to be tested is used for realizing the resource transfer function.
In one embodiment, the test case generation method is implemented through a test case generation model, and the test case generation model comprises a calling layer, a scene series layer and a business logic layer; the calling layer is used for traversing the plurality of interface tag groups and the plurality of parameter tag groups, and determining a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; the service logic layer is used for acquiring test parameters corresponding to each target parameter label in the target label group and sending the test parameters corresponding to each target parameter label in the target label group to the scene serial layer; the scene serial layer is used for receiving the target tag group sent by the calling layer, and calling the test parameters corresponding to the target parameter tags in the target tag group obtained from the service logic layer through the interface calling method corresponding to each target interface tag in the target tag group included in the scene serial layer, so as to generate the target test case corresponding to the target tag group.
Embodiments of the present application provide a computer program product comprising a computer program stored in a computer storage medium; the processor of the test case generating device reads the computer program from the computer storage medium, and the processor executes the computer program, so that the test case generating device executes the method embodiments shown in fig. 2, 4 and 5. The computer readable storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), or the like.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (13)

1. A test case generation method, comprising:
acquiring a plurality of interface tag groups and a plurality of parameter tag groups; any one of the plurality of interface tag groups includes at least one interface tag, and any one of the plurality of parameter tag groups includes at least one parameter tag;
Traversing the plurality of interface tag groups and the plurality of parameter tag groups, and determining a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; the target tag group includes: a target interface tag determined from each of the plurality of interface tag groups and a target parameter tag determined from each of the plurality of parameter tag groups;
obtaining test parameters corresponding to each target parameter label in the target label group;
and generating a target test case corresponding to the target tag group based on the call of the interface call method corresponding to each target interface tag in the target tag group to the test parameter corresponding to the target parameter tag in the target tag group.
2. The method of claim 1, wherein the method further comprises:
acquiring original parameters corresponding to each parameter label in the plurality of parameter label groups;
and respectively carrying out encryption processing on original parameters corresponding to each parameter label in the parameter label groups based on the parameter encryption method corresponding to each parameter label in the parameter label groups to obtain test parameters corresponding to each parameter label in the parameter label groups.
3. The method of claim 1, wherein the obtaining the test parameters corresponding to each target parameter tag in the target tag group comprises:
acquiring original parameters corresponding to each target parameter label in the target label group;
and respectively carrying out encryption processing on original parameters corresponding to each target parameter label in the target label group based on a parameter encryption method corresponding to each target parameter label in the target label group to obtain test parameters corresponding to each target parameter label in the target label group.
4. The method of claim 1, wherein the generating the target test case corresponding to the target tag group based on the calling of the test parameter corresponding to the target parameter tag in the target tag group by the interface calling method corresponding to each target interface tag in the target tag group comprises:
determining a parameter tag group corresponding to any one of the target interface tags based on the corresponding relation between the plurality of interface tag groups and the plurality of parameter tag groups aiming at any one of the target interface tags;
acquiring a target parameter label determined from a parameter label group corresponding to any target interface label from all target parameter labels of the target label group;
Generating an interface test case corresponding to any target interface label based on the call of the interface call method corresponding to the any target interface label to the test parameter corresponding to the obtained target parameter label;
and combining the interface test cases corresponding to the target interface tags in the target tag group to obtain the target test cases corresponding to the target tag group.
5. The method of claim 1, wherein a tag format of each interface tag in the plurality of interface tag groups and each parameter tag in the plurality of parameter tag groups is a first format;
the obtaining a plurality of interface tag groups and a plurality of parameter tag groups includes:
acquiring a plurality of initial interface tag groups and a plurality of initial parameter tag groups; any one of the plurality of initial interface tag groups comprises at least one initial interface tag, any one of the plurality of initial parameter tag groups comprises at least one initial parameter tag, and each initial interface tag in the plurality of initial interface tag groups and each initial parameter tag in the plurality of initial parameter tag groups have a tag format of a second format;
Based on a preset mapping relation, mapping each initial interface tag in a plurality of initial interface tag groups in a second format into an interface tag in a first format, and mapping each initial parameter tag in a plurality of initial parameter tag groups in the second format into a parameter tag in the first format to obtain an interface tag group corresponding to each initial interface tag group in the plurality of initial interface tag groups and a parameter tag group corresponding to each initial parameter tag group in the plurality of initial parameter tag groups.
6. The method of claim 1, wherein the method further comprises:
detecting operation logic indicated by each target interface label and each target parameter label in the target label group;
and if the operation logic indicated by each target interface label and each target parameter label in the target label group is normal, triggering and executing to acquire the test parameters corresponding to each target parameter label in the target label group.
7. The method of claim 1, wherein the method further comprises:
constructing interface labels of all functional modules in a code to be tested, and constructing a plurality of interface label groups based on the interface labels of all functional modules in the code to be tested; code modules corresponding to the interface tags included in any one of the plurality of interface tag groups are used for realizing the same function;
Aiming at any one interface tag group in the plurality of interface tag groups, obtaining a parameter tag corresponding to the any one interface tag group based on parameter analysis of a functional module corresponding to each interface tag in the any one interface tag group;
classifying the parameter labels corresponding to any interface label group according to the parameter types to obtain one or more parameter label groups corresponding to any interface label group; the parameter tag groups include parameter tags of different parameter types.
8. The method of claim 1, wherein the method further comprises:
receiving a test request input by a target object; the test request carries a specified tag group, the specified tag group comprising: a specified interface tag determined from each of the plurality of interface tag groups and a specified parameter tag determined from each of the plurality of parameter tag groups;
acquiring a target test case corresponding to the specified tag group;
testing the code to be tested by adopting a target test case corresponding to the specified tag group to obtain a test result of the code to be tested based on the specified tag group; the code to be tested is used for realizing the resource transfer function.
9. The method of claim 1, wherein the test case generation method is implemented by a test case generation model, the test case generation model comprising a call layer, a scene concatenation layer, and a business logic layer; the calling layer is used for traversing the plurality of interface tag groups and the plurality of parameter tag groups, and determining a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; the service logic layer is used for acquiring test parameters corresponding to each target parameter label in the target label group and sending the test parameters corresponding to each target parameter label in the target label group to the scene serial layer; the scene serial layer is used for receiving the target tag group sent by the calling layer, and calling the test parameters corresponding to the target parameter tags in the target tag group obtained from the service logic layer through the interface calling method corresponding to each target interface tag in the target tag group included in the scene serial layer, so as to generate the target test case corresponding to the target tag group.
10. A test case generating apparatus, comprising:
The acquisition unit is used for acquiring a plurality of interface tag groups and a plurality of parameter tag groups; any one of the plurality of interface tag groups includes at least one interface tag, and any one of the plurality of parameter tag groups includes at least one parameter tag;
the processing unit is used for traversing the plurality of interface tag groups and the plurality of parameter tag groups and determining a currently traversed target tag group from the plurality of interface tag groups and the plurality of parameter tag groups; the target tag group includes: a target interface tag determined from each of the plurality of interface tag groups and a target parameter tag determined from each of the plurality of parameter tag groups;
the processing unit is further used for acquiring test parameters corresponding to each target parameter label in the target label group;
the processing unit is further configured to generate a target test case corresponding to the target tag group based on a call of the interface call method corresponding to each target interface tag in the target tag group to the test parameter corresponding to the target parameter tag in the target tag group.
11. A test case generating device, wherein the test case generating device includes an input interface and an output interface, and further includes:
A processor adapted to implement one or more instructions; the method comprises the steps of,
a computer storage medium storing one or more instructions adapted to be loaded by the processor and to perform the test case generation method of any of claims 1-9.
12. A computer storage medium having stored therein computer program instructions for performing the test case generating method according to any of claims 1-9 when executed by a processor.
13. A computer program product or computer program, characterized in that the computer program product comprises a computer program for loading and executing the test case generating method according to any of claims 1-9 when the computer program is executed by a processor.
CN202210516695.3A 2022-05-12 2022-05-12 Test case generation method, device, equipment, medium and computer program product Pending CN117093468A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210516695.3A CN117093468A (en) 2022-05-12 2022-05-12 Test case generation method, device, equipment, medium and computer program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210516695.3A CN117093468A (en) 2022-05-12 2022-05-12 Test case generation method, device, equipment, medium and computer program product

Publications (1)

Publication Number Publication Date
CN117093468A true CN117093468A (en) 2023-11-21

Family

ID=88773967

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210516695.3A Pending CN117093468A (en) 2022-05-12 2022-05-12 Test case generation method, device, equipment, medium and computer program product

Country Status (1)

Country Link
CN (1) CN117093468A (en)

Similar Documents

Publication Publication Date Title
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN107391359B (en) Service testing method and device
CN110602056B (en) Service parameter transmission method and device
CN111090581B (en) Intelligent contract testing method, intelligent contract testing device, computer equipment and storage medium
CN109710677A (en) Processing for Data Analysis in Physics, device, computer equipment and storage medium
CN114500690B (en) Interface data processing method and device, electronic equipment and storage medium
CN113315828B (en) Traffic recording method and device, traffic recording equipment and storage medium
CN112560114B (en) Method and device for calling intelligent contract
CN111179061B (en) Resource transfer processing method, device and equipment
CN111815454B (en) Data uplink method and device, electronic equipment and storage medium
RU2734027C2 (en) Method and device for preventing an attack on a server
CN108804399A (en) The method of calibration and device of list
CN112328486A (en) Interface automation test method and device, computer equipment and storage medium
CN111552696A (en) Data processing method and device based on big data, computer equipment and medium
CN107526580A (en) Terminal applies recognition methods and device
CN111752820A (en) Pressure testing method of gPC interface, computer equipment and storage medium
CN113626512A (en) Data processing method, device, equipment and readable storage medium
CN112433936A (en) Test method, test device and storage medium
CN117093619A (en) Rule engine processing method and device, electronic equipment and storage medium
CN117093468A (en) Test case generation method, device, equipment, medium and computer program product
CN108268545B (en) Method and device for establishing hierarchical user label library
CN114371884A (en) Method, device, equipment and storage medium for processing Flink calculation task
CN115016995A (en) Interface testing method, computer device and computer storage medium
CN113590352A (en) Data calling method, device, equipment and readable storage medium
CN114428723A (en) Test system, system test method, related device 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