CN115168212A - Method, device, equipment and computer readable medium for testing software - Google Patents
Method, device, equipment and computer readable medium for testing software Download PDFInfo
- Publication number
- CN115168212A CN115168212A CN202210831923.6A CN202210831923A CN115168212A CN 115168212 A CN115168212 A CN 115168212A CN 202210831923 A CN202210831923 A CN 202210831923A CN 115168212 A CN115168212 A CN 115168212A
- Authority
- CN
- China
- Prior art keywords
- resource file
- code
- source code
- software
- test software
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3692—Test management for test results analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a method, a device, equipment and a computer readable medium for testing software, and relates to the technical field of computers. One embodiment of the method comprises: responding to a successful code submitting message of a client in the distributed version control system, calling 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; according to the production resource codes of the source code resource file, a server production resource file is constructed; 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; and loading the test software by adopting a browser, and feeding back a test result of the test software based on the display content of the browser. The implementation mode can avoid the process of testing the software by human intervention and improve the software testing efficiency.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a computer readable medium for testing software.
Background
With the continuous development of front-end development technology and the continuous popularization of HTML5 technology, the webpage requirements of a browser end are increased day by day, and when the webpage requirements are met through rapid iterative development, resource server deployment every time is not needed, and online and testing are executed.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art: the software testing process is intervened manually, so that the software testing efficiency is low.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, an apparatus, a device, and a computer readable medium for testing software, which can avoid human intervention in a software testing process, and improve software testing efficiency.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of testing software, including:
responding to a successful code submitting message of a client in the distributed version control system, calling 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;
according to the production resource codes of the source code resource file, a server production resource file is constructed;
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;
and loading the test software by adopting a browser, and feeding back a test result of the test software based on the display content of the browser.
Before the responding to the successful message of the code submitted by the client in the distributed version control system, the method further comprises the following steps:
associating the test software with the distributed version control system, the distributed version control system receiving the test software.
The constructing a server side production resource file according to the production resource code of the source code resource file comprises the following steps:
and installing the production resource file corresponding to the production resource code according to the production resource code of the source code resource file so as to construct a production resource file of the server.
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, and the method comprises the following steps:
based on the version identification of the source code resource file, a historical code resource file is appointed in a server;
adopting a browsing simulator to respectively combine the source code resource file and the appointed historical source code resource file to obtain a code snapshot of the source code resource file and a code snapshot of the historical source code resource file;
and 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.
The designated historical code resource file comprises the historical code resource file which is most recent to the version identification.
The loading the test software by adopting the browser and feeding back the test result of the test software based on the display content of the browser comprise:
and executing the test software by adopting a browser, and feeding back a test result of the test software based on the display content of a browser rendering page, wherein the rendering page is a specified page in the source code resource file.
The loading the test software by adopting the browser and feeding back the test result of the test software based on the display content of the browser comprise:
loading the test software by adopting a browser, and failing to render and display content based on the browser;
and redirecting the loading request of the browser to a backup server, and feeding back the test result of the test software by reloading the test software in the backup server.
According to a second aspect of the embodiments of the present invention, there is provided an apparatus for testing software, including:
the system comprises a receiving module, a code generating module and a code analyzing module, wherein the receiving module is used for responding to a code success message submitted by a client in the distributed version control system, calling a controller to receive test software through a network application programming interface, and the test software comprises a client production resource file and a source code resource file;
the construction module is used for constructing a server production resource file according to the production resource code of the source code resource file;
the determining module is used for determining that the client side production resource file is consistent with the server side 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;
and the feedback module is used for loading the test software by adopting a browser and feeding back a test result of the test software based on the display content of the browser.
According to a third aspect of embodiments of the present invention, there is provided an electronic device for testing software, including:
one or more processors;
a storage device to store one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method as described above.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method as described above.
One embodiment of the above invention has the following advantages or benefits: responding to a successful code submitting message of a client in the distributed version control system, calling 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; according to the production resource codes of the source code resource file, a server production resource file is constructed; 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; and loading the test software by adopting a browser, and feeding back a test result of the test software based on the display content of the browser. And judging that the production environments are the same by comparing the production resource files, comparing the code snapshots to ensure that the existing codes are consistent, and loading test software by using a browser to feed back a test result. The process is automatically executed, manual intervention is not needed, and therefore software testing efficiency is improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic flow chart of the main flow of a method of testing software according to an embodiment of the invention;
FIG. 2 is a schematic flow diagram of a code snapshot comparing source code resource files, according to an embodiment of the invention;
FIG. 3 is a flowchart illustrating a test result of the browser-based display content feedback test software according to an embodiment of the present invention;
FIG. 4 is a flow diagram illustrating a method of executing test software according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of the main structure of an apparatus for testing software according to an embodiment of the present invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 7 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The existing software deployment scheme comprises: the service logic is compiled into html codes, manually and locally constructed and packaged, uploaded to a pre-sending environment, deployed by a back-end server, and tested aiming at the function points. The following disadvantages exist according to the above deployment scheme:
the method has the following advantages that 1, each deployment needs to upload a dist deployment package, the dependency environment of each developer is different, and the constructed resource packages may be different.
And 2, frequent manpower input is used for testing functional points, all pages cannot be comprehensively tested, and partial code modification may cause other dependent modules to report errors.
In conclusion, the software testing efficiency is low due to the fact that the software testing process is manually intervened.
In order to solve the problem of low software testing efficiency, the following technical scheme in the embodiment of the invention can be adopted.
Referring to fig. 1, fig. 1 is a schematic view of a main flow of a method for testing software according to an embodiment of the present invention, which judges that production environments are the same by comparing production resource files, compares code snapshots to ensure that existing codes are consistent, and loads test software using a browser to feed back a test result. As shown in fig. 1, the method specifically comprises the following steps:
s101, responding to a code success message submitted by a client in the distributed version control system, calling 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.
In the embodiment of the invention, the software developer can upload the test software through the client. Specifically, in the client, the user creates an html project, and then generates test software for the html project.
As one example, html items are created using front-end domain tools such as VueCli. Such as: inputting project names, automatically generating file resources such as js and vue folders by VueCli, and automatically installing dependency packages required by projects. And normally writing service logic, and constructing a production environment code to generate a dist file resource package. Wherein, the dist file resource package is the client side production resource file.
At the client, a distributed version control system (git) init script is used in association with git. Such as: git hidden folders and other related configurations are generated in the project root directory. With the above configuration, the association of the git init script with git is realized. To upload the test software into git. That is, test software is associated with git, which receives the test software.
And the server is used for testing the software relative to the client. It is understood that the server is the execution subject of each step of the test software. Specifically, the server creates a back-end service. As an example, the server creates a back-end service using node. Js is a JavaScript running environment based on Chrome V8 engine, using an event-driven, non-blocking I/O model.
The client is listened to through the git warehouse service webhook. Therefore, when the client is monitored to upload the test software, the WebHooksController can be called to receive the test software through a web application programming interface (WebAPI) in response to the successful code submission message of the client in git. Wherein the WebAPI is sent by gitwebhook.
In an embodiment of the present invention, 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 for generating the html page. As an example, the test software is noted release v1.0. It will be appreciated that the test software is marked with a version identification. Such as: v1.0, v2.0. The larger the number of the version identification, the newer the version is.
S102, according to the production resource codes of the source code resource files, the server production resource files are constructed.
After receiving the test software, the server needs to construct a production resource file in order to determine the production environment of the test software.
Specifically, the information is received in the controller through the WebAPI, and whether the information is "release vXX" information is analyzed, and the test software is generally identified by release vXX. And after the test software is determined to be received, the server side constructs a server side production resource file according to the production resource code of the source code resource file.
In one embodiment of the invention, the source code resource file includes production resource code. The production resource code is used to identify a version of the production resource file. And installing the production resource file corresponding to the production resource code at the server to realize the construction of the production resource file of the server. Namely, according to the production resource code of the source code resource file, the production resource file corresponding to the production resource code is installed to construct the server production resource file.
As one example, at the server side, based on the production resource code, a server side installation dependency is made to build a generate server dist resource package. Wherein, the server dist resource packet is the server production resource file.
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.
In the embodiment of the invention, in order to improve the accuracy of the test software, the production resource file and the source code resource file need to be compared respectively.
The purpose of comparing production resource files is to: the accuracy of the production environment of the test software is guaranteed. In the process of actually applying the test software, the situation that the test software fails due to the difference of the production environment is easy to occur. Specifically, a production environment of vc5.0 is adopted at the client; and a production environment of vc6.0 is adopted at the service end. Due to different production environments, it is necessary to cause the test software to fail.
Therefore, in the embodiment of the invention, the production environment is compared by comparing the production resource files. And comparing the code snapshot under the condition that the production environment is consistent.
In the embodiment of the invention, if the client side production resource file is determined to be inconsistent with the server side production resource file, the production environment of the client side is different from that of the server side, and the test software fails; and if the client production resource file is consistent with the server production resource file, indicating that the production environment of the client is the same as that of the server, and continuing to compare the code snapshots.
Referring to fig. 2, fig. 2 is a schematic flowchart of comparing a code snapshot of a source code resource file according to an embodiment of the present invention. The method specifically comprises the following steps:
the purpose of comparing the code snapshot of the source code resource file is to: the accuracy of the historical codes in the test software is guaranteed.
S201, based on the version identification of the source code resource file, a history code resource file is specified in the server.
In an embodiment of the invention, the source code resource file is marked with a version identification. As an example, the version identification of the source code resource file is V1.1, the version identification of the source code resource file is V1.2, and so on. Wherein, the larger the number of the version mark identification, the newer the corresponding version. Such as: the version of V1.2 is an updated version of V1.1.
In each process of testing the software, the server needs to store the testing software. It will be appreciated that the server stores multiple versions of the test software. As an example, the server stores three versions of test software V1.0, V1.1 and V1.2.
Compared with the version of the existing source code resource file, the purpose of the current test software is to test whether the new code of the current version runs normally, and the historical code of which the current version is the same as the original version is tested in a code snapshot mode.
Therefore, the historical code resource file is specified in the server side based on the version identification of the source code resource file, and therefore the same code in the source code resource file as the specified historical code resource file is tested in a code snapshot mode. In this way, the code snapshot of the source code resource file is compared to the code snapshot of the specified historical source code resource.
In one embodiment of the invention, the designated historical code resource file includes the historical code resource file most recent to the version identification. The most recent history code resource file with the version identification is the least different from the source code resource file, and the code number of the code snapshot is increased so as to improve the testing efficiency.
S202, a browsing simulator is adopted, and a code snapshot of the source code resource file and a code snapshot of the historical source code resource file are obtained by respectively combining the source code resource file and the specified historical source code resource file.
Aiming at the source code resource file, a code snapshot of the source code resource file is obtained by adopting a browsing simulator; and aiming at the appointed historical source code resource file, acquiring a code snapshot of the historical source code resource file by adopting a browsing simulator.
The code snapshot includes the contents of the source code resource file. As one example, the contents of the source code resource file include code that executes software.
As one example, the browsing simulator includes Puppeteer. puppieeer is a node. Js package used to simulate the operation of a Chrome browser. And at the server, a Puppeneer browsing simulator is preset and configured.
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.
And under the condition 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, the code in the source code resource file, which is the same as the code in the specified historical code resource file, passes the test. As an example, puppeteeer determines 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 should be noted that, in the following case, it can be directly determined that the test software fails. And determining that the client side production resource file is different from the server side production resource file. And 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 different from the code snapshot of the historical source code resource file.
In the embodiment of fig. 2, a browsing simulator is used to implement code snapshot comparison of the source code resource file, and implement test of the same code in the source code resource file as the specified historical code resource file.
And S104, loading the test software by adopting the browser, and feeding back a test result of the test software based on the display content of the browser.
In an embodiment of the invention, the test software is used to display html pages. Therefore, the browser can be used for loading the testing software, and the testing result of the testing software is fed back based on the display content of the browser.
In the embodiment of the invention, aiming at the specified page, the browser is adopted to display the display content of the specified service so as to determine the test software. Specifically, the browser is adopted to execute the testing software, and the testing result of the testing software is fed back based on the display content of the browser rendering page, wherein the rendering page is a specified page in the source code resource file.
As an example, if the display content in the rendered page is consistent with the display content in the designated page, the test result fed back to the test software is a pass test; correspondingly, if the display content in the rendered page is different from the display content in the designated page, the test result fed back by the test software is a failed test. Unlike the display content in the designated page, the method includes: an error is displayed 404.
It will be appreciated that by displaying a specified page, the test results can be determined directly.
Referring to fig. 3, fig. 3 is a schematic flowchart of a test result of the browser-based display content feedback test software according to an embodiment of the present invention. The method specifically comprises the following steps:
s301, loading test software by adopting a browser, and failing to render and display content based on the browser.
And loading the test software by adopting the browser, and failing to render and display the content based on the browser. There are several reasons why rendering display content by a browser fails: production server failure or test software errors, etc.
In order to avoid the failure of the test software caused by the failure of the server, the software can be tested by the backup server.
S302, redirecting the loading request of the browser to a backup server, and feeding back the test result of the test software by loading the test software in the backup server again.
The backup server is preset, and can be understood as a disaster recovery server. And redirecting the loading request of the browser to the backup server, and feeding back the test result of the test software by reloading the test software in the backup server. The display content of the page in the test software can be normally displayed through the backup server, and the test result of the test software is a pass test; correspondingly, the display content of the page in the test software cannot be normally displayed through the backup server, and the test result of the test software is a failed test.
As an example, a site represents a production environment for a production server and b site represents a disaster recovery environment for a backup server.
And (3) accessing the website a by adopting the browser, namely, directing a loading request of the browser to the production server, loading the test software, and failing to render and display the content based on the browser. And redirecting the loading request of the browser to a backup server, loading the test software again through the b-site, and feeding back the test result of the test software.
In the embodiment of the present invention, in response to a successful code submission message from a client in a distributed version control system, a controller is called to receive test software through a network application programming interface, where the test software includes a client production resource file and a source code resource file; according to the production resource codes of the source code resource file, a server production resource file is constructed; 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; and loading the test software by adopting a browser, and feeding back a test result of the test software based on the display content of the browser. And judging that the production environments are the same by comparing the production resource files, comparing the code snapshots to ensure that the existing codes are consistent, and loading test software by using a browser to feed back a test result. The process is automatically executed, manual intervention is not needed, and therefore software testing efficiency is improved.
Referring to fig. 4, fig. 4 is a flowchart illustrating a method for executing test software according to an embodiment of the present invention. The method specifically comprises the following steps:
s401, a developer creates test software at a client.
The software developer can upload the test software through the client. Specifically, in the client, the user creates an html project, and then generates test software for the html project.
S402, uploading the test software to a distributed version control system.
At the client, the test software is associated with git, which receives the uploaded test software.
And S403, monitoring that the client uploads test software.
And monitoring the client by adopting webhook. Thus, in response to the client submitting the code success message in git, the client can be monitored to verify that the client has uploaded the test software,
s404, establishing a server production resource file.
After receiving the test software, the server needs to construct a production resource file in order to determine the production environment of the test software.
S405, determining that the client side production resource file is consistent with the server side production resource file.
And if the client side production resource file is consistent with the server side production resource file, indicating that the production environments of the client side and the server side are the same. And if the client side production resource file is different from the server side production resource file, the test software fails.
S406, determining that the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file.
Determining that the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file, and continuing to adopt browser test software; and determining that the code snapshot of the source code resource file is different from the code snapshot of the historical source code resource file, and failing to test the software.
S407, rendering the display content of the test software through the production server is successful.
And if the display content of the test software rendered by the production server is successful, the test result is a pass test. And if the display content of the test software is not rendered through the production server, redirecting the loading request of the browser to the backup server.
S408, rendering the display content of the test software through the backup server is successful.
And if the display content of the test software rendered by the backup server is successful, the test result is a pass test. And if the display content of the rendering test software fails through the backup server, the test result is a failed test.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a device for testing software according to an embodiment of the present invention, where the device for testing software can implement a method for testing software, and as shown in fig. 5, the device for testing software specifically includes:
a receiving module 501, configured to respond to a successful code submission message from a client in the distributed version control system, call a controller to receive test software through a network application programming interface, where the test software includes a client production resource file and a source code resource file;
a building module 502, configured to build a server production resource file according to the production resource code of the source code resource file;
a determining module 503, configured to determine 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;
a feedback module 504, 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.
In an embodiment of the present invention, 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.
In an embodiment of the present invention, the building module 502 is specifically configured to install, according to a production resource code of the source code resource file, a production resource file corresponding to the production resource code, so as to build a server production resource file.
In an embodiment of the present invention, the determining module 503 is specifically configured to specify a historical code resource file in the server based on the version identifier of the source code resource file;
adopting a browsing simulator to respectively combine the source code resource file and the appointed historical source code resource file to obtain a code snapshot of the source code resource file and a code snapshot of the historical source code resource file;
and 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.
In one embodiment of the invention, the designated historical code resource file comprises the historical code resource file most recent to the version identification.
In an embodiment of the present invention, 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, where the rendered page is a specified page in the source code resource file.
In an embodiment of the present invention, the feedback module 504 is specifically configured to load the test software by using a browser, and render and display content based on the browser fails;
and redirecting the loading request of the browser to a backup server, and feeding back the test result of the test software by reloading the test software in the backup server.
Fig. 6 illustrates an exemplary system architecture 600 of a method of testing software or an apparatus for testing software to which embodiments of the present invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves as a medium for providing communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with a server 605, via a network 604, to receive or send messages or the like. The terminal devices 601, 602, 603 may have various messaging client applications installed thereon, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 601, 602, 603. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for testing software provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the device for testing software is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. 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 magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer-readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present invention, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a receiving module, a constructing module, a determining module, and a feedback module. Where the names of these modules do not constitute a limitation on the modules themselves in some cases, for example, a receiving module may also be described as "for invoking a controller to receive test software via a web application programming interface in response to a client submitting a code success message in a distributed version control system".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not assembled into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
responding to a successful code submitting message of a client in the distributed version control system, calling 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;
according to the production resource codes of the source code resource file, a server production resource file is constructed;
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;
and loading the test software by adopting a browser, and feeding back a test result of the test software based on the display content of the browser.
According to the technical scheme of the embodiment of the invention, in response to a successful code submitting message of a client in the distributed version control system, a controller is called 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; according to the production resource codes of the source code resource file, a server production resource file is constructed; 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; and loading the test software by adopting a browser, and feeding back a test result of the test software based on the display content of the browser. And judging that the production environments are the same by comparing the production resource files, comparing the code snapshots to ensure that the existing codes are consistent, and loading test software by using a browser to feed back a test result. The process is automatically executed, manual intervention is not needed, and therefore software testing efficiency is improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. A method of testing software, comprising:
responding to a successful code submitting message of a client in the distributed version control system, calling 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;
according to the production resource codes of the source code resource file, a server production resource file is constructed;
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;
and loading the test software by adopting a browser, and feeding back a test result of the test software based on the display content of the browser.
2. The method for testing software according to claim 1, wherein before the responding to the client submitting the code success message in the distributed version control system, further comprising:
associating the test software with the distributed version control system, the distributed version control system receiving the test software.
3. The method for testing software according to claim 1, wherein the constructing a server-side production resource file according to the production resource code of the source code resource file comprises:
and installing the production resource file corresponding to the production resource code according to the production resource code of the source code resource file so as to construct a production resource file of the server.
4. The method for testing software according to claim 1, wherein 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, comprising:
based on the version identification of the source code resource file, a historical code resource file is appointed in a server;
acquiring a code snapshot of the source code resource file and a code snapshot of the historical source code resource file by adopting a browsing simulator and respectively combining the source code resource file and the appointed historical source code resource file;
and 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.
5. The method for testing software according to claim 4, wherein said designated historical code resource file comprises the historical code resource file most recent to said version identification.
6. The method for testing software according to claim 1, wherein the loading the testing software by using a browser and feeding back the testing result of the testing software based on the display content of the browser comprises:
and executing the test software by adopting a browser, and feeding back a test result of the test software based on the display content of a browser rendering page, wherein the rendering page is a specified page in the source code resource file.
7. The method for testing software according to claim 1, wherein the loading the test software by using a browser and feeding back the test result of the test software based on the display content of the browser comprises:
loading the test software by adopting a browser, and failing to render and display content based on the browser;
and redirecting the loading request of the browser to a backup server, and feeding back the test result of the test software by reloading the test software in the backup server.
8. An apparatus for testing software, comprising:
the system comprises a receiving module, a code generating module and a code generating module, wherein the receiving module is used for responding to a successful code submitting message of a client in the distributed version control system, calling a controller to receive test software through a network application programming interface, and the test software comprises a client production resource file and a source code resource file;
the construction module is used for constructing a server side production resource file according to the production resource codes of the source code resource file;
the determining module is used for determining that the client side production resource file is consistent with the server side 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;
and the feedback module is used for loading the test software by adopting a browser and feeding back a test result of the test software based on the display content of the browser.
9. An electronic device for testing software, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210831923.6A CN115168212A (en) | 2022-07-14 | 2022-07-14 | Method, device, equipment and computer readable medium for testing software |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210831923.6A CN115168212A (en) | 2022-07-14 | 2022-07-14 | Method, device, equipment and computer readable medium for testing software |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115168212A true CN115168212A (en) | 2022-10-11 |
Family
ID=83495140
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210831923.6A Pending CN115168212A (en) | 2022-07-14 | 2022-07-14 | Method, device, equipment and computer readable medium for testing software |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115168212A (en) |
-
2022
- 2022-07-14 CN CN202210831923.6A patent/CN115168212A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109002389B (en) | Method and device for automatically testing page | |
CN110888639A (en) | Business code compiling and packaging method and device | |
CN113760729A (en) | Code detection method and device | |
CN114237651A (en) | Installation method and device of cloud native application, electronic equipment and medium | |
CN113900834A (en) | Data processing method, device, equipment and storage medium based on Internet of things technology | |
CN112559024A (en) | Method and device for generating transaction code change list | |
CN110716956A (en) | Data request intercepting method and device | |
CN111783005A (en) | Method, apparatus and system for displaying web page, computer system and medium | |
CN111158654A (en) | Algorithm calling method, device, server and storage medium | |
CN112947919A (en) | Method and device for constructing service model and processing service request | |
CN113297081A (en) | Execution method and device of continuous integration assembly line | |
CN112579447A (en) | Browser testing method and device | |
CN110825622A (en) | Software testing method, device, equipment and computer readable medium | |
CN111382953A (en) | Dynamic process generation method and device | |
CN112131095A (en) | Pressure testing method and device | |
CN115168212A (en) | Method, device, equipment and computer readable medium for testing software | |
CN112783903B (en) | Method and device for generating update log | |
CN113312900A (en) | Data verification method and device | |
CN112306723B (en) | Operation information acquisition method and device applied to applet | |
CN113132447A (en) | Reverse proxy method and system | |
CN112835609A (en) | Method and device for modifying dependent package download address | |
CN112799797A (en) | Task management method and device | |
CN111290870A (en) | Method and device for detecting abnormity | |
CN113031960B (en) | Code compiling method, device, server and storage medium | |
CN118069539B (en) | Data processing method, device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |