CN116795723B - Chain unit test processing method and device and computer equipment - Google Patents

Chain unit test processing method and device and computer equipment Download PDF

Info

Publication number
CN116795723B
CN116795723B CN202311049474.0A CN202311049474A CN116795723B CN 116795723 B CN116795723 B CN 116795723B CN 202311049474 A CN202311049474 A CN 202311049474A CN 116795723 B CN116795723 B CN 116795723B
Authority
CN
China
Prior art keywords
test
interface
entry
unit
session identifier
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311049474.0A
Other languages
Chinese (zh)
Other versions
CN116795723A (en
Inventor
袁翠芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202311049474.0A priority Critical patent/CN116795723B/en
Publication of CN116795723A publication Critical patent/CN116795723A/en
Application granted granted Critical
Publication of CN116795723B publication Critical patent/CN116795723B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/9035Filtering based on additional data, e.g. user or group profiles

Abstract

The invention relates to the technical field of artificial intelligence, and particularly discloses a chain unit test processing method, a device and computer equipment, wherein the method comprises the following steps: receiving a test entry of a tested page through a unit test interface, and determining a session identifier in the test entry; matching the test entry with an entry filter configured by the unit test interface, and acquiring a simulation data object returned by the matched entry filter under the condition that the test entry is matched with the entry filter; the unit test interface is provided with a plurality of parameter entering filters, and the parameter entering filters are corresponding to unique analog data objects; returning the session identification and the simulation data object to the tested page; and recording a matching log of the unit test interface successfully matched with the parameter entering filter, and determining the logic sequence of the test task according to the matching log and the session identifier. The method and the device can improve the consistency, accuracy and stability of page testing.

Description

Chain unit test processing method and device and computer equipment
Technical Field
The disclosure relates to the technical field of artificial intelligence, and in particular relates to a chain unit test processing method, a device and computer equipment.
Background
With the deep and complicated development of web pages, a way for the front-end page to simulate the back-end service return data by using a unit test interface provided by a mock tool has been used in maturity, and this way can reduce the matching cost of the back-end service and other back-end service uncertainties.
In the related art, when testing a front-end page, a mock tool faces to unit testing, coverage is limited, and for the situation that the flow of a task to be tested is long and a test result needs to be obtained by combining context test data, the mock tool is difficult to meet the requirements of accuracy and continuity of the test task.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a chain unit test processing method, apparatus, computer device, storage medium, and computer program product.
In a first aspect, the present disclosure provides a chain unit test processing method. The method comprises the following steps:
receiving a test entry of a tested page through a unit test interface, and determining a session identifier in the test entry; the session identifier is used for uniquely determining a session flow of a test task of the tested page, and the test task comprises at least one unit test interface;
Matching the test entry with an entry filter configured by the unit test interface, and acquiring a simulation data object returned by the matched entry filter under the condition that the test entry is matched with the entry filter; the unit test interface is provided with a plurality of parameter entering filters, and the parameter entering filters are corresponding to unique analog data objects;
returning the session identification and the simulation data object to the tested page;
and recording a matching log of the unit test interface successfully matched with the parameter entering filter, and determining the logic sequence of the test task according to the matching log and the session identifier so as to obtain a test result of the test task.
In one embodiment, the method further comprises:
configuring a corresponding interface simulation project according to the test task of the tested page, wherein the interface simulation project comprises at least one unit test interface;
marking a starting interface and a non-starting interface in the interface simulation engineering.
In one embodiment, the receiving, by the unit test interface, a test entry of a tested page, and determining a session identifier in the test entry includes:
Receiving the test entry through a unit test interface, identifying whether the unit test interface is an initial interface or not, and identifying whether the session identifier is carried in the test entry or not;
generating a session identifier for the test entry under the condition that the unit test interface is an initial interface and the test entry does not carry the session identifier, and taking the generated session identifier as a unique identifier of the session flow;
deleting a session identifier carried in the test entry under the condition that the unit test interface is an initial interface and the session identifier is carried in the test entry, generating a new session identifier, and taking the generated new session identifier as a unique identifier of the session flow;
and under the condition that the unit test interface is a non-initial interface and the test participating in carries a session identifier, the session identifier is used as the unique identifier of the session flow.
In one embodiment, the method further comprises:
and under the condition that the test input parameters are not matched with the input parameter filter, sending the test input parameters to a test environment, and receiving a response result of the test environment.
In one embodiment, the method further comprises:
and determining a calling sequence link of the unit test interface according to the logic sequence of the test task, and optimizing the unit test interface according to the calling sequence link.
In a second aspect, the present disclosure also provides a chain unit test handler. The device comprises:
the parameter entering module is used for receiving a test parameter of a tested page through the unit test interface and determining a session identifier in the test parameter; the session identifier is used for uniquely determining a session flow of a test task of the tested page, and the test task comprises at least one unit test interface;
the parameter entering filter module is used for matching the parameter entering filter configured by the test parameter entering participation unit test interface, and acquiring a simulation data object returned by the matched parameter entering filter under the condition that the test parameter entering is matched with the parameter entering filter; the unit test interface is provided with a plurality of parameter entering filters, and the parameter entering filters are corresponding to unique analog data objects;
the simulation data module is used for returning the session identification and the simulation data object to the tested page;
And the test result module is used for recording the matching log of the unit test interface successfully matched with the parameter entering filter, and determining the logic sequence of the test task according to the matching log and the session identifier so as to obtain the test result of the test task.
In one embodiment, the apparatus further comprises:
the test configuration module is used for configuring a corresponding interface simulation project according to the test task of the tested page, and the interface simulation project comprises at least one unit test interface;
and the interface marking module is used for marking the initial interface and the non-initial interface in the interface simulation engineering.
In one embodiment, the joining module includes:
the identification unit is used for receiving the test entry through a unit test interface, identifying whether the unit test interface is an initial interface or not and identifying whether the session identifier is carried in the test entry or not;
the first identifier generating unit is used for generating a session identifier for the test entry under the condition that the unit test interface is an initial interface and the test entry does not carry the session identifier, and taking the generated session identifier as a unique identifier of the session flow;
The second identifier generating unit is used for deleting the session identifier carried in the test entry under the condition that the unit test interface is an initial interface and the test entry carries the session identifier, generating a new session identifier, and taking the generated new session identifier as the unique identifier of the session flow;
the identification determining unit is used for taking the session identification as the unique identification of the session flow under the condition that the unit test interface is a non-initial interface and the test participating carries the session identification.
In one embodiment, the apparatus further comprises:
and the response module is used for sending the test entry to a test environment and receiving a response result of the test environment under the condition that the test entry is not matched with the entry filter.
In one embodiment, the apparatus further comprises:
and the calling link module is used for determining a calling sequence link of the unit test interface according to the logic sequence of the test task and optimizing the unit test interface according to the calling sequence link.
In a third aspect, the present disclosure also provides a computer device. The computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the steps of the chain unit test processing method when executing the computer program.
In a fourth aspect, the present disclosure also provides a computer-readable storage medium. The computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the above-described chain unit test processing method.
In a fifth aspect, the present disclosure also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of the above-described chain unit test processing method.
The chain unit test processing method, the device, the computer equipment, the storage medium and the computer program product at least comprise the following beneficial effects:
according to the method, the test input parameters are received through the unit test interface, different simulation data objects corresponding to the test input parameters are obtained through the matched input parameter filter at the unit test interface, meanwhile, the logic sequence of the test task is obtained through the session identification and the matched log, the mock data return of a long-page multi-branch test flow is supported, so that the development of continuous page functions is conveniently completed, the probability of occurrence of problems in the integrated test is reduced, and the continuity, accuracy and stability of the page test are greatly improved; the supporting unit tests the content association of the front interface and the back interface of the interface and supports the dynamic return of the content of the context data; the multi-interface mock test of the test cases is supported, the functional completion verification of the test cases is supported from the technical level, and the regression test verification of the multi-test cases can be supported on a page of functional coupling through accumulation of the test cases.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments or the conventional techniques of the present disclosure, the drawings required for the descriptions of the embodiments or the conventional techniques will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present disclosure, and other drawings may be obtained according to the drawings without inventive effort to those of ordinary skill in the art.
FIG. 1 is a diagram of an application environment for a chain unit test processing method in one embodiment;
FIG. 2 is a flow chart of a chain unit test processing method according to an embodiment;
FIG. 3 is a flow chart illustrating steps of configuration interface simulation engineering in one embodiment;
FIG. 4 is a flow diagram of a process for determining session identification in one embodiment;
FIG. 5 is a schematic diagram of an interactive flow of a test entry in one embodiment;
FIG. 6 is a block diagram of a chain unit test handler in one embodiment;
FIG. 7 is a block diagram of a chain unit test handler in another embodiment;
FIG. 8 is a block diagram of the configuration of the parameter entry module in one embodiment;
FIG. 9 is a block diagram of the internal architecture of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs. The terminology used in the description of the disclosure herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure.
The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims. The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, it is not excluded that additional identical or equivalent elements may be present in a process, method, article, or apparatus that comprises a described element.
As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," and/or the like, specify the presence of stated features, integers, steps, operations, elements, components, or groups thereof, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, or groups thereof. Also, in this specification, the term "and/or" includes any and all combinations of the associated listed items.
The chain unit test processing method provided by the embodiment of the disclosure can be applied to an application environment as shown in fig. 1. The terminal 102 communicates with the test server 104 through a network, and the test server 104 is communicatively connected with the backend server 106. The data storage system may store data that the test server 104 needs to process. The data storage system may be integrated on the test server 104 or may be located on a cloud or other network server. The test server 104 may test the page on the terminal 102, where the terminal 102 is configured to send a test entry to the test server 104, and the test server 104 may receive the test entry of the tested page through the unit test interface, pair and determine a session identifier in the test entry; and matching the entry filter configured by the test entry participating unit test interface, acquiring a simulation data object returned by the matched entry filter under the condition that the test entry is matched with the entry filter, and returning the session identifier and the simulation data object to the tested page. The test server 104 may also send the test entry to the backend server 106 and receive the returned results from the backend server 106 if the test entry does not match the entry filter. The backend server 106 has deployed thereon a test environment of software and hardware for testing. The test server 104 may further obtain a logic sequence of the test task from the obtained simulated data object and the matching log, so as to obtain a test result.
The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The test server 104 and the backend server 106 may each be implemented as a stand-alone server or as a server cluster of multiple servers.
In some embodiments of the present disclosure, as shown in fig. 2, a chain unit test processing method is provided, and the method is applied to the test server in fig. 1 for illustration, and includes the following steps:
step 210, receiving a test entry of a tested page through a unit test interface, and determining a session identifier in the test entry; the session identifier is used for uniquely determining a session flow of a test task of the tested page, and the test task comprises at least one unit test interface.
The unit test interface is provided by a mock tool and can be a mock interface. mock tools generally refer to test tools that are created with a virtual object for testing during unit testing for some objects that are not easily constructed or easily obtained. Mock tools may include easy Mock tools, moco tools, etc., which generally refer to a set of class libraries for generating Mock objects for a given interface by simple methods that provide simulated return to a single interface. Moco tools generally refer to a mock tool that achieves the effect of simulating a single request to return mock data by simply configuring request and response objects.
The test server may illustratively test the page under test by running test cases, which generally refer to descriptions of test tasks performed on a particular software product, as a set of test inputs, execution conditions, and expected results tailored for a particular objective to verify whether a particular software requirement is met. In general, a test case corresponds to a test task, and when the test task is executed, the test server may receive a test entry of a tested page through the unit test interface, and identify a session identifier in the test entry. The session identifier may be used to uniquely determine the session flow of the test task of the page under test, and the session identifier may be a UUID (Universally Unique Identifier, universal unique identifier) field. Test tasks typically complete a test task through one session flow, the test task comprising at least one unit test interface, i.e. the test task may comprise a series of unit test interfaces.
Step 220, matching the test entry with the entry filter configured by the unit test interface, and obtaining the simulation data object returned by the matched entry filter when the test entry is matched with the entry filter; the unit test interface is equipped with a number of in-reference filters that correspond to unique analog data objects.
Each unit test interface can be configured with a plurality of parameter entering filters, and each parameter entering filter corresponds to one analog data object.
For example, the test server may match, at the unit test interface, the received test entry filters participating in the unit test interface according to a preset matching rule, where the matching rule is used to determine whether the test entry hits the entry filter. Under the condition that the test entry is determined to be matched with the entry filter, the test server can acquire the corresponding analog data object of the matched entry filter, namely, the corresponding analog data object can be acquired at the unit test interface according to different test entries, and a plurality of branch logics of the test page function are supported.
And step 230, returning the session identification and the simulation data object to the tested page.
The test server returns the simulated data object and the session identifier of the current session flow to the tested page of the terminal together after obtaining the simulated data object.
In some embodiments, the test server may store the session identifier field using cookie technology (a technology for storing information between the Web server and the browser), and the terminal browser may automatically package and transfer cookie data to all associated backend interface services in the test server when multiple unit test interfaces are invoked in the front-end page test flow.
And 240, recording a matching log of the unit test interface successfully matched with the parameter entering filter, and determining the logic sequence of the test task according to the matching log and the session identifier so as to obtain a test result of the test task.
Illustratively, the test server may record a matching log of all unit test interfaces successfully matching the participating filters, and the matching log may include a unit test interface index identifier (for querying the unit test interface), a unit test interface call sequence, time information, and the like. The test server can analyze and obtain the calling sequence of all the unit test interfaces, the number of the unit test interfaces and the like in the test task according to the matching log and the corresponding session identification, namely, the logic sequence of the test task can be determined, and the test result of the test task can be accurately obtained by combining the context.
In the chain unit test processing method, the unit test interface is used for receiving test input parameters, different simulation data objects corresponding to the test input parameters are obtained at the unit test interface through the matched input parameter filter, meanwhile, the logic sequence of the test task is obtained through the session identification and the matched log, and the mock data of the long-page and multi-branch test flow is supported to return, so that the development of continuous page functions is conveniently completed, the probability of occurrence of problems in the integrated test is reduced, and the continuity, accuracy and stability of the page test are greatly improved; the supporting unit tests the content association of the front interface and the back interface of the interface and supports the dynamic return of the content of the context data; the multi-interface mock test of the test cases is supported, the functional completion verification of the test cases is supported from the technical level, and the regression test verification of the multi-test cases can be supported on a page of functional coupling through accumulation of the test cases.
In some embodiments of the present disclosure, as shown in fig. 3, the method further comprises:
and step 010, configuring a corresponding interface simulation project according to the test task of the tested page, wherein the interface simulation project comprises at least one unit test interface.
For example, the test server may configure a corresponding interface simulation project according to the test task to be tested before executing the test task, and the test task may involve one or more unit test interfaces, and a corresponding number of unit test interfaces may be configured in the interface simulation project according to actual requirements of the test task.
And step 020, marking a starting interface and a non-starting interface in the interface simulation engineering.
Typically, a test case (session flow) has an initial interface. The test server can mark all unit test interfaces in the interface simulation engineering, and mark a starting interface and a non-starting interface. It is also possible to mark only the starting interface, the unmarked unit test interface being the non-starting interface.
According to the embodiment, the unit test interface of the interface simulation engineering is configured before the test task is executed, and the unit test interface is marked with the initial interface, so that the interface and the receiving interface response can be quickly called, the initial interface is quickly positioned, the test efficiency is greatly improved, the test convenience is also provided, and the quick configuration according to different test cases is facilitated.
In some embodiments of the present disclosure, as shown in fig. 4, step 210 includes:
step 212, receiving the test entry through a unit test interface, identifying whether the unit test interface is an initial interface, and identifying whether the session identifier is carried in the test entry.
For example, after receiving the test entry according to the unit test interface, the test server may identify and determine whether the unit test interface is an initial interface, for example, by querying whether the unit test interface has an initial interface flag, and determine whether the test entry carries a session identifier, for example, determine whether the test entry includes a UUID field.
Step 214, generating a session identifier for the test entry under the condition that the unit test interface is an initial interface and the test entry does not carry the session identifier, and using the generated session identifier as a unique identifier of the session flow.
The test server can generate the session identifier of the current session flow under the condition that the test interface of the test unit is the initial interface and the test entry does not carry the session identifier, so that the generated session identifier and the simulation data object can be returned to the tested page together.
Step 216, deleting the session identifier carried in the test entry under the condition that the unit test interface is an initial interface and the session identifier is carried in the test entry, generating a new session identifier, and taking the generated new session identifier as the unique identifier of the session flow.
In an exemplary embodiment, when the test server determines that the unit test interface is an initial interface and the test entry carries the session identifier, the test server may delete the session identifier carried in the test entry and generate a new session identifier of the current session flow, so as to facilitate the subsequent return of the newly generated session identifier and the analog data object to the tested page together.
Step 218, in the case that the unit test interface is a non-initiation interface and the test entry carries a session identifier, the session identifier is used as a unique identifier of the session flow.
The test server determines that the unit test interface is a non-initial interface, and if the test entry carries the session identifier, the session identifier carried in the test entry is the session identifier of the current session flow, so that the session identifier and the analog data object can be returned to the tested page together. The non-initial interface can return according to the state of the previous interface, namely the non-initial interface obtains the session identification of the previous interface and returns the session identification and the simulation data object to the tested page.
In some embodiments, when the test server determines that the unit test interface is a non-initial interface and the test entry does not carry the session identifier, the test server may trace back the status of the preamble interface of the unit test interface to obtain the session identifier of the preamble interface. If the test server fails to acquire the session identification of the preamble interface, a fault flow can be reported, or an alarm can be given.
For example, as shown in fig. 5, in one embodiment, the test server receives a test entry sent by the terminal through interface a, which is the originating interface. The test server may return the newly generated session identification with the simulated data object. The test server receives the test input parameters sent by the terminal through an interface B, wherein the interface B is a non-initial interface. The test server may return the session identification and the simulated data object carried in the test entry.
After the unit test interface receives the test input parameters, the embodiment can identify and judge whether the unit test interface is an initial interface or not and judge whether the test input parameters carry session identification or not, and further execute corresponding operation according to different conditions, so that the returned content always comprises the session identification, and the continuity and the accuracy of the chain test task are ensured.
In some embodiments of the present disclosure, the method further comprises:
step 250, in the case that the test entry does not match the entry filter, sending the test entry to a test environment, and receiving a response result of the test environment.
When the test server matches the received test entry filters participating in the unit test interface at the unit test interface according to the preset matching rule, the test entry may be sent to the real test environment, that is, to the back-end server, where the back-end server responds to the test entry and obtains the returned response result, under the condition that it is determined that the test entry is not matched to any of the entry filters.
In the embodiment, the missed test entry of the entry filter is sent to the real test environment, and the response result of the test environment is obtained, so that the integrity of the test process is ensured.
In some embodiments of the present disclosure, the method further comprises:
and 260, determining a calling sequence link of the unit test interface according to the logic sequence of the test task, and optimizing the unit test interface according to the calling sequence link.
The test server may determine call sequencing links of the unit test interfaces according to the logic sequence of the test tasks, and may analyze accuracy and coverage rate of interface call in combination with logic flows of the test pages. For example, the test server may obtain an expected interface call link according to the logic flow of the test page, and compare the expected interface call link with an actually obtained interface call sequence link in consistency, so as to obtain accuracy and coverage rate. The test server can optimize the unit test interface according to the interface calling accuracy and coverage rate obtained by analysis, for example, the interface is continuously corrected, increased or decreased and the like, so that the interface calling accuracy and coverage rate are improved.
According to the method and the device, the unit test interface can be optimized through the determined calling sequence links of the unit test interface, so that the accuracy rate and the coverage rate of interface calling are improved.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the present disclosure also provides a chain unit test processing apparatus for implementing the above-mentioned related chain unit test processing method. The implementation of the solution provided by the device is similar to that described in the above method, so the specific limitations in the embodiments of the chain unit test processing device or devices provided below may be referred to above for the limitations of the chain unit test processing method, which are not repeated here.
In some embodiments of the present disclosure, as shown in fig. 6, a chain unit test handler is provided. The apparatus 600 includes:
the parameter entering module 610 is configured to receive a test parameter of a tested page through a unit test interface, and determine a session identifier in the test parameter; the session identifier is used for uniquely determining a session flow of a test task of the tested page, and the test task comprises at least one unit test interface;
the parameter entering filtering module 620 is configured to match the parameter entering filter configured by the unit test interface, and obtain a simulated data object returned by the matched parameter entering filter when the test parameter entering is matched with the parameter entering filter; the unit test interface is provided with a plurality of parameter entering filters, and the parameter entering filters are corresponding to unique analog data objects;
a simulation data module 630, configured to return the session identifier and the simulation data object to the tested page;
and the test result module 640 is used for recording the matching log of the unit test interface successfully matched with the parameter entering filter, and determining the logic sequence of the test task according to the matching log and the session identifier so as to obtain the test result of the test task.
In some embodiments of the present disclosure, as shown in fig. 7, the apparatus further comprises:
the test configuration module 650 is configured to configure a corresponding interface simulation project according to a test task of the tested page, where the interface simulation project includes at least one unit test interface;
the interface marking module 660 is used for marking the initial interface and the non-initial interface in the interface simulation engineering.
In some embodiments of the present disclosure, as shown in fig. 8, the joining module 610 includes:
the identifying unit 612 is configured to receive the test entry through a unit test interface, identify whether the unit test interface is an initial interface, and identify whether the session identifier is carried in the test entry;
a first identifier generating unit 614, configured to generate a session identifier for the test entry under the condition that the unit test interface is an initial interface and the test entry does not carry a session identifier, and use the generated session identifier as a unique identifier of the session flow;
the second identifier generating unit 616 is configured to delete a session identifier carried in the test entry, generate a new session identifier, and use the generated new session identifier as a unique identifier of the session flow when the unit test interface is an initial interface and the test entry carries a session identifier;
The identifier determining unit 618 is configured to, when the unit test interface is a non-initial interface and the test entry carries a session identifier, use the session identifier as a unique identifier of the session flow.
In some embodiments of the present disclosure, the apparatus further comprises:
and the response module is used for sending the test entry to a test environment and receiving a response result of the test environment under the condition that the test entry is not matched with the entry filter.
In some embodiments of the present disclosure, the apparatus further comprises:
and the calling link module is used for determining a calling sequence link of the unit test interface according to the logic sequence of the test task and optimizing the unit test interface according to the calling sequence link.
The modules in the chain unit test processing device described above may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules. It should be noted that, in the embodiment of the present disclosure, the division of the modules is merely a logic function division, and other division manners may be implemented in actual practice.
Based on the foregoing description of the embodiments of the chain unit test processing method, in another embodiment provided by the present disclosure, a computer device is provided, which may be a server, and an internal structure diagram thereof may be as shown in fig. 9. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing data. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a chain unit test processing method.
It will be appreciated by persons skilled in the art that the architecture shown in fig. 9 is merely a block diagram of some of the architecture relevant to the present inventive arrangements and is not limiting as to the computer device to which the present inventive arrangements are applicable, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
Based on the foregoing description of the embodiments of the chain unit test processing method, in another embodiment provided by the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, which when executed by a processor, implements the steps of the method embodiments described above.
Based on the foregoing description of the embodiments of the chain unit test processing method, in another embodiment provided by the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
In the description of the present specification, reference to the terms "some embodiments," "other embodiments," "desired embodiments," and the like, means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, schematic descriptions of the above terms do not necessarily refer to the same embodiment or example.
It should be understood that, in the present specification, each embodiment of the method is described in a progressive manner, and the same/similar parts of each embodiment are referred to each other, where each embodiment focuses on a difference from other embodiments. For relevance, reference should be made to the description of other method embodiments.
The technical features of the above embodiments may be arbitrarily combined, and for brevity, all of the possible combinations of the technical features of the above embodiments are not described, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present disclosure, which are described in more detail and are not to be construed as limiting the scope of the claims. It should be noted that variations and modifications can be made by those skilled in the art without departing from the spirit of the disclosure, which are within the scope of the disclosure. Accordingly, the scope of protection of the present disclosure should be determined by the following claims.

Claims (10)

1. A method of chain unit test processing, the method comprising:
receiving a test entry of a tested page through a unit test interface, and determining a session identifier in the test entry; the session identifier is used for uniquely determining a session flow of a test task of the tested page, and the test task comprises at least one unit test interface;
matching the test entry with an entry filter configured by the unit test interface, and acquiring a simulation data object returned by the matched entry filter under the condition that the test entry is matched with the entry filter; the unit test interface is provided with a plurality of parameter entering filters, and the parameter entering filters are corresponding to unique analog data objects;
returning the session identification and the simulation data object to the tested page;
recording a matching log of the unit test interface successfully matched with a parameter entering filter, and determining a logic sequence of the test task according to the matching log and the session identifier to obtain a test result of the test task;
the method further comprises the steps of:
configuring a corresponding interface simulation project according to the test task of the tested page, wherein the interface simulation project comprises at least one unit test interface;
Marking an initial interface and a non-initial interface in the interface simulation engineering;
the receiving, by the unit test interface, a test entry of a tested page, and determining a session identifier in the test entry includes:
receiving the test entry through a unit test interface, identifying whether the unit test interface is an initial interface or not, and identifying whether the session identifier is carried in the test entry or not;
generating a session identifier for the test entry under the condition that the unit test interface is an initial interface and the test entry does not carry the session identifier, and taking the generated session identifier as a unique identifier of the session flow;
deleting a session identifier carried in the test entry under the condition that the unit test interface is an initial interface and the session identifier is carried in the test entry, generating a new session identifier, and taking the generated new session identifier as a unique identifier of the session flow;
and under the condition that the unit test interface is a non-initial interface and the test participating in carries a session identifier, the session identifier is used as the unique identifier of the session flow.
2. The method according to claim 1, wherein the method further comprises:
And under the condition that the test input parameters are not matched with the input parameter filter, sending the test input parameters to a test environment, and receiving a response result of the test environment.
3. The method according to claim 1, wherein the method further comprises:
and determining a calling sequence link of the unit test interface according to the logic sequence of the test task, and optimizing the unit test interface according to the calling sequence link.
4. The method of claim 1, wherein the unit test interface is a mock interface.
5. A chain unit test handler, the apparatus comprising:
the parameter entering module is used for receiving a test parameter of a tested page through the unit test interface and determining a session identifier in the test parameter; the session identifier is used for uniquely determining a session flow of a test task of the tested page, and the test task comprises at least one unit test interface;
the parameter entering filter module is used for matching the parameter entering filter configured by the test parameter entering participation unit test interface, and acquiring a simulation data object returned by the matched parameter entering filter under the condition that the test parameter entering is matched with the parameter entering filter; the unit test interface is provided with a plurality of parameter entering filters, and the parameter entering filters are corresponding to unique analog data objects;
The simulation data module is used for returning the session identification and the simulation data object to the tested page;
the test result module is used for recording a matching log of the unit test interface successfully matched with the parameter entering filter, and determining the logic sequence of the test task according to the matching log and the session identifier so as to obtain the test result of the test task;
the apparatus further comprises:
the test configuration module is used for configuring a corresponding interface simulation project according to the test task of the tested page, and the interface simulation project comprises at least one unit test interface;
the interface marking module is used for marking an initial interface and a non-initial interface in the interface simulation engineering;
the parameter entering module comprises:
the identification unit is used for receiving the test entry through a unit test interface, identifying whether the unit test interface is an initial interface or not and identifying whether the session identifier is carried in the test entry or not;
the first identifier generating unit is used for generating a session identifier for the test entry under the condition that the unit test interface is an initial interface and the test entry does not carry the session identifier, and taking the generated session identifier as a unique identifier of the session flow;
The second identifier generating unit is used for deleting the session identifier carried in the test entry under the condition that the unit test interface is an initial interface and the test entry carries the session identifier, generating a new session identifier, and taking the generated new session identifier as the unique identifier of the session flow;
the identification determining unit is used for taking the session identification as the unique identification of the session flow under the condition that the unit test interface is a non-initial interface and the test participating carries the session identification.
6. The apparatus of claim 5, wherein the apparatus further comprises:
and the response module is used for sending the test entry to a test environment and receiving a response result of the test environment under the condition that the test entry is not matched with the entry filter.
7. The apparatus of claim 5, wherein the apparatus further comprises:
and the calling link module is used for determining a calling sequence link of the unit test interface according to the logic sequence of the test task and optimizing the unit test interface according to the calling sequence link.
8. The apparatus of claim 5, wherein the unit test interface is a mock interface.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 4 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 4.
CN202311049474.0A 2023-08-21 2023-08-21 Chain unit test processing method and device and computer equipment Active CN116795723B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311049474.0A CN116795723B (en) 2023-08-21 2023-08-21 Chain unit test processing method and device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311049474.0A CN116795723B (en) 2023-08-21 2023-08-21 Chain unit test processing method and device and computer equipment

Publications (2)

Publication Number Publication Date
CN116795723A CN116795723A (en) 2023-09-22
CN116795723B true CN116795723B (en) 2023-11-21

Family

ID=88050044

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311049474.0A Active CN116795723B (en) 2023-08-21 2023-08-21 Chain unit test processing method and device and computer equipment

Country Status (1)

Country Link
CN (1) CN116795723B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112637008A (en) * 2020-12-14 2021-04-09 广州品唯软件有限公司 Link simulation test method, device, system, computer equipment and storage medium
CN112631910A (en) * 2020-12-22 2021-04-09 平安普惠企业管理有限公司 Front-end testing method and device, computer equipment and storage medium
CN113064808A (en) * 2021-05-24 2021-07-02 华信汇联(北京)科技有限公司 Link simulation method
CN113485880A (en) * 2021-07-12 2021-10-08 浙江网商银行股份有限公司 Test method and device
CN113656304A (en) * 2021-08-16 2021-11-16 上海浦东发展银行股份有限公司 Method and device for testing front-end application program and storage medium
CN113778871A (en) * 2021-09-07 2021-12-10 未鲲(上海)科技服务有限公司 Mock testing method, device, equipment and storage medium
CN115391219A (en) * 2022-09-06 2022-11-25 平安银行股份有限公司 Test case generation method and device, electronic equipment and storage medium
CN115437903A (en) * 2021-06-01 2022-12-06 京东科技控股股份有限公司 Interface test method, device, apparatus, storage medium, and program
CN116028368A (en) * 2023-01-12 2023-04-28 深圳依时货拉拉科技有限公司 Interface testing method, device, computer equipment and computer readable storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5516381B2 (en) * 2010-12-17 2014-06-11 富士通株式会社 Test program, test apparatus, and test method
US8935573B2 (en) * 2012-08-29 2015-01-13 International Business Machines Corporation Reliable unit testing through cached mocking
US9146826B2 (en) * 2013-03-12 2015-09-29 Tellabs Operations, Inc. Method and apparatus for scaling network simulation
US11232019B1 (en) * 2020-07-07 2022-01-25 Bank Of America Corporation Machine learning based test coverage in a production environment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112637008A (en) * 2020-12-14 2021-04-09 广州品唯软件有限公司 Link simulation test method, device, system, computer equipment and storage medium
CN112631910A (en) * 2020-12-22 2021-04-09 平安普惠企业管理有限公司 Front-end testing method and device, computer equipment and storage medium
CN113064808A (en) * 2021-05-24 2021-07-02 华信汇联(北京)科技有限公司 Link simulation method
CN115437903A (en) * 2021-06-01 2022-12-06 京东科技控股股份有限公司 Interface test method, device, apparatus, storage medium, and program
CN113485880A (en) * 2021-07-12 2021-10-08 浙江网商银行股份有限公司 Test method and device
CN113656304A (en) * 2021-08-16 2021-11-16 上海浦东发展银行股份有限公司 Method and device for testing front-end application program and storage medium
CN113778871A (en) * 2021-09-07 2021-12-10 未鲲(上海)科技服务有限公司 Mock testing method, device, equipment and storage medium
CN115391219A (en) * 2022-09-06 2022-11-25 平安银行股份有限公司 Test case generation method and device, electronic equipment and storage medium
CN116028368A (en) * 2023-01-12 2023-04-28 深圳依时货拉拉科技有限公司 Interface testing method, device, computer equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN116795723A (en) 2023-09-22

Similar Documents

Publication Publication Date Title
CN111221726A (en) Test data generation method and device, storage medium and intelligent equipment
CN107080945B (en) Method and device for testing artificial intelligence behaviors in game and electronic equipment
CN111522728A (en) Method for generating automatic test case, electronic device and readable storage medium
CN109783457A (en) CGI interface managerial method, device, computer equipment and storage medium
CN111221721B (en) Automatic recording and executing method and device for unit test cases
CN114691506A (en) Pressure testing method, apparatus, device, medium, and program product
CN114185770A (en) Method and device for generating test data, computer equipment and storage medium
CN113535538B (en) Method, device, electronic equipment and storage medium for automatically testing application full link
CN116795723B (en) Chain unit test processing method and device and computer equipment
CN111708712A (en) User behavior test case generation method, flow playback method and electronic equipment
CN116155597A (en) Access request processing method and device and computer equipment
CN116561003A (en) Test data generation method, device, computer equipment and storage medium
CN116167327A (en) Tool and method for checking length of PCB signal line length and via stub length
CN112631905A (en) Execution process data management method and device, computer equipment and storage medium
CN116541454B (en) Event configuration method, device, computer equipment and storage medium
CN116228045B (en) Product reliability weak link assessment method and device based on performance degradation
CN117785674A (en) Interface use case generation method, device, computer equipment and storage medium
CN117395175A (en) Network application software testing method, device, equipment, medium and program product
CN108628750B (en) Test code processing method and device
CN117271367A (en) Configuration of application system test flow, application system test method and device
CN117194221A (en) Test method, test device, computer equipment and storage medium
CN116010349A (en) Metadata-based data checking method and device, electronic equipment and storage medium
CN114546863A (en) Automatic pressure measurement script generation method and device
CN115576834A (en) Software test multiplexing method, system, terminal and medium for supporting fault recovery
CN117591431A (en) Test method, test device, computer equipment and storage medium

Legal Events

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