Methods, apparatus, devices, and computer readable media for testing software
By combining a distributed version control system and a browser simulator, the production environment and code snapshots of the automated testing software solve the problem of low testing efficiency caused by human intervention and realize a highly efficient automated testing process.
Patent Information
- Application Number
- CN202210831923.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-14
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2042-07-14
AI Technical Summary
In existing technologies, human intervention in the software testing process leads to low software testing efficiency.
The system receives test software through a distributed version control system, builds server-side production resource files, compares code snapshots using a browser simulator, and automatically executes test results feedback, avoiding manual intervention.
It achieves an automated testing process that requires no manual intervention, thus improving software testing efficiency.
Smart Images

Figure CN115168212B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and in particular, to a method and device for testing software, and a computer readable medium. BACKGROUND
[0002] With the continuous development of front-end development technology and the continuous popularization of HTML5 technology, the demand for web pages on the browser side is increasing. Rapid iteration development to meet the demand for web pages cannot be separated from each deployment of resource servers, execution of online and testing.
[0003] In the process of implementing the present application, the inventors have found that at least the following problems exist in the prior art: human intervention in the process of testing software, resulting in low software testing efficiency. SUMMARY
[0004] Therefore, the embodiments of the present application provide a method and device for testing software, and a computer readable medium, which can avoid human intervention in the process of testing software and improve the software testing efficiency.
[0005] To achieve the above object, according to one aspect of the embodiments of the present application, a method for testing software is provided, comprising:
[0006] In response to a client code submission success message in a distributed version control system, a controller is called to receive testing software through a network application programming interface, wherein the testing software comprises a client production resource file and a source code resource file;
[0007] According to production resource code of the source code resource file, a server production resource file is constructed;
[0008] It is determined that the client production resource file is consistent with the server production resource file, and a code snapshot of the source code resource file is consistent with a code snapshot of a historical source code resource file;
[0009] The testing software is loaded by a browser, and a test result of the testing software is fed back based on display content of the browser.
[0010] Before the response to the client code submission success message in the distributed version control system, the method further comprises:
[0011] The testing software is associated with the distributed version control system, and the distributed version control system receives the testing software.
[0012] The construction of the server production resource file according to the production resource code of the source code resource file comprises:
[0013] According to the production resource code of the source code resource file, a production resource file corresponding to the production resource code is installed to build a server-side production resource file.
[0014] The code snapshot of the source code resource file is consistent with a code snapshot of a historical source code resource file in the server, and the code snapshot of the source code resource file comprises:
[0015] The historical code resource file is specified in the server based on the version identifier of the source code resource file.
[0016] A browser simulator is used to obtain the code snapshot of the source code resource file and the code snapshot of the specified historical source code resource file by combining the source code resource file and the specified historical source code resource file.
[0017] The code snapshot of the source code resource file is determined to be consistent with the code snapshot of the historical source code resource file in the server.
[0018] The specified historical code resource file comprises a historical code resource file closest to the version identifier.
[0019] The test software is loaded by using the browser, and a test result of the test software is fed back based on display content of the browser, and the test result of the test software comprises:
[0020] The test software is executed by using the browser, and a test result of the test software is fed back based on display content of a rendered page of the browser, and the rendered page is a specified page in the source code resource file.
[0021] The test software is loaded by using the browser, and a test result of the test software is fed back based on display content of the browser, and the test result of the test software comprises:
[0022] The test software is loaded by using the browser, and rendering display content based on the browser fails.
[0023] The loading request of the browser is redirected to a backup server, and a test result of the test software is fed back by loading the test software again in the backup server.
[0024] According to a second aspect of an embodiment of the application, a device for testing software is provided, and the device comprises:
[0025] A receiving module is configured to, in response to a client-side code submission success message in a distributed version control system, invoke a controller to receive test software through a network application programming interface, and the test software comprises a client-side production resource file and a source code resource file.
[0026] The constructing module is configured to construct a server-side production resource file according to production resource code of the source code resource file.
[0027] The determining module is configured to determine that the client-side production resource file is consistent with the server-side production resource file, and that a code snapshot of the source code resource file is consistent with a code snapshot of a historical source code resource file.
[0028] The feedback module is configured to load the test software by using a browser, and feed back a test result of the test software based on display content of the browser.
[0029] According to a third aspect of an embodiment of the present application, an electronic device for testing software is provided, comprising:
[0030] one or more processors;
[0031] a storage device configured to store one or more programs,
[0032] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0033] According to a fourth aspect of an embodiment of the present application, a computer readable medium is provided, which stores a computer program, and the program is executed by a processor to implement the method as described above.
[0034] One embodiment of the above application has the following advantages or beneficial effects: in response to a client-side code submission success message in a distributed version control system, a controller is called to receive test software through a network application programming interface, the test software comprising a client-side production resource file and a source code resource file; a server-side production resource file is constructed according to production resource code of the source code resource file; it is determined that the client-side production resource file is consistent with the server-side production resource file, and that a code snapshot of the source code resource file is consistent with a code snapshot of a historical source code resource file; the test software is loaded by using a browser, and a test result of the test software is fed back based on display content of the browser. By comparing production resource files to determine that the production environments are the same, and by comparing code snapshots to ensure that the existing code is consistent, the test software is loaded by using a browser to feed back the test result. The above process is automatically executed without human intervention, thereby improving software testing efficiency.
[0035] Further effects of the above non-conventional optional mode will be described in the following combined with specific embodiments. BRIEF DESCRIPTION OF DRAWINGS
[0036] The accompanying drawings are used to better understand the present application, and do not constitute an improper limitation on the present application. Among them:
[0037] Figure 1 is a main flowchart of a method of testing software according to an embodiment of the present application;
[0038] Figure 2 is a flowchart of comparing a code snapshot of a source code resource file according to an embodiment of the present application;
[0039] Figure 3 is a flowchart of displaying a test result of browser-based content feedback test software according to an embodiment of the present application;
[0040] Figure 4 is a flowchart of a method of executing test software according to an embodiment of the present application;
[0041] Figure 5 is a main structure diagram of an apparatus of testing software according to an embodiment of the present application;
[0042] Figure 6 is an exemplary system architecture diagram to which embodiments of the present application can be applied;
[0043] Figure 7 is a structure diagram of a computer system of a terminal device or a server suitable for implementing embodiments of the present application. DETAILED DESCRIPTION
[0044] Exemplary embodiments of the present application are described herein with reference to the accompanying drawings, in which various details of the embodiments of the present application are set forth to assist in the understanding of the present application. It should be appreciated that the embodiments of the present application can be practiced with variations of these details as would be known to those of ordinary skill in the art without departing from the scope and spirit of the present application. In addition, it should be noted that the description of the embodiments of the present application is not intended to limit the present application to the described embodiments, but rather, the described embodiments are intended to be exemplary of the present application. Accordingly, the description of the embodiments of the present application is intended to be illustrative, but not to limit the scope of the present application.
[0045] The deployment scheme of the existing software includes: business logic is written as html code, manual local construction package is uploaded to the pre-release environment, the backend server is deployed, and the function point test is carried out. The above deployment scheme has the following disadvantages:
[0046] Disadvantage 1: The dist deployment package needs to be uploaded every time the deployment is carried out, and the dependent environment of each developer is different, and the resource package constructed may also be different.
[0047] Disadvantage 2: Frequent manpower is invested to test the function points, and it is impossible to achieve comprehensive testing of all pages, and part of the modified code may cause error of other dependent modules.
[0048] In summary, due to the human intervention in the test software process, the software test efficiency is low.
[0049] To address the issue of low software testing efficiency, the following technical solutions from the embodiments of the present invention can be adopted.
[0050] See Figure 1 , Figure 1 This is a schematic diagram of the main flow of a testing software method according to an embodiment of the present invention. It determines whether the production environment is the same by comparing production resource files and ensures consistency of existing code by comparing code snapshots. Then, a browser loads the testing software to provide test results. Figure 1 As shown, the specific steps include:
[0051] S101. In response to a successful code submission message from a client in a distributed version control system, the controller is invoked to receive test software via a network application programming interface. The test software includes client-generated resource files and source code resource files.
[0052] In this embodiment of the invention, software developers can upload test software through a client. Specifically, in the client, the user creates an HTML project, which in turn generates the test software for that HTML project.
[0053] As an example, we'll use front-end tools like Vue CLI to create an HTML project. For instance, by entering a project name, Vue CLI automatically generates files and resources such as .js and vue folders, and automatically installs the necessary dependencies. We then write the business logic and build the production environment code to generate the dist file resource package. This dist file resource package represents the client-side production resource files.
[0054] On the client side, the distributed version control system (git) is associated with the `git init` script. This includes configurations such as creating a hidden `.git` folder in the project root directory. Using these configurations, the `git init` script is associated with git, allowing test software to be uploaded to git. In other words, the test software is associated with git, and git receives the test software.
[0055] In contrast to the client, the server is used for testing the software. It's understandable that the server is the main entity executing each step of the software testing process. Specifically, the server creates the backend service. As an example, the server uses Node.js to create the backend service. Node.js is a JavaScript runtime environment based on the Chrome V8 engine, using an event-driven, non-blocking I / O model.
[0056] The client is listened to by a git repository service webhook. Thus, after the client uploads the test software, the controller WebHooksController can be called to receive the test software through a web application programming interface (WebAPI) in response to a client code submission success message in the git, wherein the WebAPI is sent by the git webhook.
[0057] In an embodiment of the present application, the test software specifically includes a client production resource file and a source code resource file. The client production resource file represents the production environment of the test software. The source code resource file is used to generate an html page. As an example, the test software is noted as release v1.0. It can be understood that the test software is marked with a version identifier. For example, v1.0, v2.0. The larger the number of the version identifier, the newer the version.
[0058] S102, constructing a server production resource file according to production resource code of the source code resource file.
[0059] After the server receives the test software, in order to determine the production environment of the test software, it is necessary to construct a production resource file on the server.
[0060] Specifically, the information is received through the WebAPI in the controller, and it is analyzed whether it is “release vXX” information. The test software is usually marked with release vXX. After it is determined that the test software is received, the server constructs a server production resource file according to the production resource code of the source code resource file.
[0061] In an embodiment of the present application, the source code resource file includes production resource code. The production resource code is used to identify the version of the production resource file. The production resource file corresponding to the production resource code is installed on the server to realize the construction of the server production resource file. That is, the production resource file corresponding to the production resource code is installed according to the production resource code of the source code resource file to construct the server production resource file.
[0062] As an example, the server installs dependencies based on the production resource code to construct a server dist resource package. The server dist resource package is the server production resource file.
[0063] S103, determining that the client production resource file is consistent with the server production resource file, and the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file.
[0064] In an embodiment of the present application, in order to improve the accuracy of the test software, it is necessary to compare the production resource file and the source code resource file respectively. The purpose of comparing the production resource files is to ensure the accuracy of the production environment of the test software.
[0065] In actual application of the test software, the test software is prone to failure due to the difference between the production environments.
[0066] Therefore, in the embodiment of the application, the production environments are compared by comparing the production resource files.
[0067] In the embodiment of the application, when it is determined that the production resource files of the client and the server are inconsistent, it is indicated that the production environments of the client and the server are different, and the test software fails.
[0068] Referring to Figure 2 , Figure 2 is a flowchart of comparing the code snapshots of the source code resource files according to the embodiment of the application.
[0069] The purpose of comparing the code snapshots of the source code resource files is to ensure the accuracy of the historical codes in the test software.
[0070] S201, based on the version identifier of the source code resource file, the historical code resource file is specified in the server.
[0071] In the embodiment of the application, the source code resource file is marked with a version identifier. As an example, the version identifier of the source code resource file is V1.1, the version identifier of the source code resource file is V1.2, and the like. Among them, the larger the number of the version identifier is, the newer the corresponding version is. For example, the version of V1.2 is an updated version of V1.1.
[0072] In each test software process, the server needs to store the test software. It can be understood that the server stores multiple versions of the test software. As an example, the server stores test software V1.0, V1.1 and V1.2.
[0073] Compared with the version of the existing source code resource file, the purpose of the current test software is to test whether the newly added code of the current version is normally operated, and the historical code which is the same as the current version and the original version is tested by using the code snapshot method.
[0074] Therefore, based on the version identification of the source code resource file, the historical code resource file is specified in the server, so that the code snapshot is used for testing the same code in the source code resource file as the specified historical code resource file. In this way, the code snapshot of the source code resource file and the code snapshot of the specified historical source code resource are compared.
[0075] In an embodiment of the present application, the specified historical code resource file includes the historical code resource file closest to the version identification. The historical code resource file closest to the version identification has the smallest difference from the source code resource file, increases the code quantity of the code snapshot, and improves the testing efficiency.
[0076] S202, using a browsing simulator, respectively combining the source code resource file and the specified historical source code resource file, obtaining the code snapshot of the source code resource file and the code snapshot of the historical source code resource file.
[0077] For the source code resource file, the browsing simulator is used to obtain the code snapshot of the source code resource file; and for the specified historical source code resource file, the browsing simulator is used to obtain the code snapshot of the historical source code resource file.
[0078] The code snapshot includes the content of the source code resource file. As an example, the content of the source code resource file includes the code for executing the software.
[0079] As an example, the browsing simulator includes Puppeteer. Puppeteer is a Node.js package for simulating the operation of a Chrome browser. In the server, Puppeteer browsing simulator is preset.
[0080] S203, determining that the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file in the server.
[0081] In the case where it is determined that the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file in the server, it is indicated that the same code in the source code resource file as the specified historical code resource file is tested. As an example, Puppeteer is used to determine that the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file in the server.
[0082] It should be noted that in the following cases, it can be directly determined that the testing software fails. It is determined that the client production resource file is different from the server production resource file. And it is determined that the client production resource file is consistent with the server production resource file, and the code snapshot of the source code resource file is different from the code snapshot of the historical source code resource file.
[0083] InFigure 2 In the embodiment of the present application, the code snapshot comparison of the source code resource file is realized by using the browsing simulator, and the same code in the source code resource file as the specified historical code resource file is tested.
[0084] S104, the test software is loaded by using the browser, and the test result of the test software is fed back based on the display content of the browser.
[0085] In the embodiment of the present application, the test software is used to display an html page. Therefore, the test software can be loaded by using the browser, and the test result of the test software is fed back based on the display content of the browser.
[0086] In the embodiment of the present application, the display content of the specified business is displayed by using the browser for the specified page to determine the test software. Specifically, the test software is executed by using the browser, and the test result of the test software is fed back based on the display content of the rendered page in the browser. The rendered page is the specified page in the source code resource file.
[0087] As an example, if the display content in the rendered page is consistent with the display content in the specified page, the test result of the test software is fed back as passing the test; correspondingly, if the display content in the rendered page is different from the display content in the specified page, the test result of the test software is fed back as failing the test. The display content different from the display content in the specified page includes displaying an error 404.
[0088] It can be understood that the test result can be directly determined by displaying the specified page.
[0089] Referring to Figure 3 , Figure 3 is a flowchart of feeding back the test result of the test software based on the display content of the browser according to the embodiment of the present application. Specifically, the following steps are included:
[0090] S301, the test software is loaded by using the browser, and the display content is rendered by the browser.
[0091] The test software is loaded by using the browser, and the display content is rendered by the browser. There are many reasons for the failure of the browser to render the display content, such as production server failure or test software error.
[0092] In order to avoid the failure of the test software caused by the server failure, the test software can also be tested by the backup server.
[0093] S302, the loading request of the browser is redirected to the backup server, the test software is loaded again in the backup server, and the test result of the test software is fed back.
[0094] The backup server can be understood as a disaster recovery server. The loading request of the browser is redirected to the backup server, and the test software is loaded again through the backup server to feed back the test result of the test software. Through the backup server, the display content of the page in the test software can be normally displayed, and the test result of the test software is passed; correspondingly, through the backup server, the display content of the page in the test software cannot be normally displayed, and the test result of the test software is not passed.
[0095] As an example, a website is a production server representing a production environment, and b website is a backup server representing a disaster recovery environment.
[0096] The browser accesses a website, that is, the loading request of the browser is directed to the production server, the test software is loaded, and the display content based on the browser rendering fails. The loading request of the browser is redirected to the backup server, and the test software is loaded again through b website to feed back the test result of the test software.
[0097] In the above embodiment of the application, in response to a client code submission success message in the distributed version control system, the controller receives test software through a network application programming interface, the test software including a client production resource file and a source code resource file; a server production resource file is constructed according to production resource code of the source code resource file; it is determined that the client production resource file is consistent with the server production resource file, and a code snapshot of the source code resource file is consistent with a code snapshot of a historical source code resource file; the test software is loaded by a browser, and the test result of the test software is fed back based on the display content of the browser. By comparing the production resource files to determine that the production environments are the same, and comparing the code snapshots to ensure that the existing codes are consistent, the test software is loaded by the browser to feed back the test result. The above process is automatically executed without human intervention, thereby improving the software testing efficiency.
[0098] Referring to Figure 4 , Figure 4 is a method flow diagram for executing test software according to an embodiment of the application. Specifically, the following steps are included:
[0099] S401, a developer creates test software on a client.
[0100] The software developer can upload the test software through the client. Specifically, in the client, the user creates an html project to generate the test software of the html project.
[0101] S402, upload the test software to a distributed version control system.
[0102] At the client side, the test software is associated with the git, and the git receives the uploaded test software.
[0103] S403, listen to the client has uploaded test software.
[0104] The webhook is used to listen to the client. Thus, when the test software uploaded by the client is listened to, the client can respond to the code submission success message in the git,
[0105] S404, build the production resource file of the server.
[0106] After the server receives the test software, in order to determine the production environment of the test software, the production resource file needs to be built on the server.
[0107] S405, determine that the production resource file of the client is consistent with the production resource file of the server.
[0108] When it is determined that the production resource file of the client is consistent with the production resource file of the server, it indicates that the production environment of the client and the server is the same. When it is determined that the production resource file of the client is different from the production resource file of the server, the test software fails.
[0109] S406, determine that the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file.
[0110] When it is determined that the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file, the browser continues to test the software; when it is determined that the code snapshot of the source code resource file is different from the code snapshot of the historical source code resource file, the test software fails.
[0111] S407, successfully render the display content of the test software through the production server.
[0112] When the display content of the test software is successfully rendered through the production server, the test result is that the test passes. When the display content of the test software is failed to be rendered through the production server, the loading request of the browser is redirected to the backup server.
[0113] S408, successfully render the display content of the test software through the backup server.
[0114] When the display content of the test software is successfully rendered through the backup server, the test result is that the test passes. When the display content of the test software is failed to be rendered through the backup server, the test result is that the test fails.
[0115] Referring to Figure 5 , Figure 5 is the main structure schematic diagram of the test software device according to the embodiment of the application. The test software device can implement the test software method, such as Figure 5As shown, the device for testing software specifically comprises:
[0116] The receiving module 501 is configured to, in response to a client code submission success message in a distributed version control system, invoke a controller to receive test software through a network application programming interface, wherein the test software comprises a client production resource file and a source code resource file;
[0117] The building module 502 is configured to build a server production resource file according to production resource code of the source code resource file;
[0118] The determining module 503 is configured to determine that the client production resource file is consistent with the server production resource file, and that a code snapshot of the source code resource file is consistent with a code snapshot of a historical source code resource file;
[0119] The feedback module 504 is configured to load the test software by using a browser, and feed back a test result of the test software based on display content of the browser.
[0120] In an embodiment of the present application, the receiving module 501 is specifically configured to associate the test software with the distributed version control system, and the distributed version control system receives the test software.
[0121] In an embodiment of the present application, the building module 502 is specifically configured to install a production resource file corresponding to the production resource code of the source code resource file according to the production resource code of the source code resource file, so as to build a server production resource file.
[0122] In an embodiment of the present application, the determining module 503 is specifically configured to specify a historical code resource file in a server based on a version identifier of the source code resource file.
[0123] The source code resource file and the specified historical source code resource file are combined respectively by using a browser simulator, so as to obtain a code snapshot of the source code resource file and a code snapshot of the historical source code resource file.
[0124] It is determined that the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file in the server.
[0125] In an embodiment of the present application, the specified historical code resource file comprises a historical code resource file closest to the version identifier.
[0126] In an embodiment of the present application, the feedback module 504 is specifically configured to execute the test software by using a browser, and feed back a test result of the test software based on display content of a rendered page of the browser, wherein the rendered page is a specified page in the source code resource file.
[0127] In one embodiment of the present application, the feedback module 504 is specifically configured to load the test software by using a browser, and to feed back a test result of the test software based on a failure of the browser to render display content.
[0128] The loading request of the browser is redirected to a backup server, and the test software is loaded again by the backup server to feed back the test result of the test software.
[0129] Figure 6 An exemplary system architecture 600 of the test software method or the test software apparatus to which embodiments of the present application can be applied is shown.
[0130] As shown in Figure 6 The system architecture 600 can include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 is a medium for providing a communication link between the terminal devices 601, 602, 603 and the server 605. The network 604 can include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0131] A user can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 601, 602, 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0132] The terminal devices 601, 602, 603 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.
[0133] The server 605 can be a server providing various services, such as a background management server supporting a shopping website browsed by a user using the terminal devices 601, 602, 603 (only as an example). The background management server can analyze and process received product information query requests and other data, and feed back the processing results (such as target push information, product information - only as examples) to the terminal devices.
[0134] It should be noted that the test software method provided by the embodiments of the present application is generally executed by the server 605, and accordingly, the test software apparatus is generally provided in the server 605.
[0135] It should be understood that Figure 6 the number of terminal devices, networks, and servers in the above description is only illustrative. Any number of terminal devices, networks, and servers can be provided according to implementation needs.
[0136] The following is for reference. Figure 7 It shows a schematic diagram of the structure of a computer system 700 suitable for implementing a terminal device of the present invention. Figure 7 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0137] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 702 or programs loaded from storage section 708 into random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the system 700. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0138] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 710 as needed so that computer programs read from it can be installed into the storage section 708 as needed.
[0139] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 709, and / or installed from removable medium 711. When the computer program is executed by central processing unit (CPU) 701, it performs the functions defined above in the system of this invention.
[0140] It should be noted that the computer-readable medium shown in the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or component. In the present application, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or component. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0141] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment or a part of code containing one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order than that shown in the drawings. For example, two blocks that are shown in succession can actually be executed substantially in parallel, and sometimes in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams or flowcharts, and the combination of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0142] The modules described in the embodiments of the present application can be implemented in the form of software or in the form of hardware. The described modules can also be arranged in a processor, for example, a processor can be described as including a receiving module, a constructing module, a determining module and a feedback module. In some cases, the names of these modules do not constitute a limitation on the modules themselves, for example, the receiving module can also be described as "configured to, in response to a client code submission success message in a distributed version control system, invoke a controller to receive test software through a network application programming interface".
[0143] As another aspect, the present application also provides a computer readable medium, which can be included in the device described in the above embodiments, or can exist independently without being assembled into the device. The computer readable medium carries one or more programs, which, when executed by the device, cause the device to include:
[0144] in response to a client code submission success message in a distributed version control system, invoke a controller to receive test software through a network application programming interface, the test software including a client production resource file and a source code resource file;
[0145] construct a server production resource file according to production resource code of the source code resource file;
[0146] determine that the client production resource file is consistent with the server production resource file, and that a code snapshot of the source code resource file is consistent with a code snapshot of a historical source code resource file;
[0147] load the test software using a browser, and feed back a test result of the test software based on display content of the browser.
[0148] According to the technical solution of the embodiments of the present application, in response to a client code submission success message in a distributed version control system, a controller is invoked to receive test software through a network application programming interface, the test software including a client production resource file and a source code resource file; a server production resource file is constructed according to production resource code of the source code resource file; it is determined that the client production resource file is consistent with the server production resource file, and that a code snapshot of the source code resource file is consistent with a code snapshot of a historical source code resource file; the test software is loaded using a browser, and a test result of the test software is fed back based on display content of the browser. By comparing production resource files to determine that the production environment is the same, and by comparing code snapshots to ensure that the existing code is consistent, the test software is loaded using a browser to feed back the test result. The above process is automatically executed without human intervention, thereby improving the software testing efficiency.
[0149] The foregoing detailed description has set forth various embodiments of the devices and / or processes via the use of specific terminology. However, embodiments thereof can be practiced with the exact description not being set forth but with the same essence; the principles set forth herein can be practiced with plasticity in a manner appropriate to specific implementations. The scope of the disclosure is therefore intended to be on the true spirit and principles of the technology disclosed herein, and further scope can be provided by the appended claims.
Claims
1. A method for testing software, characterized in that, include: In response to a successful code submission message from a client in a distributed version control system, the controller receives test software via a network application programming interface. The test software includes client-generated resource files and source code resource files. Based on the production resource code of the source code resource file, construct the server-side production resource file; the production resource code is used to identify the version of the production resource file. It is determined that the client-side production resource file is consistent with the server-side production resource file, and that the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file; The testing software is loaded using a browser, and the test results are fed back based on the content displayed in the browser.
2. The method for testing software according to claim 1, characterized in that, The response, prior to the client's successful code commit message in the distributed version control system, also includes: The test software is associated with the distributed version control system, which receives the test software.
3. The method for testing software according to claim 1, characterized in that, The step of constructing the server-side production resource file based on the production resource code of the source code resource file includes: Based on the production resource code in the source code resource file, install the production resource file corresponding to the production resource code to build the server-side production resource file.
4. The method for testing software according to claim 1, characterized in that, The code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file on the server, including: Based on the version identifier of the source code resource file, specify the historical code resource file on the server. Using a browser simulator, code snapshots of the source code resource files and the specified historical source code resource files are obtained respectively. Ensure that the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file on the server.
5. The method for testing software according to claim 4, characterized in that, The specified historical code resource file includes the historical code resource file most recently associated with the version identifier.
6. The method for testing software according to claim 1, characterized in that, The process of loading the testing software using a browser and providing feedback on the test results based on the browser's display content includes: The test software is executed using a browser, and the test results are fed back based on the content displayed on the browser-rendered page, where the rendered page is a specified page in the source code resource file.
7. The method for testing software according to claim 1, characterized in that, The process of loading the testing software using a browser and providing feedback on the test results based on the browser's display content includes: The test software was loaded using a browser, and the content was rendered and displayed using the browser. The browser's loading request is redirected to the backup server, where the test software is reloaded and the test results are fed back.
8. An apparatus for testing software, characterized in that, include: The receiving module is used to respond to a successful code submission message from a client in a distributed version control system by calling the controller to receive test software through a network application programming interface. The test software includes client production resource files and source code resource files. The construction module is used to construct a server-side production resource file based on the production resource code of the source code resource file; the production resource code is used to identify the version of the production resource file. The determination module is used to determine that the client-side production resource file is consistent with the server-side production resource file, and that the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file; The feedback module is used to load the testing software using a browser and, based on the content displayed in the browser, provide feedback on the test results of the testing software.
9. An electronic device for testing software, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-7.
10. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-7.
Citation Information
Patent Citations
Front-end engineering construction method and device, electronic equipment and readable storage medium
CN107704234A
Front-end web page loading method based on webpack, storage medium
CN109284472A