CN112433944A - Service testing method, device, computer equipment and storage medium - Google Patents

Service testing method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN112433944A
CN112433944A CN202011342367.3A CN202011342367A CN112433944A CN 112433944 A CN112433944 A CN 112433944A CN 202011342367 A CN202011342367 A CN 202011342367A CN 112433944 A CN112433944 A CN 112433944A
Authority
CN
China
Prior art keywords
service
tested
node
logic structure
test
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
CN202011342367.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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011342367.3A priority Critical patent/CN112433944A/en
Publication of CN112433944A publication Critical patent/CN112433944A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • 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

Abstract

The present application relates to the field of software testing technologies, and in particular, to a method and an apparatus for testing a service, a computer device, and a storage medium. The method comprises the following steps: acquiring a service request to be tested, wherein the service request to be tested carries a service identifier to be tested; acquiring a service logic structure corresponding to a service identifier to be tested, wherein the service logic structure is determined by service nodes corresponding to the service identifier and an incidence relation between the service nodes; determining a corresponding service node to be tested based on the service logic structure, and acquiring a test case which is configured in advance in association with the service node to be tested; and testing the service node to be tested according to the test case. The service test data can be stored in the block chain, and the method can improve the efficiency of service test.

Description

Service testing method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of software testing technologies, and in particular, to a method and an apparatus for testing a service, a computer device, and a storage medium.
Background
With the popularization and development of computer technology, various new services are continuously generated, and each new service appears, in order to ensure that the service can normally run, before the service is applied, a code corresponding to the service needs to be tested, otherwise, unexpected errors are very likely to occur during the application.
Regression testing needs to cover most existing test case scenarios, such as existing business processes and functions of previous versions. For each business process, it can be regarded as an independent business logic, or as a branch in the whole business logic.
However, in the conventional technology, for each node branch, the regression test is required to be performed one by one manually, and a lot of time and manpower are required for verification, thereby resulting in low test efficiency.
Disclosure of Invention
In view of the above, it is necessary to provide a service testing method, apparatus, computer device and storage medium capable of improving testing efficiency.
A service testing method comprises the following steps:
acquiring a service request to be tested, wherein the service request to be tested carries a service identifier to be tested;
acquiring a service logic structure corresponding to a service identifier to be tested, wherein the service logic structure is determined by service nodes corresponding to the service identifier and an incidence relation between the service nodes;
determining a corresponding service node to be tested based on the service logic structure, and acquiring a test case which is configured in advance in association with the service node to be tested;
and testing the service node to be tested according to the test case.
In one embodiment, obtaining a service logic structure corresponding to a service identifier to be tested includes:
acquiring service nodes corresponding to the service identification to be tested and the association relation among the service nodes; and associating the service nodes according to the association relationship to obtain a service logic structure.
In one embodiment, obtaining a test case configured in advance in association with a service node to be tested includes:
acquiring a preposed associated node corresponding to a service node to be tested based on a service logic structure;
and obtaining a test case which is associated and configured with the service node to be tested and the prepositive associated node in advance from a preset test case library.
In one embodiment, obtaining a test case configured in advance in association with a service node to be tested includes:
acquiring a service interface corresponding to a service node to be tested;
and acquiring a test case which is configured in association with the service interface in advance from a preset test case library, wherein the test case corresponding to the service interface is used for testing the parameter input, parameter output and parameter output results of the service interface.
In one embodiment, obtaining a service logic structure corresponding to a service identifier to be tested includes:
acquiring a historical service logic structure and service modification data corresponding to a service identifier to be tested;
and updating the historical service logic according to the service modification data to obtain the current service logic structure corresponding to the service identifier to be tested.
In one embodiment, the method further comprises:
based on the service logic structure, sequentially generating service node identifiers to be tested of the service nodes to be tested according to the logic flow direction corresponding to the service logic structure;
respectively obtaining test cases corresponding to the service node identifications to be tested, and testing the service nodes to be tested according to the test cases;
and when the test result of the service node meets the test condition, returning to the step based on the service logic structure, sequentially generating the service node identifier to be tested of the service node to be tested according to the logic flow direction corresponding to the service logic structure, and continuing to execute the step until the test end condition is met, thereby completing the service test.
In one embodiment, obtaining a service logic structure corresponding to a service identifier to be tested includes:
acquiring service information corresponding to a service to be tested;
generating and storing preset format data according to the service information, wherein the preset format data is stored in a block chain;
and reading the preset format data and generating a business logic structure containing input and output.
A traffic testing apparatus, the apparatus comprising:
the first acquisition module is used for acquiring a service request to be tested, wherein the service request to be tested carries a service identifier to be tested;
the second acquisition module is used for acquiring a service logic structure corresponding to a service identifier to be tested, wherein the service logic structure is determined by service nodes corresponding to the service identifier and an incidence relation between the service nodes;
the third acquisition module is used for determining a corresponding service node to be tested based on the service logic structure and acquiring a test case which is configured in advance in association with the service node to be tested;
and the test module is used for testing the service node to be tested according to the test case.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the method of any of the embodiments described above when the computer program is executed by the processor.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of any of the above embodiments.
According to the service testing method, the service testing device, the computer equipment and the storage medium, the test case is predetermined and is associated and bound with the node to be tested, so that when a certain service needs to be tested, the service logic structure corresponding to the service is obtained, the corresponding service node to be tested is selected based on the service logic structure, the test case corresponding to the service node to be tested can be automatically called, and automatic testing is realized. In the whole process, a tester does not need to manually compile a test case on site, so that the test efficiency of the service node to be tested is improved. And when a plurality of or all service nodes in the service logic structure need to be tested, the corresponding test case can be automatically called only by selecting the corresponding service node at the front end, so that the automatic test is realized, and particularly when a large number of service nodes to be tested are involved, the service testing efficiency can be greatly improved by the method provided by the application.
Drawings
FIG. 1 is a diagram of an application environment of a method for testing services in one embodiment;
FIG. 2 is a flow diagram illustrating a method for testing services in one embodiment;
fig. 3 is a schematic flow chart of a service testing method provided in another embodiment;
FIG. 4 is a block diagram of a traffic test apparatus according to an embodiment;
FIG. 5 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The service testing method provided by the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The terminal 102 sends a test request aiming at the service to be tested through a test page, and the server 104 receives the service request to be tested sent by the terminal 102, wherein the service request to be tested carries the service identification to be tested; acquiring a service logic structure corresponding to a service identifier to be tested, wherein the service logic structure is determined by service nodes corresponding to the service identifier and an incidence relation between the service nodes; determining a corresponding service node to be tested based on the service logic structure, and acquiring a test case which is configured in advance in association with the service node to be tested; and testing the service node to be tested according to the test case. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In an embodiment, as shown in fig. 2, a service testing method is provided, where the service testing method may be specifically applied to a computer device, where the computer device may be specifically a server or a terminal, and includes the following steps:
step 202, a service request to be tested is obtained, wherein the service request to be tested carries a service identifier to be tested.
The service request to be tested is a request for testing a program code of a specific service, and may specifically be a request for testing a program code in an insurance service field, or a request for testing a program code in another service field, and the like, which is not limited herein. The service request to be tested may be a request sent by the terminal to the server, or may be a request automatically generated in the server or the terminal (for example, the request may be a request periodically generated in a timing test scenario). The service identifier to be tested is used for uniquely identifying one service to be tested, and the service identifier to be tested specifically may be an ID number of the service to be tested.
In a specific embodiment, when the service request to be tested corresponds to an insurance service request, the insurance service test request may include one or more service nodes to be tested, for example, the service nodes to be tested may be a login node, an information submission node, an information audit node, and the like, without limitation, so as to test a program code corresponding to each service node in the service to be tested, thereby ensuring normal operation of each service node in the insurance service.
Step 204, obtaining a service logic structure corresponding to the service identifier to be tested, where the service logic structure is determined by the service node corresponding to the service identifier and the association relationship between the service nodes.
The service logic structure is obtained according to the processing logic of the service, and the service logic structure may be specifically a service flow chart or a service structure chart determined according to the processing logic of the service. And the service logic structure comprises more than one service node and the incidence relation among different service nodes, and specifically, each service node can be connected in an incidence way according to the incidence relation among different service nodes to obtain the service logic structure. And the service logic structure can also comprise a judgment node so as to test the judgment logic corresponding to the judgment node.
Specifically, the computer device obtains a service logic structure corresponding to the service identifier to be tested.
And step 206, determining the corresponding service node to be tested based on the service logic structure, and acquiring a test case which is configured in association with the service node to be tested in advance.
Specifically, the service logic structure includes more than one service node, and when different service nodes have an association relationship, the corresponding service nodes are further associated and connected according to the corresponding association relationship. In a specific service, when a certain service node in the service logic structure needs to be tested, the corresponding service node can be positioned in the service logic structure, and the positioned service node is determined as a service node to be tested.
It should be noted that each service to be tested corresponds to a structure file for implementing the service to be tested, and each structure file corresponds to a visual service logic structure. The structure file may be specifically in the form of a structure tree, and the structure tree includes an association relationship between different service nodes. And the structure file in the form of the structure tree can be visually displayed in the form of a business logic structure, so that a front-end user can select a business node to be tested in the visually displayed business logic structure to test the business node to be tested. It should be noted that each service node in the service logic structure may be associated with a test case in advance, and the corresponding service node to be tested is tested according to the test case.
And 208, testing the service node to be tested according to the test case.
Specifically, each service node to be tested can correspond to a predetermined test case, so that when the corresponding service node to be tested is selected at the front end, the test case configured in association with the service node to be tested can be directly obtained, automatic testing is realized, and the testing efficiency of the service node to be tested is improved. And the test result of the service node to be tested according to the test case can correspond to at least two different results of test success and test failure, wherein the test success corresponds to the service node to be tested being a qualified node, otherwise, the test failure corresponds to the service node to be tested being a failed node. Furthermore, the results corresponding to the test success or the test failure respectively can be sent to the front end, so that the corresponding test results can be displayed at the front end, the user at the front end can be informed of the corresponding test results in time, particularly when the test fails, the test failure results can be displayed at the front end in time, and corresponding fault nodes can be given out to indicate related personnel to process the fault nodes, thereby ensuring the normal execution of the service.
In the embodiment, the test case is predetermined and is associated and bound with the node to be tested, so that when a certain service needs to be tested, the test case corresponding to the service node to be tested can be automatically invoked only by acquiring the service logic structure corresponding to the service and selecting the corresponding service node to be tested based on the service logic structure, thereby realizing automatic testing. In the whole process, a tester does not need to manually compile a test case on site, so that the test efficiency of the service node to be tested is improved. And when a plurality of or all service nodes in the service logic structure need to be tested, the corresponding test case can be automatically called only by selecting the corresponding service node at the front end, so that the automatic test is realized, and particularly when a large number of service nodes to be tested are involved, the service testing efficiency can be greatly improved by the method provided by the application.
In one embodiment, obtaining a service logic structure corresponding to a service identifier to be tested includes: acquiring service nodes corresponding to the service identification to be tested and the association relation among the service nodes; and associating the service nodes according to the association relationship to obtain a service logic structure.
Specifically, the service logic structure corresponds to a service flow chart, and the service flow chart includes an implementation structure of a corresponding service, for example, the service flow chart may include a service node for implementing a judgment function, a service node for implementing a processing function, and the like. In one specific embodiment, when the service to be tested corresponds to a specific product, it can be understood that the same product may have different versions in different periods or in different scenes, and a common service node that may be shared exists between products of different versions, and an individual service node that each service individually corresponds to also exist. The universal service node is a node used in products of multiple versions, the individual service node is a node used in products of partial versions, and the individual service node is used for distinguishing products of different versions. It should be noted that the business logic structures corresponding to different versions of products are different. In a specific scenario, a service logic structure corresponding to an actual service version may be determined according to actual requirements of a service, and a corresponding test case is associated in advance for a service node in the service logic structure.
In one embodiment, obtaining a test case configured in advance in association with a service node to be tested includes: acquiring a preposed associated node corresponding to a service node to be tested based on a service logic structure; and obtaining a test case which is associated and configured with the service node to be tested and the prepositive associated node in advance from a preset test case library.
The pre-association node has an association relation with the service node to be tested, and is a service node which must be executed when the service node to be tested is realized. It is to be understood that the service node to be tested may further include a post-service node, which is a node executed after the service node to be tested is executed. It can also be understood that, when the service node to be tested has a post-association node, the service node to be tested at this time can be understood as a pre-association node of the post-association node, that is, the pre-association node and the post-association node are relative concepts, and in different scenarios, the concepts of the pre-association node and the post-association node can be flexibly changed.
In a specific embodiment, when the service node a is an independent node in the service flow diagram, that is, the service node a has no associated node, the service node a may be tested separately in a specific test scenario. In another embodiment, if the service node C has an associated node, specifically, the front service node of the service node C is the service node B, when the node C is tested, the service node C and the front service node B need to be tested simultaneously, and only when the service node and the front service node are tested simultaneously, it is determined that the testing step for the service node to be tested is completed.
In a specific embodiment, according to an actual service scenario, service logics and service requirements corresponding to all versions of services are integrated, and a corresponding service flow chart is drawn according to the service logics and the service requirements and is designed into an automation platform. Then, a certain service node to be tested is selected in the service flow chart, and then all necessary pre-correlation nodes corresponding to the service node to be tested can be automatically correlated in the service flow chart, and the corresponding pre-correlation nodes can be selected to carry out automatic testing of the service flow. Furthermore, a branch node in a certain service node may also be selected, all necessary front-end nodes before the branch node may also be automatically associated, and an automated test of a service flow may be selected.
It can be understood that, in the above embodiment, in the process of testing the service to be tested, there may be a case where multiple tests are performed on the same service node, and there is no case where test nodes are omitted, so that the comprehensiveness and accuracy of the service test are ensured, and the security of the service test is improved.
In the above embodiment, in the process of testing the service node, the method further includes obtaining an associated service node corresponding to the service node to be tested according to the service logic structure, specifically, obtaining a pre-associated node corresponding to the service node to be tested, and testing the service node to be tested according to a test case corresponding to the pre-associated node and a test case corresponding to the service node to be tested. The preposed associated node is a necessary node for realizing the service node to be tested, so that the test of the preposed associated node is introduced when the current service node to be tested is tested, and the test accuracy of the current service node to be tested can be ensured.
In one embodiment, obtaining a test case configured in advance in association with a service node to be tested includes: acquiring a service interface corresponding to a service node to be tested; and acquiring a test case which is configured in association with the service interface in advance from a preset test case library, wherein the test case corresponding to the service interface is used for testing the parameter input, parameter output and parameter output results of the service interface.
Specifically, the automatic test of the service node to be tested can be realized based on the service logic structure, and in the automatic test process of the service node to be tested, when the service node to be tested is selected, the service interface associated with the service node to be tested can be automatically acquired, and the simulation test of the participation and the participation of the service interface is performed. Further, assertions may be added to determine whether the parameters are correct.
Specifically, a UI of the automation platform may be designed in advance, and the automation platform may be displayed as a flowchart of an existing mature service, where the flowchart is specifically a configurable structural diagram. Specifically, each node branch of the flowchart covers all existing service nodes, and a test case can be automatically generated after the corresponding service node is selected. In one embodiment, the automation platform may directly select the service node to be tested by means of a flowchart, and may further add a configurable parameter to lock the service node to be tested, for example, a service node such as an order number or a regional test environment may be added. Further, a start/pause/stop button may be added to control the progress of the flow.
In one embodiment, when designing the back-end logic of the automation platform, the necessary configurable SQL may be added for each service node to perform normal flow of the flow, and the necessary configurable interface and configurable participation assertion may be added for each service node. And adding necessary logs for each service node to observe the success and failure of the service process, and automatically stopping when a certain service node fails in the test.
In the above embodiment, in a specific business scenario, in many cases, a scenario of the WEB regression test needs to cover most existing test case scenarios, such as existing business processes and functions of previous multiple versions, and an existing interface input and output participation scenario. If the regression test is performed only manually or according to the previous test case, the efficiency is not always high enough. In the specific implementation, each business process may be regarded as an independent business logic, or may be regarded as a branch in the whole business logic. For each node branch, if the process needs to be manually and gradually regressed and tested one time, a great deal of time and manpower are needed for verification; if the branches of each node only pick some of them for verification, the efficiency will be improved, but the coverage of the test cases will be reduced. And if the regression test is carried out, the test is rough, manpower and time are wasted, and a large lifting space is provided. Then, if the whole business process is considered as a whole, the business process and the interfaces are drawn into a flow chart, each business process is gradually written into an automatic test case by utilizing the existing business functions and the existing processes, the existing interfaces participate in the participation and the testing is carried out, a large amount of automatic scripts and a large amount of interface test plans can be generated, a large amount of time is needed for maintaining the automatic scripts at the later stage, and unnecessary script errors can be generated. However, the scheme of the present disclosure configures the test case in the database in advance, and then the test on the service node to be tested can be directly executed according to the visual service logic structure diagram, so that the test efficiency is improved, and when the service changes, only the data configured in the database needs to be adaptively changed, and meanwhile, the visual structure diagram at the front end can be dynamically updated, so that the maintenance of the test script becomes simple.
In one embodiment, obtaining a service logic structure corresponding to a service identifier to be tested includes: acquiring a historical service logic structure and service modification data corresponding to a service identifier to be tested; and updating the historical service logic according to the service modification data to obtain the current service logic structure corresponding to the service identifier to be tested.
The corresponding application scenarios are as follows: the product is updated quickly, but the code corresponding to the product is not updated much, and if the test is executed once for each product update, a lot of time will be consumed. However, in the field of insurance services, it is necessary to ensure the correctness and accuracy of each updated product, so that the coverage of the test needs to be ensured, specifically, the whole service process of each product needs to be tested once, and a large amount of test time is consumed. The method and the device are realized for improving the testing efficiency, and specifically realize that the test case which is configured in advance is automatically called according to the service node in the flow chart without manually compiling the test case by a user.
Specifically, the application aims to automatically generate the test case according to the flow chart. The flow chart is designed manually according to specific project requirements, and when a project is changed, the corresponding flow chart also needs to be changed correspondingly. Specifically, a flow chart is displayed in a front-end page, but the back-end page corresponds to a tree structure, and the tree structure comprises the incidence relation among different nodes, the attribute information of the different nodes, SQL statements, assertions and the like of the different nodes can be configured in a self-defined manner.
By means of the method, regression testing can be effectively and accurately carried out, then certain business can be selected in a targeted mode for testing, and testing efficiency is improved. Compared with some existing automatic tests, the configuration mode of the automatic test case is more flexible and changeable, and the maintenance of the automatic test case is simpler. Different actual requirements can be met, a necessary regression testing scene is selected, and the regression testing efficiency is improved.
In one embodiment, as shown in fig. 3, a schematic flow chart of a service testing method provided in another embodiment is provided. Specifically, the method further comprises:
and step 302, sequentially generating service node identifiers to be tested of the service nodes to be tested according to the logic flow direction corresponding to the service logic structure based on the service logic structure.
And 304, respectively obtaining test cases corresponding to the service node identifications to be tested, and testing the service nodes to be tested according to the test cases.
And step 306, when the test result of the service node meets the test condition, returning to the step based on the service logic structure, sequentially generating the service node identifiers to be tested of the service nodes to be tested according to the logic flow direction corresponding to the service logic structure, and continuing to execute the step until the test end condition is met, thereby completing the service test.
The service node identifier to be tested is used for uniquely identifying one service node, and the service node identifier to be tested may specifically be information such as an ID of the service node to be tested. And each service node identifier to be tested is associated with at least one test case in advance, so that the corresponding test case can be automatically obtained according to the corresponding identifier, and the service node to be tested can be tested according to the test case. And when the service node to be tested has the preposed associated node, obtaining a test case corresponding to the preposed associated node so as to finish the test step of the current service node to be tested according to the preposed associated node and the test case respectively corresponding to the current service node to be tested. And according to the node flow direction in the service logic structure, all service nodes in the service logic structure can be continuously tested, when the service nodes with failed test exist, the test flow of other unfinished service nodes can be stopped, test failure warning information about the failed nodes is sent out, and when the test of all the service nodes in the service logic structure is finished and the test of all the service nodes is successful, the test success information can be sent out.
In one embodiment, the test end condition includes at least one of: when the test result of the service node does not meet the test condition, judging that the test end condition is met; and when the test of all the service nodes in the service logic structure is finished, judging that the test ending condition is met.
In one embodiment, obtaining a service logic structure corresponding to a service identifier to be tested includes: acquiring service information corresponding to a service to be tested, generating preset format data according to the service information, and storing the preset format data in a block chain; and reading the preset format data and generating a business logic structure containing input and output.
Specifically, a server acquires service information corresponding to a service identifier to be tested, wherein the service information comprises node information and a judgment condition; generating json data according to the service information and the judgment condition and storing the json data in a database; the server reads the json information and can automatically generate a business process case containing input and output. And, a python framework can be used to generate a test automatic verification framework to verify the business process case.
It should be emphasized that, in order to further ensure the privacy and security of the preset format data, the preset format data may also be stored in a node of a block chain.
In the process of testing the service node, the proposal acquires a preposed associated node corresponding to the service node to be tested, and tests the service node to be tested according to a test case corresponding to the preposed associated node and the test case corresponding to the service node to be tested. The preposed associated node is a necessary node for realizing the service node to be tested, so that the test of the preposed associated node is introduced when the current service node to be tested is tested, and the test accuracy of the current service node to be tested can be ensured.
And the proposal integrates the existing business logic of all versions, then draws flow charts for all flows and different branches, and designs the flow charts into an automation platform. Selecting a certain node, automatically associating all necessary preposed nodes before the node, and selecting to carry out automatic test of a service flow; selecting a branch node in a certain node, automatically associating all necessary preposed nodes in front of the branch node, and selectively performing automatic test on a service flow; aiming at the selection of the first two nodes, all interfaces associated with the node can be automatically brought out, simulation tests of interface parameter input and parameter output are carried out, and assertions are added to judge the correctness of interface parameter output.
And the test case is configured into the database in advance through the scheme of the proposal, so that the test on the node to be tested can be directly executed according to the visual business logic structure chart, the test efficiency is improved, when the business changes, only the data configured in the database needs to be adaptively changed, and meanwhile, the visual structure chart at the front end can be dynamically updated, so that the maintenance of the test script is simple.
It should be understood that although the various steps in the flow charts of fig. 2-3 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-3 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps.
In one embodiment, as shown in fig. 4, there is provided a traffic testing apparatus, including:
the first obtaining module 402 is configured to obtain a service request to be tested, where the service request to be tested carries a service identifier to be tested.
A second obtaining module 404, configured to obtain a service logic structure corresponding to a service identifier to be tested, where the service logic structure is determined by a service node corresponding to the service identifier and an association relationship between the service nodes.
The third obtaining module 406 is configured to determine a corresponding service node to be tested based on the service logic structure, and obtain a test case configured in advance in association with the service node to be tested.
And the testing module 408 is configured to test the service node to be tested according to the test case.
In one embodiment, the device further comprises a relationship obtaining module, wherein the relationship obtaining module is used for obtaining the service nodes corresponding to the service identifiers to be tested and the association relationship among the service nodes; and associating the service nodes according to the association relationship to obtain a service logic structure.
In an embodiment, the third obtaining module 406 is further configured to obtain a pre-association node corresponding to the service node to be tested based on the service logic structure; and obtaining a test case which is associated and configured with the service node to be tested and the prepositive associated node in advance from a preset test case library.
In an embodiment, the third obtaining module 406 is further configured to obtain a service interface corresponding to the service node to be tested; and acquiring a test case which is configured in association with the service interface in advance from a preset test case library, wherein the test case corresponding to the service interface is used for testing the input and output of the service interface and the output result.
In an embodiment, the second obtaining module 404 is further configured to obtain a historical service logic structure and service modification data corresponding to the service identifier to be tested; and updating the historical service logic according to the service modification data to obtain the current service logic structure corresponding to the service identifier to be tested.
In one embodiment, the apparatus further includes a test module, where the test module is configured to sequentially generate service node identifiers to be tested of the service nodes to be tested according to logic flow directions corresponding to the service logic structures based on the service logic structures; respectively obtaining test cases corresponding to the service node identifications to be tested, and testing the service nodes to be tested according to the test cases; and when the test result of the service node meets the test condition, returning to the step based on the service logic structure, sequentially generating the service node identifier to be tested of the service node to be tested according to the logic flow direction corresponding to the service logic structure, and continuing to execute the step until the test end condition is met, thereby completing the service test.
In an embodiment, the second obtaining module 404 is further configured to obtain service information corresponding to a service to be tested; generating and storing preset format data according to the service information, wherein the preset format data is stored in a block chain; and reading the preset format data and generating a business logic structure containing input and output.
For the specific definition of the service testing device, reference may be made to the above definition of the service testing method, which is not described herein again. All or part of each module in the service testing device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as shown in fig. 5. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a storage medium and an internal memory. The storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operating system and computer programs in the storage medium to run. The database of the computer device is used for storing service test data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of business testing.
It will be appreciated by those skilled in the art that the configuration shown in fig. 5 is a block diagram of only a portion of the configuration relevant to the present solution and does not constitute a limitation on the computer apparatus to which the present solution is applied, and in particular the computer apparatus may include more or less components than those shown in the drawings, or combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program: acquiring a service request to be tested, wherein the service request to be tested carries a service identifier to be tested; acquiring a service logic structure corresponding to a service identifier to be tested, wherein the service logic structure is determined by service nodes corresponding to the service identifier and an incidence relation between the service nodes; determining a corresponding service node to be tested based on the service logic structure, and acquiring a test case which is configured in association with the service node to be tested in advance, wherein the test case is configured in association with the service node to be tested in advance; and testing the service node to be tested according to the test case.
In one embodiment, the step of obtaining the service logic structure corresponding to the service identifier to be tested is further performed when the processor executes the computer program: acquiring service nodes corresponding to the service identification to be tested and the association relation among the service nodes; and associating the service nodes according to the association relationship to obtain a service logic structure.
In one embodiment, the step of obtaining the test case configured in advance in association with the service node to be tested when the processor executes the computer program is further configured to: acquiring a preposed associated node corresponding to a service node to be tested based on a service logic structure; and obtaining a test case which is associated and configured with the service node to be tested and the prepositive associated node in advance from a preset test case library.
In one embodiment, the step of obtaining the test case configured in advance in association with the service node to be tested when the processor executes the computer program is further configured to: acquiring a service interface corresponding to a service node to be tested; and acquiring a test case which is configured in association with the service interface in advance from a preset test case library, wherein the test case corresponding to the service interface is used for testing the parameter input, parameter output and parameter output results of the service interface.
In one embodiment, the step of obtaining the service logic structure corresponding to the service identifier to be tested is further performed when the processor executes the computer program: acquiring a historical service logic structure and service modification data corresponding to a service identifier to be tested; and updating the historical service logic according to the service modification data to obtain the current service logic structure corresponding to the service identifier to be tested.
In one embodiment, the processor, when executing the computer program, is further configured to: based on the service logic structure, sequentially generating service node identifiers to be tested of the service nodes to be tested according to the logic flow direction corresponding to the service logic structure; respectively obtaining test cases corresponding to the service node identifications to be tested, and testing the service nodes to be tested according to the test cases; and when the test result of the service node meets the test condition, returning to the step based on the service logic structure, sequentially generating the service node identifier to be tested of the service node to be tested according to the logic flow direction corresponding to the service logic structure, and continuing to execute the step until the test end condition is met, thereby completing the service test.
In one embodiment, the step of obtaining the service logic structure corresponding to the service identifier to be tested is further performed when the processor executes the computer program: acquiring service information corresponding to a service to be tested, wherein the service information comprises node information and a judgment condition; generating and storing preset format data according to the service information, wherein the preset format data is stored in a block chain; and reading the preset format data and generating a business logic structure containing input and output.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: acquiring a service request to be tested, wherein the service request to be tested carries a service identifier to be tested; acquiring a service logic structure corresponding to a service identifier to be tested, wherein the service logic structure is determined by service nodes corresponding to the service identifier and an incidence relation between the service nodes; determining a corresponding service node to be tested based on the service logic structure, and acquiring a test case which is configured in advance in association with the service node to be tested; and testing the service node to be tested according to the test case.
In one embodiment, the computer program, when executed by the processor, further performs the step of obtaining a service logic structure corresponding to the service identifier to be tested, to: acquiring service nodes corresponding to the service identification to be tested and the association relation among the service nodes; and associating the service nodes according to the association relationship to obtain a service logic structure.
In one embodiment, the computer program when executed by the processor further performs the step of obtaining a test case configured in advance in association with the service node to be tested, further configured to: acquiring a preposed associated node corresponding to a service node to be tested based on a service logic structure; and obtaining a test case which is associated and configured with the service node to be tested and the prepositive associated node in advance from a preset test case library.
In one embodiment, the computer program when executed by the processor further performs the step of obtaining a test case configured in advance in association with the service node to be tested, further configured to: acquiring a service interface corresponding to a service node to be tested; and acquiring a test case which is configured in association with the service interface in advance from a preset test case library, wherein the test case corresponding to the service interface is used for testing the parameter input, parameter output and parameter output results of the service interface.
In one embodiment, the computer program, when executed by the processor, further performs the step of obtaining a service logic structure corresponding to the service identifier to be tested, to: acquiring a historical service logic structure and service modification data corresponding to a service identifier to be tested; and updating the historical service logic according to the service modification data to obtain the current service logic structure corresponding to the service identifier to be tested.
In one embodiment, the computer program when executed by the processor is further operable to implement: based on the service logic structure, sequentially generating service node identifiers to be tested of the service nodes to be tested according to the logic flow direction corresponding to the service logic structure; respectively acquiring test cases corresponding to the service node identifications to be tested, and testing the service nodes to be tested according to the test cases; and when the test result of the service node meets the test condition, returning to the step based on the service logic structure, sequentially generating the service node identifier to be tested of the service node to be tested according to the logic flow direction corresponding to the service logic structure, and continuing to execute the step until the test end condition is met, thereby completing the service test.
In one embodiment, the computer program, when executed by the processor, further performs the step of obtaining a service logic structure corresponding to the service identifier to be tested, to: acquiring service information corresponding to a service to be tested, wherein the service information comprises node information and a judgment condition; generating and storing preset format data according to the service information, wherein the preset format data is stored in a block chain; and reading the preset format data and generating a business logic structure containing input and output.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a computer-readable storage medium, and when the computer program is executed, the computer program can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for service testing, the method comprising:
acquiring a service request to be tested, wherein the service request to be tested carries a service identifier to be tested;
acquiring a service logic structure corresponding to the service identifier to be tested, wherein the service logic structure is determined by service nodes corresponding to the service identifier and an incidence relation between the service nodes;
determining a corresponding service node to be tested based on the service logic structure, and acquiring a test case which is configured in advance in association with the service node to be tested;
and testing the service node to be tested according to the test case.
2. The method of claim 1, wherein the obtaining the service logic structure corresponding to the service identifier to be tested comprises:
acquiring service nodes corresponding to the service identification to be tested and an incidence relation between the service nodes;
and associating the service nodes according to the association relationship to obtain a service logic structure.
3. The method according to claim 1, wherein said obtaining a test case configured in advance in association with the service node to be tested comprises:
acquiring a preposed associated node corresponding to the service node to be tested based on the service logic structure;
and obtaining a test case which is associated and configured with the service node to be tested and the prepositive associated node in advance from a preset test case library.
4. The method according to claim 1, wherein said obtaining a test case configured in advance in association with the service node to be tested comprises:
acquiring a service interface corresponding to the service node to be tested;
and acquiring a test case which is configured in association with the service interface in advance from a preset test case library, wherein the test case corresponding to the service interface is used for testing the input and output of the service interface and the output result.
5. The method of claim 1, wherein the obtaining the service logic structure corresponding to the service identifier to be tested comprises:
acquiring a historical service logic structure and service modification data corresponding to the service identifier to be tested;
and updating the historical service logic according to the service modification data to obtain the current service logic structure corresponding to the service identifier to be tested.
6. The method according to any one of claims 1 to 5, further comprising:
based on the service logic structure, sequentially generating service node identifiers to be tested of the service nodes to be tested according to the logic flow direction corresponding to the service logic structure;
respectively acquiring test cases corresponding to the service node identifications to be tested, and testing the service nodes to be tested according to the test cases;
and when the test result of the service node meets the test condition, returning to the step based on the service logic structure, sequentially generating the service node identification to be tested of the service node to be tested according to the logic flow direction corresponding to the service logic structure, and continuing to execute the step until the test end condition is met, thereby completing the service test.
7. The method of claim 1, wherein the obtaining the service logic structure corresponding to the service identifier to be tested comprises:
acquiring service information corresponding to the service to be tested;
generating preset format data according to the service information and storing the preset format data, wherein the preset format data is stored in a block chain;
and reading the preset format data and generating a business logic structure containing input and output.
8. A traffic testing apparatus, characterized in that the apparatus comprises:
the first acquisition module is used for acquiring a service request to be tested, wherein the service request to be tested carries a service identifier to be tested;
a second obtaining module, configured to obtain a service logic structure corresponding to the service identifier to be tested, where the service logic structure is determined by a service node corresponding to the service identifier and an association relationship between the service nodes;
the third acquisition module is used for determining a corresponding service node to be tested based on the service logic structure and acquiring a test case which is configured in advance in association with the service node to be tested;
and the testing module is used for testing the service node to be tested according to the test case.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202011342367.3A 2020-11-25 2020-11-25 Service testing method, device, computer equipment and storage medium Pending CN112433944A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011342367.3A CN112433944A (en) 2020-11-25 2020-11-25 Service testing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011342367.3A CN112433944A (en) 2020-11-25 2020-11-25 Service testing method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112433944A true CN112433944A (en) 2021-03-02

Family

ID=74698228

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011342367.3A Pending CN112433944A (en) 2020-11-25 2020-11-25 Service testing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112433944A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113132522A (en) * 2021-03-19 2021-07-16 深圳市几米物联有限公司 Test method, device, server and medium
CN113238968A (en) * 2021-06-23 2021-08-10 中国农业银行股份有限公司 System test method, apparatus, device, medium, and program product
CN114398289A (en) * 2022-01-20 2022-04-26 中国联合网络通信集团有限公司 Service test method, device, equipment and storage medium
CN114968787A (en) * 2022-05-27 2022-08-30 中移互联网有限公司 Node relation-based test method and device and electronic equipment

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113132522A (en) * 2021-03-19 2021-07-16 深圳市几米物联有限公司 Test method, device, server and medium
CN113238968A (en) * 2021-06-23 2021-08-10 中国农业银行股份有限公司 System test method, apparatus, device, medium, and program product
CN114398289A (en) * 2022-01-20 2022-04-26 中国联合网络通信集团有限公司 Service test method, device, equipment and storage medium
CN114968787A (en) * 2022-05-27 2022-08-30 中移互联网有限公司 Node relation-based test method and device and electronic equipment
CN114968787B (en) * 2022-05-27 2023-09-19 中移互联网有限公司 Method and device for testing based on node relation and electronic equipment

Similar Documents

Publication Publication Date Title
CN112433944A (en) Service testing method, device, computer equipment and storage medium
US8151248B1 (en) Method and system for software defect management
CN108959059B (en) Test method and test platform
CN112256558B (en) Test case generation method and device, computer equipment and storage medium
CN110058998B (en) Software testing method and device
CN106612204B (en) Service checking method and device
CN109933521A (en) Automated testing method, device, computer equipment and storage medium based on BDD
CN108595342A (en) Unit test method and device
CN103186463B (en) Determine the method and system of the test specification of software
CN112631919A (en) Comparison test method and device, computer equipment and storage medium
CN109614312A (en) Method for generating test case, device, electronic equipment and storage medium
US8661305B2 (en) Method and system for test vector generation
CN114003451B (en) Interface testing method, device, system and medium
CN107357721B (en) Method and device for testing system
CN117493188A (en) Interface testing method and device, electronic equipment and storage medium
CN112561690A (en) Method, system, equipment and storage medium for testing credit card staging service interface
CN112858876A (en) Self-adaptive chip automatic testing method
CN112948233A (en) Interface testing method, device, terminal equipment and medium
CN116431522A (en) Automatic test method and system for low-code object storage gateway
CN111459800A (en) Method, device, equipment and medium for verifying availability of service system
CN115840560A (en) Management system for software development process
CN115934513A (en) Demand analysis and test design adaptation method, device, equipment and medium
JP2023000907A (en) Source code correction support device and source code correction support method
CN113791980A (en) Test case conversion analysis method, device, equipment and storage medium
CN112948480B (en) Data extraction method, device, electronic equipment and storage medium

Legal Events

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