Page test method and system, equipment, storage medium and program product
By intercepting interface requests and determining the test scenario and data type based on configuration information, the test data is obtained at one time, which solves the problem of low testing efficiency caused by frequent data acquisition in traditional methods and improves the efficiency of page testing.
Patent Information
- Application Number
- CN202411106438.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-12
- Publication Date
- 2024-12-10
AI Technical Summary
Traditional page testing methods frequently obtain test data in multiple different scenarios, resulting in cumbersome and inefficient testing.
By intercepting the test data acquisition request sent by the target interface, determine the test scenario and test data type of the page to be tested based on the interface configuration information, obtain the corresponding test data, and send it to the target interface for testing, so as to obtain the test data at one time .
The test data acquisition process is simplified, the test data acquisition efficiency is improved in different test scenarios, and thus the test efficiency is improved.
Smart Images

Figure CN119105959A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of testing, and in particular to a page testing method and system, device, storage medium and program product. Background Art
[0002] With the development of Internet technology, web pages are becoming more and more diverse. In order to ensure that the display or function of the page meets the needs of users, the page is usually tested.
[0003] When performing page testing, testing is often performed in multiple scenarios to meet different testing requirements. Different test data will be used for testing in different scenarios. Taking the order page as an example, in one scenario, the order time, order number, amount to be paid and other order test data can be displayed on the order page to verify the data display logic of the order page. In another scenario, the payment time, payment amount, payment method and other payment test data can be displayed on the order page to verify the data display logic of the order page, and so on.
[0004] In traditional solutions, when the page to be tested corresponds to multiple different scenarios, the test data is usually obtained for one scenario in the test order to test the scenario, and then the corresponding test data is obtained for the next scenario to test the next scenario. This results in frequent acquisition of test data to meet the testing requirements in multiple different scenarios, making the testing process cumbersome and the testing efficiency low. Summary of the invention
[0005] The embodiments of the present application provide a page testing method and system, device, storage medium and program product to solve the problem of frequently acquiring test data in traditional solutions to meet testing requirements in multiple different scenarios, simplify the testing process and improve testing efficiency.
[0006] In a first aspect, an embodiment of the present application provides a page testing method, comprising:
[0007] Intercept and obtain a test data acquisition request for a page to be tested sent by a target interface, wherein the test data acquisition request includes interface configuration information;
[0008] Based on the interface configuration information, determining at least one test scenario corresponding to the page to be tested, and types of test data respectively corresponding to the at least one test scenario;
[0009] According to the test data type corresponding to each of the test scenarios, acquiring the test data corresponding to the test scenarios, so as to obtain the test data corresponding to the at least one test scenario respectively;
[0010] The test data respectively corresponding to the at least one test scenario are sent to the target interface, so as to test the to-be-tested page by using the test data respectively corresponding to the at least one test scenario.
[0011] In a second aspect, an embodiment of the present application provides a page testing method, including:
[0012] In response to a test operation triggered for a page to be tested, a test data acquisition request is generated; the test data acquisition request is intercepted and acquired by an interceptor, and the interceptor determines at least one test scenario corresponding to the page to be tested and a test data type respectively corresponding to the at least one test scenario according to the interface configuration information included in the test data acquisition request, and acquires the test data corresponding to the test scenario according to the test data type corresponding to each test scenario, so as to obtain the test data respectively corresponding to the at least one test scenario;
[0013] Receiving test data corresponding to at least one test scenario sent by the interceptor;
[0014] The to-be-tested page is tested for each test scenario using the test data corresponding to the at least one test scenario.
[0015] In a third aspect, an embodiment of the present application provides a page testing system, including a testing platform and an interceptor;
[0016] The test platform is used to send a test data acquisition request for the page to be tested using the target interface;
[0017] The interceptor is used to intercept and obtain the test data acquisition request, wherein the test data acquisition request includes interface configuration information; based on the interface configuration information, determine at least one test scenario corresponding to the page to be tested, and the type of test data respectively corresponding to the at least one test scenario; according to the test data type corresponding to each test scenario, obtain the test data corresponding to the test scenario to obtain the test data respectively corresponding to the at least one test scenario; send the test data respectively corresponding to the at least one test scenario to the target interface;
[0018] The test platform is also used to receive test data corresponding to at least one test scenario sent by the interceptor; and use the test data corresponding to the at least one test scenario to test the page to be tested for each test scenario.
[0019] In a fourth aspect, an embodiment of the present application provides a computing device, comprising a storage component and a processing component; the storage component stores one or more computer instructions, the computer instructions are called and executed by the processing component, and the processing component calls the one or more computer instructions to implement the page testing method as described in the first aspect or the second aspect.
[0020] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a computer, implements the page testing method as described in the first aspect or the second aspect.
[0021] In a sixth aspect, an embodiment of the present application provides a computer program product storing a computer program, wherein when the computer program is executed by a computer, the page testing method as described in the first aspect or the second aspect is implemented.
[0022] In an embodiment of the present application, a test data acquisition request for a page to be tested sent by a target interface can be intercepted and acquired, wherein the test data acquisition request can include interface configuration information, based on the interface configuration information, at least one test scenario corresponding to the page to be tested and the test data type respectively corresponding to at least one test scenario can be determined, and according to the test data type corresponding to each test scenario, the test data corresponding to the test scenario is acquired to obtain the test data respectively corresponding to at least one test scenario, and the test data respectively corresponding to at least one test scenario is sent to the target interface, so as to test the page to be tested using the test data respectively corresponding to at least one test scenario. By intercepting the test data acquisition request sent by the target interface, at least one test scenario corresponding to the page to be tested and the test data type respectively corresponding to at least one test scenario are determined according to the interface configuration information included in the test data acquisition request, and the test data respectively corresponding to the at least one test scenario are acquired, and the test data corresponding to the at least one test scenario corresponding to the page to be tested is acquired once by using a test data acquisition request, so that the test data under at least one test scenario corresponding to the page to be tested can be acquired at one time, and the test data does not need to be acquired frequently during the test process, which simplifies the test data acquisition process, improves the test data acquisition efficiency under different test scenarios, and thus improves the test efficiency under different test scenarios.
[0023] These and other aspects of the present application will become more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0025] Figure 1 A flow chart of an embodiment of a page testing method provided by the present application is shown;
[0026] Figure 2 A flow chart showing another embodiment of a page testing method provided by the present application is shown;
[0027] Figure 3 A schematic diagram showing the structure of an embodiment of a page testing device provided by the present application is shown;
[0028] Figure 4 A schematic diagram showing the structure of another embodiment of a page testing device provided by the present application is shown;
[0029] Figure 5 A schematic diagram showing the structure of an embodiment of a page testing system provided by the present application is shown;
[0030] Figure 6 A schematic diagram of the structure of an embodiment of a computing device provided by the present application is shown. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0032] In some of the processes described in the specification and claims of this application and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.
[0033] The technical solution of the embodiment of the present application is applicable to test scenarios, especially page test scenarios. With the development of Internet technology, web pages are becoming more and more diverse. In order to ensure that the function or display of the page meets the needs of users, the page is usually tested.
[0034] When performing page testing, testing is often performed in multiple scenarios to meet different testing requirements. Different test data will be used for testing in different scenarios. Taking the order page as an example, in one scenario, the order time, order number, amount to be paid and other order test data can be displayed on the order page to verify the data display logic of the order page. In another scenario, the payment time, payment amount, payment method and other payment test data can be displayed on the order page to verify the data display logic of the order page, and so on.
[0035] In traditional solutions, when the page to be tested corresponds to multiple different scenarios, the test data is usually obtained for one scenario in the test order to test the scenario, and then the corresponding test data is obtained for the next scenario to test the next scenario. This results in frequent acquisition of test data to meet the testing requirements in multiple different scenarios, making the testing process cumbersome and the testing efficiency low.
[0036] In order to solve the above technical problems, the inventors proposed the technical solution of the present application, including intercepting and obtaining a test data acquisition request for a page to be tested sent by a target interface, the test data acquisition request including interface configuration information; based on the interface configuration information, determining at least one test scenario corresponding to the page to be tested, and a test data type respectively corresponding to the at least one test scenario; according to the test data type corresponding to each test scenario, obtaining the test data corresponding to the test scenario to obtain the test data respectively corresponding to the at least one test scenario; sending the test data respectively corresponding to the at least one test scenario to the target interface, so as to test the page to be tested using the test data respectively corresponding to the at least one test scenario.
[0037] By intercepting the test data acquisition request sent by the target interface, determining at least one test scenario corresponding to the page to be tested and the test data type respectively corresponding to at least one test scenario according to the interface configuration information included in the test data acquisition request, obtaining the test data corresponding to the at least one test scenario, and realizing one-time acquisition of test data under at least one test scenario corresponding to the page to be tested by using a single test data acquisition request, there is no need to frequently acquire test data during the testing process, which simplifies the test data acquisition process, improves the efficiency of acquiring test data under different test scenarios for the page to be tested, and thereby improves the testing efficiency under different test scenarios for the page to be tested.
[0038] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0039] The technical solution of the embodiment of the present application can be applied to a system architecture including a test platform and an interceptor.
[0040] In an optional implementation, the above-mentioned interceptor can be an interceptor of the Cypress test framework or an interceptor of other test frameworks, wherein the Cypress test framework is a modern front-end end-to-end (End-to-End, referred to as E2E) test framework, which can be used to write and run automated test cases to test Web applications (applications based on the browser / server architecture (Browser / Server, referred to as B / S architecture) model).
[0041] It should be noted that the embodiments of the present application may involve the use of user data. In actual applications, user-specific personal data can be used in the scheme described herein within the scope permitted by applicable laws and regulations, subject to the requirements of applicable laws and regulations of the country where the user is located (for example, with the user's explicit consent, effective notification to the user, etc.).
[0042] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0043] It should be noted that the technical solution of the embodiment of the present application is applicable to a network virtual environment. The users described generally refer to "virtual users". Real users can register a user account in the server through registration to obtain a user identity in the network environment.
[0044] The technical solution of this application is described below.
[0045] like Figure 1 As shown, it is a flowchart of an embodiment of a page testing method provided by the present application. The method can be applied to an interceptor and may include the following steps:
[0046] 101: intercept and obtain the test data acquisition request for the page to be tested sent by the target interface.
[0047] The test data acquisition request may include interface configuration information.
[0048] 102: Determine, based on the interface configuration information, at least one test scenario corresponding to the page to be tested, and a test data type corresponding to each of the at least one test scenario.
[0049] In the embodiment of the present application, the scenario of page testing (referred to as UI testing) is applicable. For the page to be tested, it is necessary to obtain at least one test data to test its display function or processing function for at least one application scenario (referred to as test scenario in this application). The display function test for the application scenario may include, for example, testing whether the application scenario corresponding to the page to be tested can display the test data and display the controls corresponding to the test data in a set display method; the processing function test for the application scenario may include, for example, testing whether the processing function of the application scenario corresponding to the page to be tested can run according to the set program to give the expected operation results.
[0050] The test data acquisition request for the page to be tested may be generated based on the test operation for the control in the page to be tested, such as the trigger operation of the tester for the confirmation button in the page to be tested, etc. The test data acquisition request may be sent by the target interface, which may be located in the test platform, and the interceptor may intercept and acquire the test acquisition request.
[0051] In this embodiment, for the page to be tested, it can be tested in multiple scenarios to meet different testing requirements, and then meet the different requirements of users for page display or processing functions in actual applications. For example, when the page to be tested is an order page, in one test scenario, the order page is to display order test related data, such as order time, order number, amount to be paid, etc. In another test scenario, the order page is to display payment test related data, such as payment time, payment amount, payment method, etc. In another test scenario, the order page is to display refund test related data, such as refund amount, refund method, refund instructions, etc., to verify the data display logic of the order page. It can be understood that the order page can contain display locations for order test related data, payment test related data, and refund test related data, and the test data corresponding to the test scenario can be displayed in the corresponding display location, and other display locations can display preset default data or no data, which is not limited by this application. For another example, the page to be tested is a house management page. In one test scenario, the house area field to be displayed on the house management page is in a locked state, that is, it cannot be edited. In another test scenario, the house area field to be displayed on the house management page is in an unlocked state, that is, it can be edited, to verify the data display logic of the house management page.
[0052] The test data acquisition request may include interface configuration information, and the interface configuration information may include identification information of at least one test scenario corresponding to the page to be tested, and identification information of the test data type corresponding to the at least one test scenario.
[0053] The identification information of the test scenario can uniquely identify the test scenario, and can be implemented as a test scenario ID or a parameter having a corresponding relationship with the test scenario, etc. For example, the interface configuration information may include at least one test scenario ID, and based on the at least one test scenario ID, at least one test scenario corresponding to the page to be tested can be determined. For another example, the interface configuration information may include at least one parameter, and based on the corresponding relationship between the at least one parameter and the test scenario, at least one test scenario corresponding to the page to be tested can be determined. The parameter can be pre-set, which will be described in subsequent embodiments.
[0054] The test data type can be set according to actual needs, for example, it may include online data, offline data, real-time data, non-real-time data, amount data, time data, order number data, etc. Among them, online data may refer to server data, offline data may refer to local data, real-time data may refer to data generated in real time, non-real-time data may refer to data generated in non-real time, and may include pre-set data, etc. The identification information of the test data type may uniquely identify the test data type, and may be implemented as a test data type ID or a parameter having a corresponding relationship with the test data type, etc., and the parameter may be pre-set.
[0055] Therefore, based on the interface configuration information obtained by interception, at least one test scenario corresponding to the page to be tested and the test data types respectively corresponding to the at least one test scenario can be determined.
[0056] Of course, the interface configuration information may also include information such as interface path, request method, etc., which can be set according to actual needs, and this application does not limit this.
[0057] 103: According to the test data type corresponding to each test scenario, obtain the test data corresponding to the test scenario, so as to obtain the test data corresponding to at least one test scenario.
[0058] 104: Send the test data corresponding to the at least one test scenario to the target interface, so as to test the page to be tested by using the test data corresponding to the at least one test scenario.
[0059] For example, the page to be tested may correspond to two test scenarios, namely test scenario A and test scenario B, wherein the test data type corresponding to test scenario A may be online data, and the test data type corresponding to test scenario B may be offline data, then the online data corresponding to test scenario A and the offline data corresponding to test scenario B may be obtained. For another example, the page to be tested may correspond to three test scenarios, namely test scenario C, test scenario D and test scenario E, wherein the test data type corresponding to test scenario C may be amount data, the test data type corresponding to test scenario D may be time data, and the test data type corresponding to test scenario E may be order number data, then the amount data corresponding to test scenario C, the time data corresponding to test scenario D, and the order number data corresponding to test scenario E may be obtained.
[0060] After obtaining the test data corresponding to at least one test scenario, the test data corresponding to the at least one test scenario can be sent to the target interface, so as to test the page to be tested using the test data corresponding to the at least one test scenario. For example, in test scenario A, the page to be tested can be tested using online data, and in test scenario B, the page to be tested can be tested using offline data. The specific test process can refer to the implementation in the traditional solution, and will not be described in detail.
[0061] In this embodiment, a test data acquisition request for a page to be tested sent by a target interface can be intercepted, wherein the test data acquisition request can include interface configuration information. Based on the interface configuration information, at least one test scenario corresponding to the page to be tested and a test data type respectively corresponding to at least one test scenario can be determined, and according to the test data type corresponding to each test scenario, the test data respectively corresponding to the test scenario can be acquired to obtain the test data respectively corresponding to at least one test scenario, and the test data respectively corresponding to at least one test scenario can be sent to the target interface to test the page to be tested using the test data respectively corresponding to at least one test scenario. By intercepting the test data acquisition request sent by the target interface, at least one test scenario corresponding to the page to be tested and the type of test data respectively corresponding to at least one test scenario are determined according to the interface configuration information included in the test data acquisition request, and the test data respectively corresponding to the at least one test scenario are acquired. A one-time acquisition of test data under at least one test scenario corresponding to the page to be tested is achieved by using a single test data acquisition request. For example, if the page to be tested is an order page, the order page corresponds to at least an order test scenario, a payment test scenario and a refund test scenario. The test data acquisition request for the order page can simultaneously include acquiring order test-related data, payment test-related data and refund test-related data. After intercepting the test data acquisition request, the order test-related data, payment test-related data and refund test-related data can be acquired at one time according to the test data acquisition request. There is no need to frequently acquire test data during the test process, which simplifies the test data acquisition process, improves the test data acquisition efficiency in different test scenarios, and thereby improves the test efficiency in different test scenarios.
[0062] In actual applications, different test scenarios usually have corresponding scenario interfaces to obtain corresponding test data. Therefore, in some embodiments, the interface configuration information may include configuration information of at least one scenario interface. At this time, based on the interface configuration information, determining at least one test scenario corresponding to the page to be tested and the test data type corresponding to at least one test scenario may include:
[0063] Based on the configuration information of at least one scenario interface, determining at least one scenario interface corresponding to the page to be tested;
[0064] Determine at least one test scenario corresponding to the page to be tested according to a first mapping relationship between the scenario interface and the test scenario;
[0065] According to the second mapping relationship between the configuration information of the scenario interface and the test data type, the test data type respectively corresponding to at least one test scenario is determined.
[0066] Among them, the configuration information of the scene interface may include the scene interface identifier, parameters corresponding to the test data requested, etc. The parameters may include numbers, letters, graphics and other forms, and this application does not limit this.
[0067] Specifically, at least one corresponding scenario interface is determined based on the scenario interface identifier of at least one scenario interface. And, at least one corresponding test scenario is determined according to a first mapping relationship between the scenario interface and the test scenario. The first mapping relationship may include, for example, a corresponding relationship between scenario interface a and test scenario A, a corresponding relationship between scenario interface b and test scenario B, etc. The first mapping relationship may be generated and stored in advance.
[0068] According to the second mapping relationship between the parameter corresponding to the requested test data configured in the scenario interface and the test data type, the test data type corresponding to at least one scenario interface is determined, and then the test data type corresponding to at least one scenario interface is determined. The second mapping relationship may include, for example, the corresponding relationship between parameter x and online data, the corresponding relationship between parameter y and offline data, the corresponding relationship between parameter 10 and amount data, the corresponding relationship between parameter 20 and time data, etc. The second mapping relationship may be generated and stored in advance.
[0069] By combining the first mapping relationship and the second mapping relationship based on the configuration information of at least one scenario interface included in the interface configuration information, at least one test scenario corresponding to the page to be tested and the test data type corresponding to at least one test scenario are determined, so as to meet the testing requirements of the page to be tested in different test scenarios and improve the testing efficiency.
[0070] In order to further improve the testing efficiency, in some embodiments, the configuration information of each scenario interface may include a first preset parameter for requesting to obtain local data or a second preset parameter for requesting to obtain server data, and the test data type may include simulated test data stored locally and server test data stored on the server; the second mapping relationship may include a correspondence between the first preset parameter for requesting to obtain local data and the simulated test data, and a correspondence between the second preset parameter for requesting to obtain server data and the server test data.
[0071] At this time, according to the test data type corresponding to each test scenario, obtaining the test data corresponding to the test scenario may include:
[0072] When it is determined that the test data type corresponding to the test scenario is simulated test data according to the second mapping relationship between the configuration information of the scenario interface and the test data type, the simulated test data corresponding to the test scenario is obtained from the corresponding local scenario interface according to the third mapping relationship between the scenario interface and the simulated test data;
[0073] When it is determined that the test data type corresponding to the test scenario is server test data based on the second mapping relationship between the configuration information of the scenario interface and the test data type, the server test data corresponding to the test scenario is obtained from the corresponding scenario interface in the server based on the third mapping relationship between the scenario interface and the simulation test data.
[0074] Among them, the simulation test data can be pre-built and generated based on the server test data and stored locally. The simulation test data can be fictitious server test data and have the same test functions as the server test data. Using the simulation test data for page testing can obtain the same test results as using the server test data for page testing. It can be understood that compared to obtaining server test data from the server, obtaining simulation test data locally does not require access to the server, will not be affected by factors such as network fluctuations and request responses, and has higher acquisition efficiency. Therefore, for test scenarios with rapid testing requirements, simulation test data can be obtained locally.
[0075] In this embodiment, the test data type may include simulation test data stored locally and server-side test data stored on the server, and the configuration information of the scenario interface may include a first preset parameter for requesting to obtain local data or a second preset parameter for requesting to obtain server-side data, and the first preset parameter is different from the second preset parameter. For example, the first preset parameter may be parameter 1, and the second preset parameter may be parameter 2. For another example, the first preset parameter may be empty, and the second preset parameter may be a predetermined parameter. For another example, the second preset parameter may be empty, and the first preset parameter may be a predetermined parameter. The two predetermined parameters may be the same or different, and this application does not limit this.
[0076] It can be understood that the configuration information of each scenario interface includes the first preset parameter or the second preset parameter based on the actual test requirements. When each test scenario has a quick test requirement, the configuration information of each scenario interface includes the first preset parameter. When each test scenario does not have a quick test requirement, the configuration information of each scenario interface includes the second preset parameter. When some test scenarios have a quick test requirement, the configuration information of the corresponding scenario interface includes the first preset parameter, and the configuration information of other scenario interfaces includes the second preset parameter.
[0077] The second mapping relationship may include a correspondence between the first preset parameter and the simulation test data, and a correspondence between the second preset parameter and the server test data. Furthermore, for each test scenario corresponding to the page to be tested, the simulation test data can be obtained from the local according to the second mapping relationship when it is determined that the test data type corresponding to the test scenario is the simulation test data. Specifically, the simulation test data corresponding to the test scenario can be obtained from the local corresponding scenario interface according to the third mapping relationship between the scenario interface and the simulation test data, and the third mapping relationship can be generated and stored together when the simulation test data is constructed and stored locally. When it is determined that the test data type corresponding to the test scenario is the server test data, the server test data corresponding to the test scenario can be obtained from the scene interface corresponding to the server according to the fourth mapping relationship between the scene interface and the server test data, and the fourth mapping relationship can be generated and stored in advance. Optionally, when it is determined that the test data type corresponding to the test scenario is the server test data, a data acquisition request can be sent to the server to obtain the corresponding server test data.
[0078] By setting the first preset parameter for requesting local data or the second preset parameter for requesting server data in the configuration information of the scenario interface, combined with the correspondence between the first preset parameter and the simulated test data and the correspondence between the second preset parameter and the server test data, it is possible to obtain the corresponding simulated test data locally for test scenarios with rapid testing requirements without accessing the server, and without being affected by factors such as network fluctuations and request responses, thereby improving the efficiency of obtaining test data, thereby improving page testing efficiency and meeting rapid testing requirements.
[0079] As can be seen from the description of one or more of the above embodiments, the simulation test data can be pre-built and generated based on the server test data. Therefore, in some embodiments, the above method can also include:
[0080] Before intercepting the test data acquisition request for the page to be tested sent by the target interface, corresponding simulation test data is constructed based on the server-side test data corresponding to the page to be tested, and the constructed simulation test data is stored locally, saving the third mapping relationship between the simulation test data and the corresponding scenario interface.
[0081] Among them, the server-side test data corresponding to at least one test scenario corresponding to the page to be tested can be downloaded, and the corresponding simulation test data can be constructed and generated according to the downloaded data. Specifically, the simulation test data can be constructed and generated by various implementation methods such as plug-ins, third-party libraries or manual construction. In a practical application, Mock technology can be used to implement it. Mock technology is a testing technology that refers to a testing technology that uses a virtual data or object to create some data or objects that are not easy to construct or obtain during the test process for testing.
[0082] By pre-building simulated test data based on server-side test data and storing it locally, you can directly obtain the locally stored simulated test data for page testing when there is a need for fast testing, avoiding factors such as network fluctuations and untimely access processing that affect the testing process, thereby improving testing efficiency.
[0083] In order to improve the accuracy of the simulation test data, the above method may further include:
[0084] When the server test data corresponding to the page to be tested is updated, the simulation test data corresponding to the updated server test data is updated, and the updated simulation test data is stored locally, and the third mapping relationship is updated based on the updated simulation test data and its corresponding scenario interface.
[0085] Among them, the server-side test data update information can be monitored, or the test data update prompt information sent by the server can be received to learn the update status of the server-side test data. The simulation test data corresponding to the updated server-side test data can be updated accordingly. For example, the simulation test data can be rebuilt and generated based on the updated server-side test data, and the updated simulation test data can be obtained and stored. At the same time, the third mapping relationship can be updated based on the updated simulation test data and its corresponding scenario interface, so as to obtain the corresponding simulation test data according to the updated third mapping relationship, thereby improving the accuracy of the simulation test data.
[0086] By updating and storing the simulation test data and the third mapping relationship corresponding to the updated server test data when the server test data is updated, the dynamic alignment of the simulation test data and the server test data is maintained, thereby improving the accuracy of the simulation test data and further improving the accuracy of the page test.
[0087] like Figure 2 FIG. 1 is a flowchart of another embodiment of a page testing method provided by the present application. The method can be applied to a testing platform and may include the following steps:
[0088] 201: In response to a test operation triggered on a page to be tested, a test data acquisition request is generated.
[0089] When the test data acquisition request is intercepted and acquired by the interceptor, the interceptor determines at least one test scenario corresponding to the page to be tested and the test data type corresponding to at least one test scenario according to the interface configuration information included in the test data acquisition request, and acquires the test data corresponding to the test scenario according to the test data type corresponding to each test scenario, so as to obtain the test data corresponding to at least one test scenario. The specific implementation process is as follows: Figure 1 The above has been described in the illustrated embodiment and will not be described in detail herein.
[0090] 202: Receive test data corresponding to at least one test scenario sent by the interceptor.
[0091] 203: Using the test data corresponding to at least one test scenario, test the page to be tested for each test scenario.
[0092] Specifically, for each test scenario, the test data corresponding to the test scenario can be displayed in the page to be tested, or the test data corresponding to the test scenario can be used to perform functional tests on the page to be tested. The specific testing process can be implemented according to the testing process in the traditional solution, and this application will not go into details.
[0093] In this embodiment, a test data acquisition request can be generated in response to a test operation triggered for a page to be tested, wherein the test data acquisition request can include interface configuration information. When the test data acquisition request is intercepted by an interceptor, the interceptor can determine at least one test scenario corresponding to the page to be tested and the test data type corresponding to at least one test scenario according to the interface configuration information, and acquire the test data corresponding to the test scenario according to the test data type corresponding to each test scenario, so as to obtain the test data corresponding to at least one test scenario. The test data corresponding to at least one test scenario sent by the interceptor can be received, and the test data corresponding to at least one test scenario can be used to test the page to be tested for each test scenario. By determining at least one test scenario corresponding to the page to be tested and the test data type corresponding to at least one test scenario according to the interface configuration information included in the test data acquisition request sent by the target interface, the test data under the at least one test scenario is acquired, and the test data under the at least one test scenario is acquired. The test data under the at least one test scenario corresponding to the page to be tested is acquired once by using a test data acquisition request. There is no need to frequently acquire test data during the test process, which simplifies the test data acquisition process, improves the acquisition efficiency of test data under different test scenarios, and thus improves the test efficiency under different test scenarios.
[0094] In some embodiments, in response to a test operation triggered on a page to be tested, generating a test data acquisition request may include:
[0095] According to at least one scenario interface corresponding to the page to be tested, generate configuration information corresponding to at least one scenario interface respectively;
[0096] Based on the configuration information respectively corresponding to at least one scenario interface, the interface configuration information is determined, and based on the interface configuration information, a test data acquisition request is generated.
[0097] In actual applications, the interface configuration can be performed in advance on the test platform. Specifically, for the scenario interface of each test scenario corresponding to the page to be tested, the scenario interface identifier, the parameters corresponding to the test data type requested, and other information can be configured to generate configuration information corresponding to at least one scenario interface, and based on the configuration information corresponding to the scenario interface of at least one test scenario, the interface configuration information is determined to generate a test data acquisition request based on the interface configuration information. The target interface can provide the interface configuration information to the outside. Optionally, the information provided by the target interface to the outside may also include the interface path, the interface request mode, such as obtaining data, writing data, etc., and the interface response data, such as simulated error response, simulated network delay and timeout, data cache and offline mode test, identity authentication and permission test and other information, which can be set according to actual needs.
[0098] By generating configuration information of the scenario interface, at least one test scenario corresponding to the page to be tested and the test data type respectively corresponding to at least one test scenario are determined, so as to meet the test requirements of the page to be tested in different test scenarios and improve the test efficiency.
[0099] like Figure 3 FIG. 1 is a schematic diagram of a structure of an embodiment of a page testing device provided by the present application. The device may include the following modules:
[0100] The interception module 301 is used to intercept and obtain the test data acquisition request for the page to be tested sent by the target interface; the test data acquisition request includes interface configuration information;
[0101] A determination module 302, configured to determine at least one test scenario corresponding to the page to be tested and test data corresponding to the at least one test scenario based on the interface configuration information;
[0102] An acquisition module 303 is used to acquire test data corresponding to each test scenario according to the test data type corresponding to the test scenario, so as to obtain test data corresponding to at least one test scenario respectively;
[0103] The sending module 304 is used to send the test data corresponding to the at least one test scenario to the target interface, so as to test the page to be tested by using the test data corresponding to the at least one test scenario.
[0104] The page testing device of this embodiment can realize Figure 1 The page testing method of the embodiment can intercept and obtain the test data acquisition request for the page to be tested sent by the target interface, wherein the test data acquisition request can include interface configuration information, based on the interface configuration information, at least one test scenario corresponding to the page to be tested and the test data type respectively corresponding to at least one test scenario can be determined, and according to the test data type corresponding to each test scenario, the test data respectively corresponding to at least one test scenario is acquired to obtain the test data respectively corresponding to at least one test scenario, and the test data respectively corresponding to at least one test scenario is sent to the target interface, so as to test the page to be tested using the test data respectively corresponding to at least one test scenario. By intercepting the test data acquisition request sent by the target interface, at least one test scenario corresponding to the page to be tested and the test data type respectively corresponding to at least one test scenario are determined according to the interface configuration information included in the test data acquisition request, and the test data respectively corresponding to the at least one test scenario are acquired, and the test data corresponding to the at least one test scenario corresponding to the page to be tested is acquired once by using a test data acquisition request, and the test data under at least one test scenario corresponding to the page to be tested is acquired, and the test data does not need to be frequently acquired during the test process, which simplifies the test data acquisition process, improves the test data acquisition efficiency under different test scenarios, and thus improves the test efficiency under different test scenarios.
[0105] In some embodiments, the interface configuration information includes configuration information of at least one scenario interface;
[0106] Determination module 302 can be specifically used to determine at least one scenario interface corresponding to the page to be tested based on the configuration information of at least one scenario interface; determine at least one test scenario corresponding to the page to be tested according to a first mapping relationship between the scenario interface and the test scenario; determine the test data type corresponding to at least one test scenario according to a second mapping relationship between the configuration information of the scenario interface and the test data type.
[0107] In some embodiments, the configuration information of each scenario interface includes a first preset parameter for requesting to obtain local data or a second preset parameter for requesting to obtain server-side data, and the test data type includes simulated test data stored locally and server-side test data stored on the server; the second mapping relationship includes a correspondence between the first preset parameter for requesting to obtain local data and the simulated test data, and a correspondence between the second preset parameter for requesting to obtain server-side data and the server-side test data;
[0108] The acquisition module 303 can be specifically used to obtain the simulation test data corresponding to the test scenario from the local corresponding scenario interface according to the third mapping relationship between the scenario interface and the simulation test data when it is determined that the test data type corresponding to the test scenario is simulation test data based on the second mapping relationship between the configuration information of the scenario interface and the test data type; and to obtain the server-side test data corresponding to the test scenario from the corresponding scenario interface in the server according to the fourth mapping relationship between the scenario interface and the server-side test data when it is determined that the test data type corresponding to the test scenario is server-side test data based on the second mapping relationship between the scenario interface and the test data type.
[0109] In some embodiments, the above apparatus may further include:
[0110] The simulation module is used to construct and generate corresponding simulation test data based on the server-side test data corresponding to the page to be tested, store the constructed simulation test data locally, and save the third mapping relationship between the simulation test data and the corresponding scenario interface.
[0111] In some embodiments, the above apparatus may further include:
[0112] The update module is used to update the simulation test data corresponding to the updated server test data when the server test data corresponding to the page to be tested is updated, and store the updated simulation test data locally, and update the third mapping relationship based on the updated simulation test data and its corresponding scenario interface.
[0113] like Figure 4 FIG. 1 is a schematic diagram of the structure of another embodiment of a page testing device provided by the present application. The device may include the following modules:
[0114] The generating module 401 is used to generate a test data acquisition request in response to a test operation triggered for a page to be tested; the test data acquisition request is intercepted and acquired by an interceptor, and the interceptor determines at least one test scenario corresponding to the page to be tested and a test data type respectively corresponding to the at least one test scenario according to the interface configuration information included in the test data acquisition request, and acquires the test data corresponding to the test scenario according to the test data type corresponding to each test scenario, so as to obtain the test data respectively corresponding to the at least one test scenario;
[0115] The receiving module 402 is used to receive test data corresponding to at least one test scenario sent by the interceptor;
[0116] The testing module 403 is used to test the page to be tested for each test scenario using the test data corresponding to at least one test scenario.
[0117] The page testing device of this embodiment can realize Figure 2 The page testing method of the embodiment can generate a test data acquisition request in response to a test operation triggered for a page to be tested, wherein the test data acquisition request can include interface configuration information. When the test data acquisition request is intercepted by an interceptor, the interceptor can determine at least one test scenario corresponding to the page to be tested and the test data type corresponding to at least one test scenario according to the interface configuration information, and acquire the test data corresponding to the test scenario according to the test data type corresponding to each test scenario, so as to obtain the test data corresponding to at least one test scenario. The test data corresponding to at least one test scenario sent by the interceptor can be received, and the test data corresponding to at least one test scenario can be used to test the page to be tested for each test scenario. By determining at least one test scenario corresponding to the page to be tested and the test data type corresponding to at least one test scenario according to the interface configuration information included in the test data acquisition request sent by the target interface, the test data under the at least one test scenario is acquired, and the test data under the at least one test scenario is acquired. The test data under the at least one test scenario corresponding to the page to be tested is acquired once by using a test data acquisition request. There is no need to frequently acquire test data during the test process, which simplifies the test data acquisition process, improves the acquisition efficiency of test data under different test scenarios, and thus improves the test efficiency under different test scenarios.
[0118] In some embodiments, the generation module 401 can be specifically used to generate configuration information corresponding to at least one scenario interface according to at least one scenario interface corresponding to the page to be tested; determine the interface configuration information based on the configuration information corresponding to at least one scenario interface, and generate a test data acquisition request based on the interface configuration information.
[0119] like Figure 5 As shown, it is a structural schematic diagram of an embodiment of a page testing system provided by the present application, which may include a testing platform 501 and an interceptor 502.
[0120] The test platform 501 may generate a test data acquisition request in response to a test operation triggered on the page to be tested.
[0121] The interceptor 502 can intercept and obtain the test data acquisition request sent by the target interface, the test data acquisition request including the interface configuration information; based on the interface configuration information, determine at least one test scenario corresponding to the page to be tested, and the test data type respectively corresponding to the at least one test scenario; according to the test data type corresponding to each test scenario, obtain the test data corresponding to the test scenario to obtain the test data respectively corresponding to the at least one test scenario; send the test data respectively corresponding to the at least one test scenario to the target interface;
[0122] The test platform 501 may also receive test data corresponding to at least one test scenario sent by the interceptor, and use the test data corresponding to at least one test scenario to test the page to be tested.
[0123] By intercepting the test data acquisition request sent by the target interface, determining at least one test scenario corresponding to the page to be tested and the test data type respectively corresponding to at least one test scenario according to the interface configuration information included in the test data acquisition request, obtaining the test data corresponding to the at least one test scenario, and realizing one-time acquisition of the test data under at least one test scenario corresponding to the page to be tested by using a single test data acquisition request, there is no need to frequently acquire test data during the test process, which simplifies the test data acquisition process, improves the test data acquisition efficiency under different test scenarios, and thereby improves the testing efficiency under different test scenarios.
[0124] Optionally, the test platform 501 can generate configuration information of at least one scenario interface corresponding to the page to be tested, and the configuration information of each scenario interface can include a first preset parameter for requesting to obtain local data or a second preset parameter for requesting to obtain server data. Based on the configuration information of at least one scenario interface, the interface configuration information can be determined, and a test data acquisition request can be generated, so that the interceptor 502 can determine at least one test scenario corresponding to the page to be tested, and the test data type corresponding to at least one test scenario based on the interface configuration information. According to the second mapping relationship between the configuration information of the scenario interface and the test data type, the second mapping relationship can include a correspondence relationship between the first preset parameter for requesting to obtain local data and simulated test data, and a correspondence relationship between the second preset parameter for requesting to obtain server data and server test data. When it is determined that the test data type corresponding to the test scenario is simulated test data, according to the third mapping relationship between the scenario interface and the simulated test data, the simulated test data corresponding to the test scenario is obtained from the local corresponding scenario interface; when it is determined that the test data type corresponding to the test scenario is server test data, according to the third mapping relationship between the scenario interface and the simulated test data, the server test data corresponding to the test scenario is obtained from the corresponding scenario interface in the server.
[0125] By setting the first preset parameter for requesting local data or the second preset parameter for requesting server data in the configuration information of the scenario interface, combined with the correspondence between the first preset parameter and the simulated test data and the correspondence between the second preset parameter and the server test data, it is possible to obtain the corresponding simulated test data locally for test scenarios with rapid testing requirements without accessing the server, and without being affected by factors such as network fluctuations and request responses, thereby improving the efficiency of obtaining test data, thereby improving page testing efficiency and meeting rapid testing requirements.
[0126] like Figure 6 , which is a schematic diagram of the structure of an embodiment of a computing device provided by the present application, may include a storage component 601 and a processing component 602 .
[0127] The storage component 601 stores one or more computer instructions, wherein the one or more computer instructions are called and executed by the processing component 602 to implement Figure 1 or Figure 2 Page test method shown.
[0128] Of course, the above computing device may also include other components, such as input / output interfaces, communication components, etc.
[0129] The input / output interface provides an interface between the processing component and the peripheral interface module, which may be an output device, an input device, etc. The communication component is configured to facilitate wired or wireless communication between the computing device and other devices.
[0130] It should be noted that the above computing device implements Figure 1 In the case of the page testing method shown, it can be a physical device or an elastic computing host provided by a cloud computing platform, etc. It can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or as a single server or a single terminal device.
[0131] The computing device described above implements Figure 2 In the case of the page testing method shown, it can also be implemented as an electronic device. The electronic device can refer to a device used by developers or testers, which has functions such as surfing the Internet, computing, and communicating, such as a mobile phone, a tablet computer, a personal computer, a wearable device, etc. It is understandable that the above-mentioned electronic device must also include a display component, an input / output interface, a communication component, and other components, which will not be repeated.
[0132] The processing component may include one or more processors to execute computer instructions to complete all or part of the steps in the method. Of course, the processing component may also be implemented as one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the method.
[0133] The storage component is configured to store various types of data to support operations at the terminal. The storage component can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0134] The present application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a computer, the above-mentioned Figure 1 or Figure 2 The page testing method shown. The computer readable medium may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device.
[0135] The present application also provides a computer program product, which includes a computer program carried on a computer-readable storage medium. When the computer program is executed by a computer, the above-mentioned Figure 1 or Figure 2 Page test method shown.
[0136] In such an embodiment, the computer program may be downloaded and installed from a network, and / or installed from a removable medium. When the computer program is executed by a processor, various functions defined in the system of the present application are performed.
[0137] It should be noted that the above computing device can be a physical device or an elastic computing host provided by a cloud computing platform, etc. It can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or as a single server or a single terminal device.
[0138] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0139] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0140] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A page testing method, characterized in that: include: Intercept and obtain a test data acquisition request for a page to be tested sent by a target interface, wherein the test data acquisition request includes interface configuration information; Based on the interface configuration information, determining at least one test scenario corresponding to the page to be tested, and types of test data respectively corresponding to the at least one test scenario; According to the test data type corresponding to each of the test scenarios, acquiring the test data corresponding to the test scenarios, so as to obtain the test data corresponding to the at least one test scenario respectively; The test data respectively corresponding to the at least one test scenario are sent to the target interface, so as to test the to-be-tested page by using the test data respectively corresponding to the at least one test scenario.
2. The method according to claim 1, characterized in that The interface configuration information includes configuration information of at least one scene interface; The determining, based on the interface configuration information, at least one test scenario corresponding to the page to be tested, and the type of test data respectively corresponding to the at least one test scenario comprises: Based on the configuration information of the at least one scenario interface, determining at least one scenario interface corresponding to the page to be tested; Determine at least one test scenario corresponding to the page to be tested according to a first mapping relationship between the scenario interface and the test scenario; According to a second mapping relationship between the configuration information of the scenario interface and the test data type, the test data type respectively corresponding to the at least one test scenario is determined.
3. The method according to claim 2, characterized in that The configuration information of each of the scenario interfaces includes a first preset parameter for requesting to obtain local data or a second preset parameter for requesting to obtain server data, and the test data type includes simulation test data stored locally and server test data stored on the server; The second mapping relationship includes a correspondence between a first preset parameter for requesting to obtain local data and simulation test data, and a correspondence between a second preset parameter for requesting to obtain server data and server test data; According to the type of test data corresponding to each test scenario, obtaining the test data corresponding to the test scenario includes: When it is determined that the test data type corresponding to the test scenario is simulated test data according to the second mapping relationship between the configuration information of the scenario interface and the test data type, the simulated test data corresponding to the test scenario is obtained from the locally corresponding scenario interface according to the third mapping relationship between the scenario interface and the simulated test data; When it is determined that the test data type corresponding to the test scenario is server test data based on the second mapping relationship between the configuration information of the scenario interface and the test data type, the server test data corresponding to the test scenario is obtained from the corresponding scenario interface in the server based on the fourth mapping relationship between the scenario interface and the server test data.
4. The method according to claim 3, characterized in that Also includes: Before intercepting and obtaining the test data acquisition request for the page to be tested sent by the target interface, corresponding simulation test data is constructed and generated based on the server-side test data corresponding to the page to be tested, and the constructed simulation test data is stored locally, and a third mapping relationship between the simulation test data and the corresponding scenario interface is saved.
5. The method according to claim 4, characterized in that Also includes: When the server test data corresponding to the page to be tested is updated, the simulation test data corresponding to the updated server test data is updated, and the updated simulation test data is stored locally, and the third mapping relationship is updated based on the updated simulation test data and its corresponding scenario interface.
6. A page testing method, characterized in that: include: In response to a test operation triggered on the page to be tested, a test data acquisition request is generated; The test data acquisition request is intercepted and acquired by the interceptor, and the interceptor determines at least one test scenario corresponding to the page to be tested and the test data type respectively corresponding to the at least one test scenario according to the interface configuration information included in the test data acquisition request, and acquires the test data corresponding to the test scenario according to the test data type corresponding to each test scenario, so as to obtain the test data respectively corresponding to the at least one test scenario; Receiving test data corresponding to at least one test scenario sent by the interceptor; The to-be-tested page is tested for each test scenario respectively using the test data corresponding to the at least one test scenario.
7. The method according to claim 6, characterized in that The generating of the test data acquisition request in response to the test operation triggered on the page to be tested includes: According to at least one scenario interface corresponding to the page to be tested, generating configuration information corresponding to the at least one scenario interface respectively; Based on the configuration information respectively corresponding to the at least one scenario interface, interface configuration information is determined, and based on the interface configuration information, a test data acquisition request is generated.
8. A page testing system, characterized in that: Including test platform and interceptor; The test platform is used to send a test data acquisition request for the page to be tested using the target interface; The interceptor is used to intercept and obtain the test data acquisition request, wherein the test data acquisition request includes interface configuration information; based on the interface configuration information, determine at least one test scenario corresponding to the page to be tested, and the test data type corresponding to each of the at least one test scenario; According to the test data type corresponding to each test scenario, acquiring the test data corresponding to the test scenario to obtain the test data respectively corresponding to the at least one test scenario; sending the test data respectively corresponding to the at least one test scenario to the target interface; The test platform is also used to receive test data corresponding to at least one test scenario sent by the interceptor; and use the test data corresponding to the at least one test scenario to test the page to be tested for each test scenario.
9. A computing device, characterized in that It comprises a storage component and a processing component; the storage component stores one or more computer instructions, the computer instructions are called and executed by the processing component, and the processing component executes the one or more computer instructions to implement the page testing method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a computer, the page testing method according to any one of claims 1 to 7 is implemented.
11. A computer program product, characterized in that A computer program is stored, and when the computer program is executed by a computer, the page testing method according to any one of claims 1 to 7 is implemented.
