Business object testing method, device and electronic equipment
By receiving test requests and retrieving data from the local test database to test business objects, the problem of testing relying on testers' experience is solved, and higher test accuracy is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA UNITED NETWORK COMM GRP CO LTD
- Filing Date
- 2021-06-24
- Publication Date
- 2026-06-26
AI Technical Summary
In existing technologies, business object testing relies on the experience of testers, resulting in insufficient test accuracy.
By receiving test requests, the interface environment type of the business object is determined, the corresponding test data is obtained from the local test database, and tests are conducted based on this data, reducing the reliance on the experience of testers.
It improves the accuracy of business object testing and reduces the reliance on testers' experience.
Smart Images

Figure CN115525529B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of data processing, and particularly relate to a business object testing method and device and electronic equipment. BACKGROUND
[0002] With the increasing user demand, the business system corresponding to the user demand is also more and more complex. In order to ensure the normal implementation of the business, it is necessary to test each business object in the business system before and after the business system is put into operation.
[0003] In the prior art, when testing a business object, a test parameter needs to be set manually, and then the business object is tested according to the manually set test parameter.
[0004] However, the way of testing a business object by manually setting a test parameter is too dependent on the experience of the tester, which affects the accuracy of the business object testing. SUMMARY
[0005] Embodiments of the present application provide a business object testing method, device and electronic equipment to improve the accuracy of business object testing.
[0006] In a first aspect, embodiments of the present application provide a business object testing method, comprising:
[0007] receiving a test request, wherein the test request contains a business object to be tested;
[0008] determining an interface environment type corresponding to the business object to be tested according to the test request, obtaining a sub-database corresponding to the interface environment type from a pre-stored local test database, and obtaining test data corresponding to the business object to be tested from the sub-database;
[0009] testing the business object according to the test data to obtain a test result, and sending the test result to a terminal device for display.
[0010] Optionally, the testing the business object according to the test data to obtain a test result comprises:
[0011] constructing a virtual object corresponding to the business object according to the test data, and testing the virtual object to obtain a test result.
[0012] Optionally, the local test database is a Mock database, and the determining, according to the test request, of the interface environment type corresponding to the business object to be tested and the obtaining, from a pre-stored local test database, of a sub-database corresponding to the interface environment type and the obtaining, from the sub-database, of test data corresponding to the business object to be tested, comprises:
[0013] determining, according to the test request, of the interface environment type corresponding to the business object to be tested and the obtaining, from the Mock database, of a sub-database corresponding to the interface environment type;
[0014] obtaining, according to the test request, of initial test data corresponding to the business object to be tested from the sub-database corresponding to the interface environment type;
[0015] judging, according to a preset test rule, whether the initial test data can meet the scene test requirement corresponding to different interface environment types, to obtain a judgment result;
[0016] if the judgment result is not met, performing test data simulation processing according to a pre-stored interface document to obtain simulated test data, and obtaining test data corresponding to the business object to be tested according to the simulated test data and the initial test data.
[0017] Optionally, the method further comprises:
[0018] if the judgment result is met, determining the initial test data as test data corresponding to the business object to be tested.
[0019] Optionally, before the determining, according to the test request, of the interface environment type corresponding to the business object to be tested and the obtaining, from a pre-stored local test database, of a sub-database corresponding to the interface environment, the method further comprises:
[0020] determining interface environment types corresponding to different test environments;
[0021] obtaining sub-databases corresponding to the interface environment types;
[0022] obtaining a local test database according to the sub-databases corresponding to the interface environment types, and storing the local test database.
[0023] Optionally, if the test result is a test failure, after the sending of the test result to a terminal device for display, the method further comprises:
[0024] judging whether the number of test failures exceeds a preset failure number threshold;
[0025] If no more than 10 are found, proceed with the steps of determining the interface environment type corresponding to the business object to be tested based on the test request and subsequent steps.
[0026] Optionally, the method further includes:
[0027] If the test exceeds the limit, a test failure message will be generated and sent to the terminal device for display.
[0028] Secondly, embodiments of the present invention provide a business object testing apparatus, comprising:
[0029] A receiving module is used to receive test requests, wherein the test requests contain the business object to be tested;
[0030] The processing module is used to determine the interface environment type corresponding to the business object to be tested according to the test request, obtain the sub-database corresponding to the interface environment type from the pre-stored local test database, and obtain the test data corresponding to the business object to be tested from the sub-database;
[0031] The processing module is further configured to test the business object based on the test data, obtain test results, and send the test results to the terminal device for display.
[0032] Thirdly, embodiments of the present invention provide an electronic device, comprising: at least one processor and a memory;
[0033] The memory stores computer-executed instructions;
[0034] The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the business object testing method as described in any of the first aspects.
[0035] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the business object testing method as described in any of the first aspects.
[0036] Fifthly, embodiments of the present invention provide a computer program product, including a computer program, which, when executed by a processor, implements the business object testing method described in the first aspect and various possible designs of the first aspect.
[0037] This invention provides a method, apparatus, and electronic device for testing business objects. Using this approach, a test request containing the business object to be tested is first received. Then, the interface environment type corresponding to the business object to be tested is determined based on the test request. A sub-database corresponding to the interface environment type is retrieved from a pre-stored local test database, and test data corresponding to the business object to be tested is retrieved from this sub-database. The business object can then be tested based on this test data to obtain test results, which are then sent to a terminal device for display. By retrieving test data corresponding to the business object to be tested from a pre-stored local test database and directly testing the business object based on this test data, the reliance on the tester's experience is reduced, thereby improving the accuracy of business object testing. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] Figure 1 This is a schematic diagram of the application system architecture for the business object testing method provided in this embodiment of the invention;
[0040] Figure 2 A flowchart illustrating the business object testing method provided in this embodiment of the invention;
[0041] Figure 3 This is an application diagram illustrating the test failure prompt provided in an embodiment of the present invention;
[0042] Figure 4 A schematic diagram illustrating the principle of the business object testing method provided in this embodiment of the invention;
[0043] Figure 5 This is a schematic diagram of the structure of the business object testing device provided in an embodiment of the present invention;
[0044] Figure 6 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0045] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0046] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can also include other sequential examples besides those illustrated or described. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0047] In existing technologies, a business system may include multiple business objects, which interact with each other to achieve the corresponding business functions. To ensure the normal implementation of business functions, each business object in the business system needs to be tested before and after the system goes live. This typically requires manual testing by testers, who pre-set test parameters for the business objects based on their own testing experience and then test them according to these parameters. However, manually setting test parameters for business objects relies heavily on the testers' experience. For example, for the same business object A, tester 1 sets test parameters a1, a2, and a4 based on their experience; tester 2 sets test parameters a1, a2, and a3 based on their experience; and tester 3 sets test parameters a1, a3, and a4 based on their experience. Because each person's testing experience is different, the final test parameters set will also differ, affecting the accuracy of the business object testing.
[0048] Based on the aforementioned technical issues, this application achieves the technical effect of reducing reliance on testers' experience and improving the accuracy of business object testing by retrieving test data corresponding to the business object to be tested from a locally pre-stored test database and directly testing the business object based on the test data.
[0049] Figure 1This is a schematic diagram of the application system architecture for the business object testing method provided in this embodiment of the invention, such as... Figure 1 As shown, the application system may include: a server 101, a local test database 102, and a terminal device 103. The local test database 102 may be deployed on the server 101. The server 101 can receive a test request triggered by a user, containing a business object to be tested. Based on the test request, the server 101 retrieves the corresponding test data from the local test database and performs tests on the business object using the test data to obtain the test results. The test results can then be sent to the terminal device for display.
[0050] The terminal device can be a smartphone, tablet, personal computer, or a smart wearable device or a monitor that can display the test results.
[0051] Additionally, users can trigger test requests within the front-end interface. Correspondingly, the front-end interface displays touch controls for multiple business objects to be tested; triggering the corresponding touch control will generate a test request containing the business objects to be tested.
[0052] The technical solution of the present invention will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0053] Figure 2 This is a flowchart illustrating a business object testing method provided in an embodiment of the present invention. The method in this embodiment can be executed by server 101. Figure 2 As shown, the method in this embodiment may include:
[0054] S201: Receive a test request, which contains the business object to be tested.
[0055] In this embodiment, in order to ensure the normal operation of the business system, each business object of the business system can be tested at preset intervals, or the business objects of the business system can be tested before the business system goes online.
[0056] When testing various business objects, the server can first receive test requests. These test requests can be automatically generated by the server or generated by the user through touch operations in the front-end interface.
[0057] Furthermore, if the test requests are automatically generated by the server, the test interval and the test order of each business object in the business system can be preset, and then test requests containing the business objects to be tested can be generated sequentially according to the preset test interval and the test order of each business object.
[0058] S202: Determine the interface environment type corresponding to the business object to be tested based on the test request, retrieve the sub-database corresponding to the interface environment type from the pre-stored local test database, and retrieve the test data corresponding to the business object to be tested from the sub-database.
[0059] In this embodiment, after receiving a test request, the interface environment type corresponding to the business object to be tested can be determined based on the test request. Different business objects may belong to different application environments, and different application environments correspond to different interface environment types; therefore, different business objects correspond to different interface environment types. For example, the application environment may be a Windows system, a Mac OS system, or a Linux system.
[0060] Furthermore, to improve the accuracy of test data acquisition, the local test database can store test data for each business object separately into different sub-databases based on the interface environment type corresponding to the business object, thus obtaining the local test database. Therefore, after determining the interface environment type corresponding to the business object, the sub-database corresponding to the interface environment type can be retrieved from the pre-stored local test database, and then the test data corresponding to the business object to be tested can be retrieved from the sub-database.
[0061] Furthermore, if the local test database is a mock database, then the interface environment type corresponding to the business object to be tested is determined according to the test request, and a sub-database corresponding to the interface environment type is obtained from the pre-stored local test database, and test data corresponding to the business object to be tested is obtained from the sub-database. Specifically, this may include:
[0062] Based on the test request, determine the interface environment type corresponding to the business object to be tested, and retrieve the sub-database corresponding to the interface environment type from the Mock database.
[0063] According to the test request, the initial test data corresponding to the business object to be tested is obtained from the sub-database corresponding to the interface environment type.
[0064] Based on the preset test rules, determine whether the initial test data can meet the scenario test requirements corresponding to different interface environment types, and obtain the judgment result.
[0065] If the judgment result is not satisfied, test data simulation processing is performed according to the pre-stored interface document to obtain simulated test data, and test data corresponding to the business object to be tested is obtained according to the simulated test data and the initial test data.
[0066] Specifically, after obtaining the initial test data corresponding to the business object to be tested from the sub-database corresponding to the interface environment type, since there may be insufficient initial test dataset, which may affect the accuracy of business object testing, the initial test data can be judged according to the preset test rules to determine whether it can meet the scenario test requirements corresponding to different interface environment types, and the judgment result can be obtained.
[0067] The preset test rules can be the existing test rules, which will not be discussed in detail here.
[0068] Furthermore, if the judgment result is not met, it indicates that the existing initial test data cannot meet the corresponding scenario testing requirements, and relevant test data needs to be added to improve the accuracy of business object testing. Therefore, test data modeling can be performed based on pre-stored interface documents to obtain simulated test data corresponding to the interface environment type. Then, the simulated test data and the initial test data are merged to obtain the test data corresponding to the business object to be tested. The pre-stored interface documents can be existing interface documents, meaning that existing interface documents can be used to generate simulated test data corresponding to the interface environment type, improving the efficiency of simulated test data generation.
[0069] Additionally, the method may also include:
[0070] If the judgment result is satisfactory, the initial test data will be determined as the test data corresponding to the business object to be tested.
[0071] Specifically, if the judgment result is that it can meet the scenario testing requirements corresponding to different interface environment types, the initial test data can be directly determined as the test data corresponding to the business object to be tested, without the need for additional simulated test data, thus reducing the pressure of data processing.
[0072] S203: Test the business object based on the test data, obtain the test results, and send the test results to the terminal device for display.
[0073] In this embodiment, after obtaining the test data, the business object can be tested based on the test data to obtain test results. The test data can include two types: one is data corresponding to the interface environment type obtained entirely from the local test database; the other is a mixture of simulated test data and data corresponding to the interface environment type obtained from the local test database, and the testing methods for both types of data are the same.
[0074] Furthermore, the business objects are tested based on the test data to obtain test results, which may include:
[0075] Based on the test data, construct virtual objects corresponding to the business objects, test the virtual objects, and obtain the test results.
[0076] Specifically, a virtual object corresponding to the business object can be constructed based on the test data, and then the virtual object can be tested directly to obtain the test results. By directly testing the virtual object, the impact on the original business object is reduced, ensuring the normal operation of the original business system.
[0077] Furthermore, test results can include two types: test success and test failure. If the test result is successful, a success notification can be sent to the terminal device for display. If the test result is unsuccessful, a failure notification can be sent to the terminal device for display, thus reminding testers to adjust various business objects in a timely manner based on the test results, thereby ensuring the normal operation of the business system.
[0078] By adopting the above scheme, a test request containing the business object to be tested can be received first. Then, the interface environment type corresponding to the business object to be tested can be determined according to the test request. A sub-database corresponding to the interface environment type can be obtained from the pre-stored local test database. Then, the test data corresponding to the business object to be tested can be obtained from the sub-database. The business object can then be tested according to the test data to obtain the test results, and the test results can be sent to the terminal device for display. By obtaining the test data corresponding to the business object to be tested from the pre-stored local test database and directly testing the business object according to the test data, the dependence on the testers' experience is reduced, thereby improving the accuracy of business object testing.
[0079] based on Figure 2 In addition to the method described herein, this specification also provides some specific implementation schemes of the method, which will be described below.
[0080] In another embodiment, before determining the interface environment type corresponding to the business object to be tested based on the test request, and retrieving the sub-database corresponding to the interface environment from the pre-stored local test database, the method may further include:
[0081] Determine the interface environment type corresponding to different test environments.
[0082] Retrieve the sub-database corresponding to each interface environment type.
[0083] The local test database is obtained based on the sub-database corresponding to each interface environment type, and the local test database is stored.
[0084] In this embodiment, before using the pre-stored local test database to obtain the sub-database corresponding to the interface environment, a local test database can be built first, and then the built local test database can be stored on the server, so that the local test database can be directly used to obtain data later.
[0085] Furthermore, when building the local test database, you can first determine the interface environment type corresponding to different test environments, then obtain the sub-database corresponding to each interface environment type, and finally obtain the local test database based on each sub-database. The interface environment type and the sub-database correspond one-to-one.
[0086] In addition, the data in the sub-databases corresponding to each interface environment type can be adjusted according to the actual application scenario or historical test results, thereby improving the accuracy of testing each business object.
[0087] Furthermore, in another embodiment, if the test result is a test failure, after sending the test result to the terminal device for display, the method may further include:
[0088] Determine whether the number of test failures exceeds a preset failure threshold.
[0089] If no more than 10 are found, proceed with the steps of determining the interface environment type corresponding to the business object to be tested based on the test request and subsequent steps.
[0090] In this embodiment, the test result can include two types: test success and test failure. If the test result is successful, a test success notification can be directly sent to the terminal device. If the test result is failed, to avoid accidental operation, it can first be determined whether the number of test failures exceeds a preset failure threshold. If it does not exceed the threshold, the steps of determining the interface environment type corresponding to the business object under test based on the test request and subsequent steps can be re-executed until the test succeeds, or until the number of test failures exceeds the preset failure threshold.
[0091] The preset failure threshold can be customized according to the actual application scenario, and will not be specified in detail here.
[0092] In addition, the method may also include:
[0093] If the test exceeds the limit, a test failure message will be generated and sent to the terminal device for display.
[0094] In this embodiment, if the number of test failures exceeds a preset failure threshold, it indicates that the problem can be ruled out as a misoperation. There may be problems with the test data or network lines, which need to be adjusted by relevant personnel in a timely manner. Therefore, when the number of test failures exceeds the preset failure threshold, a test failure prompt can be generated and sent to the terminal device for display.
[0095] For example, Figure 3 This is an application illustration of the test failure prompt provided in an embodiment of the present invention, such as... Figure 3 As shown in this embodiment, when the number of test failures exceeds a preset failure threshold, a test failure message can be generated. The message text can be "Business object test failed, please check!", and then the test failure message can be sent to the terminal device for display.
[0096] By adopting the above solution and localizing the Mock database, targeted testing of specific interface environment types can be performed, improving test coverage and reducing testing costs. It also allows for integration with multiple backend environments for functionalities, enabling rapid switching and verifying the stability of business operations under different environments. Furthermore, it optimizes the issue of inconsistent data management in the Mock database. The test and production environments are managed independently, eliminating the need to modify related code or configuration files for the Mock database, thus preventing issues where the production environment points to the Mock database due to unrestored Mock database test configurations. Additionally, it can simulate and aggregate data verification such as digital signature data, record call parameters and processing time, and assist developers in interface and performance debugging.
[0097] Figure 4 This is a schematic diagram illustrating the principle of the business object testing method provided in this embodiment of the invention, as shown below. Figure 4As shown, in this embodiment, the user can trigger a test request on the web (front-end interface). The test request is first sent to the corresponding application server. The application server can request a Mock database (i.e., a preset local database). The Mock database can first simulate and generate the corresponding aggregation interface data, and then send it to the corresponding aggregation production environment and aggregation test environment for separate processing via a genetic aggregation mode to obtain the aggregation return data. The aggregation return data is sent to the Mock database to simulate the generation of aggregation verification digital signature data, and the aggregation environment can be switched at will to obtain the data returned by the Mock database. The test data returned by the Mock database is then returned to the corresponding application server so that the application server can perform tests based on the test data, obtain test results, and return the test results to the web for display. In addition, the development end can also obtain configuration data, which includes the call processing time recorded by the Mock database, and adjust the Mock database according to the obtained configuration data.
[0098] By adopting the above solution, tests using the Mock database can independently simulate the convergence response of capabilities, allowing for earlier commencement of both the development self-testing and testing phases. This is beneficial for ensuring the quality and schedule of the entire business system. Furthermore, in situations where actual test data is insufficient, simulating return values from various scenarios improves test coverage and effectively prevents defects from remaining in the production environment due to incomplete data and inadequate test scenario coverage.
[0099] Based on the same idea, this specification also provides an apparatus corresponding to the above method. Figure 5 This is a schematic diagram of the structure of the business object testing device provided in an embodiment of the present invention, as shown below. Figure 5 As shown, it may include:
[0100] The receiving module 501 is used to receive a test request, wherein the test request contains a business object to be tested.
[0101] The processing module 502 is used to determine the interface environment type corresponding to the business object to be tested according to the test request, obtain the sub-database corresponding to the interface environment type from the pre-stored local test database, and obtain the test data corresponding to the business object to be tested from the sub-database.
[0102] In this embodiment, the local test database is a Mock database, and the processing module 502 is further configured to:
[0103] Based on the test request, determine the interface environment type corresponding to the business object to be tested, and retrieve the sub-database corresponding to the interface environment type from the Mock database.
[0104] According to the test request, the initial test data corresponding to the business object to be tested is obtained from the sub-database corresponding to the interface environment type.
[0105] Based on the preset test rules, determine whether the initial test data can meet the scenario test requirements corresponding to different interface environment types, and obtain the judgment result.
[0106] If the judgment result is not satisfied, test data simulation processing is performed according to the pre-stored interface document to obtain simulated test data, and test data corresponding to the business object to be tested is obtained according to the simulated test data and the initial test data.
[0107] In addition, the processing module 502 is also used for:
[0108] If the judgment result is satisfactory, then the initial test data is determined as the test data corresponding to the business object to be tested.
[0109] The processing module 502 is further configured to:
[0110] The business object is tested based on the test data to obtain test results, which are then sent to the terminal device for display.
[0111] In this embodiment, the processing module 502 is further configured to:
[0112] Based on the test data, construct a virtual object corresponding to the business object, and test the virtual object to obtain the test results.
[0113] Furthermore, in another embodiment, the processing module 502 is also used for:
[0114] Determine the interface environment type corresponding to different test environments.
[0115] Retrieve the sub-database corresponding to each interface environment type.
[0116] The local test database is obtained based on the sub-database corresponding to each interface environment type, and the local test database is stored.
[0117] Furthermore, in another embodiment, if the test result is a test failure, the processing module 502 is further configured to:
[0118] Determine whether the number of test failures exceeds a preset failure threshold.
[0119] If no more than 10 are found, proceed with the steps of determining the interface environment type corresponding to the business object to be tested based on the test request and subsequent steps.
[0120] Furthermore, the processing module 502 is also used for:
[0121] If the test exceeds the limit, a test failure message will be generated and sent to the terminal device for display.
[0122] The apparatus provided in this embodiment of the invention can achieve the above-mentioned... Figure 2 The methods in the embodiments shown are similar in principle and technical effect, and will not be described again here.
[0123] Figure 6 A schematic diagram of the hardware structure of the electronic device provided in the embodiments of the present invention, such as... Figure 6 As shown, the device 600 provided in this embodiment includes at least one processor 601 and a memory 602. The processor 601 and the memory 602 are connected via a bus 603.
[0124] In a specific implementation, at least one processor 601 executes computer execution instructions stored in the memory 602, causing at least one processor 601 to execute the method in the above method embodiment.
[0125] The specific implementation process of processor 601 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0126] In the above Figure 6 In the illustrated embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0127] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage.
[0128] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0129] This invention also provides a computer-readable storage medium storing computer-executable instructions. When a processor executes the computer-executable instructions, it implements the business object testing method described in the above method embodiments.
[0130] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the business object testing method described above.
[0131] The aforementioned computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0132] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0133] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for testing business objects, characterized in that, include: Receive a test request, wherein the test request contains the business object to be tested; Based on the test request, determine the interface environment type corresponding to the business object to be tested, retrieve the sub-database corresponding to the interface environment type from the pre-stored local test database, and retrieve the test data corresponding to the business object to be tested from the sub-database; The business object is tested based on the test data to obtain test results, and the test results are sent to the terminal device for display. If the local test database is a Mock database, then the process of determining the interface environment type corresponding to the business object to be tested based on the test request, obtaining the sub-database corresponding to the interface environment type from the pre-stored local test database, and obtaining the test data corresponding to the business object to be tested from the sub-database includes: The interface environment type corresponding to the business object to be tested is determined according to the test request, and the sub-database corresponding to the interface environment type is obtained from the Mock database; According to the test request, the initial test data corresponding to the business object to be tested is obtained from the sub-database corresponding to the interface environment type. Based on the preset test rules, determine whether the initial test data can meet the scenario test requirements corresponding to different interface environment types, and obtain the judgment result; If the judgment result is not satisfied, test data simulation processing is performed according to the pre-stored interface document to obtain simulated test data, and test data corresponding to the business object to be tested is obtained according to the simulated test data and the initial test data. If the judgment result is satisfied, then the initial test data is determined as the test data corresponding to the business object to be tested; Before determining the interface environment type corresponding to the business object to be tested based on the test request, and retrieving the sub-database corresponding to the interface environment from the pre-stored local test database, the method further includes: Determine the interface environment type corresponding to different test environments; different business objects may belong to different application environments, and different application environments correspond to different interface environment types. Retrieve the sub-database corresponding to each interface environment type; The local test database is obtained based on the sub-database corresponding to each interface environment type, and the local test database is stored.
2. The method according to claim 1, characterized in that, The step of testing the business object based on the test data and obtaining test results includes: Based on the test data, construct a virtual object corresponding to the business object, and test the virtual object to obtain the test results.
3. The method according to any one of claims 1-2, characterized in that, If the test result is a test failure, then after sending the test result to the terminal device for display, the process further includes: Determine whether the number of test failures exceeds a preset failure threshold; If no more than 10 are found, proceed with the steps of determining the interface environment type corresponding to the business object to be tested based on the test request and subsequent steps.
4. The method according to claim 3, characterized in that, The method further includes: If the test exceeds the limit, a test failure message will be generated and sent to the terminal device for display.
5. A business object testing device, characterized in that, include: A receiving module is used to receive test requests, wherein the test requests contain the business object to be tested; The processing module is used to determine the interface environment type corresponding to the business object to be tested according to the test request, obtain the sub-database corresponding to the interface environment type from the pre-stored local test database, and obtain the test data corresponding to the business object to be tested from the sub-database; The processing module is also used to test the business object based on the test data, obtain test results, and send the test results to the terminal device for display; If the local test database is a Mock database, then the processing module is specifically used for: The interface environment type corresponding to the business object to be tested is determined according to the test request, and the sub-database corresponding to the interface environment type is obtained from the Mock database; According to the test request, the initial test data corresponding to the business object to be tested is obtained from the sub-database corresponding to the interface environment type. Based on the preset test rules, determine whether the initial test data can meet the scenario test requirements corresponding to different interface environment types, and obtain the judgment result; If the judgment result is not satisfied, test data simulation processing is performed according to the pre-stored interface document to obtain simulated test data, and test data corresponding to the business object to be tested is obtained according to the simulated test data and the initial test data. If the judgment result is satisfied, then the initial test data is determined as the test data corresponding to the business object to be tested; Before the processing module determines the interface environment type corresponding to the business object to be tested based on the test request and retrieves the sub-database corresponding to the interface environment from the pre-stored local test database, it is also used for: Determine the interface environment type corresponding to different test environments; different business objects may belong to different application environments, and different application environments correspond to different interface environment types. Retrieve the sub-database corresponding to each interface environment type; The local test database is obtained based on the sub-database corresponding to each interface environment type, and the local test database is stored.
6. An electronic device, characterized in that, include: At least one processor and memory; The memory stores computer-executed instructions; The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the business object testing method as described in any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by the processor, implement the business object testing method as described in any one of claims 1 to 4.
8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the business object testing method as described in any one of claims 1 to 4.