A testing method, device, storage medium and electronic equipment

By updating and clearing the initial state-related parameters of business functions in end-to-end testing, the database pollution problem caused by test case playback is solved, ensuring the cleanliness of the test environment and the accuracy of the test results.

CN118860895BActive Publication Date: 2025-04-22广州三七极耀网络科技有限公司
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411106663.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2025-04-22
Estimated Expiration
2044-08-12

AI Technical Summary

Technical Problem

When conducting end-to-end testing, frequent replay of test cases results in a large amount of invalid data generated in the database, contaminating the test environment and affecting the accuracy of the test results.

Method used

By receiving the test request, determine the service function to be tested, and update the initial state-related parameters after the function is triggered. Send these parameters to the server, perform the test, and clear the parameters after the test is completed, and restore the function to the initial state.

Benefits of technology

It effectively prevents invalid data generated during the test to pollute the test environment, ensures that the business functions return to the initial state every time the test is tested, and improves the accuracy of the test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118860895B_ABST
    Figure CN118860895B_ABST
Patent Text Reader

Abstract

This specification discloses a testing method, device, storage medium and electronic device. The testing method includes: receiving a test request for a target object; determining the business function to be tested in the target object according to the test request; after triggering the business function to be tested, determining the state-related parameters corresponding to the business function to be tested; sending the state-related parameters to the server, so that the server performs the test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters, and after determining that the test for the business function to be tested is completed, clearing the state-related parameters, and restoring the state of the business function to be tested during the test to the initial state. This solution clears the "dirty data" generated during the test and completes the data rollback after the test is completed, effectively avoiding the pollution of the test environment by the data generated by executing the same test case multiple times.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a testing method, device, storage medium and electronic device. Background Art

[0002] End-to-end testing mainly refers to testing the various business functions of a business program from the front end to the back end to ensure that the business program can work normally after it goes online. When performing end-to-end testing, it is usually necessary to replay the same test case multiple times (that is, through a series of operations and inputs to test a certain function or process) to verify whether the business function meets expectations.

[0003] However, each time a test case is executed to test a business function, the data generated during the test will be written to the database, which will contain a large amount of invalid data. These invalid data will pollute the test environment, causing the business function to be unable to be restored to the default initial state when the same test case is executed next time, seriously affecting the accuracy of the test results.

[0004] Therefore, how to avoid the pollution of the test environment by the data generated during each test process and further ensure the accuracy of the test results when the same test case is executed multiple times is an urgent problem to be solved. Summary of the invention

[0005] This specification provides a testing method, device, storage medium and electronic device to partially solve the above problems existing in the prior art.

[0006] This manual adopts the following technical solutions:

[0007] This manual provides a test method, including:

[0008] receiving a test request for a target object;

[0009] Determining, according to the test request, a business function to be tested in the target object;

[0010] After the service function to be tested is triggered, determining state-related parameters corresponding to the service function to be tested, wherein the state-related parameters are obtained by updating initial state-related parameters of the service function to be tested in an initial state after the service function to be tested is triggered;

[0011] The state-related parameters are sent to the server so that the server performs a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters; after determining that the test on the business function to be tested is completed, the state-related parameters are cleared, and the state of the business function to be tested during the test is restored to the initial state.

[0012] Optionally, before the step of sending the state-related parameters to the server, the method further includes:

[0013] Generate a test protocol number;

[0014] The step of sending the state-related parameters to the server so that the server performs a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters, and clearing the state-related parameters after determining that the test on the business function to be tested is completed, specifically includes:

[0015] The test protocol number and the state-related parameters are bound and sent to the server, so that the server saves the state-related parameters according to the binding relationship between the test protocol number and the state-related parameters, and performs a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters. After determining that the test of the business function to be tested is completed, the state-related parameters are determined from the saved data according to the test protocol number and the binding relationship, and the state-related parameters are cleared.

[0016] Optionally, the step of generating a test protocol number specifically includes:

[0017] The test protocol number is determined based on the time information of the current moment and the random number generated at the current moment.

[0018] Optionally, before the step of sending the state-related parameters to the server, the method further includes:

[0019] Generate an operation log based on the business operations involved after triggering the business function to be tested;

[0020] The state-related parameters are sent to a server so that the server performs a test on the service function to be tested based on the state corresponding to the service function to be tested under the state-related parameters, and after determining that the test on the service function to be tested is completed, the state-related parameters are cleared, and the state of the service function to be tested during the test is restored to the initial state, specifically including:

[0021] The state-related parameters and the operation log are sent to the server, so that the server performs a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters; after determining that the test on the business function to be tested is completed, the state-related parameters are cleared, and the state of the business function to be tested during the test is restored to the initial state based on the operation log.

[0022] Optionally, the method further comprises:

[0023] If it is determined according to the obtained test result that the service function to be tested is abnormal, then determining other service functions associated with the service function to be tested;

[0024] Determining the state of the other business functions according to the state of the business function to be tested corresponding to the state-related data;

[0025] Based on the status of the other functions, generate test cases for the other business functions, so as to test the other business functions through the test cases;

[0026] Based on the obtained test results for the other business functions, factor information causing the abnormality of the business function to be tested is determined, so as to repair the business function to be tested according to the factor information.

[0027] This specification provides a testing method, which is applied to a server and includes:

[0028] Acquire state-related parameters sent by the client, wherein the state-related parameters are obtained and determined after updating initial state-related parameters of the service function to be tested in an initial state after triggering the service function to be tested, and the service function to be tested is determined by the client according to a received test request for a target object;

[0029] Based on the state corresponding to the service function to be tested under the state-related parameters, executing a test on the service function to be tested;

[0030] After it is determined that the test on the service function to be tested is completed, the state-related parameters are cleared, and the state of the service function to be tested during the test is restored to the initial state.

[0031] This specification provides a testing device, including:

[0032] A receiving module, used for receiving a test request for a target object;

[0033] A determination module, used to determine the business function to be tested in the target object according to the test request;

[0034] A trigger module, used for determining, after triggering the service function to be tested, state-related parameters corresponding to the service function to be tested, wherein the state-related parameters are obtained by updating the initial state-related parameters of the service function to be tested in the initial state after triggering the service function to be tested;

[0035] The test module is used to send the state-related parameters to the server so that the server performs the test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters; after determining that the test on the business function to be tested is completed, the state-related parameters are cleared, and the state of the business function to be tested during the test is restored to the initial state.

[0036] This specification provides a testing device, including:

[0037] an acquisition module, used for acquiring state-related parameters sent by the client, wherein the state-related parameters are obtained and determined after updating the initial state-related parameters of the business function to be tested in the initial state after triggering the business function to be tested, and the business function to be tested is determined by the client according to the received test request for the target object;

[0038] An execution module, configured to execute a test on the service function to be tested based on a state corresponding to the service function to be tested under the state-related parameters;

[0039] The clearing module is used to clear the state-related parameters after determining that the test on the service function to be tested is completed, and restore the state of the service function to be tested during the test to the initial state.

[0040] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned test method is implemented.

[0041] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the above-mentioned test method is implemented when the processor executes the program.

[0042] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:

[0043] In the test method provided in the present specification, a test request for a target object is received; based on the test request, a business function to be tested in the target object is determined; after the business function to be tested is triggered, state-related parameters corresponding to the business function to be tested are determined; the state-related parameters are sent to a server so that the server performs a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters; after determining that the test on the business function to be tested is completed, the state-related parameters are cleared, and the state of the business function to be tested during the test is restored to the initial state.

[0044] It can be seen from the above method that when this solution tests the business function in the target object, when the business function is triggered, its initial state will change, and the initial state related parameters will also be updated accordingly. Although the business function will maintain the state under the updated state related parameters during the test, when it is determined that the test is completed, the state related parameters will be cleared and the business function will be restored to the initial state. In this way, not only is the data rollback of the business function completed, so that the business function can maintain the initial state when the business function is tested next time, but it also effectively prevents the "dirty data" generated during the test from polluting the test environment, further ensuring the accuracy of the test results. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:

[0046] Figure 1 A flow chart of a test method provided in this specification;

[0047] Figure 2 A flow chart of a test method provided in this specification;

[0048] Figure 3 A schematic diagram of a test device provided for this specification;

[0049] Figure 4 A schematic diagram of a test device provided for this specification;

[0050] Figure 5 A method corresponding to the Figure 1 or Figure 2 Schematic diagram of electronic equipment. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.

[0052] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.

[0053] Figure 1 A flow chart of a test method provided in this specification includes the following steps:

[0054] S101: Receive a test request for a target object.

[0055] When performing end-to-end testing, it is usually necessary to replay the same test case multiple times to verify whether the system's behavior meets expectations. However, since most application systems use a database, each time a test case is replayed, the data is persisted to the database, which can lead to data duplication and polluted test environments. Existing solutions usually involve manually cleaning up database data after the test is completed, or backing up / restoring database snapshots before and after each test, but these methods are cumbersome and inefficient.

[0056] For example, for the e-commerce website to be tested, the website uses a database as its persistence layer framework. When performing end-to-end testing, it is necessary to test the entire process of users purchasing goods, including user login, adding goods to the shopping cart, and order settlement. Since this process involves multiple database operations, if the database state cannot be effectively rolled back after each test, it will lead to data duplication and pollution of the test environment.

[0057] Based on this, this specification provides a testing method that uses standardized protocols to mark traffic and track, and uses dynamic bytecode modification technology to design a dynamic data sandbox environment, so as to promptly delete invalid data generated during the test process and effectively prevent pollution of the test environment.

[0058] When the user triggers a test case, the client of the test system can receive a test request for the target object. In actual applications, the target object can be an application installed on a specified device (such as a mobile phone, tablet computer, laptop computer, etc.), or a website that provides specific services (such as shopping, finance, search, etc.).

[0059] For each test, the client can generate a unique test protocol number corresponding to the test.

[0060] In this specification, the client can obtain the time information of the current moment and generate a random number, and then generate a unique test protocol number based on the time information and the random number.

[0061] For example, the client can calculate the hash value of the current time information and the random number, and use the hash value as the test protocol number. Of course, the client can also directly use the combination of the time information and the random number as the test protocol number.

[0062] In actual applications, the client may also generate a test protocol number based on either time information or a random number, or may generate a test protocol number based on time information, a random number, and other conditional parameters (such as location information). This specification does not make specific limitations on this.

[0063] S102: Determine the business function to be tested in the target object according to the test request.

[0064] S103: after the service function to be tested is triggered, determining state-related parameters corresponding to the service function to be tested, wherein the state-related parameters are obtained by updating initial state-related parameters of the service function to be tested in an initial state after the service function to be tested is triggered.

[0065] After receiving the test request, the client can determine the business function to be tested in the target object that needs to be tested by the current test case based on the test request, and further generate test instructions for the business function to be tested (such as startup, login, registration, anti-addiction, payment, and core application functions, etc.) to trigger the business function to be tested through the test instructions.

[0066] The test instruction may carry operations or parameters involved in executing the business function. After receiving the test instruction, the business function may execute the operations or input parameters therein.

[0067] Since a series of operations and parameter inputs are involved after a business function is triggered, its initial state will also change. Accordingly, the initial state-related parameters in its initial state will also be updated with the operations performed or the input parameters.

[0068] Therefore, for each service function to be tested, after triggering the service function, the client can determine the state-related parameters corresponding to the service function (ie, the state-related parameters after updating the initial state-related parameters in the initial state).

[0069] In this specification, the above-mentioned status-related parameters can be used to characterize a series of parameters and data related to the business function status. For example, when the "login" function is tested, its initial state may be a non-logged-in state, and the initial state-related parameters may be zero (i.e., not logged in and no login data exists). After triggering the "login" function, the state of the function will be changed to a logged-in state. At this time, the state-related parameters include a logged-in state identifier and login information such as a password and an account number.

[0070] For another example, when testing the "shopping cart" function, its initial state may be an unused shopping cart state, in which case the items in the shopping cart are empty, and its corresponding state-related data may be zero (i.e., the shopping cart is not used and there are no items in the shopping cart). After the "shopping cart" function is triggered, the state of the function will change to an added shopping cart state, in which case the state-related parameters include an added shopping cart state identifier and product information corresponding to the items added to the shopping cart.

[0071] In addition, the client can also generate operation logs based on the business operations involved in the process of triggering the business function.

[0072] S104: Send the state-related parameters to the server so that the server performs a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters; after determining that the test on the business function to be tested is completed, clear the state-related parameters and restore the state of the business function to be tested during the test to the initial state.

[0073] The client may send the above-mentioned state-related parameters to the server, so that the server performs a test on the service function to be tested based on the state corresponding to the service function to be tested under the state-related parameters.

[0074] It should be noted that the process of testing the business function can be completed on the client. During the test, the server can maintain the state of the business function based on the received state-related parameters, and perform tests on the business function to be tested based on the business state.

[0075] For example, when the target object is a website, the server can update the status of the business function each time it receives the status-related parameters (e.g. each time an item is added to the shopping cart, the list of items in the shopping cart will also be updated accordingly). The business functions provided by the website are in a state corresponding to the status-related parameters with the support of the server, so that the client can test the business functions based on the current state of the business functions.

[0076] Of course, the above test process can also be completed entirely by the server. The client only needs to provide state-related parameters of the business function, and the server can perform tests on the business function based on the state corresponding to the state-related parameters.

[0077] In actual applications, there are many ways to test business functions. For example, after the server receives state-related parameters, it can be determined whether the state of the business function to be tested matches the preset target state. If so, the test is successful, otherwise the test fails.

[0078] Of course, the business functions can also be tested in other ways, such as determining whether it can obtain correct results based on input parameters or operations, whether it outputs error codes, whether it can access the server normally, whether it can respond to input parameters or operations and the response time, etc. This manual does not make specific restrictions on this.

[0079] After determining that the test of the business function to be tested is completed, the server can clear the status-related parameters and restore the state of the business function to be tested during the test to the initial state to ensure that the next time the same test case is executed to test the business function, the state of the business function is still in the initial state.

[0080] In actual applications, multiple different test cases may be executed simultaneously to test different target objects or business functions. Therefore, the server will also receive status-related parameters corresponding to different test cases. In order to avoid deletion of status-related parameters of business functions that have not been tested, the server can isolate the test data generated by different test cases through the test protocol number.

[0081] Specifically, the client may bind the test protocol number and the state-related parameters and send them to the server, so that the server saves the state-related parameters according to the binding relationship between the test protocol number and the state-related parameters.

[0082] The server can then perform a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters. After determining that the test on the business function to be tested is completed, the server can determine the state-related parameters from the saved data based on the test protocol number and the binding relationship, and clear the state-related parameters.

[0083] Furthermore, during the test execution, the server often receives some data other than the above-mentioned state-related parameters, such as test results and other data such as error prompt information, interface information, response time, execution efficiency, resource utilization, etc. On the one hand, these data will not affect the test results of the next test case execution, and on the other hand, these data are needed in the subsequent improvement and optimization of business programs, so these data may not be bound to the test protocol number. The server may not clear these data, but store them in a local database.

[0084] For each data received during the test process, the server can first determine whether the data is bound to a test protocol number. If not, it means that the data is not a state-related parameter and will not affect the next execution of the same test case. Therefore, the data can be stored in the database.

[0085] If the data is bound to a test protocol number, the data can be determined to be the state-related parameter, and according to the binding relationship between the test protocol number and the data, the data is stored in a designated storage environment in the server.

[0086] Among them, the above-mentioned designated storage environment may refer to a dynamic data sandbox environment set up in the server. The dynamic data sandbox environment may group the traffic received by the server according to the test protocol number and create independent transactions to isolate state-related parameters bound to different test protocol numbers, thereby realizing data isolation of state-related parameters generated by different test cases.

[0087] In this specification, the implementation method of grouping traffic through dynamic data sandbox can be: using JavaAgent technology to dynamically modify the key transaction submission class at the bytecode level. By injecting customized transaction control logic, the binding of protocol numbers and the isolation of data operations are achieved, ensuring the independence and security of data interaction in end-to-end testing.

[0088] In practical applications, the above dynamic data sandbox environment can also integrate advanced bytecode manipulation libraries, such as ASM and Javassist. These libraries provide rich APIs and tools, making it more efficient and accurate when implementing bytecode enhancement and modification.

[0089] On this basis, when it is determined that the test of the business function to be tested is completed, the server can determine the status-related parameters bound to the test protocol number from the above-mentioned specified storage environment and clear them according to the current test protocol number and the binding relationship corresponding to the test protocol number.

[0090] After receiving the test end signal, the server can perform a rollback operation in the dynamic data sandbox, thereby restoring the business function to the initial state (i.e., the state before the test) according to the state-related parameters bound to the test protocol number corresponding to the current test case.

[0091] In this specification, the process of data rollback operation can be understood as the process of restoring the state of the business function to be tested during the test to the initial state based on the state-related parameters. When the state-related parameters are deleted, the server cannot maintain the current state of the business function, and the business function will be restored to the initial state.

[0092] For example, after clearing the items in the shopping cart, all product information will also be deleted from the server, and the shopping cart function will be restored to the state of the unused shopping cart.

[0093] For another example, if you clear the password of a logged-in account and log off, the login function will be restored to the unlogged-in state.

[0094] In addition, the client may also send the operation log described in step S103 to the server, so that the server can restore the state of the service function to be tested under the state-related parameters during the test to the initial state based on the operation log.

[0095] The server may perform data recovery based on the operation log and status-related parameters, and clear status-related parameters after the business function is restored to the initial state.

[0096] Furthermore, after the test is completed, the client can obtain the test results of the business function from the server's database. If, based on the obtained test results, it is determined that the business function to be tested is abnormal, the client can determine other business functions associated with the business function to be tested; determine the status of other business functions according to the status of the business function to be tested corresponding to the status-related data; and generate test cases for other business functions based on the status of other functions, so as to test other business functions through the test cases. Afterwards, the client can determine the factor information that caused the abnormality of the business function to be tested based on the obtained test results for other business functions, and repair the business function to be tested based on the factor information.

[0097] For example, when testing the "payment" function, if it is found that the test result is abnormal (such as the payment cannot be completed), the client can determine other business functions associated with it, such as the "login" function, the "shopping cart" function, etc., and then the client can further determine the login status of the "login" function and the status of the items in the shopping cart based on the current payment status of the "payment" function, and generate test cases based on the status of these business functions to test these functions.

[0098] When it is determined that the "payment" function is abnormal due to factors such as the inability to pay after logging in, or the inability to pay for items in the shopping cart, the "payment" function, as well as the "login" function or the "shopping cart" function can be further repaired based on these factor information.

[0099] The above is an explanation of a test method provided in this specification from the perspective of the test system client. For ease of understanding, the following is an explanation of a test method provided in this specification from the perspective of the server. Figure 2 shown.

[0100] Figure 2 A test method provided in this specification includes the following steps:

[0101] S201: Acquire state-related parameters sent by the client, wherein the state-related parameters are obtained and determined after updating initial state-related parameters of the service function to be tested in an initial state after the service function to be tested is triggered, and the service function to be tested is determined by the client according to a received test request for a target object;

[0102] S202: Execute a test on the service function to be tested based on a state corresponding to the service function to be tested under the state-related parameters;

[0103] S203: After determining that the test on the service function to be tested is completed, clear the state-related parameters, and restore the state of the service function to be tested during the test to the initial state.

[0104] It can be seen from the above method that this solution effectively avoids data duplication in end-to-end automatic rollback testing that leads to test failures and environmental pollution; there is no need to manually clean up the database, nor is there a need to frequently back up / restore database snapshots, which improves test efficiency; the solution is non-invasive and does not require modification of the business program code itself, achieving good decoupling.

[0105] The above are one or more implementation test methods of this specification. Based on the same idea, this specification also provides corresponding test devices, such as Figure 3 or Figure 4 shown.

[0106] Figure 3 A schematic diagram of a test device provided for this specification includes:

[0107] The receiving module 301 is used to receive a test request for a target object;

[0108] A determination module 302, configured to determine a business function to be tested in the target object according to the test request;

[0109] A trigger module 303 is used to determine, after triggering the service function to be tested, state-related parameters corresponding to the service function to be tested, wherein the state-related parameters are obtained by updating the initial state-related parameters of the service function to be tested in the initial state after triggering the service function to be tested;

[0110] The test module 304 is used to send the state-related parameters to the server so that the server performs a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters. After determining that the test of the business function to be tested is completed, the state-related parameters are cleared and the state of the business function to be tested during the test is restored to the initial state.

[0111] Optionally, before the step of sending the state-related parameters to the server, the test module 304 is further used to generate a test protocol number;

[0112] The test module 304 is specifically used to bind the test protocol number and the state-related parameters and send them to the server, so that the server saves the state-related parameters according to the binding relationship between the test protocol number and the state-related parameters, and performs a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters. After determining that the test of the business function to be tested is completed, the state-related parameters are determined from the saved data according to the test protocol number and the binding relationship, and the state-related parameters are cleared.

[0113] Optionally, the test module 304 is specifically used to determine the test protocol number based on time information at a current moment and a random number generated at the current moment.

[0114] Optionally, before the step of sending the state-related parameters to the server, the testing module 304 is further configured to generate an operation log based on the business operations involved after the business function to be tested is triggered;

[0115] Optionally, the test module 304 is specifically used to send the state-related parameters and the operation log to the server, so that the server performs a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters; after determining that the test of the business function to be tested is completed, the state-related parameters are cleared, and the state of the business function to be tested during the test is restored to the initial state based on the operation log.

[0116] Optionally, the device further comprises:

[0117] The repair module 305 is used to determine other business functions associated with the business function to be tested if it is determined that the business function to be tested has an abnormality based on the obtained test results; determine the status of the other business functions according to the status of the business function to be tested corresponding to the status-related data; generate test cases for the other business functions based on the status of the other functions, so as to test the other business functions through the test cases; determine the factor information causing the abnormality of the business function to be tested based on the obtained test results for the other business functions, so as to repair the business function to be tested based on the factor information.

[0118] Figure 4 A schematic diagram of a test device provided for this specification includes:

[0119] The acquisition module 401 is used to acquire the state-related parameters sent by the client, wherein the state-related parameters are obtained and determined after updating the initial state-related parameters of the service function to be tested in the initial state after triggering the service function to be tested, and the service function to be tested is determined by the client according to the received test request for the target object;

[0120] An execution module 402 is used to execute a test on the service function to be tested based on the state corresponding to the service function to be tested under the state-related parameters;

[0121] The clearing module 403 is used to clear the state-related parameters after determining that the test on the service function to be tested is completed, and restore the state of the service function to be tested during the test to the initial state.

[0122] This specification also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 or Figure 2 A test method is provided.

[0123] This manual also provides Figure 5 The one shown corresponds to Figure 1 or Figure 2 A schematic diagram of the electronic device. Figure 5 As mentioned above, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 or Figure 2 Of course, in addition to the software implementation, this specification does not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0124] For the improvement of a technology, it can be clearly distinguished whether it is a hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or a software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0125] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0126] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0127] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0128] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0129] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0130] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0131] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0132] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0133] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0134] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0135] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0136] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0137] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0138] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0139] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.

Claims

1. A testing method, characterized in that: The method is applied to a client and includes: Receive a test request for a target object, and generate a unique test protocol number corresponding to the test request; Determining, according to the test request, a business function to be tested in the target object; After the service function to be tested is triggered, determining state-related parameters corresponding to the service function to be tested, wherein the state-related parameters are obtained by updating initial state-related parameters of the service function to be tested in an initial state after the service function to be tested is triggered; The test protocol number and the state-related parameters are sent to a server, so that the server saves the state-related parameters according to the binding relationship between the test protocol number and the state-related parameters, and performs a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters. After determining that the test on the business function to be tested is completed, the state-related parameters are determined from the saved data according to the test protocol number and the binding relationship, the state-related parameters are cleared, and the state of the business function to be tested during the test is restored to the initial state; Before sending the state-related parameters to the server, the method further includes: Generate an operation log based on the business operations involved after triggering the business function to be tested; The state-related parameters and the operation log are sent to the server, so that the server performs a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters; after determining that the test on the business function to be tested is completed, the state-related parameters are cleared, and the state of the business function to be tested during the test is restored to the initial state based on the operation log.

2. The method according to claim 1, characterized in that Generating a unique test protocol number corresponding to the test request, specifically including: The test protocol number is determined based on the time information of the current moment and the random number generated at the current moment.

3. The method according to claim 1, characterized in that The method further comprises: If it is determined according to the obtained test result that the service function to be tested is abnormal, then determining other service functions associated with the service function to be tested; Determining the state of the other business functions according to the state of the business function to be tested corresponding to the state-related data; Based on the status of the other business functions, generating test cases for the other business functions, so as to test the other business functions through the test cases; Based on the obtained test results for the other service functions, factor information causing the abnormality of the service function to be tested is determined, so as to repair the service function to be tested according to the factor information.

4. A testing method, characterized in that: The method is applied to a server and includes: Obtaining a test protocol number and state-related parameters sent by the client, wherein the state-related parameters are obtained and determined after updating initial state-related parameters of the service function to be tested in an initial state after triggering the service function to be tested, the service function to be tested is determined by the client according to a received test request for a target object, and the test protocol number is uniquely generated by the client for the test request; According to the binding relationship between the test protocol number and the state-related parameter, the state-related parameter is saved, and based on the state corresponding to the business function to be tested under the state-related parameter, the test of the business function to be tested is performed; After determining that the test for the service function to be tested is completed, determining the state-related parameters from the saved data according to the test protocol number and the binding relationship, clearing the state-related parameters, and restoring the state of the service function to be tested during the test to the initial state; Wherein, the method further comprises: Acquire an operation log sent by the client, where the operation log is generated by the client before sending the status-related parameters to the server based on the business operations involved after triggering the business function to be tested; Based on the state corresponding to the business function to be tested under the state-related parameters, perform a test on the business function to be tested. After determining that the test on the business function to be tested is completed, clear the state-related parameters, and restore the state of the business function to be tested during the test to the initial state based on the operation log.

5. A testing device, characterized in that: The device is applied to a client and includes: A receiving module, used to receive a test request for a target object and generate a unique test protocol number corresponding to the test request; A determination module, used to determine the business function to be tested in the target object according to the test request; A trigger module, used for determining, after triggering the service function to be tested, state-related parameters corresponding to the service function to be tested, wherein the state-related parameters are obtained by updating the initial state-related parameters of the service function to be tested in the initial state after triggering the service function to be tested; A test module, used for sending the test protocol number and the state-related parameters to a server, so that the server saves the state-related parameters according to the binding relationship between the test protocol number and the state-related parameters, and performs a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters; after determining that the test on the business function to be tested is completed, determine the state-related parameters from the saved data according to the test protocol number and the binding relationship, clear the state-related parameters, and restore the state of the business function to be tested during the test to the initial state; Wherein, before the step of sending the state-related parameters to the server, the trigger module is further used to generate an operation log based on the business operations involved after triggering the business function to be tested; The test module is also used to send the state-related parameters and the operation log to the server, so that the server performs a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters. After determining that the test of the business function to be tested is completed, the state-related parameters are cleared, and the state of the business function to be tested during the test is restored to the initial state based on the operation log.

6. A testing device, characterized in that: The device is applied to a server and includes: an acquisition module, used for acquiring a test protocol number and state-related parameters sent by a client, wherein the state-related parameters are obtained and determined after updating the initial state-related parameters of the business function to be tested in an initial state after triggering the business function to be tested, wherein the business function to be tested is determined by the client according to a received test request for a target object, and the test protocol number is uniquely generated by the client for the test request; An execution module, used for saving the state-related parameters according to the binding relationship between the test protocol number and the state-related parameters, and executing a test on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters; A clearing module, used for determining the state-related parameters from the saved data according to the test protocol number and the binding relationship after determining that the test for the service function to be tested is completed, clearing the state-related parameters, and restoring the state of the service function to be tested during the test to the initial state; The acquisition module is further used to acquire the operation log sent by the client, where the operation log is generated by the client before sending the status-related parameters to the server based on the business operations involved after triggering the business function to be tested; The clearing module is also used to perform testing on the business function to be tested based on the state corresponding to the business function to be tested under the state-related parameters. After determining that the test on the business function to be tested is completed, the state-related parameters are cleared, and the state of the business function to be tested during the test is restored to the initial state based on the operation log.

7. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • System and method for testing robustness of communication equipment system

    CN114697238A

  • Interface calling method, device and equipment and readable storage medium

    CN116841884A

  • Automatic testing method and device and electronic equipment

    CN117194252A