Front-end page testing method and device, storage medium and equipment
By generating and creating an interface on the target server to reply to the return data of the front-end page, the problem of front-end development progress synchronization is solved, and flexible testing and decoupled development of the front-end page is realized.
Patent Information
- Application Number
- CN202411492105.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-02-14
AI Technical Summary
In the front-end separation architecture, the testing process of the front-end page is limited by the synchronization of the front-end development progress, lacks flexibility, and it is difficult to test after the front-end and the back-end complete development.
By obtaining the front-end page file, determining the interface endpoint of its request, and generating the creation code to create an interface on the target server, so that the front-end page is returned when requested, so that the front-end page will be performed without the need for back-end system or database construction. test.
It realizes decoupling of front-end development testing progress, improves the flexibility of front-end development, and allows front-end pages to be tested without relying on the back-end system at all.
Smart Images

Figure CN119441036A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, storage medium, and equipment for testing a front-end page. Background Art
[0002] In the front-end and back-end separation architecture, the front-end and back-end interact and communicate with each other through APIs. The front-end sends requests and the back-end returns responses. This loosely coupled architecture model improves the flexibility and maintainability of the system, but it also puts forward stricter requirements on interface definition, data format, request response, etc. during the development phase.
[0003] In the current development process, since the front-end page usually involves interface interaction with the back-end, when the front-end page needs to be tested, it is usually necessary to test it together after the front-end and the back-end have completed their development. This front-end and back-end interaction testing process is also limited by the development progress of both the front-end and the back-end, and lacks flexibility.
[0004] Therefore, the present invention provides a method, device, storage medium and equipment for testing a front-end page. Summary of the invention
[0005] This specification provides a front-end page testing method and device to partially solve the above-mentioned problems existing in the prior art.
[0006] This manual adopts the following technical solutions:
[0007] This manual provides a front-end page testing method, including:
[0008] Get the front-end page file;
[0009] Determine the interface endpoint requested by the front-end page according to the front-end page file;
[0010] Generate creation code for each interface according to the interface endpoint requested by the front-end page;
[0011] Creating an interface on the target server according to the creation code, wherein the interface is used to reply to the return data when the front-end page is requested;
[0012] The target server is used as the backend address to test the frontend page.
[0013] Optionally, also include:
[0014] According to the interface endpoint requested by the front-end page, determine the return data type corresponding to each interface endpoint requested by the front-end page;
[0015] Generate return data corresponding to each interface endpoint according to the return data type.
[0016] Optionally, generating return data corresponding to each interface endpoint according to the return data type specifically includes:
[0017] If the return data type of any interface endpoint is database change and authentication type, a virtual status code corresponding to the interface endpoint is generated as return data;
[0018] If the return data type of any interface endpoint is a data query class, generate virtual content corresponding to the interface endpoint as return data;
[0019] If the return data type of any interface endpoint is a resource download type, a virtual link corresponding to the interface endpoint is generated as the return data.
[0020] Optionally, generating return data corresponding to each interface endpoint according to the return data type specifically includes:
[0021] Each return data type and the return data template corresponding to each return data type are input into a pre-trained large language model to obtain the return data corresponding to each interface endpoint.
[0022] Optionally, generating return data of each interface endpoint according to the interface endpoint requested by the front-end page specifically includes:
[0023] Randomly generate arbitrary content as return data.
[0024] Optionally, generating creation codes for each interface according to the interface endpoint requested by the front-end page specifically includes:
[0025] The interface endpoints requested by the front-end page and the front-end page file are input into a large language model to generate creation codes for each port.
[0026] Optionally, the target server is used as the backend address to test the frontend page, specifically including:
[0027] Obtain the domain name requested by the front-end page;
[0028] Binding the address of the target server to the domain name;
[0029] Run the front-end page file;
[0030] The test result of the front-end page is determined according to the content of the front-end page after the front-end page file is run and / or the arrangement of the front-end page.
[0031] This specification provides a testing device for a front-end page, including:
[0032] Get the module and get the front-end page file;
[0033] A determination module, which determines the interface endpoint requested by the front-end page according to the front-end page file;
[0034] A generation module generates creation codes for each interface according to the interface endpoint requested by the front-end page;
[0035] A creation module, which creates an interface on the target server according to the creation code, wherein the interface is used to reply to the return data when the front-end page is requested;
[0036] The test module uses the target server as the backend address to test the frontend page.
[0037] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned front-end page testing method is implemented.
[0038] This specification provides a device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned front-end page testing method when executing the program.
[0039] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:
[0040] In the front-end page testing method provided in this specification, the front-end page file is obtained, and the interface endpoint requested by the front-end page is determined based on the front-end page file. The creation code of each interface is generated based on the interface endpoint requested by the front-end page. The interface is created on the target server according to the creation code. The interface is used to reply to the return data when the front-end page is requested. The target server is used as the back-end address to test the front-end page.
[0041] It can be seen from the above method that, without the need to build a back-end system or database, the code can be created through the real-time generated back-end interface to complete the testing of the front-end page, so that the development and testing progress of the front-end and back-end are decoupled, thereby improving the flexibility of front-end development. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:
[0043] Figure 1 A flowchart of a front-end page testing method in this specification;
[0044] Figure 2 This is a schematic diagram of the structure of the front-end page testing system in this manual;
[0045] Figure 3 A schematic diagram of the relationship between the front-end page testing system and the large language model in this manual;
[0046] Figure 4 A schematic diagram of a front-end page testing device provided in this specification;
[0047] Figure 5 The corresponding Figure 1 Schematic diagram of electronic equipment. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0049] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.
[0050] Figure 1 The following is a flow chart of a method for testing a front-end page in this specification. The method for testing a front-end page specifically includes the following steps:
[0051] S100: Obtain the front-end page file.
[0052] Currently, when it is necessary to test the front-end page, it is usually necessary to conduct the test together after the front-end and the back-end have completed their development. Therefore, this specification provides a front-end page testing method, which can complete the test of the front-end page when the back-end server is not fully constructed. The front-end page testing method can be applied to a front-end page testing system, and users can submit front-end page files in the front-end page testing system to complete the test of the front-end page.
[0053] First, obtain the front-end page file submitted by the user.
[0054] Among them, the method for users to submit front-end pages is to directly upload the front-end page files required for testing to the front-end page testing system, or to upload the front-end page link to the front-end page testing system, and the front-end page testing system will automatically obtain the front-end page files required for testing.
[0055] Among them, the above-mentioned front-end page files can be HTML files and resources such as JS files and CSS files referenced in HTML files, which will not be elaborated in this manual.
[0056] S102: Determine the interface endpoint requested by the front-end page according to the front-end page file.
[0057] After obtaining the front-end page file submitted by the user, the front-end page testing system can determine the interface endpoint requested by the front-end page according to the interface calling statement in the front-end page file.
[0058] Among them, the front-end page file and the corresponding prompt statement can be input into the large language model, so that the large language model can identify and sort out the interface endpoints requested in the front-end page file. For example, the prompt statement can be "Please count the interface call requests in the file, and enter the interface name called by each interface call request in the file"; it is also possible to search according to the common keywords in the interface call statements used in the front-end page file to call the back-end interface, extract the interface call statements in the front-end page file and count them. For example, if XMLHttpRequest is used in the front-end page file to call the back-end interface, "xhr." can be used as a keyword to search, and fetchAPI is used in the front-end page file to call the back-end interface, then "fetch" can be used as a keyword to search, and the context after the search can be extracted to locate each interface endpoint and the interface call statements of each interface endpoint.
[0059] In one or more embodiments of the present specification, each interface call request statement in the front-end page file submitted by the user may include a comment statement for each interface call request, and the comment statement may be in a unified format of "interface endpoint name-interface endpoint type". Thus, the comment statement in the front-end page file can be directly used to determine the interface endpoints requested by the front-end page.
[0060] It should be noted that an interface may include several interface endpoints, which represent the specific URLs where the API can receive requests and return responses. Each interface endpoint corresponds to a specific function or resource in the API.
[0061] S104: Generate creation codes for each interface according to the interface endpoint requested by the front-end page.
[0062] After obtaining the interface endpoints requested by the front-end page, the creation code of each interface can be generated according to the interface endpoints requested by each front-end page.
[0063] In one or more embodiments of the present specification, interface creation code templates corresponding to different interface functions can be prepared in advance according to the interface functions, and the function of each interface endpoint can be determined according to the interface calling statement in the front-end page file corresponding to each interface endpoint. The calling template corresponding to each interface endpoint can be determined according to the function of each interface endpoint, and the URL of the interface endpoint can be replaced with the calling template corresponding to the interface endpoint to obtain a creation code corresponding to the interface endpoint. The creation codes corresponding to the interface endpoints can be combined, and the referenced application framework can be declared in the creation code to obtain a complete creation code.
[0064] The application frameworks that can assist in creating backend interfaces are relatively mature, such as Express, Spring Boot, and Mybatis Plus, which are not described in detail in this manual.
[0065] S106: Creating an interface on the target server according to the creation code, wherein the interface is used to reply to return data when a front-end page is requested.
[0066] After obtaining the complete creation code, the creation code is deployed and run on the target server. Thus, when the front-end page sends an interface call request to the target server, the target server can reply to the front-end page through the deployed interface with return data corresponding to the interface call request sent by the front-end page.
[0067] The returned data may be selected from a return database prepared in advance for different types of interface endpoints.
[0068] It should be noted that after receiving the interface call request from the front-end page, each interface of each target server only replies with return data to the front-end page, and executes specific back-end business processes, such as changing database content, extracting data from the database, etc. That is, the data returned by each interface endpoint to the front-end page is virtual data, rather than the real feedback of the interface call request sent by the front-end page after the back-end system runs. Since the testing of the front-end page only requires the return result of the back-end interface reply, there is no need to pay attention to the authenticity of the result, thereby simplifying the testing process of the front-end page.
[0069] S108: Using the target server as a backend address, the frontend page is tested.
[0070] After the deployment of the created code is completed, the target server can be used as the backend address to run the pre-prepared test program to send interface call requests to each interface endpoint of the backend page through the frontend page to test the frontend page. Figure 2As shown, the test program can be deployed in a virtual computing node or a physical computing node, the virtual computing node or the physical computing node is connected to the target server, and a core application is used to receive and process the user's front-end page test request. The three together constitute the front-end page test system.
[0071] In one or more embodiments of the present specification, the backend domain name requested by the front-end page can be specified in the front-end page file, so that after the front-end page test system completes deployment on the target server, a host file can be generated to jump the backend domain name requested by the front-end page to the target server. After binding the host file in the environment where the test program is deployed, the test of the front-end page file can be completed.
[0072] Among them, the above-mentioned test program can be a public front-end testing tool such as Lighthouse, Pingdom Website Speed Test, etc., or it can be other testing programs with similar functions, which will not be elaborated in this manual.
[0073] like Figure 1 The front-end page testing method shown can complete the testing of the front-end page by creating code through the real-time generated back-end interface without the need to build a back-end system or database, thereby decoupling the development and testing progress of the front-end and back-end and improving the flexibility of front-end development.
[0074] In addition, in Figure 1 After step S100 shown, the return data type corresponding to each interface endpoint requested by the front-end page is determined according to the interface endpoint requested by the front-end page, and the return data corresponding to each interface endpoint is generated according to the return data type.
[0075] Specifically, to determine the return data replied by each interface endpoint after receiving the request, the return data type corresponding to each interface endpoint can be determined according to each interface endpoint, for example, the following interface call statement: fetch('https: / / api.example.com / data',{method:'GET'}).
[0076] The interface call statement uses fetch to call the backend interface. The type of the interface endpoint requested by the interface call statement can be determined from "method: 'GET'", and then the return data type corresponding to the interface endpoint requested by the interface call statement can be determined.
[0077] In one or more embodiments of the present specification, various types of return data may be generated in advance and a return database may be established. After determining the interface endpoint requested by the front-end page, the return data corresponding to each interface endpoint may be determined in the return database based on the interface endpoints requested by the front-end page.
[0078] In such Figure 1 In S106 shown, an interface is created on the target server according to the creation code and the return data, and the interface is used to reply to the return data when the front-end page is requested.
[0079] Specifically, each returned data may be added to the code corresponding to the interface endpoint according to the interface endpoint corresponding to the returned data. For example, the returned data may be declared as a constant using the const method, or other feasible methods may be used.
[0080] Therefore, after each interface endpoint receives the interface call request sent by the front-end page, it can reply to the front-end page with the return data corresponding to the interface endpoint.
[0081] Furthermore, in Figure 1 After step S100 shown, if the return data type of any interface endpoint is the database change and authentication class, a virtual status code corresponding to the interface endpoint is generated as return data; if the return data type of any interface endpoint is the data query class, virtual content corresponding to the interface endpoint is generated as return data; if the return data type of any interface endpoint is the resource download class, a virtual link corresponding to the interface endpoint is generated as return data.
[0082] The return content of the back-end interface to the front-end interface call request may generally include an http status code, a response header, and a response body. The return data in this specification refers to the content included in the response body.
[0083] The method provided in this specification divides the return data into three types according to the interface call statement, namely, database change and authentication class, data query class and resource download class, among which, the database change and authentication class may specifically include data update, data creation, file upload, user authentication, permission authentication, etc. For the interface endpoints corresponding to the data change and authentication class, such interface endpoints only need to reply whether the request is successfully executed, thereby generating a virtual status code corresponding to the interface endpoint as the return data; for the interface endpoints corresponding to the data query class, such interface endpoints need to reply to the data content requested by the front-end page, thereby generating the virtual content corresponding to the interface endpoint as the return data; for the interface endpoints of the resource download class, a virtual link corresponding to the interface endpoint is generated as the return data.
[0084] It should be noted that for the interface endpoint corresponding to the data query class, the specific data content type - the format and type of the data, etc., can be determined based on the comments corresponding to the interface call statement requesting this type of interface endpoint in the front-end page file.
[0085] In one or more embodiments of the present specification, a JSON object may also be generated as return data. Thus, based on the characteristics of the JSON object consisting of key-value pairs and supporting multiple data types, the JSON object may be used as a virtual status code or as virtual content.
[0086] Specifically, in Figure 1 After step S100 shown, each return data type and the return data template corresponding to each return data type are input into a pre-trained large language model to obtain the return data corresponding to each interface endpoint.
[0087] In one or more embodiments of the present specification, any content may be randomly generated as the return data.
[0088] This can be used to test the stability of the front-end page when the back-end link is attacked or replaced, causing abnormalities in the back-end return data.
[0089] In addition, in Figure 1 In step S106 shown, each interface endpoint of the front-end page request and the front-end page file are input into a large language model to generate a creation code for each port.
[0090] After obtaining each interface endpoint, each request endpoint and the front-end page file can be input into the large language model, and the creation code for each port can be generated using preset prompt statements, such as "Please determine the request endpoint type corresponding to each interface endpoint based on the comments in the front-end page file, and generate the creation code for each interface based on the request endpoint type corresponding to each request endpoint."
[0091] like Figure 3 As shown, the front-end page testing system is connected to an external large language model through a preset interface, and upon receiving a front-end page testing request from a user, a generation request for creating code and / or returning data is sent to the large language model.
[0092] In addition, in Figure 1 In step S108 shown, the domain name requested by the front-end page is obtained, the address of the target server is bound to the domain name, the front-end page file is run, and the test result of the front-end page is determined based on the content in the front-end page after the front-end page file is run and / or the arrangement in the front-end page.
[0093] Specifically, when testing the front-end page, the test result of the front-end page can be determined based on whether the content displayed on the front-end page conforms to a predetermined format after the front-end page is run and obtains the return data based on the back-end interface, whether the return content can be normally displayed on the front-end page, whether the return content that does not need to be displayed is displayed on the front-end page, the display content of the front-end page after obtaining abnormal return content, the interval time from running the front-end page file to the display result after the front-end page obtains the return content, and the arrangement of the pages displayed by the front-end page based on the return content.
[0094] The above is a front-end page testing method provided in one or more embodiments of this specification. Based on the same idea, this specification also provides a corresponding front-end page testing device, such as Figure 4 shown.
[0095] Figure 4 A schematic diagram of a front-end page test device provided in this specification specifically includes:
[0096] Acquisition module 400, acquiring a front-end page file;
[0097] Determining module 402, determining the interface endpoint requested by the front-end page according to the front-end page file;
[0098] A generation module 404 generates creation codes for each interface according to the interface endpoints requested by the front-end page;
[0099] A creation module 406, which creates an interface on the target server according to the creation code, wherein the interface is used to reply to the return data when the front-end page is requested;
[0100] The testing module 408 uses the target server as a backend address to test the frontend page.
[0101] Optionally, the determination module 402 is further used to: determine, according to the interface endpoint requested by the front-end page, a return data type corresponding to each interface endpoint requested by the front-end page;
[0102] The generating module 404 is further used to generate the return data corresponding to each interface endpoint according to the return data type.
[0103] Optionally, generation module 404 is specifically used to: if the return data type of any interface endpoint is a database change and authentication class, generate a virtual status code corresponding to the interface endpoint as return data; if the return data type of any interface endpoint is a data query class, generate virtual content corresponding to the interface endpoint as return data; if the return data type of any interface endpoint is a resource download class, generate a virtual link corresponding to the interface endpoint as return data.
[0104] Optionally, the generation module 404 is specifically used to: input each return data type and the return data template corresponding to each return data type into a pre-trained large language model to obtain the return data corresponding to each interface endpoint.
[0105] Optionally, the generation module 404 is specifically used to randomly generate any content as return data.
[0106] Optionally, the generation module 404 is specifically used to: input each interface endpoint of the front-end page request and the front-end page file into the large language model to generate the creation code of each port.
[0107] Optionally, the test module 408 is specifically used to: obtain the domain name requested by the front-end page, bind the address of the target server to the domain name, run the front-end page file, and determine the test result of the front-end page based on the content in the front-end page after the front-end page file is run and / or the layout of the front-end page.
[0108] This specification also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 Provides testing methods for front-end pages.
[0109] This manual also provides Figure 5 The schematic structure diagram of the electronic device shown in FIG. Figure 5 As mentioned above, at the hardware level, the test equipment of the front-end page includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and of course may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 Of course, in addition to the software implementation, this specification does not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0110] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0111] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0112] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0113] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0114] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0115] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0116] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0117] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0118] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0119] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0120] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0121] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0122] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0123] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0124] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0125] The above description is only an embodiment of this specification and is not intended to limit this specification. For those skilled in the art, this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification should be included in the scope of the claims of this application.
Claims
1. A front-end page testing method, characterized in that: The method comprises: Get the front-end page file; Determine the interface endpoint requested by the front-end page according to the front-end page file; Generate creation code for each interface according to the interface endpoint requested by the front-end page; Creating an interface on the target server according to the creation code, wherein the interface is used to reply to the return data when the front-end page is requested; The target server is used as the backend address to test the frontend page.
2. The method according to claim 1, characterized in that Also includes: According to the interface endpoint requested by the front-end page, determine the return data type corresponding to each interface endpoint requested by the front-end page; Generate return data corresponding to each interface endpoint according to the return data type.
3. The method according to claim 2, characterized in that Generate return data corresponding to each interface endpoint according to the return data type, specifically including: If the return data type of any interface endpoint is database change and authentication type, a virtual status code corresponding to the interface endpoint is generated as return data; If the return data type of any interface endpoint is a data query class, generate virtual content corresponding to the interface endpoint as return data; If the return data type of any interface endpoint is a resource download type, a virtual link corresponding to the interface endpoint is generated as the return data.
4. The method according to claim 2, characterized in that Generate return data corresponding to each interface endpoint according to the return data type, specifically including: Each return data type and the return data template corresponding to each return data type are input into a pre-trained large language model to obtain the return data corresponding to each interface endpoint.
5. The method according to claim 1, characterized in that Generate return data of each interface endpoint according to the interface endpoint requested by the front-end page, specifically including: Randomly generate arbitrary content as return data.
6. The method according to claim 1, characterized in that Generate creation code for each interface according to the interface endpoint requested by the front-end page, specifically including: The interface endpoints requested by the front-end page and the front-end page file are input into a large language model to generate creation codes for each port.
7. The method according to claim 6, characterized in that Using the target server as the backend address, testing the frontend page includes: Obtain the domain name requested by the front-end page; Binding the address of the target server to the domain name; Run the front-end page file; The test result of the front-end page is determined according to the content of the front-end page after the front-end page file is run and / or the arrangement of the front-end page.
8. A front-end page testing device, characterized in that: include: Get the module and get the front-end page file; A determination module, which determines the interface endpoint requested by the front-end page according to the front-end page file; A generation module generates creation codes for each interface according to the interface endpoint requested by the front-end page; A creation module, which creates an interface on the target server according to the creation code, wherein the interface is used to reply to the return data when the front-end page is requested; The test module uses the target server as the backend address to test the frontend page.
9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. A device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.