Testing Method, Device, Equipment and Medium
By judging the target interface of online application code in the sandbox environment and obtaining the test environment, the impact of sandbox testing on external applications is solved, and efficient and accurate testing results are achieved.
Patent Information
- Application Number
- CN202111592902.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-23
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-12-23
AI Technical Summary
When testing in a sandbox environment, interactive testing between online applications and external applications will affect the production environment of external applications, affecting the accuracy and reliability of the test.
By determining whether the online application code contains the target interface, obtain the test environment of the target external application, and execute test requests in the test environment, avoiding the impact on the production environment.
On the basis of ensuring the accuracy of the test, it avoids the impact on the online use of external applications and improves the testing efficiency and accuracy.
Smart Images

Figure CN114168485B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer application technologies, and in particular, to a testing method, apparatus, device, and medium. Background Art
[0002] A sandbox environment is also known as a pre-production environment or a simulation environment. As the last test checkpoint before the test code of a new version goes online, the sandbox environment is applied in the code development of an application.
[0003] In related technologies, to ensure the reliability of testing, metadata in the production environment is replicated to build in the sandbox environment. When testing in the sandbox, the test is implemented by running according to the configuration information in the production environment.
[0004] However, in the above-mentioned sandbox testing method, when it comes to testing related to docking with an external system, that is, when encountering tests involving interactions with other external applications, it will cause test data to be generated for other external applications docked during sandbox testing, thus affecting the operation of other external applications. Summary of the Invention
[0005] To solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a testing method, apparatus, device, and medium, which can avoid affecting the online use of other external applications during testing while ensuring the testing accuracy rate when performing sandbox testing on an online application.
[0006] An embodiment of the present disclosure provides a testing method, which includes: in response to a test request for an online application to be tested in a sandbox environment, determining whether a target interface for communicating with other external applications is included in the online application code of the online application to be tested; if the target interface is included, determining a target external application corresponding to the target interface, and obtaining a test environment of the target external application; and in response to a test request for the target interface, invoking the target external application in the test environment to execute the test request.
[0007] An embodiment of the present disclosure further provides a testing apparatus, which includes: a judging module, configured to determine whether a target interface for communicating with other external applications is included in the online application code of the online application to be tested in response to a test request for the online application to be tested in a sandbox environment; a determining module, configured to determine a target external application corresponding to the target interface and obtain a test environment of the target external application when the target interface is included; and an invoking module, configured to invoke the target external application in the test environment to execute the test request in response to a test request for the target interface.
[0008] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions executable by the processor; the processor is configured to read the executable instructions from the memory and execute the instructions to implement the test method provided by the embodiment of the present disclosure.
[0009] An embodiment of the present disclosure also provides a computer-readable storage medium, which stores a computer program for executing the test method provided by the embodiment of the present disclosure.
[0010] The technical solution provided by the embodiment of the present disclosure has the following advantages compared with the prior art: The test solution provided by the embodiment of the present disclosure, in response to a test request for a to-be-tested online application in a sandbox environment, determines whether the online application code of the to-be-tested online application contains a target interface for communicating with other external applications. If the target interface is included, the target external application corresponding to the target interface is determined, and the test environment of the target external application is obtained. In response to a test request for the target interface, the target external application is called in the test environment to execute the test request. Thereby, when performing sandbox testing on an online application, on the basis of ensuring the test accuracy rate, the impact on the online use of other external applications during testing is avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In combination with the accompanying drawings and with reference to the following specific embodiments, the above and other features, advantages and aspects of the embodiments of the present disclosure will become more obvious. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the original elements and elements are not necessarily drawn to scale.
[0012] Figure 1 It is a schematic flowchart of a test method provided by an embodiment of the present disclosure;
[0013] Figure 2 It is a schematic diagram of a sandbox test page corresponding to a sandbox test environment provided by an embodiment of the present disclosure;
[0014] Figure 3 It is a schematic diagram of another sandbox test page corresponding to a sandbox test environment provided by an embodiment of the present disclosure;
[0015] Figure 4 It is a schematic diagram of another sandbox test page corresponding to a sandbox test environment provided by an embodiment of the present disclosure;
[0016] Figure 5 It is a schematic diagram of another sandbox test page corresponding to a sandbox test environment provided by an embodiment of the present disclosure;
[0017] Figure 6Another schematic diagram of the sandbox test page corresponding to the embodiment provided by the present disclosure;
[0018] Figure 7 Schematic structural diagram of a test device provided by an embodiment of the present disclosure;
[0019] Figure 8 Schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. Detailed implementation manners
[0020] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. On the contrary, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not used to limit the protection scope of the present disclosure.
[0021] It should be understood that the various steps recited in the method embodiments of the present disclosure can be executed in a different order and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.
[0022] The term "including" and its variants used herein are open-ended, that is, "including but not limited to". The term "based on" is "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0023] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order of the functions executed by these devices, modules or units or the interdependent relationship.
[0024] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly stated in the context, it should be understood as "one or more".
[0025] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information.
[0026] As mentioned above, when conducting sandbox tests, in order to simulate the real online service environment, metadata in the production environment is replicated in the sandbox. Metadata is data that describes data, mainly information describing data attributes, and is used to support functions such as indicating storage locations, historical data, resource searches, and file records. The production environment is a container that hosts the operation of an online application service and data storage, and is used by other external applications. Thus, the sandbox environment, as a container parallel to the production environment, has basically the same configuration information as the production environment, and this configuration information includes the execution source code, etc. When it comes to functional tests involving interactions with external systems corresponding to other external applications, the tests in the sandbox environment will affect the external systems.
[0027] For example, for a human resources system A application, when other users submit approval applications online, application A can view the approval reports submitted by other users. If application B, an online application, is being tested in the sandbox, and the approval reporting interface of online application B communicates with application A, if the production environment version of application A is called, then the test approval instances generated by online application B during the test will be sent to the online application A. This will cause the approvers in application A to be able to see not only the real approval instances submitted by other users, but also the approval instances generated by online application B during the test.
[0028] To solve the above problems, embodiments of the present disclosure provide a testing method, which will be introduced below in conjunction with specific embodiments.
[0029] Figure 1 The following is a schematic flowchart of a testing method provided by embodiments of the present disclosure. This method can be executed by a testing device, where the device can be implemented using software and / or hardware and is generally integrated in an electronic device. As Figure 1 shown, the method includes:
[0030] Step 101, in response to a test request for a to-be-tested online application in the sandbox environment, determine whether the online application code of the to-be-tested online application contains a target interface for communicating with other external applications.
[0031] It should be noted that the test request for the to-be-tested online application in the sandbox environment can be to display the test service interface of the to-be-tested online application on the sandbox test page after replicating all the metadata in the production environment. This test service page is basically the same as the service page of the to-be-tested online application displayed in other external applications, and the functions correspond one by one.
[0032] For example, when the to-be-tested online application is a "project management application", then as Figure 2As shown, if the online application includes functions such as "employee management", "business line management", "requirement management", "problem management", etc., the corresponding functions are also configured on the corresponding sand test page in the sandbox test environment.
[0033] Thus, in this embodiment, when a trigger operation on any function control on the sandbox test page is obtained by the tester, a test request for the online application to be tested is obtained.
[0034] In other external application scenarios, the test request can also be triggered in other ways. For example, when an execution instruction of the code corresponding to the online application to be tested in the user's sandbox environment is obtained, the corresponding test request is obtained, etc. In this embodiment, the online application code of the online application to be tested can be created in the sandbox environment.
[0035] After obtaining the test request, in order to determine whether the test request will affect the operation of the external system, etc., it is determined whether the online application code of the online application to be tested includes a target interface for communicating with other external applications. Among them, the target interface for communicating with other external applications is used to communicate with other external applications and feedback execution data to other external applications. For example, for an approval application program, an interface for submitting an approval document to the user interface belongs to the target interface.
[0036] It should be noted that in different application scenarios, the method for determining whether the online application code of the online application to be tested includes a target interface for communicating with other external applications is different. The examples are as follows:
[0037] In an embodiment of the present disclosure, the call object corresponding to each candidate interface in the online application code is obtained. The call object includes, but is not limited to, a link, application identification information, etc. It is determined whether the call object belongs to other external applications. For example, a whitelist call object belonging to the online application is obtained, and it is determined whether the call object belongs to the whitelist object. If not, it is determined that the call object belongs to other external applications. Another example is that if the call object is application identification information, it is determined whether the application identification information is consistent with the identification information of the online application to be tested. If not, it is determined that the call object belongs to other external applications. Thus, the candidate interface whose call object belongs to other external applications is determined as the target interface.
[0038] In another embodiment of the present disclosure, considering that the interface types of cross-application calls are different from the interface types of other functional interfaces, therefore, in this embodiment, a preset interface type that can be cross-application called is preset for the online application to be tested. The interface type of each candidate interface in the online application code is obtained, and then it is determined whether the interface type is the preset interface type. Among them, the candidate interface whose interface type is determined to be the preset interface is the target interface.
[0039] Step 102: If the target interface is included, determine the target external application corresponding to the target interface and obtain the test environment of the target external application.
[0040] The test environment includes descriptions of the soft application code and the hardware environment running thereon. The test environment refers to the general term of computer hardware, test code, network devices, and historical data necessary to complete the test work of the target external application. Moreover, due to the data isolation between the test environment and the production environment, in the embodiments of the present disclosure, obtaining the test environment of the target external application is to avoid affecting the production environment of the target external application on the basis of satisfying the functional test of the target interface.
[0041] In this embodiment, if the target interface is included, it indicates that the test request may feedback data to other external applications, etc. Therefore, in order to avoid affecting other external applications, determine the target external application corresponding to the target interface and obtain the test environment of the target external application. The test environment is similar to the production environment. Therefore, other applications can be called based on the test environment, avoiding affecting the use of other applications in the production environment.
[0042] Step 103: In response to the test request for the target interface, call the test environment to execute the test request.
[0043] In this embodiment, in response to the test request for the target interface, in response to the test request for the target interface, call the target external application in the test environment to execute the test request. The test environment contains the test version code of the target external application. Therefore, the test version code of the target external application can be executed in the corresponding test environment to implement the call of the target external application.
[0044] Continuing with the example where the external application is a certain human resources system A application, if the approval reporting interface of the online application B is communicated with the A application when testing the online application B in the sandbox, in the embodiments of the present disclosure, obtain the test environment of the A application. In response to the test request for the approval reporting interface of the online application B, call the code of the test version of the A application in the test environment of the A application to execute the approval reporting function. Thus, it is not the A application in the production environment that is called but the A application in the test environment, and the test approval instances generated by the online application B during the test will not be sent to the online A application, and it will not cause the approver to see the approval instances generated by the online application B during the test in the A application, avoiding the operation of the A application in the production environment.
[0045] In some possible embodiments, when a next test request is received while the target external application has not completed the test request for the current target interface, the request level of the test request is determined. The request level can be set by the tester or determined according to the interface type of the corresponding target interface, that is, the corresponding relationship between different interface types and the corresponding request levels is preset in advance, and the request level corresponding to the corresponding target interface is determined based on this corresponding relationship. If the request level of the next test request is greater than the preset value, the test version code of the target external application is copied in the test environment, and the corresponding test request is synchronously executed in another test version code. Thus, parallel processing of test requests is achieved, and the test efficiency is improved.
[0046] In some other possible embodiments, when there are multiple non-parallelizable test requests for the same external application within a preset period, for example, multiple test requests call the same interface of the same target external application. To further improve the test efficiency, the number of pending test requests that are non-parallelizable for each target external application is counted according to the preset period. If the number of pending requests is greater than a certain value, the test version code corresponding to the target external application is copied in the test environment. The number of copies of the test version code is related to the number of pending requests. Furthermore, the relevant test requests are processed in parallel based on multiple test version codes. In this embodiment, to improve the test efficiency, the test version code can be copied in advance.
[0047] It should be noted that in different application scenarios, the methods of calling the target external application in the test environment to execute the test request are different. Examples are as follows:
[0048] In an embodiment of the present disclosure, as Figure 3 shown, the online application code of the online application to be tested is created in the sandbox environment. The online application code corresponds to the configuration information in the production environment. Furthermore, if the online application to be tested needs to interact with other external systems in the production environment, after copying the online application code of the online application to be tested in the sandbox environment, the call to the target interface can be prohibited, that is, the value of the target interface is set to a preset value that is unavailable. Thus, the target interface cannot call the target external application in the review environment. In this embodiment, to improve the intuitiveness of the test, relevant prompt information of the prohibited target interface can be displayed on the test interface in the sandbox environment.
[0049] When a test request for the target interface is detected, the call object of the test request and the test environment of the corresponding target external application are determined. The test call object of the target external application in the test environment is called to execute the test request, and the execution result of the executed test request is obtained, so that the tester can correct or iteratively update the online application code according to the execution result.
[0050] In another embodiment of the present disclosure, to avoid determining whether to interact with an external system for each target interface, as Figure 4 shown, in a sandbox environment, replicate the online application code to obtain candidate test application code, determine the online call object of the target interface. The online call object can be a function interface of a target external application, etc. Determine the test call object corresponding to the online call object in the test environment, and replace the online call object of the target interface in the candidate application code with the test call object to generate the target test application code.
[0051] Thus, except for the call object of the target interface being replaced, the target application test code and the online application code are the same in other code segments. Therefore, testing can be achieved by executing the target application test code without replacing the call objects of the target interfaces one by one, improving the test efficiency.
[0052] In this embodiment, determine the first code segment corresponding to the target interface in the target test application code. The first code segment can be understood as the execution code for the target interface, and run the first code segment to call the target external application in the test environment to execute a test request.
[0053] In this embodiment, to further enhance the intuitiveness of the test, as Figure 5 shown, in the background test in the sandbox environment, display only the target interfaces that are only supported in the production environment. The target interfaces include but are not limited to object call interfaces, authorization setting interfaces, report submission interfaces, etc., so as to intuitively inform the test user which interfaces will affect the use of the external target application, etc. Among them, when displaying the relevant information of the target interface, to further improve the convenience of the test, the configuration information of the target interface and the detailed information of the call object can also be displayed.
[0054] During sandbox testing, to further enhance the intuitiveness of the test, as Figure 6 shown, in addition to being able to display all call objects corresponding to the online application code, a comparison interface between the online test object in the production environment and the test call object corresponding to the actual sandbox test environment can also be displayed on the background test page. The comparison interface can display not only the target interface and its corresponding call object, but also non-target interfaces and their call objects, etc. According to the scenario requirements, other configuration information such as the function description information and permission rules of the target interface can also be displayed, so that the test personnel can intuitively know the corresponding test call object in the test environment based on this interface, providing technical support for improving the accuracy of the test. For example, referring to Figure 6 , it shows that the call object of target interface 1 is replaced from a1 to a2 in the test environment.
[0055] Further, in the embodiments of the present disclosure, the purpose of testing an application in a sandbox environment is to optimize the online application code. Therefore, in this embodiment, in response to a user's modification request for the target test application code, the second code segment corresponding to the modification request is obtained. The modification request can be modified by a test user in the background, etc. Since the target test application code is not the online application code corresponding to the online service application, the third code segment corresponding to the second code segment in the online application code is determined, and the third code segment is modified according to the modification request to obtain the modified online application code. The online application code in the online environment is updated according to the modified online application code, thereby realizing the optimization of the online application code in the online environment and the optimization of the code of the online application.
[0056] In summary, for the testing method of the embodiments of the present disclosure, in response to a test request for a to-be-tested online application in a sandbox environment, it is determined whether the online application code of the to-be-tested online application contains a target interface for communicating with other external applications. If the target interface is included, the target external application corresponding to the target interface is determined, and the test environment of the target external application is obtained. In response to a test request for the target interface, the target external application is called in the test environment to execute the test request. Thus, when performing sandbox testing on an online application, on the basis of ensuring the test accuracy rate, the impact on the online use of other external applications during testing is avoided.
[0057] To implement the above embodiments, the present disclosure also proposes a testing device.
[0058] Figure 7 As shown in the structural schematic diagram of a testing device provided by the embodiments of the present disclosure, the device can be implemented by software and / or hardware and is generally integrated in an electronic device. Figure 7 As shown, the device includes: a judgment module 710, a determination module 720, and a call module 730, where
[0059] The judgment module 710 is configured to, in response to a test request for a to-be-tested online application in a sandbox environment, determine whether the online application code of the to-be-tested online application contains a target interface for communicating with other external applications;
[0060] The determination module 720 is configured to, when the target interface is included, determine the target external application corresponding to the target interface and obtain the test environment of the target external application;
[0061] The call module 730 is configured to, in response to a test request for the target interface, call the target external application in the test environment to execute the test request.
[0062] The testing device provided by the embodiments of the present disclosure can execute the testing methods provided by any embodiments of the present disclosure and has the corresponding functional modules and beneficial effects for executing the methods.
[0063] To implement the above embodiments, the present disclosure also provides a computer program application, including computer programs / instructions, which, when executed by a processor, implement the testing method in the above embodiments.
[0064] Figure 8 FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
[0065] Specifically, referring below to Figure 8 , which shows a schematic structural diagram of an electronic device 800 suitable for implementing the present disclosure. The electronic device 800 in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The electronic device shown is merely an example and should not impose any limitation on the functions and usage scope of the embodiments of the present disclosure.
[0066] As Figure 8 shown, the electronic device 800 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 801, which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0067] Generally, the following devices may be connected to the I / O interface 805: an input device 806 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 808 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 809. The communication device 809 may allow the electronic device 800 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 8 the electronic device 800 with various devices is shown, it should be understood that it is not required to implement or include all the shown devices. More or fewer devices may be alternatively implemented or included.
[0068] In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present disclosure includes a computer program application that includes a computer program carried on a non-transitory computer-readable medium, the computer program including program code for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device 809, or installed from a storage device 808, or installed from a ROM 802. When the computer program is executed by a processing device 801, the above-described functions defined in the test method of the embodiments of the present disclosure are performed.
[0069] It should be noted that the computer-readable medium described above in the present disclosure can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. And in the present disclosure, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0070] In some embodiments, the client and the server can communicate using any currently known or future-developed network protocol such as HTTP (HyperText Transfer Protocol), and can be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include local area networks ("LANs"), wide area networks ("WANs"), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.
[0071] The above computer-readable medium can be included in the above electronic device; it can also exist separately without being assembled into the electronic device.
[0072] The above computer-readable medium carries one or more programs. When the above one or more programs are executed by the electronic device, the electronic device is caused to: in response to a test request for an online application to be tested in a sandbox environment, determine whether the online application code of the online application to be tested contains a target interface for communicating with other external applications. If the target interface is included, determine the target external application corresponding to the target interface, and obtain the test environment of the target external application. In response to a test request for the target interface, call the target external application in the test environment to execute the test request. Thus, when performing sandbox testing on an online application, while ensuring the test accuracy rate, the impact on the online use of other external applications during testing is avoided.
[0073] Computer program code for performing the operations of the present disclosure can be written in one or more programming languages or combinations thereof. The above programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., by using an Internet service provider to connect through the Internet).
[0074] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of code, or a portion thereof that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks may occur in a different order than noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functionality involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or by a combination of dedicated hardware and computer instructions.
[0075] The units described in the embodiments of the present disclosure can be implemented in software or in hardware. In some cases, the name of the unit does not constitute a limitation on the unit itself.
[0076] The functions described above herein can be performed, at least in part, by one or more hardware logic components. By way of example, and without limitation, the types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system on a chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0077] In the context of the present disclosure, a machine-readable medium may be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0078] According to one or more embodiments of the present disclosure, the present disclosure provides a testing method, including: in response to a test request for an online application to be tested in a sandbox environment, determining whether a target interface for communicating with other external applications is included in the online application code of the online application to be tested;
[0079] If the target interface is included, determining a target external application corresponding to the target interface, and obtaining a test environment of the target external application;
[0080] In response to a test request for the target interface, calling the target external application in the test environment to execute the test request.
[0081] According to one or more embodiments of the present disclosure, in the testing method provided by the present disclosure, before the step of in response to a test request for an online application to be tested in a sandbox environment, it further includes:
[0082] Creating the online application code of the online application to be tested in the sandbox environment.
[0083] According to one or more embodiments of the present disclosure, in the testing method provided by the present disclosure, the step of determining whether a target interface for communicating with other external applications is included in the online application code of the online application to be tested includes:
[0084] Obtaining a calling object corresponding to each candidate interface in the online application code;
[0085] Determining whether the calling object belongs to the other external applications, where a candidate interface determined to belong to the other external applications is the target interface.
[0086] According to one or more embodiments of the present disclosure, in the testing method provided by the present disclosure, the step of determining whether a target interface for communicating with other external applications is included in the online application code of the online application to be tested includes:
[0087] Obtaining an interface type of each candidate interface in the online application code;
[0088] Determining whether the interface type is a preset interface type, where a candidate interface determined to have the interface type as the preset interface is the target interface.
[0089] According to one or more embodiments of the present disclosure, in the testing method provided by the present disclosure, before the step of in response to a test request for the target interface, it includes:
[0090] Copying the online application code in the sandbox environment to obtain candidate test application code;
[0091] Determine the online call object of the target interface, and determine the corresponding test call object in the test environment;
[0092] In the sandbox environment, replace the online call object of the target interface in the candidate application code with the test call object to generate the target test application code.
[0093] According to one or more embodiments of the present disclosure, in the test method provided by the present disclosure, before responding to the test request for the target interface, it includes:
[0094] In the sandbox environment, copy the online application code to obtain the candidate test application code;
[0095] Determine the online call object of the target interface, and determine the corresponding test call object in the test environment;
[0096] Replace the online call object of the target interface in the candidate application code with the test call object to generate the target test application code.
[0097] According to one or more embodiments of the present disclosure, the test method provided by the present disclosure further includes:
[0098] In response to a user's modification request for the target test application code, obtain a second code segment corresponding to the modification request;
[0099] Determine a third code segment in the online application code corresponding to the second code segment;
[0100] Modify the third code segment according to the modification request to obtain the modified online application code;
[0101] Update the online application code in the online environment according to the modified online application code.
[0102] According to one or more embodiments of the present disclosure, in the test method provided by the present disclosure, after the target interface is included, it further includes: modifying the value of the target interface in the online application code to a preset value,
[0103] Wherein, when the value of the target interface is the preset value, the target interface prohibits calling the target external application in the production environment.
[0104] According to one or more embodiments of the present disclosure, the present disclosure provides a test device, including: a judgment module, configured to respond to a test request for an online application to be tested in a sandbox environment, and judge whether the online application code of the online application to be tested includes a target interface for communicating with other external applications;
[0105] A determination module, configured to determine a target external application corresponding to the target interface and obtain a test environment of the target external application when the target interface is included.
[0106] An invocation module, configured to, in response to a test request for the target interface, invoke the target external application in the test environment to execute the test request.
[0107] According to one or more embodiments of the present disclosure, in the test device provided by the present disclosure, it further includes:
[0108] A creation module, configured to create online application code of the online application to be tested in the sandbox environment.
[0109] According to one or more embodiments of the present disclosure, in the test device provided by the present disclosure, the determination module is specifically configured to: obtain an invocation object corresponding to each candidate interface in the online application code;
[0110] Determine whether the invocation object belongs to the other external application, where a candidate interface determined to belong to the other external application is the target interface.
[0111] According to one or more embodiments of the present disclosure, in the test device provided by the present disclosure, the determination module is specifically configured to: obtain an interface type of each candidate interface in the online application code;
[0112] Determine whether the interface type is a preset interface type, where a candidate interface determined to have the interface type as the preset interface is the target interface.
[0113] According to one or more embodiments of the present disclosure, in the test device provided by the present disclosure, it further includes: a first acquisition module, configured to copy the online application code in the sandbox environment to obtain candidate test application code;
[0114] An invocation object determination module, configured to determine an online invocation object of the target interface and determine a test invocation object corresponding to the online invocation object in the test environment;
[0115] A replacement module, configured to replace the online invocation object of the target interface in the candidate application code with the test invocation object in the sandbox environment to generate target test application code.
[0116] According to one or more embodiments of the present disclosure, in the test device provided by the present disclosure, the invocation module is specifically configured to:
[0117] Determine a first code segment corresponding to the target interface in the target test application code;
[0118] Run the first code segment to call the target external application in the test environment to execute the test request.
[0119] According to one or more embodiments of the present disclosure, in the test device provided by the present disclosure, it further includes:
[0120] A second acquisition module, configured to determine a third code segment corresponding to the second code segment in the online application code;
[0121] A third acquisition module, configured to modify the third code segment according to the modification request to obtain the modified online application code;
[0122] An update module, configured to update the online application code in the online environment according to the modified online application code.
[0123] According to one or more embodiments of the present disclosure, in the test device provided by the present disclosure, it further includes: an interface processing module, configured to modify the value of the target interface in the online application code to a preset value,
[0124] wherein, when the value of the target interface is the preset value, the target interface prohibits calling the target external application in the production environment. According to one or more embodiments of the present disclosure, an electronic device is provided, including:
[0125] A processor;
[0126] A memory for storing executable instructions of the processor;
[0127] The processor is configured to read the executable instructions from the memory and execute the instructions to implement any one of the test methods provided by the present disclosure.
[0128] According to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, where the storage medium stores a computer program, and the computer program is used to execute any one of the test methods provided by the present disclosure.
[0129] The above description is only a preferred embodiment of the present disclosure and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosure concept. For example, the technical solutions formed by mutually replacing the above features with the technical features (but not limited to) having similar functions disclosed in the present disclosure.
[0130] In addition, although the operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in sequential order. In multi-tasking and parallel processing may be advantageous in certain environments. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the present disclosure. Certain features that are described in the context of separate embodiments may also be implemented in combination in a single embodiment. Conversely, the various features that are described in the context of a single embodiment may also be implemented separately or in any suitable sub-combination in multiple embodiments.
[0131] Although the subject matter has been described in language specific to structural features and / or methodological acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A testing method, characterized in that, It includes the following steps: In response to a test request for the online application to be tested in the sandbox environment, determine whether the online application code of the online application to be tested contains a target interface for communicating with other external applications; If the target interface is included, determine the target external application corresponding to the target interface, and obtain the test environment of the target external application; In response to a test request for the target interface, call the target external application in the test environment to execute the test request.
2. The method according to claim 1, wherein Before the response to the test request for the online application to be tested in the sandbox environment, it further includes: Create the online application code of the online application to be tested in the sandbox environment.
3. The method according to claim 1, wherein The determination of whether the online application code of the online application to be tested contains a target interface for communicating with other external applications includes: Obtain the call object corresponding to each candidate interface in the online application code; Determine whether the call object belongs to the other external applications, where the candidate interface determined to belong to the other external applications is the target interface.
4. The method according to claim 1, wherein The determination of whether the online application code of the online application to be tested contains a target interface for communicating with other external applications includes: Obtain the interface type of each candidate interface in the online application code; Determine whether the interface type is a preset interface type, where the candidate interface determined to have the interface type as the preset interface is the target interface.
5. The method according to claim 1, characterized in that, Before the response to the test request for the target interface, it includes: Copy the online application code in the sandbox environment to obtain candidate test application code; Determine the online call object of the target interface, and determine the corresponding test call object in the test environment; Replace the online call object in the candidate application code with the test call object in the sandbox environment to generate target test application code.
6. The method according to claim 5, characterized in that The calling of the target external application in the test environment to execute the test request includes: Determine the first code segment corresponding to the target interface in the target test application code; Run the first code segment to call the target external application in the test environment to execute the test request.
7. The method according to claim 5 or 6, characterized in that, It further includes: In response to a user's modification request for the target test application code, obtain a second code segment corresponding to the modification request; Determine the third code segment corresponding to the second code segment in the online application code; Modify the third code segment according to the modification request to obtain the modified online application code; Update the online application code in the online environment according to the modified online application code.
8. The method according to claim 1, wherein After the target interface is included, it further includes: modify the value of the target interface in the online application code to a preset value, where when the value of the target interface is the preset value, the target interface prohibits calling the target external application in the production environment.
9. A testing device, characterized in that, It includes: A judgment module, configured to, in response to a test request for the online application to be tested in the sandbox environment, judge whether the online application code of the online application to be tested contains a target interface for communicating with other external applications; A determination module, configured to determine a target external application corresponding to the target interface and obtain a test environment of the target external application when the target interface is included; An invocation module, configured to, in response to a test request for the target interface, invoke the target external application in the test environment to execute the test request.
10. An electronic device, characterized in that, The electronic device includes: A processor; A memory for storing executable instructions of the processor; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the test method according to any one of claims 1-8 above.
11. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, and the computer program is used to execute the test method according to any one of claims 1-8 above.
Citation Information
Patent Citations
Performance test method, device and system based on cloud computing platform
CN104461856A
Method for accessing application program interface through sandbox, sandbox and sandbox equipment
CN109683997A