A testing method, device, server and storage medium
By obtaining the business data of user operations, generating test cases and automating application functional testing, the problem of cumbersome and inefficient testing in the existing technology is solved, and more efficient and comprehensive testing coverage is achieved.
Patent Information
- Application Number
- CN201910659734.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-07-19
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2039-08-14
Smart Images

Figure CN112241362B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a testing method, device, server and storage medium. Background Art
[0002] With the continuous development of computer technology, more and more applications have emerged. In order to ensure that the functions in the application run normally in the terminal (mobile phone, computer, tablet computer, etc.), a large number of functional testing operations are required on the application.
[0003] The existing testing method mainly involves manually writing scripts to test applications. The above method requires developers to spend a lot of time editing codes and has high technical requirements for developers, resulting in a cumbersome testing process and low testing efficiency. Summary of the invention
[0004] The embodiments of the present invention provide a testing method, an apparatus, a server and a storage medium, which can generate test cases based on user operations to perform functional testing, thereby improving the testing efficiency of functional testing for application programs.
[0005] In a first aspect, an embodiment of the present invention provides a testing method, the method comprising:
[0006] Obtain business data corresponding to user operations on the target application;
[0007] If it is determined according to the user operation that a preset test case generation condition is met, then using the business data to generate a test case corresponding to the user operation;
[0008] Run the test case corresponding to the user operation to test the function of the target application triggered by the user operation.
[0009] In a second aspect, an embodiment of the present invention provides a testing device, the device comprising:
[0010] An acquisition module is used to acquire business data corresponding to user operations on a target application;
[0011] A generating module, configured to generate a test case corresponding to the user operation by using the business data if it is determined that a preset test case generation condition is met according to the user operation;
[0012] The running module is used to run the test case corresponding to the user operation to test the function of the target application triggered by the user operation.
[0013] In a third aspect, an embodiment of the present invention provides a test server, comprising a processor, an input interface, an output interface and a memory, wherein the processor, input interface, output interface and memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method described in the first aspect.
[0014] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method described in the first aspect.
[0015] In an embodiment of the present invention, the test server obtains business data corresponding to the user operation on the target application; if it is determined that the preset test case generation conditions are met according to the user operation, the test server generates a test case corresponding to the user operation using the business data; the test server runs the test case corresponding to the user operation to test the function of the target application triggered by the user operation. By implementing the above method, it is possible to generate test cases based on the user's operation to perform functional testing, thereby improving the test efficiency of functional testing for the application; and the above test method can perform scene playback based on the actual running status of the function, covering test scenarios that developers cannot think of in advance, thereby improving the comprehensiveness of functional testing for the application. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0017] Figure 1 is a structural schematic diagram of a test system provided by an embodiment of the present invention;
[0018] Figure 2 It is a flow chart of a testing method provided by an embodiment of the present invention;
[0019] Figure 3 is a flow chart of another testing method provided by an embodiment of the present invention;
[0020] Figure 4 It is a flowchart of another testing method provided by an embodiment of the present invention;
[0021] Figure 5 This is a schematic diagram of business data provided by an embodiment of the present invention;
[0022] Figure 6 It is a schematic diagram of time consumption comparison provided by an embodiment of the present invention;
[0023] Figure 7 This is a schematic diagram of development threshold comparison provided by an embodiment of the present invention;
[0024] Figure 8 is a structural schematic diagram of a testing device provided by an embodiment of the present invention;
[0025] Fig. 9 It is a structural diagram of a test server provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0027] The purpose of application testing is to ensure the quality of the application and make the application run in the correct way. The main tasks of testing are to find misalignments in the application, effectively define and implement the assembly process of application components from low-level to high-level, verify whether the application meets the technical requirements specified in the task book and system definition document, and provide a basis for the establishment of the application quality model. The functional testing of the application is not only to ensure that the functions can be implemented normally, but also to provide information to developers to facilitate their preparation for risk assessment.
[0028] The related art of the embodiments of the present invention mentions that the current functional testing solutions usually use manual coding to test the functions of the application. The above method requires developers to spend a lot of time editing the code and has high technical requirements for developers, resulting in a cumbersome testing process and low testing efficiency. Furthermore, during the testing process, developers may not be able to consider all the running scenarios during the running of the application, resulting in the test being unable to fully cover all the functions in the application.
[0029] Based on this, an embodiment of the present invention proposes a testing solution that can generate test cases based on user operations to perform functional testing, thereby improving the comprehensiveness of functional testing for applications while also improving the testing efficiency of functional testing.
[0030] Based on the above description, an embodiment of the present invention provides a test system. Figure 1The test system includes: a test server 101, a business distribution server 102, a data management server 103, a terminal 104 and a business server 105, wherein the business distribution server 102 is connected to at least one terminal 104, the business server 105 and the test server 101, the test server 101 is connected to the business distribution server 102 and the data management server 103, and the terminal 104 may include but is not limited to: a mobile phone, a tablet computer, a computer, etc., for interacting with the user, such as detecting the user's selection operation on the function in the application, and generating a corresponding request packet according to the user's operation and sending it to the business distribution server 102. The business distribution server 102 receives the request packet sent by the terminal 104, and sends the request packet to the business server 105. The business server 105 responds to the request packet, generates a response packet and returns the response packet to the business distribution server 102. The business distribution server 102 sends the response packet to the terminal 104 and stores the request packet and the response packet in this process. Specifically, the name of the application, the name of the function corresponding to the user operation, the request packet and the response packet can be stored in the form of a log file to form a log file. When receiving the data call instruction sent by the test service 101, the business distribution server 102 sends the log file to the test server 101. The test server 101 obtains a template for generating a test case, and calls a test automation tool (such as QTA) to import the log file into the corresponding field of the template, generates a test case corresponding to the user operation, and sends the test case to the data management server 103, so that the data management server 103 stores the test case. The test server 101 can call the test case stored in the data management server 103 based on the script regularly, and test the function of the application based on the test case.
[0031] In summary, Figure 1 The test system shown can obtain request packets and response packets formed based on user operations, and automatically generate test cases for functional testing. Developers do not need to edit a large amount of test code, thereby improving the test efficiency of functional testing of applications. In addition, the above-mentioned test method can replay scenarios based on the actual running status of the function, covering test scenarios that developers cannot think of in advance, thereby improving the comprehensiveness of functional testing of applications.
[0032] Based on the description of the embodiment of the above test system, the embodiment of the present invention provides a test method, which can be applied to Figure 1 In the test system shown in the figure, the Figure 1 See the test server execution shown. Figure 2 , the testing process may include the following steps S201-S203:
[0033] S201. The test server obtains business data corresponding to user operations on a target application.
[0034] In an embodiment of the present invention, the target application can be any application program that needs to be tested, and the business data can specifically include the name of the target application used by the user operation, the name of the function of the target application, the request packet generated by the terminal based on the user operation, and the response packet returned by the business server based on the request packet. In a specific implementation, the process of generating business data can be that the user inputs the corresponding user operation in the target application in the terminal. After the terminal detects the user operation input by the user for the target application, it generates a corresponding request packet based on the user operation and sends the request packet to the business distribution server. After the business distribution server receives the request packet, it can send the request packet to the corresponding business server based on the load balancing principle. The business server responds based on the content in the request packet, generates a corresponding response packet, and sends the response packet to the business distribution server. The business distribution server sends the above response packet to the terminal. After the above process, the business distribution server can use the name of the target application corresponding to the user operation, the name of the function, the request packet and the response packet as business data, and store them in the form of a log file. The request packet and the response packet in the log file can specifically be hexadecimal numbers. Figure 5 As shown, it is a schematic diagram of business data, wherein appid represents the name of the target application, cmd represents the name of the function corresponding to the user operation, qmfupstream represents the request packet, and qmfdownsstream represents the response packet.
[0035] In a specific implementation, the test server can obtain the above-mentioned log file periodically based on the script file, and specifically can obtain the log file corresponding to the business data from the business distribution server according to the first preset frequency. Furthermore, the test server can parse the above-mentioned log file to obtain the business data corresponding to the user operation of the target application.
[0036] S202: If it is determined according to the user operation that a preset test case generation condition is met, the test server generates a test case corresponding to the user operation using the business data.
[0037] In an embodiment of the present invention, after the test server obtains the business data corresponding to the user operation on the target application, it will determine whether the preset test case generation conditions are met based on the user operation. If so, the test server will use the business data to generate a test case corresponding to the user operation.
[0038] In one implementation, the specific method for the test server to determine whether the preset test case generation condition is met according to the user operation can be that the test server obtains the historical operation record for the target application, and queries whether the historical operation record includes the identifier of the user operation; if not, it is determined that the preset test case generation condition is met. The historical operation record includes the identifier of the historical user operation for the target application, and the identifier of the user operation is used to reflect the name of the function in the target application corresponding to the user operation, such as Figure 5 The content "RadioService.GetSplashScreen" corresponding to "cmd" is an identifier of a user operation. For example, the user operation identifiers recorded in the historical operation record include identifier A, identifier B, and identifier C. If the test server receives business data including identifier D, it determines that the business data meets the preset test case generation conditions, and uses the business data to generate a test case corresponding to the user operation. Furthermore, after the test server generates a test case based on the business data corresponding to the user operation, the identifier of the user operation can be added to the historical operation record, so that the identifier saved in the historical operation record is updated. In the above manner, the test server can generate test cases based on new operations used by the user, and test the functions corresponding to the new operations in a timely manner.
[0039] In one implementation, the specific method for the test server to determine whether the preset test case generation conditions are met based on the user operation can be that the test server queries the database whether there is a test case corresponding to the user operation; if not, the test server determines that the business data meets the preset test case generation conditions. Specifically, a variety of reference test cases that have been tested are pre-stored in the database. The test server can detect whether the reference request package in the reference test case is the same as the request package in the business data, and whether the reference response package in the reference test case is the same as the response package in the business data. If so, it is determined that there is a test case corresponding to the user operation in the database. If not, it is determined that there is no test case corresponding to the user operation in the database. In the above manner, the test server can filter the functions corresponding to the user operation so that the test cases are not generated repeatedly.
[0040] In one implementation, the specific method by which the test server determines whether the preset test case generation conditions are met based on the user operation is that the test server detects whether the business data corresponding to the user operation contains complete information, that is, whether it contains the name of the target application, the name of the function corresponding to the user operation, the request packet, and the response packet. If so, the test server determines that the business data meets the preset test case generation conditions.
[0041] It should be noted that the specific method for the test server to use the business data to generate the test case corresponding to the user operation can be that the test server obtains a template for generating the test case; and calls the test automation tool to import the business data into the corresponding field of the template to generate the test case corresponding to the user operation. The template for generating the test case can be a pre-edited program code, as shown below:
[0042] Chn=RDChannel(qqacc)
[0043] svc=GetSpalshScreenService(chn)
[0044] …
[0045] upstream=qmf_protocal_define_jce.QmfUpsteam()
[0046] upstream.load('')
[0047] After the terminal obtains the business data, it directly imports the content in the business data into the corresponding field of the template. For example, if the request packet in the business data is: "qmfupstream: 005124F", the above data is imported into the code in the template to obtain the code "upstream.load('005124F')". The test server can generate the test case corresponding to the user operation after importing the business data into the template. By implementing the above method, the test server can directly generate the corresponding test case after receiving the business data, without the need for developers to edit the code for each test, thereby improving the test efficiency of the application test.
[0048] S203: The test server runs the test case corresponding to the user operation to test the function of the target application triggered by the user operation.
[0049] In the embodiment of the present invention, after the test server generates a test case corresponding to the user operation using the business data, the test case corresponding to the user operation may be run to test the function of the target application triggered by the user operation.
[0050] In one implementation, after the test server generates a test case, it will detect whether its current operating environment meets the test case running conditions. If so, the test server can run the above test case and obtain the test results, where the test case running conditions can be that the current load is less than the preset load, the current time period is within the preset time period, the number of cases currently tested is less than the preset number, etc., which can be specifically set in advance by R&D personnel.
[0051] In one implementation, after the test server generates the test case, it can also store the test case corresponding to the user operation in the data management server. Specifically, the test server sends the test case corresponding to the user operation to the data management server, and the data management server receives and stores the test case, wherein the data management server stores at least one test case, and the at least one test case is a test case that the data management server has historically received and sent by the test server. The test server can periodically extract the test case corresponding to the user operation from the data management server based on the pre-edited script file for testing. Specifically, the test server extracts the test case corresponding to the user operation from at least one test case stored in the data management server according to a second preset frequency to test the function of the target application triggered by the user operation.
[0052] In the embodiment of the present invention, the test server obtains the business data corresponding to the user operation on the target application; if the test server determines that the preset test case generation conditions are met according to the user operation, the test server generates the test case corresponding to the user operation using the business data; the test server runs the test case corresponding to the user operation to test the function of the target application triggered by the user operation. By implementing the above method, the test case can be generated based on the user operation to perform functional testing, thereby improving the test efficiency and comprehensiveness of the functional testing of the application program. Figure 6 FIG. 1 is a schematic diagram showing a comparison between the time required for manually writing a test case and the time required for generating a test case using the method provided in an embodiment of the present invention. Figure 6 It can be seen that manually writing test cases requires a lot of time, while the time for generating test cases using the method provided by the embodiment of the present invention is close to zero, that is, the test cases can be generated immediately. Therefore, the method described in the embodiment of the present invention greatly improves the test efficiency of functional testing for application programs. Figure 7 As shown, it is a schematic diagram comparing the development threshold of manually writing test cases and the development threshold of generating test cases using the method provided by the embodiment of the present invention. Figure 7 It can be seen that manually writing test cases has high technical requirements for developers, while using the method provided by the embodiment of the present invention to generate test cases has low technical requirements for developers.
[0053] Based on the description of the embodiments of the above test system and test method, the embodiment of the present invention provides another test method, which can be applied to Figure 1 In the test system shown in the figure, the Figure 1 See the test server execution shown. Figure 3 , the functional testing process may include the following steps S301-S305:
[0054] S301: The test server obtains business data corresponding to the user operation on the target application.
[0055] In an embodiment of the present invention, the target application can be any application program that needs to be tested, and the business data can include the name of the target application used by the user operation, the name of the function of the target application, the request packet generated by the terminal based on the user operation, and the response packet returned by the business server based on the request packet. Specifically, it can be generated by the business distribution server based on the received request packet and response packet when data is interacted between the terminal and the business server.
[0056] Furthermore, the business distribution server may also classify the business data according to the name of the function of the target application in the business data, and count the number of triggering of the user operation corresponding to the business data within a preset period, that is, the number of business data of this type, and the name of the function of the target application is determined by the user operation. The test server may send a data acquisition request instruction to the business distribution server, and receive the business data corresponding to the user operation sent by the business distribution server, as well as the number of triggering of the user operation corresponding to the business data of this type within a preset period.
[0057] S302: If it is determined according to the user operation that a preset test case generation condition is met, the test server generates a test case corresponding to the user operation using the business data.
[0058] In an embodiment of the present invention, after the test server obtains the business data corresponding to the user operation on the target application, it will determine whether the preset test case generation conditions are met based on the user operation. If so, the test server will use the business data to generate a test case corresponding to the user operation.
[0059] In one implementation, the specific method for the test server to determine whether the preset test case generation conditions are met based on the user operation is that the test server obtains the historical operation records for the target application and queries whether the historical operation records include the identifier of the user operation; if not, it is determined that the preset test case generation conditions are met.
[0060] In one implementation, the test server determines whether the preset test case generation conditions are met based on the user operation by querying the database whether there is a test case corresponding to the user operation; if not, the test server determines whether the preset test case generation conditions are met.
[0061] In one implementation, the specific method for the test server to determine whether the preset test case generation condition is met according to the user operation can be that the test server detects whether the triggering number of user operations corresponding to the business data within a preset period is greater than the target triggering number, and if so, determines that the preset test case generation condition is met. The target triggering number can be the maximum triggering number recorded in the historical operation record, wherein the historical operation record specifically records the business data historically uploaded by the business distribution server and the historical triggering number of user operations corresponding to the business data. Alternatively, the target triggering number can also be preset by the R&D personnel.
[0062] S303: The test server stores the test case corresponding to the user operation in the data management server.
[0063] In the embodiment of the present invention, after the test server obtains the test case corresponding to the user operation, the test server may send the test case to the data management server connected thereto, and the data management server stores the received test case.
[0064] S304: The test server extracts a test case corresponding to the user operation from at least one test case stored in the data management server at a second preset frequency.
[0065] In the embodiment of the present invention, after the test server sends the test case to the data management server connected thereto, the test server can extract the test case corresponding to the user operation from at least one test case stored in the data management server according to the second preset frequency. The second preset frequency can be 1 hour, 1 day, etc., which can be pre-set by the R&D personnel. In the above manner, the test server can directly obtain the corresponding test case from the data management server when testing is required, without the need for the developer to edit the code, thereby improving the test efficiency.
[0066] S305: The test server runs the test case corresponding to the user operation to test the function of the target application triggered by the user operation.
[0067] In an embodiment of the present invention, after the test server receives the test case corresponding to the user operation sent by the data management server, it can run the test case corresponding to the user operation to test the function of the target application triggered by the user operation. Among them, the number of times the test case is run can be determined by the number of times the user operation corresponding to the test case is triggered. In one implementation, the test server obtains the number of times the user operation is triggered this time, and the historical number of times the user operation is triggered recorded in the historical record, and determines the change rule of the number of triggers based on the number of times this time and the historical number of triggers, and determines the number of times the test case is run for this test based on the change rule. In one implementation, the number of times the test case is run can also be the same as the number of times the user operation is triggered, so that the playback of the real function application scenario can be achieved. Or the number of times the test case is run can be N times the number of times the user operation is triggered, so as to achieve stress detection of the function of the target application, wherein N is a positive integer, which can be pre-set by the R&D personnel.
[0068] It should be noted that before the test server runs the test case corresponding to the user operation, it can also detect whether it meets the case running conditions. If so, the test server runs the test case. The case running conditions may be that the current load is less than the preset load, the current time period is within the preset time period, the number of cases currently tested is less than the preset number, etc., which can be pre-set by R&D personnel.
[0069] In an embodiment of the present invention, the test server obtains business data corresponding to the user operation on the target application; if the test server determines that the preset test case generation conditions are met according to the user operation, the test server generates a test case corresponding to the user operation using the business data; the test server stores the test case corresponding to the user operation in the data management server, and extracts the test case corresponding to the user operation from at least one test case stored in the data management server according to a second preset frequency, and the test server runs the test case corresponding to the user operation to test the function of the target application triggered by the user operation. By implementing the above method, test cases can be generated based on user operations to perform functional testing, thereby improving the test efficiency of functional testing for application programs.
[0070] Based on the description of the embodiments of the above test system and test method, the embodiment of the present invention provides another test method, which can be applied to Figure 1 In the test system shown in the figure, the Figure 1 The terminal, business distribution server, business server, test server and data management server are executed interactively. Figure 4 The method may include the following steps S401-S409:
[0071] S401: The terminal detects a user operation on a target application, generates a request packet according to the user operation, and sends it to a service distribution server.
[0072] S402: The service distribution server sends the request packet to the service server.
[0073] S403: The service server generates a response packet according to the received request packet, and sends the generated response packet to the service distribution server.
[0074] S404: The service distribution server sends a response packet to the terminal, and generates service data corresponding to the user operation of the target application according to the request packet and the response packet.
[0075] S405: The test server sends a data acquisition request instruction to the business distribution server, and acquires business data corresponding to the user operation on the target application.
[0076] S406: The test server generates a test case according to the business data corresponding to the user operation, and sends the test case to the data management server.
[0077] S407: The data management server receives and stores the test cases corresponding to the user operations.
[0078] S408. The test server extracts a test case corresponding to the user operation from at least one test case stored in the data management server at a second preset frequency.
[0079] S409: The test server runs the test case corresponding to the user operation to test the function of the target application triggered by the user operation.
[0080] By implementing the above method, test cases can be generated based on user operations to perform functional testing, thereby improving the testing efficiency of functional testing for applications.
[0081] Based on the description of the above test method embodiment, the present invention also discloses a test device, which can be applied to Figure 1 In the test system shown, the test device can be operated in Figure 1 The test server in the test system shown. The test device can be a computer program (including program code) running in the test server, or a physical device included in the test server. The test device can execute Figure 2-4 See the method shown in Figure 8 The testing device 80 includes: an acquisition module 801, a generation module 802, an operation module 803, a query module 804, a determination module 805 and a storage module 806.
[0082] Acquisition module 801, used to acquire business data corresponding to user operations on a target application;
[0083] A generating module 802 is configured to generate a test case corresponding to the user operation by using the business data if it is determined that a preset test case generation condition is met according to the user operation;
[0084] The running module 803 is used to run the test case corresponding to the user operation to test the function of the target application triggered by the user operation.
[0085] In one implementation, the business data includes an identifier of the user operation, and the acquisition module 801 is specifically configured to:
[0086] The acquisition module 801 is further used to acquire a historical operation record for the target application, wherein the historical operation record includes an identifier of a historical operation for the target application;
[0087] A query module 804 is used to query whether the historical operation record includes the identifier of the user operation;
[0088] The determination module 805 is used to determine whether the preset test case generation condition is met or not.
[0089] In one implementation, the query module 804 is used to query whether there is a test case corresponding to the user operation in the database;
[0090] The determination module 805 is used to determine whether the preset test case generation condition is met or not.
[0091] In one implementation, the acquisition module 801 is further used to acquire a template for generating a test case;
[0092] The generating module 802 is used to call the test automation tool to import the business data into the corresponding field of the template to generate a test case corresponding to the user operation.
[0093] In one implementation, the acquisition module 801 is specifically configured to:
[0094] Obtaining a log file corresponding to the business data from a business distribution server according to a first preset frequency;
[0095] Parse the log file to obtain the business data.
[0096] In one implementation, the storage module 806 is used to store the test case corresponding to the user operation in a data management server, wherein the data management server stores at least one test case;
[0097] The acquisition module 801 is used to extract the test case corresponding to the user operation from the at least one test case stored in the data management server according to a second preset frequency.
[0098] In one implementation, the storage module 806 is used to add the identifier of the user operation to the historical operation record.
[0099] In the embodiment of the present invention, the acquisition module 801 acquires the business data corresponding to the user operation for the target application; if it is determined that the preset test case generation condition is met according to the user operation, the generation module 802 generates the test case corresponding to the user operation using the business data; the operation module 803 runs the test case corresponding to the user operation to test the function of the target application triggered by the user operation. By implementing the above method, the test case can be generated based on the user operation to perform functional testing, thereby improving the test efficiency of functional testing for the application.
[0100] See also Fig. 9 , is a schematic diagram of the structure of a test server provided by an embodiment of the present invention. Fig. 9 As shown, the test server includes: at least one processor 901, an input device 903, an output device 904, a memory 905, and at least one communication bus 902. The communication bus 902 is used to realize the connection and communication between these components. The memory 905 can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The memory 905 can also be at least one storage device located away from the aforementioned processor 901. The processor 901 can be combined with Figure 8 In the described apparatus, a set of program codes is stored in the memory 905, and the processor 901, the input device 903, and the output device 904 call the program codes stored in the memory 905 to perform the following operations:
[0101] Input device 903, used to obtain business data corresponding to user operations on the target application;
[0102] Processor 901, configured to generate a test case corresponding to the user operation using the business data if it is determined that a preset test case generation condition is met according to the user operation;
[0103] The processor 901 runs the test case corresponding to the user operation to test the function of the target application triggered by the user operation.
[0104] In one implementation, the processor 901 is specifically configured to:
[0105] Acquire a historical operation record for the target application, wherein the historical operation record includes an identifier of the historical operation for the target application;
[0106] Querying whether the historical operation record includes the identifier of the user operation;
[0107] If not, determine whether the preset test case generation conditions are met
[0108] In one implementation, the processor 901 is specifically configured to:
[0109] Query the database to see whether there is a test case corresponding to the user operation;
[0110] If not, it is determined that the preset test case generation conditions are met.
[0111] In one implementation, the processor 901 is specifically configured to:
[0112] Get the template for generating test cases;
[0113] The test automation tool is called to import the business data into the corresponding fields of the template to generate a test case corresponding to the user operation.
[0114] In one implementation, the processor 901 is specifically configured to:
[0115] Obtaining a log file corresponding to the business data from a business distribution server according to a first preset frequency;
[0116] Parse the log file to obtain the business data.
[0117] In one implementation, the processor 901 is specifically configured to:
[0118] Storing the test case corresponding to the user operation in a data management server, wherein the data management server stores at least one test case;
[0119] A test case corresponding to the user operation is extracted from the at least one test case stored in the data management server according to a second preset frequency.
[0120] In one implementation, the processor 901 is specifically configured to:
[0121] The identifier of the user operation is added to the historical operation record.
[0122] In the embodiment of the present invention, the input device 903 obtains the business data corresponding to the user operation for the target application; if it is determined that the preset test case generation condition is met according to the user operation, the processor 901 generates the test case corresponding to the user operation using the business data; the processor 901 runs the test case corresponding to the user operation to test the function of the target application triggered by the user operation. By implementing the above method, the test case can be generated based on the user's operation to perform functional testing, thereby improving the test efficiency of functional testing for the application.
[0123] The modules described in the embodiments of the present invention may be implemented by a general integrated circuit, such as a CPU (Central Processing Unit), or by an ASIC (Application Specific Integrated Circuit).
[0124] It should be understood that in the embodiment of the present invention, the processor 901 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0125] The bus 902 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 902 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 It is represented by only one thick line, but it does not mean that there is only one bus or one type of bus.
[0126] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The computer-readable storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0127] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A testing method, characterized in that: The method comprises: Acquire business data corresponding to the user operation on the target application; wherein the business data includes the name of the target application, the name of the function of the target application, the request packet generated by the terminal based on the user operation, and the response packet returned by the business server based on the request packet; If it is determined according to the user operation that a preset test case generation condition is met, then using the business data to generate a test case corresponding to the user operation; Determine the number of times the test case corresponding to the user operation is run according to the number of times the user operation is triggered; The test case corresponding to the user operation is run according to the number of runs to test the function of the target application triggered by the user operation.
2. The method according to claim 1, characterized in that The business data includes an identifier of the user operation, and the determining, based on the user operation, to meet a preset test case generation condition includes: Acquire a historical operation record for the target application, wherein the historical operation record includes an identifier of the historical operation for the target application; Querying whether the historical operation record includes the identifier of the user operation; If not, it is determined that the preset test case generation conditions are met.
3. The method according to claim 1, characterized in that The determining, according to the user operation, to meet a preset test case generation condition comprises: Query the database to see whether there is a test case corresponding to the user operation; If not, it is determined that the preset test case generation conditions are met.
4. The method according to any one of claims 1 to 3, characterized in that: The using the business data to generate a test case corresponding to the user operation includes: Get the template for generating test cases; The test automation tool is called to import the business data into the corresponding fields of the template to generate a test case corresponding to the user operation.
5. The method according to claim 1, characterized in that The obtaining of business data corresponding to the user operation on the target application includes: Obtaining a log file corresponding to the business data from a business distribution server according to a first preset frequency; Parse the log file to obtain the business data.
6. The method according to claim 1, characterized in that After generating the test case corresponding to the user operation by using the business data, and before running the test case corresponding to the user operation according to the number of runs to test the function of the target application triggered by the user operation, the method further includes: Storing the test case corresponding to the user operation in a data management server, wherein the data management server stores at least one test case; A test case corresponding to the user operation is extracted from the at least one test case stored in the data management server according to a second preset frequency.
7. The method according to claim 2, characterized in that After determining that the preset test case generation condition is met, the method further includes: The identifier of the user operation is added to the historical operation record.
8. A testing device, characterized in that: The device comprises: An acquisition module, used to acquire business data corresponding to a user operation on a target application; wherein the business data includes the name of the target application, the name of a function of the target application, a request packet generated by the terminal based on the user operation, and a response packet returned by the business server based on the request packet; A generating module, configured to generate a test case corresponding to the user operation by using the business data if it is determined that a preset test case generation condition is met according to the user operation; A running module is used to determine the number of times the test case corresponding to the user operation is run according to the number of times the user operation is triggered; and run the test case corresponding to the user operation according to the number of times, so as to test the function of the target application triggered by the user operation.
9. A test server, characterized in that: The method comprises a processor, an input interface, an output interface and a memory, wherein the processor, the input interface, the output interface and the memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 7.
