CN111737140A - Interface automation test method, device, equipment and computer readable storage medium - Google Patents
Interface automation test method, device, equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN111737140A CN111737140A CN202010597341.7A CN202010597341A CN111737140A CN 111737140 A CN111737140 A CN 111737140A CN 202010597341 A CN202010597341 A CN 202010597341A CN 111737140 A CN111737140 A CN 111737140A
- Authority
- CN
- China
- Prior art keywords
- test
- engine
- protocol
- target
- mock
- 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.)
- Granted
Links
- 238000010998 test method Methods 0.000 title claims abstract description 27
- 238000012360 testing method Methods 0.000 claims abstract description 644
- 238000000034 method Methods 0.000 claims abstract description 38
- 238000011144 upstream manufacturing Methods 0.000 claims description 30
- 230000008859 change Effects 0.000 claims description 13
- 230000008569 process Effects 0.000 claims description 11
- 238000012545 processing Methods 0.000 claims description 10
- 230000002159 abnormal effect Effects 0.000 claims description 8
- 238000005516 engineering process Methods 0.000 abstract description 5
- 239000000047 product Substances 0.000 description 34
- 238000007726 management method Methods 0.000 description 14
- 238000010586 diagram Methods 0.000 description 9
- 238000004891 communication Methods 0.000 description 6
- 230000004044 response Effects 0.000 description 6
- 230000001960 triggered effect Effects 0.000 description 5
- 238000004458 analytical method Methods 0.000 description 4
- 239000000284 extract Substances 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000001502 supplementing effect Effects 0.000 description 3
- 230000009471 action Effects 0.000 description 2
- 238000012550 audit Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 235000016709 nutrition Nutrition 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 1
- 238000013475 authorization Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000013523 data management Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 235000015097 nutrients Nutrition 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012552 review Methods 0.000 description 1
- 239000013049 sediment Substances 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- KDYFGRWQOYBRFD-UHFFFAOYSA-N succinic acid Chemical compound OC(=O)CCC(O)=O KDYFGRWQOYBRFD-UHFFFAOYSA-N 0.000 description 1
- 239000013589 supplement Substances 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
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 invention relates to the technical field of financial technology (Fintech), and discloses an interface automatic test method, a device, equipment and a computer readable storage medium, wherein the method comprises the following steps: when an interface protocol test request is received, acquiring a target version protocol to be tested corresponding to the interface protocol test request; if a baseline version protocol associated with the target version protocol exists, comparing the target version protocol with the baseline version protocol to obtain protocol updating information; acquiring a baseline test engine corresponding to the baseline version protocol, updating the baseline test engine according to the protocol updating information, and acquiring a target test engine; and generating a target test case according to the target test engine, and operating the target test case to obtain a target test result of the target version protocol. According to the invention, through protocol version comparison test, a tester does not need to check the test result, and the regression test efficiency is improved.
Description
Technical Field
The invention relates to the technical field of financial technology (Fintech), in particular to an interface automatic testing method, device, equipment and a computer readable storage medium.
Background
With the rapid development of internet technologies, especially internet financial technologies (Fintech), more and more technologies (big data, distributed, Blockchain, artificial intelligence, etc.) are applied in the financial field, and the functions of financial service platforms are more and more.
The financial service platform is usually provided with a large number of data interfaces to realize financial service data interaction, when the development of the financial service platform interfaces is completed, interface testing is required, because more data interfaces are used, more test cases are used for interface testing, the current test cases are troublesome to compile mainly by hands, the test case generation time is longer, the interface testing efficiency is lower, based on the part of developers, the automatic generation scheme of the test cases is provided, the automatic generation of the test cases shortens the compilation time of the test cases, the interface testing efficiency is improved to a certain extent, however, aiming at frequent regression testing, because the test cases generated automatically at each time are different, the test results obtained at each time are different, the test result analysis is required at each time, the error finding efficiency in the test results is low, and the regression test time is long.
Disclosure of Invention
The invention mainly aims to provide an interface automatic testing method, device, equipment and a computer readable storage medium, aiming at solving the technical problems that in the current interface regression testing method, different testing results are obtained each time by using different testing cases, the testing results need to be analyzed independently each time, the error finding efficiency in the testing results is low, and the regression testing time is long.
In order to achieve the above object, the present invention provides an automatic interface testing method, which includes the following steps:
when an interface protocol test request is received, acquiring a target version protocol to be tested corresponding to the interface protocol test request;
if a baseline version protocol associated with the target version protocol exists, comparing the target version protocol with the baseline version protocol to obtain protocol updating information;
acquiring a baseline test engine corresponding to the baseline version protocol, updating the baseline test engine according to the protocol updating information, and acquiring a target test engine;
and generating a target test case according to the target test engine, and operating the target test case to obtain a target test result of the target version protocol.
Optionally, after the step of obtaining the target version protocol to be tested corresponding to the interface protocol test request when the interface protocol test request is received, the method includes:
judging whether a baseline version protocol associated with the target version protocol exists or not;
if the baseline version protocol associated with the target version protocol does not exist, analyzing the target version protocol to generate a target test engine, wherein the target test engine comprises a business rule engine, a basic field engine and an MOCK test engine;
and generating a target test case according to the target test engine, and operating the target test case to obtain a target test result of the target version protocol.
Optionally, if there is no baseline version protocol associated with the target version protocol, the step of analyzing the target version protocol to generate a target test engine includes:
if the baseline version protocol related to the target version protocol does not exist, analyzing the target version protocol to obtain a service scene identifier of the target version protocol;
inquiring a preset service number platform, acquiring a service test rule corresponding to the service scene identifier, and summarizing the service test rule to generate a service rule engine;
traversing the protocol attribute of the target version protocol, and performing divergence according to a preset divergence rule and field type, field length and field enumeration in the protocol attribute to generate a basic field engine;
pulling the protocol content information and the upstream and downstream relationship of the protocol of the target version from a preset protocol management platform, and generating an MOCK test engine according to the protocol content information and the upstream and downstream relationship of the protocol;
and combining the business rule engine, the basic field engine and the MOCK test engine to generate a target test engine.
Optionally, the step of pulling the protocol content information and the upstream and downstream relationship of the protocol of the target version from a preset protocol management platform, and generating the MOCK test engine according to the protocol content information and the upstream and downstream relationship of the protocol includes:
pulling the protocol content information and the upstream and downstream relationship of the target version protocol from a preset protocol management platform, and acquiring each target downstream protocol of the target version protocol downstream to-be-MOCK according to the upstream and downstream relationship of the protocol;
acquiring a preset target field which is configured in the target downstream protocol and is subjected to Cartesian divergence, and performing Cartesian product on the target downstream protocol according to the target field to generate a successful MOCK set and a failed MOCK set;
performing Cartesian product between the successful MOCK sets to obtain a successful MOCK rule, and performing Cartesian product on one element in the failed MOCK set and the successful MOCK set to obtain a failed MOCK rule;
and summarizing the success MOCK rules and the failure MOCK rules to generate the MOCK test engine.
Optionally, the step of obtaining the baseline test engine corresponding to the baseline version protocol, updating the baseline test engine according to the protocol update information, and obtaining the target test engine includes:
obtaining a baseline test engine corresponding to the baseline version protocol, wherein the baseline test engine comprises: a business rule engine, a basic field engine and/or a MOCK test engine;
inquiring a preset support platform, acquiring an update scene identifier in the protocol update information and an update test rule corresponding to the update scene identifier from the preset support platform, and adding the update test rule to the service rule engine to obtain an updated service rule engine;
traversing the newly added attribute of the protocol updating information, and updating the basic field engine according to the change type, the change length and the newly added enumeration in the newly added attribute to obtain an updated basic field engine;
performing Cartesian product on the protocol updating information and an MOCK rule in the MOCK test engine to update the MOCK test engine to obtain an updated MOCK test engine;
and combining the updated business rule engine, the updated basic field engine and the updated MOCK test engine to obtain a target test engine.
Optionally, the step of generating a target test case according to the target test engine and running the target test case to obtain a target test result of the target version protocol includes:
acquiring a business rule engine, a basic field engine and an MOCK test engine in the target test engine;
extracting business engine rules from the business rules engine, field engine rules from the base field engine, and MOCK engine rules from the MOCK test engine;
and generating a target test case according to the business engine rule, the field engine rule and the MOCK engine rule, and operating the target test case to obtain a target test result of the target version protocol.
Optionally, the step of generating a target test case according to the business engine rule, the field engine rule, and the MOCK engine rule, and running the target test case to obtain a target test result of the target version protocol includes:
acquiring a basic case of the business engine rule, calling a preset automatic test platform to process the basic case to generate a business message, and intercepting the business message to generate a business type test case;
acquiring the field engine rule, calling a service engine rule which is processed by a preset automatic test platform to generate a basic message, intercepting the basic message, modifying the basic message according to the field engine rule, and generating a field type test case;
acquiring the MOCK engine rule, calling a service engine rule which is processed by a preset automatic test platform to generate a basic message, intercepting the basic message, processing the basic message according to the MOCK engine rule, and generating an MOCK type test case;
and performing Cartesian product on the service type test case, the field type test case and the MOCK type test case to generate a target test case, and operating the target test case to obtain a target test result of the target version protocol.
Optionally, after the step of generating a target test case according to the target test engine and running the target test case to obtain a target test result of the target version protocol, the method includes:
acquiring a preset service serial number corresponding to the target test case, and storing a target test result of the target version protocol in association with the preset service serial number;
when a test result comparison request is received, acquiring a target test result corresponding to the target version protocol and a baseline test result corresponding to the baseline version protocol by taking the preset service serial number as a main key;
and comparing the target test result with the baseline test result to remove redundant data, and outputting comparison abnormal information.
In addition, in order to achieve the above object, the present invention further provides an interface automation test apparatus, including:
the device comprises a request receiving module, a processing module and a processing module, wherein the request receiving module is used for acquiring a target version protocol to be tested corresponding to an interface protocol test request when the interface protocol test request is received;
the protocol comparison module is used for comparing the target version protocol with a baseline version protocol if the baseline version protocol related to the target version protocol exists, so as to obtain protocol updating information;
the engine updating module is used for acquiring a baseline test engine corresponding to the baseline version protocol, updating the baseline test engine according to the protocol updating information and acquiring a target test engine;
and the operation test module is used for generating a target test case according to the target test engine and operating the target test case to obtain a target test result of the target version protocol.
In addition, to achieve the above object, the present invention further provides an interface automation test apparatus, including: the interface automation test program comprises a memory, a processor and an interface automation test program which is stored on the memory and can run on the processor, wherein the steps of the interface automation test method are realized when the interface automation test program is executed by the processor.
In addition, to achieve the above object, the present invention further provides a computer readable storage medium, having stored thereon an interface automation test program, which when executed by a processor, implements the steps of the interface automation test method as described above.
The invention provides an interface automatic test method, an interface automatic test device, interface automatic test equipment and a computer readable storage medium. In the embodiment of the invention, when an interface protocol test request is received, a target version protocol to be tested corresponding to the interface protocol test request is obtained; judging whether a baseline version protocol associated with the target version protocol exists or not, if so, judging as a regression test, and comparing the target version protocol with the baseline version protocol to obtain protocol updating information; acquiring a baseline test engine corresponding to the baseline version protocol, updating the baseline test engine according to the protocol updating information, and acquiring a target test engine; generating a target test case according to the target test engine, and running the target test case to obtain a target test result of the target version protocol, that is, in this embodiment, by updating the test engine and updating the test case by using the updated test engine, compared with the current interface regression test, the current interface regression test creates a test case each time, since the test case at each time is a new case, the test result obtained based on the test case is also a new test result, the test result analysis is required each time, and the efficiency of error discovery in the test result is low; the test case is updated according to the target protocol version, the test result obtained by the target protocol version is similar to the test result obtained by the baseline version protocol, the test results of the same test case before and after updating can be compared, problems can be quickly located, the efficiency of error finding in the test result is improved, manual checking is not needed, the workload of manual checking of testers is reduced, and the efficiency of automatic interface testing is improved.
Drawings
FIG. 1 is a schematic diagram of an apparatus architecture of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first exemplary embodiment of a method for automatically testing an interface according to the present invention;
FIG. 3 is a diagram illustrating a specific scenario created by a MOCK test engine in a first embodiment of an interface automated test method according to the present invention;
FIG. 4 is a flowchart illustrating a second embodiment of an interface automated testing method according to the present invention;
FIG. 5 is a diagram illustrating a scenario of updating a business rule engine according to a second embodiment of the interface automation test method of the present invention;
FIG. 6 is a diagram illustrating a scenario of updating a basic field engine according to a second embodiment of the method for automated testing of an interface of the present invention;
FIG. 7 is a flowchart illustrating the updating of a MOCK test engine in a second embodiment of the method for interface automated testing according to the present invention;
FIG. 8 is a diagram illustrating a scenario of comparison of results in a fourth embodiment of the interface automated testing method according to the present invention;
fig. 9 is a functional block diagram of an interface automatic test apparatus according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The existing interface test scheme continuously integrates a CI test platform (called an automated test platform), well establishes test case input and expected check points, and can manually or automatically trigger an executed test case).
The CI test platform is associated with a protocol message sending tool, the protocol message sending tool needs to manually assemble interface messages for execution, manually checks whether the interaction between an operation result and a background is normal or not, and automatically outputs a test report as a subsequent test record sediment. The CI test platform is associated with a baffle plate platform, the CI test platform is used for simulating return messages of an upstream system and a downstream system, the baffle plate system is also called as a baffle plate system, the baffle plate system needs to be manually deployed in the upstream system for the first time, a MOCK baffle plate rule is set in a page where the upstream system is located, and the simulation baffle plate is triggered to take effect by starting or closing the rule.
Such interface test scheme test case compiling cost is high: the coverage of the existing CI test scene is insufficient, and the supplement of the existing test cases with a large amount of stock is difficult. Each scene of the existing baffle plate platform needs to be configured independently, and a large number of abnormal scenes in the test consume time and labor to construct the baffle plate. Test case assertions are complex to compile and easy to omit; the interface automatic testing method, the device, the equipment and the computer readable storage medium are provided based on the defects of the interface testing scheme in the prior art.
As shown in fig. 1, fig. 1 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present invention.
The interface automation test equipment of the embodiment of the invention can be a PC or a server.
As shown in fig. 1, the interface automation test equipment may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration of the apparatus shown in fig. 1 is not intended to be limiting of the apparatus and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and an interface automation test program.
In the device shown in fig. 1, the network interface 1004 is mainly used for connecting to a backend server and performing data communication with the backend server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to call the interface automation test program stored in the memory 1005 and perform the operations of the interface automation test method described below.
Based on the hardware structure, the embodiment of the interface automatic testing method is provided.
Referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of an interface automation test method according to the present invention, where the method includes:
step S10, when receiving an interface protocol test request, acquiring a target version protocol to be tested corresponding to the interface protocol test request;
the interface automatic test method in this embodiment is applied to an interface automatic test device, the interface automatic test device is a hardware carrier of an interface automatic test computer program, and the interface automatic test device in this embodiment may be set in different financial institutions.
The interface automation test device receives an interface test request, where the triggering manner of the interface test request is not specifically limited, that is, the interface test request may be actively triggered by a user, for example, the user clicks on: interface test virtual key manual trigger interface test request; in addition, the interface test request may also be automatically triggered by the interface automation test device, for example, a tester sets in advance in the interface test device: when detecting the update of the interface version, the interface test request is automatically triggered, the interface automatic test equipment monitors the state of the interface in real time, and when detecting the release of a new interface protocol version, the interface automatic test equipment automatically triggers the interface test request.
When the interface automatic test equipment receives an interface protocol test request, the interface automatic test equipment acquires a target version protocol to be tested corresponding to the interface protocol test request, wherein the content of the target version protocol is not specifically limited, that is, the target version protocol may be an interface protocol of a first version, or an interface protocol of a second version and an interface protocol of a later update version.
Step S20, judging whether a baseline version protocol related to the target version protocol exists;
after the interface automatic test equipment acquires a target version protocol to be tested, the interface automatic test equipment acquires a version identifier of the target version protocol, the interface automatic test equipment determines whether the target version protocol is a first protocol version according to the version identifier, when the target version protocol is the first protocol version, the interface automatic test equipment judges that a baseline version protocol associated with the target version protocol does not exist, and the interface automatic test equipment needs to directly create a test case according to the target version protocol; when the target version protocol is not the first protocol version, the interface automation test equipment judges that a baseline version protocol related to the target version protocol exists, the interface automation test equipment can update the test case of the baseline version protocol to generate the test case corresponding to the target version protocol, wherein the baseline version protocol is a 'snapshot' of each workpiece version in a project repository in a specific period, provides a formal standard, and then works based on the standard, and can change the standard only after authorization, and after an initial baseline is established, the change of each time is recorded as a difference until the next baseline version protocol is established.
The technical scheme in the embodiment is to reduce the operation of the tester for checking the test result, so that the interface automation test equipment judges whether a baseline version protocol associated with the target version protocol exists, if the baseline version protocol associated with the target version protocol exists, the test case is updated according to the baseline version protocol, the test case after the update is used for testing, the test result is obtained, and the test result can be directly compared without manual checking.
For convenience of understanding, in this embodiment, an interface test without a baseline version protocol associated with a target version protocol is described first, that is, in this embodiment, first, a step of performing, by an interface automation test device, an interface automation test on an initial version protocol when the target version protocol is the initial version protocol is described, specifically:
step S30, if the baseline version protocol related to the target version protocol does not exist, analyzing the target version protocol to generate a target test engine, wherein the target test engine comprises a business rule engine, a basic field engine and a MOCK test engine;
if a baseline version protocol associated with the target version protocol does not exist, the interface automation test equipment analyzes the target version protocol to generate a target test Engine, wherein the target test Engine comprises a Business Rule Engine, a basic field Engine and a MOCK test Engine, and the Business Rule Engine (Business Rule Engine): and providing a configuration mechanism according to part of special service requirements, and generating a test case pool according to preset configuration. Basic Field Engine (Interface Field Rule Engine): and automatically generating a basic field verification test case pool according to attributes such as the length, the mandatory filling property, the enumeration and the like of the full field of the interface. MOCK Engine (MOCK Rule Engine): the MOCK service is a baffle tool provided aiming at the services of a network, a code and an RMB, and the MOCK engine is a scheme for automatically generating a set of abnormal scene test cases based on the MOCK service; specifically, the method comprises the following steps:
a1, if the baseline version protocol related to the target version protocol does not exist, analyzing the target version protocol to obtain a service scene identifier of the target version protocol;
a2, inquiring a preset service number platform, acquiring a service test rule corresponding to the service scene identifier, summarizing the service test rule and generating a service rule engine;
step a3, traversing the protocol attribute of the target version protocol, and performing divergence according to a preset divergence rule and field type, field length and field enumeration in the protocol attribute to generate a basic field engine;
a4, pulling the protocol content information and the protocol upstream and downstream relation of the target version protocol from a preset protocol management platform, and generating an MOCK test engine according to the protocol content information and the protocol upstream and downstream relation;
step a5, combining the business rule engine, the basic field engine and the MOCK test engine to generate a target test engine.
If there is no baseline version protocol associated with the target version protocol, the interface automation test device analyzes the target version protocol to obtain a service scenario identifier of the target version protocol, where the step a2 of generating, by the interface automation test device according to the service scenario identifier, a service rule engine includes: the interface automatic test equipment inquires a preset support platform (the preset support platform refers to a preset service data management platform, the preset support platform comprises service scene identifications corresponding to all interfaces, service scene information related to the service scene identifications and service test rules corresponding to all the service scene information, and the preset support platform is specifically used for completing batch execution, automatically triggering calling rules when the next batch is synchronous day-to-day and day-to-day after test cases are verified, capturing data of the batch meeting the requirement form in real time and managing the data), acquiring the service test rules corresponding to the service scene identifications, summarizing the service test rules and generating a service rule engine.
The method comprises the steps that an automatic testing basic case is manually configured on an automatic testing platform by interface automatic testing equipment and used for maintaining action scheduling and parameter transmission among actions, a business rule engine generates a business rule engine pool (1 x n) in batch through the basic case and the service number platform scene set in the automatic testing platform, and after a protocol service number platform scene to be tested is updated, the business engine is synchronously and automatically updated and is supplemented to the business engine pool to generate the business rule engine.
For example, the business rule engine automatically generates engine data according to the nutrient platform scene and stores the engine data into an engine pool; the method comprises the steps that an automatic updating engine is triggered by changing a scene of a support platform, manual maintenance is supported, rules are divided into a must-pass rule, a success rule and a failure rule, wherein the must-pass rule is used for generating a field type test case and an MOCK type test case. The business engine pool comprises fields such as an engine rule identifier, a scene identifier of a support platform, an automatic test platform basic rule identifier, a rule abstract and a state. For example, the rule summary is taken from the nutritional number platform scene, such as the nutritional number platform scene "931", the summary "is collected as a single note-single pen, 0T borrow, stay at 0T +1 day".
In this embodiment, the step a3 interface automated test equipment generates a basic field engine, which includes: the interface automation test equipment traverses the protocol attribute of the target version protocol, and performs divergence according to a preset divergence rule and field type, field length and field enumeration in the protocol attribute to generate a basic field engine.
For example, 1, if the field is STRING type: if the default value exists, emitting the conditions of being equal to the default value, not being equal to the default value, being a NULL character string and being NULL; if the enumerated values exist, the conditions of being equal to each enumerated value, non-enumerated value, NULL character string and NULL are emitted; if the default value and the enumeration value do not exist, the conditions of empty character strings, NULL, equal length and overlong are emitted; 2. if the field is of DECIMAL type: emitting NULL character strings and NULL values; a random number with negative number, and the length of maxLength (maximum precision length) equal to delLength (minimum length) equal to length is diverged; 0; 0.0; 0.00; random numbers with the same length of maxLength and delLength; a maxLength equal-length delLength ultra-long random number; random numbers with the same length as maxLength delLength; 3. if the field is of TIME type: divergence YYYMMddHHmmss and some illegal case quantities according to system time; 4. if the field is NUMBER type: empty; a random number with a negative number and a maxLength equal length; 0; a maxLength equal-length random number; maxLength ultra-long random number; the maxLength equal-length letters + random number; 5. if the field is of the MsgFieldAlrray type: dispersing and emptying; a set of data; two sets of data; and storing the emitted rule into a field engine pool.
In this embodiment, the interface automation test equipment in step a4 generates a MOCK test engine, where the MOCK engine automatically generates an engine pool for storing engine rules according to the upstream and downstream relationship and attribute values of a protocol; the MOCK engine pool comprises fields of an engine rule ID, an MOCK message header, an MOCK message body, a rule abstract, a state and the like. The abstract is a downstream service id and a service state of a to-be-MOCK, such as a MOCK message header "{" 02100040": response. response. response. ","02300298": response. errcode ═ 9999'; response. response. ", MOCK message" { "02100040": { "retCode": 30790000"," retMsg ": MOCKSUCC" }, "02300298": { "retCode": 30790002"," retMsg ": MOCKFAIL" } } ", abstract {"02100040": succ", "02300298": fail "}, which represents that the 02100040 protocol returns success and the 02300298 service returns failure. Generating a MOCK test engine, comprising:
a41, pulling the protocol content information and the upstream and downstream relationship of the target version protocol from a preset protocol management platform, and acquiring each target downstream protocol of the target version protocol downstream to-be-MOCK according to the upstream and downstream relationship of the protocol;
a42, acquiring a preset target field which is configured in the target downstream protocol and is subjected to Cartesian divergence, and performing Cartesian product on the target downstream protocol according to the target field to generate a successful MOCK set and a failed MOCK set;
step a43, performing Cartesian product between the successful MOCK sets to obtain a successful MOCK rule, and performing Cartesian product between the failed MOCK set and one element in the successful MOCK set to obtain a failed MOCK rule;
step a44, summarizing the success MOCK rules and the failure MOCK rules to generate the MOCK test engine.
For example, 1, the interface automation test equipment pre-configures which fields in the downstream protocol need cartesian divergence, and each attribute successfully enumerates a set and fails to enumerate a set. As shown in FIG. 3, protocol 1 contains attributes A and B, where A: {0}, B: { a } is the set of successful enumeration values, A: {1}, B: { B, c } is the set of failed enumeration values; 2. the interface automation test equipment acquires a downstream protocol needing MOCK according to the upstream and downstream relation (1: n) of the protocol to be tested; 3. each downstream protocol of the interface automation test equipment performs cartesian product according to the configuration of the divergence field to generate respective success and failure MOCK sets, as shown in fig. 3, a cartesian product {0} { a } ═ 0, a } is performed between the success sets of the interface 1, and a cartesian product {1} { b, c } {1, b }, and {1, c } is performed between the failure sets; 4. performing Cartesian product on a successful type set among all downstream protocols to generate a successful type MOCK rule, and writing the successful type MOCK rule into an engine pool; generating {0, a, d }, {0, a, e } by performing Cartesian product on successful MOCK sets of the interface 1 and the interface 2 in the graph shown in FIG. 3; 4. each downstream protocol failure class set only needs to be combined with the first pass data set of all other protocols and written into the engine pool. As shown in fig. 3, cartesian product generation {1, b, d }, {1, c, d }, is performed on a failure MOCK set at an interface 1 and a success MOCK set at a first pass at an interface 2, and success MOCK rules and failure MOCK rules are summarized to generate a MOCK test engine; the interface automation test equipment combines the business rule engine, the basic field engine and the MOCK test engine to generate a target test engine.
The interface automatic test equipment generates a test case by driving a target test engine to carry out interface automatic test, and specifically comprises the following steps:
and step S40, generating a target test case according to the target test engine, and operating the target test case to obtain a target test result of the target version protocol.
A service rule engine in the interface automation test equipment drives a service type test case to automatically generate; a basic field engine drives the automatic generation of a protocol field type test case; the MOCK engine drives the MOCK type test case to automatically generate; the target test engine selects three engine data to perform Cartesian product to generate a target test case, namely, the interface automation test equipment extracts the business type test case, the field type test case and the MOCK type test case from an engine pool corresponding to the target test engine, splices the business type test case, the field type test case and the MOCK type test case to form the target test case, and the interface automation test equipment operates the target test case to obtain a target test result of a target version protocol. In the embodiment, the interface automation test equipment creates the test case when the target protocol version is the initial protocol version, so that the interface automation test is more efficient.
Further, referring to fig. 4, fig. 4 is a flowchart illustrating an interface automation test method according to a second embodiment of the present invention.
Based on the first embodiment of the interface automatic test method, the second embodiment of the interface automatic test method is provided; this embodiment is a step after step S20 in the first embodiment, and is different from the above implementation in that:
step S50, if there is a baseline version protocol associated with the target version protocol, comparing the target version protocol with the baseline version protocol to obtain protocol update information.
If a baseline version protocol associated with the target version protocol exists, the interface automatic test equipment compares the target version protocol with the baseline version protocol to obtain protocol update information, and updates the test engine according to the protocol update information, specifically:
step S60, obtaining a baseline test engine corresponding to the baseline version protocol, updating the baseline test engine according to the protocol updating information, and obtaining a target test engine.
The method comprises the following steps that the interface automatic testing equipment obtains a baseline testing engine corresponding to a baseline version protocol, and the interface automatic testing equipment updates the baseline testing engine according to protocol updating information to obtain a target testing engine, and specifically comprises the following steps:
step b1, obtaining a baseline test engine corresponding to the baseline version protocol, wherein the baseline test engine comprises: a business rule engine, a basic field engine and/or a MOCK test engine;
b2, inquiring a preset support platform, acquiring an update scene identifier in the protocol update information and an update test rule corresponding to the update scene identifier from the preset support platform, and adding the update test rule to the service rule engine to acquire an updated service rule engine;
step b3, traversing the newly added attribute of the protocol updating information, and updating the basic field engine according to the change type, the change length and the newly added enumeration in the newly added attribute to obtain an updated basic field engine;
step b4, performing Cartesian product of the protocol updating information and the MOCK rule in the MOCK test engine to update the MOCK test engine to obtain an updated MOCK test engine;
and b5, combining the updated business rule engine, the updated basic field engine and the updated MOCK test engine to obtain a target test engine.
Namely, the interface automation test equipment acquires a baseline test engine corresponding to the baseline version protocol, and the baseline test engine includes: the interface automation test equipment respectively updates the business rule engine, the basic field engine and/or the MOCK test engine, and referring to FIG. 5, FIG. 5 is a scene schematic diagram of the update of the business rule engine in the second embodiment of the interface automation test method of the present invention; step b1 of updating the business rule engine in this embodiment includes: the interface automation test equipment queries a preset support platform, acquires an update scene identifier in protocol update information and an update test rule corresponding to the update scene identifier from the preset support platform, and adds the update test rule to the business rule engine to acquire an updated business rule engine.
Referring to fig. 6, fig. 6 is a schematic view of a scenario of updating a basic field engine in a second embodiment of the interface automation test method of the present invention, where the step of updating the basic field engine by the interface automation test device in this embodiment includes: 1. the protocol management platform (the protocol management module uses a timing polling mechanism to pull the latest version protocol and the upstream and downstream relations of the protocol management platform in real time, automatically synchronizes to the protocol interface management module and provides a personalized protocol configuration function, the subsequent engine generates and updates the definition depending on the protocol attribute and the upstream and downstream relations of the protocol, and the protocol management module comprises interface configuration management and upstream and downstream interface management) new version protocol. 2. Comparing the new version protocol with the old version protocol to obtain new attributes, attribute new enumeration, type change and length change; 3. and automatically dispersing the newly added engine rule according to the information of the newly added attribute, the newly added enumeration, the type change and the like according to the background definition rule, and adding the newly added engine rule into the engine pool in a supplementing manner to obtain an updated service rule engine.
Referring to fig. 7, fig. 7 is a schematic flow chart illustrating the update of a MOCK test engine in a second embodiment of the interface automated test method according to the present invention; the step of updating the MOCK test engine by the interface automation test equipment in the embodiment comprises the following steps: 1. and comparing the new downstream protocol with the old downstream protocol, identifying and storing the updated changes: enumeration, field and upstream and downstream result ports are added, and deletion is not required to be processed; for example, if an enumeration is added: and (4) re-performing the Cartesian product by using the original Cartesian product data set and the newly-added enumeration, and supplementing the re-performed Cartesian product into the engine pool. For example, the A field of the interface 1 in FIG. 3 has the new successful enumeration 2, the successful MOCK set has the added enumeration 2, and the successful MOCK set in the B field has the Cartesian product to generate {2, a }. And the newly added MOCK set executes the MOCK engine generation logic generation engine rule. b. If the field is added: and (4) re-cartesian product is carried out by using the original cartesian product data set and each enumerated value of the newly-added field, and the new cartesian product is supplemented into the engine pool. As the C field is added to the interface 1 in fig. 3, cartesian products are performed on the original successful or failed MOCK set and the successful or failed enumeration of the C field, and the recombined cartesian product combination updates the elements in the original MOCK set, such as: {0, a } is {0, a, w } etc., while the remaining rules are added to the MOCK set. And updating the rules in the original MOCK engine after the updated MOCK sets are subjected to Cartesian product, and supplementing the rules into the engine by adding the rules. c. If the protocol is newly added: and judging whether the upstream and downstream protocols participate in the MOCK, if so, re-walking the MOCK engine generation logic to obtain an updated MOCK test engine.
The interface automation test equipment combines the updated business rule engine, the updated basic field engine and the updated MOCK test engine to obtain a target test engine so as to carry out interface automation test through the target test engine, and specifically:
and step S70, generating a target test case according to the target test engine, and operating the target test case to obtain a target test result of the target version protocol.
A service rule engine in the interface automation test equipment drives a service type test case to automatically generate; a basic field engine drives the automatic generation of a protocol field type test case; the MOCK engine drives the MOCK type test case to automatically generate; the target test engine selects three engine data to perform Cartesian product to generate a target test case, namely, the interface automation test equipment extracts the business type test case, the field type test case and the MOCK type test case from an engine pool corresponding to the target test engine, splices the business type test case, the field type test case and the MOCK type test case to form the target test case, and the interface automation test equipment operates the target test case to obtain a target test result of a target version protocol.
In the embodiment of the invention, when an interface protocol test request is received, a target version protocol to be tested corresponding to the interface protocol test request is obtained; judging whether a baseline version protocol associated with the target version protocol exists or not, if so, judging as a regression test, and comparing the target version protocol with the baseline version protocol to obtain protocol updating information; acquiring a baseline test engine corresponding to the baseline version protocol, updating the baseline test engine according to the protocol updating information, and acquiring a target test engine; generating a target test case according to the target test engine, running the target test case to obtain a target test result of the target version protocol, namely, updating the test engine and updating the test case by using the updated test engine in the embodiment, compared with the current interface regression test, the current interface regression test creates the test case each time, and because the test case is a new case each time, the test result obtained based on the test case is also a new test result, while the test case of the embodiment of the invention is updated according to the target protocol version, the test result obtained by the target protocol version is similar to the test result obtained by the baseline version protocol, and the test results of the same test case before and after updating can be compared, so that the problem can be quickly positioned, the efficiency of error discovery is improved, the workload of manual audit of testers is reduced without manual audit, the efficiency of the automatic test of interface has been improved.
Further, based on the foregoing embodiment of the interface automatic test method of the present invention, a third embodiment of the interface automatic test method of the present invention is provided.
The present embodiment is a refinement of step S40 in the first embodiment and/or step S70 in the second embodiment, and a specific implementation manner of generating a target test case according to the target test engine and running the target test case to obtain a target test result of the target version protocol is provided in the present embodiment, and includes:
acquiring a business rule engine, a basic field engine and an MOCK test engine in the target test engine;
extracting business engine rules from the business rules engine, field engine rules from the base field engine, and MOCK engine rules from the MOCK test engine;
and generating a target test case according to the business engine rule, the field engine rule and the MOCK engine rule, and operating the target test case to obtain a target test result of the target version protocol.
The interface automation equipment acquires a business rule engine, a basic field engine and an MOCK test engine in a target test engine; the interface automation equipment extracts the business engine rules from the business rule engine, the field engine rules from the basic field engine, and the MOCK engine rules from the MOCK test engine; the interface automation equipment generates a target test case according to a business engine rule, a field engine rule and an MOCK engine rule, operates the target test case to obtain a target test result of a target version protocol, and specifically comprises the following steps:
acquiring a basic case of the business engine rule, calling a preset automatic test platform to process the basic case to generate a business message, and intercepting the business message to generate a business type test case;
acquiring the field engine rule, calling a service engine rule which is processed by a preset automatic test platform to generate a basic message, intercepting the basic message, modifying the basic message according to the field engine rule, and generating a field type test case;
acquiring the MOCK engine rule, calling a service engine rule which is processed by a preset automatic test platform to generate a basic message, intercepting the basic message, processing the basic message according to the MOCK engine rule, and generating an MOCK type test case;
and performing Cartesian product on the service type test case, the field type test case and the MOCK type test case to generate a target test case, and operating the target test case to obtain a target test result of the target version protocol.
Namely, the interface automation test equipment generates a basic case for acquiring the business engine rule, calls a preset automation test platform to process the basic case to generate a business message, intercepts the business message and generates a business type test case, and comprises the following steps: 1. acquiring the scene identification of the basic case and the service platform of the automatic test platform of the service engine rule, calling the automatic test platform, intercepting the message generated by the automatic test platform to fall into a test case pool, and generating a service type test case.
The generation process of the basic field type test case of the interface automation test equipment comprises the following steps: 1. and acquiring the field engine rule. 2. And acquiring the necessary business engine rule. Calling a CI platform, and intercepting a message generated by the CI platform; 3. and tampering the message A according to the field engine rule to obtain a case message A', and falling into a case pool to generate a basic field type test case. For example, the test case id, the name of the necessary business engine, the corresponding field engine id and the abstract are respectively spliced. For example, with the use case id "B0000000001 _ F15759718157471", the use case name "according to unijunction-single pen, 0T borrow, stay in 0T +1 day, APP _ TYPE enumerate value range".
The interface automation test equipment MOCK type test case generation process comprises the following steps: 1. acquiring MOCK engine rules; 2. and acquiring the necessary business engine rule. And calling the CI platform and intercepting the message generated by the CI platform. And fall into a use case pool. 3. And after all MOCK cases are generated, splicing all MOCK messages in the MOCK engine by using a case 'preset service serial number' as an if condition to generate MOCK configuration. And pushing the MOCK configuration to a mockserver platform. The interface automation test equipment generates a target test case by taking the service type test case, the field type test case and the MOCK type test case as Cartesian products, and operates the target test case to obtain a target test result of the target version protocol. In the embodiment, the target test case is generated according to the target test engine, so that a tester does not need to manually compile the target test case, and the efficiency of automatic interface test is improved.
Further, based on the foregoing embodiment of the interface automatic test method of the present invention, a fourth embodiment of the interface automatic test method of the present invention is provided.
This embodiment is a step subsequent to step S40 in the first embodiment and step S70 in the second embodiment, and the above-described embodiments in this embodiment are different in that:
acquiring a preset service serial number corresponding to the target test case, and storing a target test result of the target version protocol in association with the preset service serial number;
when a test result comparison request is received, acquiring a target test result corresponding to the target version protocol and a baseline test result corresponding to the baseline version protocol by taking the preset service serial number as a main key;
and comparing the target test result with the baseline test result to remove redundant data, and outputting comparison abnormal information.
The interface automation test equipment acquires a preset service serial number corresponding to a target test case, and stores a target test result of a target version protocol in association with the preset service serial number; when a test result comparison request is received, acquiring a target test result corresponding to the target version protocol and a baseline test result corresponding to the baseline version protocol by taking the preset service serial number as a main key; and comparing the target test result with the baseline test result to remove redundant data, and outputting comparison abnormal information.
Specifically, referring to fig. 8, fig. 8 is a schematic view of a scenario of comparing results in a fourth embodiment of the interface automation test method according to the present invention; the interface automation test equipment acquires a target message and a target DB of a target version protocol; the interface automation test equipment acquires a baseline message and a baseline target DB of a baseline version protocol, the result comparison is divided into message comparison and DB comparison, the message and DB comparison is case-level comparison, case execution results are traced back according to the message and DB comparison results, the message comparison only needs to carry out consistency comparison on case return messages, and case 'preset service serial numbers' and each table main key incidence relation are configured. And comparing the query condition in SQL by taking the major key of the full-scale table as a DB to generate a full-scale table query statement irrelevant to the subsystem dimension scene, taking the 'preset service serial number' as an input parameter for each case DB result to obtain the case-level backup of the full-scale table result, and performing consistency check on the executed test plan and the return message of the baseline version to obtain consistent records, inconsistent records and baseline version missing comparison records. Inconsistent difference records may be noise, such as fields like timestamps. A noise statistic analysis function is provided, and a noise field list is conveniently maintained manually; in this embodiment, the number of the preset service flow is used as a main key, the test result is compared, and the abnormal information of the test interface result is output, so that the manual review by a tester is not required, and the regression test efficiency is improved.
Referring to fig. 9, fig. 9 is a schematic functional block diagram of an embodiment of an interface automatic test apparatus according to the present invention, in the embodiment of the interface automatic test apparatus according to the present invention, the interface automatic test apparatus includes:
the device comprises a request receiving module, a processing module and a processing module, wherein the request receiving module is used for acquiring a target version protocol to be tested corresponding to an interface protocol test request when the interface protocol test request is received;
the protocol comparison module is used for comparing the target version protocol with a baseline version protocol if the baseline version protocol related to the target version protocol exists, so as to obtain protocol updating information;
the engine updating module is used for acquiring a baseline test engine corresponding to the baseline version protocol, updating the baseline test engine according to the protocol updating information and acquiring a target test engine;
and the operation test module is used for generating a target test case according to the target test engine and operating the target test case to obtain a target test result of the target version protocol.
In one embodiment, the interface automation test device includes:
the protocol judging module is used for judging whether a baseline version protocol related to the target version protocol exists or not;
the engine generation module is used for analyzing the target version protocol to generate a target test engine if the baseline version protocol associated with the target version protocol does not exist, wherein the target test engine comprises a business rule engine, a basic field engine and a MOCK test engine;
and the operation test module is used for generating a target test case according to the target test engine and operating the target test case to obtain a target test result of the target version protocol.
In one embodiment, the engine generation module includes:
the analysis obtaining unit is used for analyzing the target version protocol and obtaining a service scene identifier of the target version protocol if the baseline version protocol related to the target version protocol does not exist;
the first generating unit is used for inquiring a preset service number platform, acquiring a service test rule corresponding to the service scene identifier, summarizing the service test rule and generating a service rule engine;
the second generation unit is used for traversing the protocol attribute of the target version protocol, and performing divergence according to a preset divergence rule and field type, field length and field enumeration in the protocol attribute to generate a basic field engine;
the third generation unit is used for pulling the protocol content information and the protocol upstream and downstream relation of the target version protocol from a preset protocol management platform and generating an MOCK test engine according to the protocol content information and the protocol upstream and downstream relation;
and the fourth generating unit is used for combining the business rule engine, the basic field engine and the MOCK test engine to generate a target test engine.
In an embodiment, the third generating unit is further configured to:
pulling the protocol content information and the upstream and downstream relationship of the target version protocol from a preset protocol management platform, and acquiring each target downstream protocol of the target version protocol downstream to-be-MOCK according to the upstream and downstream relationship of the protocol;
acquiring a preset target field which is configured in the target downstream protocol and is subjected to Cartesian divergence, and performing Cartesian product on the target downstream protocol according to the target field to generate a successful MOCK set and a failed MOCK set;
performing Cartesian product between the successful MOCK sets to obtain a successful MOCK rule, and performing Cartesian product on one element in the failed MOCK set and the successful MOCK set to obtain a failed MOCK rule;
and summarizing the success MOCK rules and the failure MOCK rules to generate the MOCK test engine.
In one embodiment, the engine update module includes:
an engine obtaining unit, configured to obtain a baseline test engine corresponding to the baseline version protocol, where the baseline test engine includes: a business rule engine, a basic field engine and/or a MOCK test engine;
the first updating unit is used for inquiring a preset support platform, acquiring an updating scene identifier in the protocol updating information and an updating test rule corresponding to the updating scene identifier from the preset support platform, and adding the updating test rule to the business rule engine to obtain an updated business rule engine;
the second updating unit is used for traversing the newly added attribute of the protocol updating information, and updating the basic field engine according to the change type, the change length and the new addition enumeration in the newly added attribute to obtain an updated basic field engine;
the third updating unit is used for updating the MOCK test engine by taking Cartesian product of the protocol updating information and an MOCK rule in the MOCK test engine to obtain an updated MOCK test engine;
and the engine combination unit is used for combining the updated business rule engine, the updated basic field engine and the updated MOCK test engine to obtain a target test engine.
In one embodiment, the operation test module includes:
the engine acquisition unit is used for acquiring a business rule engine, a basic field engine and an MOCK test engine in the target test engine;
a rule extraction unit for extracting business engine rules from the business rule engine, field engine rules from the basic field engine, and MOCK engine rules from the MOCK test engine;
and the case generating unit is used for generating a target test case according to the business engine rule, the field engine rule and the MOCK engine rule, and operating the target test case to obtain a target test result of the target version protocol.
In an embodiment, the use case generating unit is further configured to:
acquiring a basic case of the business engine rule, calling a preset automatic test platform to process the basic case to generate a business message, and intercepting the business message to generate a business type test case;
acquiring the field engine rule, calling a service engine rule which is processed by a preset automatic test platform to generate a basic message, intercepting the basic message, modifying the basic message according to the field engine rule, and generating a field type test case;
acquiring the MOCK engine rule, calling a service engine rule which is processed by a preset automatic test platform to generate a basic message, intercepting the basic message, processing the basic message according to the MOCK engine rule, and generating an MOCK type test case;
and performing Cartesian product on the service type test case, the field type test case and the MOCK type test case to generate a target test case, and operating the target test case to obtain a target test result of the target version protocol.
In one embodiment, the interface automation test device includes:
the acquisition and storage module is used for acquiring a preset service serial number corresponding to the target test case and storing a target test result of the target version protocol in association with the preset service serial number;
the result obtaining module is used for obtaining a target test result corresponding to the target version protocol and a baseline test result corresponding to the baseline version protocol by taking the preset service serial number as a main key when a test result comparison request is received;
and the result comparison module is used for comparing the target test result with the baseline test result, removing redundant data and outputting comparison abnormal information.
In the embodiment of the invention, when an interface protocol test request is received, a target version protocol to be tested corresponding to the interface protocol test request is obtained; judging whether a baseline version protocol associated with the target version protocol exists or not, if so, judging as a regression test, and comparing the target version protocol with the baseline version protocol to obtain protocol updating information; acquiring a baseline test engine corresponding to the baseline version protocol, updating the baseline test engine according to the protocol updating information, and acquiring a target test engine; generating a target test case according to the target test engine, operating the target test case to obtain a target test result of the target version protocol, that is, in the embodiment, by updating the test engine and updating the test case by using the updated test engine, compared with the current interface regression test, the current interface regression test creates a test case each time, because each test case is a new case, the test result obtained based on the test case is also a new test result, the test case of the application is updated according to the target protocol version, and the test result obtained by the target protocol version, the method is similar to the test result obtained by the baseline version protocol, so that the tester can quickly locate the problem, the workload of manual examination and check of the tester is reduced, and the efficiency of the automatic interface test is further improved.
The method executed by each program module can refer to each embodiment of the interface automatic test method of the present invention, and is not described herein again.
The invention also provides a computer readable storage medium.
The computer readable storage medium of the present invention stores thereon an interface automation test program, which when executed by a processor implements the steps of the interface automation test method as described above.
The method implemented when the interface automation test program running on the processor is executed may refer to each embodiment of the interface automation test method of the present invention, and details are not described herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (11)
1. An automatic interface testing method is characterized by comprising the following steps:
when an interface protocol test request is received, acquiring a target version protocol to be tested corresponding to the interface protocol test request;
if a baseline version protocol associated with the target version protocol exists, comparing the target version protocol with the baseline version protocol to obtain protocol updating information;
acquiring a baseline test engine corresponding to the baseline version protocol, updating the baseline test engine according to the protocol updating information, and acquiring a target test engine;
and generating a target test case according to the target test engine, and operating the target test case to obtain a target test result of the target version protocol.
2. The method for automated testing of interfaces of claim 1, wherein after the step of obtaining that the interface protocol test request corresponds to a target version protocol to be tested when the interface protocol test request is received, the method comprises:
judging whether a baseline version protocol associated with the target version protocol exists or not;
if the baseline version protocol associated with the target version protocol does not exist, analyzing the target version protocol to generate a target test engine, wherein the target test engine comprises a business rule engine, a basic field engine and an MOCK test engine;
and generating a target test case according to the target test engine, and operating the target test case to obtain a target test result of the target version protocol.
3. The method for automated testing of interfaces of claim 2, wherein the step of analyzing the target version protocol to generate a target test engine if the baseline version protocol associated with the target version protocol does not exist comprises:
if the baseline version protocol related to the target version protocol does not exist, analyzing the target version protocol to obtain a service scene identifier of the target version protocol;
inquiring a preset service number platform, acquiring a service test rule corresponding to the service scene identifier, and summarizing the service test rule to generate a service rule engine;
traversing the protocol attribute of the target version protocol, and performing divergence according to a preset divergence rule and field type, field length and field enumeration in the protocol attribute to generate a basic field engine;
pulling the protocol content information and the upstream and downstream relationship of the protocol of the target version from a preset protocol management platform, and generating an MOCK test engine according to the protocol content information and the upstream and downstream relationship of the protocol;
and combining the business rule engine, the basic field engine and the MOCK test engine to generate a target test engine.
4. The method for automatically testing interface of claim 3, wherein the step of pulling the protocol content information and the upstream and downstream relationship of the protocol of the target version from a preset protocol management platform and generating the MOCK test engine according to the protocol content information and the upstream and downstream relationship of the protocol comprises:
pulling the protocol content information and the upstream and downstream relationship of the target version protocol from a preset protocol management platform, and acquiring each target downstream protocol of the target version protocol downstream to-be-MOCK according to the upstream and downstream relationship of the protocol;
acquiring a preset target field which is configured in the target downstream protocol and is subjected to Cartesian divergence, and performing Cartesian product on the target downstream protocol according to the target field to generate a successful MOCK set and a failed MOCK set;
performing Cartesian product between the successful MOCK sets to obtain a successful MOCK rule, and performing Cartesian product on one element in the failed MOCK set and the successful MOCK set to obtain a failed MOCK rule;
and summarizing the success MOCK rules and the failure MOCK rules to generate the MOCK test engine.
5. The method for automatically testing an interface according to claim 1, wherein the step of obtaining a baseline test engine corresponding to the baseline version protocol, updating the baseline test engine according to the protocol update information, and obtaining a target test engine comprises:
obtaining a baseline test engine corresponding to the baseline version protocol, wherein the baseline test engine comprises: a business rule engine, a basic field engine and/or a MOCK test engine;
inquiring a preset support platform, acquiring an update scene identifier in the protocol update information and an update test rule corresponding to the update scene identifier from the preset support platform, and adding the update test rule to the service rule engine to obtain an updated service rule engine;
traversing the newly added attribute of the protocol updating information, and updating the basic field engine according to the change type, the change length and the newly added enumeration in the newly added attribute to obtain an updated basic field engine;
performing Cartesian product on the protocol updating information and an MOCK rule in the MOCK test engine to update the MOCK test engine to obtain an updated MOCK test engine;
and combining the updated business rule engine, the updated basic field engine and the updated MOCK test engine to obtain a target test engine.
6. The method for automatically testing an interface according to claim 1 or 2, wherein the step of generating a target test case according to the target test engine and running the target test case to obtain a target test result of the target version protocol includes:
acquiring a business rule engine, a basic field engine and an MOCK test engine in the target test engine;
extracting business engine rules from the business rules engine, field engine rules from the base field engine, and MOCK engine rules from the MOCK test engine;
and generating a target test case according to the business engine rule, the field engine rule and the MOCK engine rule, and operating the target test case to obtain a target test result of the target version protocol.
7. The method for automatically testing an interface according to claim 6, wherein the step of generating a target test case according to the business engine rule, the field engine rule and the MOCK engine rule, and running the target test case to obtain a target test result of the target version protocol comprises:
acquiring a basic case of the business engine rule, calling a preset automatic test platform to process the basic case to generate a business message, and intercepting the business message to generate a business type test case;
acquiring the field engine rule, calling a service engine rule which is processed by a preset automatic test platform to generate a basic message, intercepting the basic message, modifying the basic message according to the field engine rule, and generating a field type test case;
acquiring the MOCK engine rule, calling a service engine rule which is processed by a preset automatic test platform to generate a basic message, intercepting the basic message, processing the basic message according to the MOCK engine rule, and generating an MOCK type test case;
and performing Cartesian product on the service type test case, the field type test case and the MOCK type test case to generate a target test case, and operating the target test case to obtain a target test result of the target version protocol.
8. The automated interface testing method according to any one of claims 1 to 7, wherein after the step of generating a target test case according to the target test engine and running the target test case to obtain a target test result of the target version protocol, the method comprises:
acquiring a preset service serial number corresponding to the target test case, and storing a target test result of the target version protocol in association with the preset service serial number;
when a test result comparison request is received, acquiring a target test result corresponding to the target version protocol and a baseline test result corresponding to the baseline version protocol by taking the preset service serial number as a main key;
and comparing the target test result with the baseline test result to remove redundant data, and outputting comparison abnormal information.
9. An interface automation test device, characterized in that the interface automation test device comprises:
the device comprises a request receiving module, a processing module and a processing module, wherein the request receiving module is used for acquiring a target version protocol to be tested corresponding to an interface protocol test request when the interface protocol test request is received;
the protocol comparison module is used for comparing the target version protocol with a baseline version protocol if the baseline version protocol related to the target version protocol exists, so as to obtain protocol updating information;
the engine updating module is used for acquiring a baseline test engine corresponding to the baseline version protocol, updating the baseline test engine according to the protocol updating information and acquiring a target test engine;
and the operation test module is used for generating a target test case according to the target test engine and operating the target test case to obtain a target test result of the target version protocol.
10. An interface automation test device, the interface automation test device comprising: memory, a processor and an interface automation test program stored on the memory and executable on the processor, the interface automation test program when executed by the processor implementing the steps of the interface automation test method of any one of claims 1 to 8.
11. A computer-readable storage medium, having stored thereon an interface automation test program which, when executed by a processor, implements the steps of the interface automation test method of any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010597341.7A CN111737140B (en) | 2020-06-28 | 2020-06-28 | Interface automatic test method, device, equipment and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010597341.7A CN111737140B (en) | 2020-06-28 | 2020-06-28 | Interface automatic test method, device, equipment and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111737140A true CN111737140A (en) | 2020-10-02 |
CN111737140B CN111737140B (en) | 2024-08-27 |
Family
ID=72651364
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010597341.7A Active CN111737140B (en) | 2020-06-28 | 2020-06-28 | Interface automatic test method, device, equipment and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111737140B (en) |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112468358A (en) * | 2020-11-05 | 2021-03-09 | 苏州浪潮智能科技有限公司 | Protocol detection method, system, equipment and computer readable storage medium |
CN112818307A (en) * | 2021-02-25 | 2021-05-18 | 深信服科技股份有限公司 | User operation processing method, system, device and computer readable storage medium |
CN113177003A (en) * | 2021-05-24 | 2021-07-27 | 深圳前海微众银行股份有限公司 | Method, device, medium and computer program product for generating Mock use case |
CN113342674A (en) * | 2021-06-28 | 2021-09-03 | 平安普惠企业管理有限公司 | Performance baseline regression testing method, device, equipment and medium based on learning |
CN113342695A (en) * | 2021-07-13 | 2021-09-03 | 中国工商银行股份有限公司 | Software version testing method and device |
CN115061916A (en) * | 2022-06-21 | 2022-09-16 | 中国平安财产保险股份有限公司 | Method for automatically generating interface test case and related equipment thereof |
CN115134397A (en) * | 2022-06-28 | 2022-09-30 | 中国银行股份有限公司 | Method, device and equipment for realizing self-adaptive transaction baffle platform |
CN115687161A (en) * | 2022-12-30 | 2023-02-03 | 云筑信息科技(成都)有限公司 | Method for automatically generating interface test case based on scanning maven warehouse |
CN118473939A (en) * | 2024-07-10 | 2024-08-09 | 国网思极网安科技(北京)有限公司 | Baseline detection method, baseline detection device, baseline detection system and computer storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140245264A1 (en) * | 2013-02-28 | 2014-08-28 | International Business Machines Corporation | Identifying Test Cases Based on Changed Test Code |
CN105302710A (en) * | 2014-07-03 | 2016-02-03 | 腾讯科技(深圳)有限公司 | Method and apparatus for determining test case in need of regression testing |
CN108694104A (en) * | 2017-04-12 | 2018-10-23 | 北京京东尚科信息技术有限公司 | A kind of interface function contrast test method, apparatus, electronic equipment and storage medium |
CN109446068A (en) * | 2018-09-26 | 2019-03-08 | 平安健康保险股份有限公司 | Interface test method, device, computer equipment and storage medium |
-
2020
- 2020-06-28 CN CN202010597341.7A patent/CN111737140B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140245264A1 (en) * | 2013-02-28 | 2014-08-28 | International Business Machines Corporation | Identifying Test Cases Based on Changed Test Code |
CN105302710A (en) * | 2014-07-03 | 2016-02-03 | 腾讯科技(深圳)有限公司 | Method and apparatus for determining test case in need of regression testing |
CN108694104A (en) * | 2017-04-12 | 2018-10-23 | 北京京东尚科信息技术有限公司 | A kind of interface function contrast test method, apparatus, electronic equipment and storage medium |
CN109446068A (en) * | 2018-09-26 | 2019-03-08 | 平安健康保险股份有限公司 | Interface test method, device, computer equipment and storage medium |
Non-Patent Citations (2)
Title |
---|
KANG, SS (KANG, SEONG-SEOK) ET AL.: "SITAT: Simulation-based Interface Testing Automation Tool for Robot Software Component", INTERNATIONAL CONFERENCE ON CONTROL, AUTOMATION AND SYSTEMS (ICCAS 2010), 30 October 2010 (2010-10-30), pages 1781 - 1784, XP031836914 * |
范典华;杨奇民;代蕊;: "在线计费接口自动化测试系统及应用", 电脑与电信, no. 12, 10 December 2015 (2015-12-10) * |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112468358B (en) * | 2020-11-05 | 2022-07-22 | 苏州浪潮智能科技有限公司 | Protocol detection method, system, equipment and computer readable storage medium |
CN112468358A (en) * | 2020-11-05 | 2021-03-09 | 苏州浪潮智能科技有限公司 | Protocol detection method, system, equipment and computer readable storage medium |
CN112818307A (en) * | 2021-02-25 | 2021-05-18 | 深信服科技股份有限公司 | User operation processing method, system, device and computer readable storage medium |
CN112818307B (en) * | 2021-02-25 | 2024-05-28 | 深信服科技股份有限公司 | User operation processing method, system, equipment and computer readable storage medium |
CN113177003A (en) * | 2021-05-24 | 2021-07-27 | 深圳前海微众银行股份有限公司 | Method, device, medium and computer program product for generating Mock use case |
CN113342674A (en) * | 2021-06-28 | 2021-09-03 | 平安普惠企业管理有限公司 | Performance baseline regression testing method, device, equipment and medium based on learning |
CN113342695A (en) * | 2021-07-13 | 2021-09-03 | 中国工商银行股份有限公司 | Software version testing method and device |
CN113342695B (en) * | 2021-07-13 | 2024-07-09 | 中国工商银行股份有限公司 | Software version testing method and device |
CN115061916A (en) * | 2022-06-21 | 2022-09-16 | 中国平安财产保险股份有限公司 | Method for automatically generating interface test case and related equipment thereof |
CN115061916B (en) * | 2022-06-21 | 2024-07-16 | 中国平安财产保险股份有限公司 | Method for automatically generating interface test case and related equipment thereof |
CN115134397A (en) * | 2022-06-28 | 2022-09-30 | 中国银行股份有限公司 | Method, device and equipment for realizing self-adaptive transaction baffle platform |
CN115687161A (en) * | 2022-12-30 | 2023-02-03 | 云筑信息科技(成都)有限公司 | Method for automatically generating interface test case based on scanning maven warehouse |
CN118473939A (en) * | 2024-07-10 | 2024-08-09 | 国网思极网安科技(北京)有限公司 | Baseline detection method, baseline detection device, baseline detection system and computer storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111737140B (en) | 2024-08-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111737140B (en) | Interface automatic test method, device, equipment and computer readable storage medium | |
US11789715B2 (en) | Systems and methods for transformation of reporting schema | |
US11429365B2 (en) | Systems and methods for automated retrofitting of customized code objects | |
US8005803B2 (en) | Best practices analyzer | |
CN104679500B (en) | Method and device for realizing automatic generation of entity class | |
US12061901B2 (en) | Documentation enforcement during compilation | |
CN116881145B (en) | Interface testing method, device, equipment and storage medium based on flow playback | |
CN111737334A (en) | Data reporting method, device, equipment and storage medium | |
US10459698B2 (en) | Framework for generating adapters in an integrated development environment | |
CN116627849B (en) | System test method, device, equipment and storage medium | |
WO2024098746A1 (en) | Test method, apparatus, and related device | |
CN110968569B (en) | Database management method, database management device, and storage medium | |
CN116467188A (en) | Universal local reproduction system and method under multi-environment scene | |
CN114003293B (en) | Interface management method, device, electronic equipment and readable storage medium | |
CN118051426A (en) | Test method, test device and related equipment | |
CN114840429A (en) | Method, apparatus, device, medium and program product for identifying version conflicts | |
CN113419738A (en) | Interface document generation method and device and interface management equipment | |
KR100962656B1 (en) | Test Method and System for System Maintenance Based on Efficiently Improved Test-case Reuse | |
CN112667491A (en) | Function test method and device of virtual machine | |
CN116594918B (en) | Test case change influence analysis method, device, equipment and storage medium | |
US11989123B1 (en) | Systems, methods, and media for updating, managing, and maintaining a reference template for web service API testing | |
CN117668327A (en) | Component identification method, device, terminal equipment and storage medium | |
CN113177003A (en) | Method, device, medium and computer program product for generating Mock use case | |
CN117763026A (en) | Interface docking method and device, electronic equipment and storage medium | |
CN117420988A (en) | Method and device for building front-end service system based on power grid master station |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |