CN115168212A - Method, device, equipment and computer readable medium for testing software - Google Patents

Method, device, equipment and computer readable medium for testing software Download PDF

Info

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
server
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
Application number
CN202210831923.6A
Other languages
Chinese (zh)
Inventor
朱志达
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202210831923.6A priority Critical patent/CN115168212A/en
Publication of CN115168212A publication Critical patent/CN115168212A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3692Test 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

测试软件的方法、装置、设备和计算机可读介质Method, apparatus, apparatus and computer readable medium for testing software

技术领域technical field

本发明涉及计算机技术领域,尤其涉及一种测试软件的方法、装置、设备和计算机可读介质。The present invention relates to the field of computer technology, and in particular, to a method, apparatus, device and computer-readable medium for testing software.

背景技术Background technique

随着前端开发技术的不断发展以及HTML5技术的不断普及,浏览器端的网页需求也日益增多,快速迭代开发满足网页需求的同时,离不开每一次资源服务器部署,执行上线和测试。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 also increasing. While rapid iterative development meets the needs of web pages, it is inseparable from each resource server deployment, implementation of online and testing.

在实现本发明过程中,发明人发现现有技术中至少存在如下问题:人为干预测试软件过程,导致软件测试效率较低。During the process of implementing the present invention, the inventor found that there are at least the following problems in the prior art: human intervention in the software testing process results in low software testing efficiency.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明实施例提供一种测试软件的方法、装置、设备和计算机可读介质,能够避免人为干预测试软件过程,提高软件测试效率。In view of this, embodiments of the present invention provide a method, apparatus, device, and computer-readable medium for testing software, which can avoid human intervention in the software testing process and improve software testing efficiency.

为实现上述目的,根据本发明实施例的一个方面,提供了一种测试软件的方法,包括:To achieve the above object, according to an aspect of the embodiments of the present invention, a method for testing software is provided, including:

响应于分布式版本控制系统中客户端提交代码成功消息,调用控制器通过网络应用程序编程接口,接收测试软件,所述测试软件包括客户端生产资源文件和源代码资源文件;In response to the successful message of the client submitting the code in the distributed version control system, the controller is invoked to receive the test software through the network application programming interface, and the test software includes the client production resource file and the source code resource file;

根据所述源代码资源文件的生产资源代码,构建服务端生产资源文件;Build a server-side production resource file according to the 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 the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file;

采用浏览器加载所述测试软件,并基于所述浏览器的显示内容,反馈所述测试软件的测试结果。A browser is used to load the test software, and based on the displayed content of the browser, the test results of the test software are fed back.

所述响应于分布式版本控制系统中客户端提交代码成功消息之前,还包括:Before the response to the client in the distributed version control system submitting the code success message, the method further includes:

将所述测试软件与所述分布式版本控制系统关联,所述分布式版本控制系统接收所述测试软件。The test software is associated with the distributed version control system, which receives the test software.

所述根据所述源代码资源文件的生产资源代码,构建服务端生产资源文件,包括:The construction of the server-side production resource file according to the production resource code of the source code resource file includes:

根据所述源代码资源文件的生产资源代码,安装所述生产资源代码对应的生产资源文件,以构建服务端生产资源文件。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.

所述源代码资源文件的代码快照与服务端中历史源代码资源文件的代码快照一致,包括: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, including:

基于所述源代码资源文件的版本标识,在服务端中指定的历史代码资源文件;Based on the version identifier of the source code resource file, the historical code resource file specified in the server;

采用浏览模拟器,分别结合所述源代码资源文件和所述指定的历史源代码资源文件,获取所述源代码资源文件的代码快照和所述历史源代码资源文件的代码快照;Using a browsing simulator, the source code resource file and the designated historical source code resource file are respectively combined to obtain a code snapshot of the source code resource file and a code snapshot of the historical source code resource file;

确定源代码资源文件的代码快照与服务端中历史源代码资源文件的代码快照一致。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.

所述指定的历史代码资源文件包括与所述版本标识最近的历史代码资源文件。The designated historical code resource file includes a historical code resource file closest to the version identifier.

所述采用浏览器加载所述测试软件,并基于所述浏览器的显示内容,反馈所述测试软件的测试结果,包括:The browser is used to load the test software, and based on the displayed content of the browser, the test results of the test software are fed back, including:

采用浏览器执行所述测试软件,并基于所述浏览器渲染页面的显示内容,反馈所述测试软件的测试结果,所述渲染页面是所述源代码资源文件中的指定页面。A browser is used to execute the test software, and based on the browser to render the displayed content of the page, the test result of the test software is fed back, and the rendered page is a designated page in the source code resource file.

所述采用浏览器加载所述测试软件,并基于所述浏览器的显示内容,反馈所述测试软件的测试结果,包括:The browser is used to load the test software, and based on the displayed content of the browser, the test results of the test software are fed back, including:

采用浏览器加载所述测试软件,并基于所述浏览器渲染显示内容失败;Use a browser to load the test software, and render and display the content based on the browser failure;

将所述浏览器的加载请求重定向至备份服务器,通过所述备份服务器中再次加载所述测试软件,反馈所述测试软件的测试结果。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.

根据本发明实施例的第二方面,提供了一种测试软件的装置,包括:According to a second aspect of the embodiments of the present invention, an apparatus for testing software is provided, including:

接收模块,用于响应于分布式版本控制系统中客户端提交代码成功消息,调用控制器通过网络应用程序编程接口,接收测试软件,所述测试软件包括客户端生产资源文件和源代码资源文件;The receiving module is used for invoking the controller to receive the test software through the network application programming interface in response to the client submitting the code success message in the distributed version control system, and the test software includes the client production resource file and the source code resource file;

构建模块,用于根据所述源代码资源文件的生产资源代码,构建服务端生产资源文件;a building module for constructing a server-side production resource file according to the production resource code of the source code resource file;

确定模块,用于确定所述客户端生产资源文件与所述服务端生产资源文件一致,且所述源代码资源文件的代码快照与历史源代码资源文件的代码快照一致;a determining module, configured to determine 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;

反馈模块,用于采用浏览器加载所述测试软件,并基于所述浏览器的显示内容,反馈所述测试软件的测试结果。The feedback module is used to load the test software by using a browser, and feed back the test results of the test software based on the displayed content of the browser.

根据本发明实施例的第三方面,提供了一种测试软件的电子设备,包括:According to a third aspect of the embodiments of the present invention, an electronic device for testing software is provided, including:

一个或多个处理器;one or more processors;

存储装置,用于存储一个或多个程序,storage means for storing one or more programs,

当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如上述的方法。The 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 the embodiments of the present invention, there is provided a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned method is implemented.

上述发明中的一个实施例具有如下优点或有益效果:响应于分布式版本控制系统中客户端提交代码成功消息,调用控制器通过网络应用程序编程接口,接收测试软件,所述测试软件包括客户端生产资源文件和源代码资源文件;根据所述源代码资源文件的生产资源代码,构建服务端生产资源文件;确定所述客户端生产资源文件与所述服务端生产资源文件一致,且所述源代码资源文件的代码快照与历史源代码资源文件的代码快照一致;采用浏览器加载所述测试软件,并基于所述浏览器的显示内容,反馈所述测试软件的测试结果。通过比较生产资源文件判断生产环境相同,以及比较代码快照保障已有代码一致,再以浏览器加载测试软件,以反馈测试结果。上述过程自动执行,无需人工干预,进而提高软件测试效率。An embodiment of the above invention has the following advantages or beneficial effects: in response to the client in the distributed version control system submitting the code success message, the controller is invoked to receive the test software through the network application programming interface, and the test software includes the client production resource file and source code resource file; build a server production resource file according to the production resource code of the source code resource file; determine that the client production resource file is consistent with the server production resource file, and the source The code snapshot of the code resource file is consistent with the code snapshot of the 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, it is judged that the production environment is the same, and the code snapshots are compared to ensure that the existing code is consistent, and then the test software is loaded in the browser to feedback the test results. The above process is performed automatically without manual intervention, thereby improving the efficiency of software testing.

上述的非惯用的可选方式所具有的进一步效果将在下文中结合具体实施方式加以说明。Further effects of the above non-conventional alternatives will be described below in conjunction with specific embodiments.

附图说明Description of drawings

附图用于更好地理解本发明,不构成对本发明的不当限定。其中:The accompanying drawings are used for better understanding of the present invention and do not constitute an improper limitation of the present invention. in:

图1是根据本发明实施例的测试软件的方法的主要流程示意图;Fig. 1 is the main flow schematic diagram of the method for testing software according to an embodiment of the present invention;

图2是根据本发明实施例的对比源代码资源文件的代码快照的流程示意图;2 is a schematic flowchart of a code snapshot of a comparison source code resource file according to an embodiment of the present invention;

图3是根据本发明实施例的基于浏览器的显示内容反馈测试软件的测试结果的流程示意图;3 is a schematic flowchart of a browser-based display content feedback test result of the test software according to an embodiment of the present invention;

图4是根据本发明实施例的执行测试软件的方法流程示意图;4 is a schematic flowchart of a method for executing test software according to an embodiment of the present invention;

图5是根据本发明实施例的测试软件的装置的主要结构示意图;5 is a schematic diagram of the main structure of an apparatus for testing software according to an embodiment of the present invention;

图6是本发明实施例可以应用于其中的示例性系统架构图;FIG. 6 is an exemplary system architecture diagram to which an embodiment of the present invention may be applied;

图7是适于用来实现本发明实施例的终端设备或服务器的计算机系统的结构示意图。FIG. 7 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.

具体实施方式Detailed ways

以下结合附图对本发明的示范性实施例做出说明,其中包括本发明实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本发明的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, which include various details of the embodiments of the present invention to facilitate understanding and should be considered as exemplary only. 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 from the following description for clarity and conciseness.

现有软件的部署方案包括:业务逻辑编写为html代码,手动本地构建打包,上传到预发环境,后端服务器部署,以及针对功能点测试。按照上述部署方案存在以下缺点:Existing software deployment solutions include: writing business logic as html code, manually building and packaging locally, uploading to the staging environment, deploying on the back-end server, and testing for function points. According to the above deployment scheme, there are the following disadvantages:

缺点1、每次部署都需要上传dist部署包,每个开发者的依赖环境不一样,构建出的资源包也可能不一样。Disadvantage 1. Each deployment needs to upload the dist deployment package. Each developer's dependency environment is different, and the constructed resource package may also be different.

缺点2、频繁的投入人力测试功能点,无法做到所有页面全面测试,部分修改代码可能会导致其他依赖模块报错。Disadvantage 2. Frequent input of manpower to test function points, and it is impossible to fully test all pages. Partial modification of the code may cause errors in other dependent modules.

综上,由于人为干预测试软件过程,导致软件测试效率较低。To sum up, the efficiency of software testing is low due to human intervention in the testing software process.

为了解决软件测试效率较低,可以采用以下本发明实施例中的技术方案。In order to solve the problem of low software testing efficiency, the following technical solutions in the embodiments of the present invention may be adopted.

参见图1,图1是根据本发明实施例的测试软件的方法主要流程示意图,通过比较生产资源文件判断生产环境相同,以及比较代码快照以保障已有代码一致,再采用浏览器加载测试软件,以反馈测试结果。如图1所示,具体包括以下步骤:Referring to FIG. 1, FIG. 1 is a schematic diagram of the main flow of a method for testing software according to an embodiment of the present invention. It is judged that the production environment is the same by comparing the production resource files, and the code snapshots are compared to ensure that the existing codes are consistent, and then the browser is used to load the test software, to provide feedback on test results. As shown in Figure 1, it specifically includes the following steps:

S101、响应于分布式版本控制系统中客户端提交代码成功消息,调用控制器通过网络应用程序编程接口,接收测试软件,所述测试软件包括客户端生产资源文件和源代码资源文件。S101. In response to the successful message of the client submitting the code in the distributed version control system, call the controller to receive the test software through the network application programming interface, where the test software includes the client production resource file and the source code resource file.

在本发明实施例中,软件开发者可以通过客户端上传测试软件。具体来说,在客户端中,用户创建html项目,进而生成html项目的测试软件。In this embodiment of the present 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.

作为一个示例,采用VueCli等前端领域工具创建html项目。如:输入项目名称,VueCli自动生成js和vue文件夹等文件资源,并且自动安装项目所需依赖包。正常编写业务逻辑,构建生产环境代码,以生成dist文件资源包。其中,dist文件资源包即客户端生产资源文件。As an example, use front-end domain tools such as VueCli to create an html project. For example: enter the project name, VueCli automatically generates file resources such as js and vue folders, and automatically installs the dependent packages required by the project. Write business logic normally, build production environment code, and generate dist file resource bundle. Among them, the dist file resource package is the client production resource file.

在客户端,使用分布式版本控制系统(git)init脚本与git关联。如:在项目根目录生成.git隐藏文件夹等相关配置。利用上述配置,实现git init脚本与git关联。以将测试软件上传至git中。即,将测试软件与git关联,git接收测试软件。On the client side, use a distributed version control system (git) init script to associate with git. For example: generate .git hidden folders and other related configurations in the project root directory. Using the above configuration, the git init script is associated with git. to upload the test software to git. That is, associate the test software with git, and git receives the test software.

相对于客户端,服务端用于测试软件。可以理解的是,服务端是测试软件各步骤的执行主体。具体地,服务端创建后端服务。作为一个示例,服务端采用node.js创建后端服务。node.js是一个基于Chrome V8引擎的JavaScript运行环境,使用了一个事件驱动、非阻塞式I/O模型.Compared with the client, the server is used to test the software. It can be understood that the server is the execution body of each step of the test software. Specifically, the server creates a backend service. As an example, the server uses node.js to create a backend service. node.js is a JavaScript runtime environment based on the Chrome V8 engine, using an event-driven, non-blocking I/O model.

通过git仓库服务webhook监听客户端。这样,在监听到客户端已上传测试软件,则可以响应于git中客户端提交代码成功消息,调用控制器WebHooksController通过网络应用程序编程接口(WebAPI),接收测试软件。其中,WebAPI是git webhook发送的。Listen to the client through the git repository service webhook. In this way, after monitoring that the client has uploaded the test software, the controller WebHooksController can be called to receive the test software through the web application programming interface (WebAPI) in response to the successful message of the client submitting the code in git. Among them, WebAPI is sent by git webhook.

在本发明的实施例中,测试软件具体包括客户端生产资源文件和源代码资源文件。客户端生产资源文件表征测试软件的生产环境。源代码资源文件用于生成html页面。作为一个示例,测试软件备注为release v1.0。可以理解的是,测试软件以版本标识标记。如:v1.0,v2.0。版本标识的数字越大,则说明版本越新。In the embodiment of the present invention, the test software specifically includes a client-side production resource file and a source code resource file. The client-side production resource file represents the production environment of the test software. Source code resource files are used to generate html pages. As an example, the test software is noted as release v1.0. It will be appreciated that the test software is marked with a version identifier. Such as: v1.0, v2.0. The higher the number of the version ID, the newer the version.

S102、根据源代码资源文件的生产资源代码,构建服务端生产资源文件。S102 , constructing a server-side production resource file according to the production resource code of the source code resource file.

服务端接收到测试软件后,为了判断测试软件的生产环境,需要在服务端构建生产资源文件。After the server receives the test software, in order to judge the production environment of the test software, a production resource file needs to be constructed on the server.

具体地,在控制器中通过WebAPI接收信息,分析是否为“release vXX”信息,测试软件通常以release vXX标识。确定接收到测试软件后,服务端根据源代码资源文件的生产资源代码,构建服务端生产资源文件。Specifically, the controller receives information through WebAPI, and analyzes whether it is "release vXX" information. The test software is usually identified by release vXX. After it is determined that the test software is received, the server builds the server production resource file according to the production resource code of the source code resource file.

在本发明的一个实施例中,在源代码资源文件包括生产资源代码。生产资源代码用于标识生产资源文件的版本。在服务端安装生产资源代码对应的生产资源文件,实现构建服务端生产资源文件。即,根据源代码资源文件的生产资源代码,安装生产资源代码对应的生产资源文件,以构建服务端生产资源文件。In one embodiment of the present invention, production resource code is included in the source code resource file. The production resource code is used to identify the version of the production resource file. Install the production resource file corresponding to the production resource code on the server to realize the construction of the server production resource file. That is, according to the production resource code of the source code resource file, install the production resource file corresponding to the production resource code to construct the server production resource file.

作为一个示例,在服务端基于生产资源代码,进行服务端安装依赖,以构建生成server dist资源包。其中,server dist资源包即服务端生产资源文件。As an example, based on the production resource code on the server side, install dependencies on the server side to build and generate the server dist resource package. Among them, the server dist resource package is the server production resource file.

S103、确定客户端生产资源文件与服务端生产资源文件一致,且源代码资源文件的代码快照与历史源代码资源文件的代码快照一致。S103. Determine 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 present invention, in order to improve the accuracy of the testing software, it is necessary to compare the production resource file and the source code resource file respectively.

比较生产资源文件的目的在于:保障测试软件的生产环境的准确性。在实际应用测试软件的过程中,容易出现因为生产环境的差异,而导致测试软件失败的情况。具体来说,在客户端采用Vc5.0的生产环境;而在服务端采用Vc6.0的生产环境。由于生产环境不同,必要导致测试软件失败。The purpose of comparing the production resource files is to ensure the accuracy of the production environment of the test software. In the process of practical application of test software, it is easy to cause the test software to fail due to differences in the production environment. Specifically, the production environment of Vc5.0 is used on the client side; the production environment of Vc6.0 is used on the server side. Because the production environment is different, it is necessary to cause the test software to fail.

因此,在本发明实施例中,通过对比生产资源文件,实现对比生产环境。在生产环境一致的情况下,再对比代码快照。Therefore, in the embodiment of the present invention, the production environment is compared by comparing the production resource files. When the production environment is consistent, compare the code snapshots.

在本发明的实施例中,确定客户端生产资源文件与服务端生产资源文件不一致,则说明客户端的生产环境与服务端生产环境不同,则测试软件失败;确定客户端生产资源文件与服务端生产资源文件一致,则说明客户端的生产环境与服务端生产环境相同,则继续对比代码快照。In the embodiment of the present invention, if it is determined that the client production resource file is inconsistent with the server production resource file, it means that the production environment of the client is different from the server production environment, and the test software fails; If the resource files are consistent, it means that the production environment of the client is the same as the production environment of the server, then continue to compare the code snapshots.

参见图2,图2是根据本发明实施例的对比源代码资源文件的代码快照的流程示意图。具体包括以下步骤:Referring to FIG. 2, FIG. 2 is a schematic flowchart of comparing code snapshots of source code resource files according to an embodiment of the present invention. Specifically include the following steps:

比较源代码资源文件的代码快照的目的在于:保障测试软件中历史代码的准确性。The purpose of comparing the code snapshots of the source code resource files is to ensure the accuracy of the historical code in the test software.

S201、基于源代码资源文件的版本标识,在服务端中指定历史代码资源文件。S201 , specifying a historical code resource file in the server based on the version identifier of the source code resource file.

在本发明实施例中,源代码资源文件以版本标识标记。作为一个示例,源代码资源文件的版本标识为V1.1,源代码资源文件的版本标识为V1.2等。其中,版本标标识的数字越大,则对应版本越新。如:V1.2的版本是V1.1的更新版本。In the embodiment of the present invention, 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 so on. The larger the number identified by the version label, the newer the corresponding version. Such as: the version of V1.2 is the updated version of V1.1.

在每次测试软件的过程中,服务端均需要存储测试软件。可以理解的是,服务端存储有测试软件的多个版本。作为一个示例,服务端存储有测试软件V1.0、V1.1和V1.2三个版本的测试软件。During each software testing process, the server needs to store the testing software. Understandably, the server stores multiple versions of the test software. As an example, the server stores the test software of three versions of the 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 is running normally, and the code snapshot method is used to test the historical code of the current version and the original version.

因此,基于源代码资源文件的版本标识,在服务端中指定历史代码资源文件,从而针对源代码资源文件中与指定的历史代码资源文件的相同代码,采用代码快照的方式测试。这样,对比源代码资源文件的代码快照和指定的历史源代码资源的代码快照。Therefore, based on the version identifier of the source code resource file, the historical code resource file is specified in the server, so that the code snapshot method is used to test 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 is compared with the code snapshot of the specified historical source code resource.

在本发明的一个实施例中,指定的历史代码资源文件包括与版本标识最近的历史代码资源文件。与版本标识最近的历史代码资源文件,与源代码资源文件的区别最小,增加代码快照的代码数量,以提高测试效率。In one embodiment of the present invention, the designated historical code resource file includes a historical code resource file closest to the version identifier. The historical code resource file with the latest version identification has the smallest difference from the source code resource file, and the number of codes in the code snapshot is increased to improve the test efficiency.

S202、采用浏览模拟器,分别结合源代码资源文件和指定的历史源代码资源文件,获取源代码资源文件的代码快照和历史源代码资源文件的代码快照。S202 , a browsing simulator is used to obtain a code snapshot of the source code resource file and a code snapshot of the historical source code resource file in combination with the source code resource file and the specified historical source code resource file respectively.

针对源代码资源文件,采用浏览模拟器,获取源代码资源文件的代码快照;以及,针对指定的历史源代码资源文件,采用浏览模拟器,获取历史源代码资源文件的代码快照。For source code resource files, a browsing simulator is used to obtain a code snapshot of the source code resource file; and for a specified historical source code resource file, a browsing simulator is used to obtain a code snapshot of the historical source code resource file.

代码快照包括源代码资源文件的内容。作为一个示例,源代码资源文件的内容包括执行软件的代码。Code snapshots include the contents of source code resource files. As one example, the content of a source code resource file includes code to execute software.

作为一个示例,浏览模拟器包括Puppeteer。puppeteer是Node.js包,用于模拟Chrome浏览器的运行。在服务端,预设配置Puppeteer浏览模拟器。As an example, a browsing emulator includes Puppeteer. puppeteer is a Node.js package that emulates the running of the Chrome browser. On the server side, the Puppeteer browsing emulator is configured by default.

S203、确定源代码资源文件的代码快照与服务端中历史源代码资源文件的代码快照一致。S203. 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.

在确定源代码资源文件的代码快照与服务端中历史源代码资源文件的代码快照一致的情况下,则说明源代码资源文件中,与指定的历史代码资源文件的相同代码,通过测试。作为一个示例,采用Puppeteer确定,源代码资源文件的代码快照与服务端中历史源代码资源文件的代码快照一致。If 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 means that the source code resource file has the same code as the specified historical code resource file and passed the test. 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.

需要说明的是,在下述情况中,则可以直接确定测试软件失败。确定客户端生产资源文件与服务端生产资源文件不同。以及,确定客户端生产资源文件与服务端生产资源文件一致,且源代码资源文件的代码快照与历史源代码资源文件的代码快照不同。It should be noted that, in the following cases, it can be directly determined that the test software fails. Make sure that the client-side production resource file is different from the server-side production resource file. And, it is determined 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 different from the code snapshot of the historical source code resource file.

在图2的实施例中,采用浏览模拟器,实现源代码资源文件的代码快照对比,实现源代码资源文件中与指定的历史代码资源文件的相同代码的测试。In the embodiment of FIG. 2, a browsing simulator is used to implement code snapshot comparison of source code resource files, and to test the same code in the source code resource file with the specified historical code resource file.

S104、采用浏览器加载测试软件,并基于浏览器的显示内容,反馈测试软件的测试结果。S104, the browser is used to load the test software, and based on the displayed content of the browser, the test result of the test software is fed back.

在本发明的实施例中,测试软件用于显示html页面。因此,可以采用浏览器加载测试软件,并基于浏览器的显示内容,反馈测试软件的测试结果。In the embodiment of the present invention, the testing software is used to display an html page. Therefore, a browser can be used to load the test software, and based on the displayed content of the browser, the test results of the test software can be fed back.

在本发明的实施例中,针对指定页面,采用浏览器显示指定业务的显示内容,以确定测试软件。具体地,采用浏览器执行测试软件,并基于浏览器渲染页面的显示内容,反馈测试软件的测试结果,渲染页面是源代码资源文件中的指定页面。In the embodiment of the present invention, for a specified page, a browser is used to display the display content of the specified service to determine the test software. Specifically, the browser is used to execute the test software, and the display content of the page is rendered based on the browser, and the test result of the test software is fed back, and the rendered page is a designated page in the source code resource file.

作为一个示例,渲染页面中的显示内容,与指定页面中的显示内容一致,则反馈测试软件的测试结果为通过测试;相应地,渲染页面中的显示内容,与指定页面中的显示内容不同,则反馈测试软件的测试结果为未通过测试。与指定页面中的显示内容不同,包括:显示报错404。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 feedback test software is passed the test; correspondingly, the display content in the rendered page is different from the display content in the specified page. Then the test result of the feedback test software is a failed test. Different from the display content in the specified page, including: display error 404.

可以理解的是,通过显示指定页面,就可以直接确定测试结果。It can be understood that by displaying the specified page, the test result can be directly determined.

参见图3,图3是根据本发明实施例的基于浏览器的显示内容反馈测试软件的测试结果的流程示意图。具体包括以下步骤:Referring to FIG. 3, FIG. 3 is a schematic flowchart of a browser-based display content feedback testing software test result according to an embodiment of the present invention. Specifically include the following steps:

S301、采用浏览器加载测试软件,并基于浏览器渲染显示内容失败。S301 , using a browser to load the test software, and rendering and displaying the content based on the browser fails.

采用浏览器加载测试软件,并基于浏览器渲染显示内容失败。浏览器渲染显示内容失败的原因有多种:生产服务器故障或测试软件出现错误等。The test software is loaded by the browser, and the display content fails based on the browser rendering. Browser rendering of displayed content can fail for a variety of reasons: a production server failure or a bug in the test software, etc.

为了避免服务器故障导致的测试软件失败,还可以通过备份服务器测试软件。In order to avoid the failure of the test software caused by the server failure, you can also test the software through the backup server.

S302、将浏览器的加载请求重定向至备份服务器,通过备份服务器中再次加载测试软件,反馈测试软件的测试结果。S302: Redirect the loading request of the browser to the backup server, and reload the test software in the backup server to feed back the test result of the test software.

预先设置备份服务器,备份服务器可以理解为容灾服务器。将浏览器的加载请求重定向至备份服务器,通过备份服务器中再次加载测试软件,反馈测试软件的测试结果。通过备份服务器,能够正常显示测试软件中页面的显示内容,则测试软件的测试结果为通过测试;相应地,通过备份服务器,不能正常显示测试软件中页面的显示内容,则测试软件的测试结果为未通过测试。A backup server is set in advance, and the backup server can be understood as a disaster recovery server. The browser's loading request is redirected to the backup server, and the test software is reloaded in the backup server, and the test results of the test software are fed back. Through the backup server, if the display content of the page in the test software can be displayed normally, the test result of the test software is passed the test; correspondingly, if the display content of the page in the test software cannot be displayed normally through the backup server, the test result of the test software is Failed the test.

作为一个示例,a网址为生产服务器代表生产环境,b网址为备份服务器代表容灾环境。As an example, a URL for the production server represents the production environment, and URL b for the backup server represents the disaster recovery environment.

采用浏览器访问a网址,即将浏览器的加载请求定向至生产服务器,加载测试软件,并基于浏览器渲染显示内容失败。将浏览器的加载请求重定向至备份服务器,通过b网址再次加载测试软件,反馈测试软件的测试结果。Using a browser to access a website, that is, directing the browser's loading request to the production server, loading the test software, and rendering the content based on the browser fails. Redirect the loading request of the browser to the backup server, load the test software again through the b URL, and feed back the test results of the test software.

在上述本发明的实施例中,响应于分布式版本控制系统中客户端提交代码成功消息,调用控制器通过网络应用程序编程接口,接收测试软件,所述测试软件包括客户端生产资源文件和源代码资源文件;根据所述源代码资源文件的生产资源代码,构建服务端生产资源文件;确定所述客户端生产资源文件与所述服务端生产资源文件一致,且所述源代码资源文件的代码快照与历史源代码资源文件的代码快照一致;采用浏览器加载所述测试软件,并基于所述浏览器的显示内容,反馈所述测试软件的测试结果。通过比较生产资源文件判断生产环境相同,以及比较代码快照保障已有代码一致,再以浏览器加载测试软件,以反馈测试结果。上述过程自动执行,无需人工干预,进而提高软件测试效率。In the above-mentioned embodiment of the present invention, in response to the successful message of the code submitted by the client in the distributed version control system, the controller is invoked to receive the test software through the network application programming interface, and the test software includes the client production resource file and the source code. code resource file; build a server-side production resource file according to the production resource code of the source code resource file; determine that the client-side production resource file is consistent with the server-side production resource file, and the code of the source code resource file The snapshot is consistent with the code snapshot of the historical source code resource file; a browser is used to load the test software, and based on the displayed content of the browser, the test results of the test software are fed back. By comparing the production resource files, it is judged that the production environment is the same, and the code snapshots are compared to ensure that the existing code is consistent, and then the test software is loaded in the browser to feedback the test results. The above process is performed automatically without manual intervention, thereby improving the efficiency of software testing.

参见图4,图4是根据本发明实施例的执行测试软件的方法流程示意图。具体包括以下步骤:Referring to FIG. 4, FIG. 4 is a schematic flowchart of a method for executing test software according to an embodiment of the present invention. Specifically include the following steps:

S401、开发人员在客户端创建测试软件。S401. The developer creates test software on the client.

软件开发者可以通过客户端上传测试软件。具体来说,在客户端中,用户创建html项目,进而生成html项目的测试软件。Software developers can upload 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、上传测试软件至分布式版本控制系统。S402, upload the test software to the distributed version control system.

在客户端,测试软件与git关联,git接收上传的测试软件。On the client side, the test software is associated with git, and git receives the uploaded test software.

S403、监听客户端已上传测试软件。S403, the monitoring client has uploaded the test software.

采用webhook监听客户端。这样,在监听到客户端已上传测试软件,则可以响应于git中客户端提交代码成功消息,Use webhook to monitor the client. In this way, after monitoring that the client has uploaded the test software, you can respond to the successful message of the client submitting the code in git,

S404、构建服务端生产资源文件。S404 , constructing a server-side production resource file.

服务端接收到测试软件后,为了判断测试软件的生产环境,需要在服务端构建生产资源文件。After the server receives the test software, in order to judge the production environment of the test software, a production resource file needs to be constructed on the server.

S405、确定客户端生产资源文件与服务端生产资源文件一致。S405, it is determined that the client production resource file is consistent with the server production resource file.

确定客户端生产资源文件与服务端生产资源文件一致,则说明客户端与服务端的生产环境相同。确定客户端生产资源文件与服务端生产资源文件不同,则测试软件失败。If it is determined that the client production resource file is the same as the server production resource file, it means that the production environment of the client and the server is the same. If it is determined that the client-side production resource file is different from the server-side production resource file, the test software fails.

S406、确定源代码资源文件的代码快照与历史源代码资源文件的代码快照一致。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.

确定源代码资源文件的代码快照与历史源代码资源文件的代码快照一致,继续采用浏览器测试软件;确定源代码资源文件的代码快照与历史源代码资源文件的代码快照不同,则测试软件失败。Confirm that the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file, and continue to use the browser to test the software; if 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.

S407、通过生产服务器渲染测试软件的显示内容成功。S407, the display content of the test software is successfully rendered by the production server.

通过生产服务器渲染测试软件的显示内容成功,则测试结果为通过测试。通过生产服务器渲染测试软件的显示内容失败,则将浏览器的加载请求重定向至备份服务器。If the display content of the test software is successfully rendered by the production server, the test result is a passing test. If rendering the display content of the test software through the production server fails, the browser's loading request is redirected to the backup server.

S408、通过备份服务器渲染测试软件的显示内容成功。S408, the display content of the test software is successfully rendered through the backup server.

通过备份服务器渲染测试软件的显示内容成功,则测试结果为通过测试。通过备份服务器渲染测试软件的显示内容失败,则测试结果为未通过测试。If the display content of the test software is successfully rendered through the backup server, the test result is a pass test. If the display content of the test software is failed to be rendered by the backup server, the test result is a failed test.

参见图5,图5是根据本发明实施例的测试软件的装置的主要结构示意图,测试软件的装置可以实现测试软件的方法,如图5所示,测试软件的装置具体包括:Referring to FIG. 5, FIG. 5 is a schematic diagram of the main structure of a device for testing software according to an embodiment of the present invention. The device for testing software can implement a method for testing software. As shown in FIG. 5, the device for testing software specifically includes:

接收模块501,用于响应于分布式版本控制系统中客户端提交代码成功消息,调用控制器通过网络应用程序编程接口,接收测试软件,所述测试软件包括客户端生产资源文件和源代码资源文件;The receiving module 501 is used for in response to the client in the distributed version control system submitting the code success message, calling the controller to receive the test software through the network application programming interface, and the test software includes the client production resource file and the source code resource file ;

构建模块502,用于根据所述源代码资源文件的生产资源代码,构建服务端生产资源文件;A construction module 502, configured to construct a server-side production resource file according to the production resource code of the source code resource file;

确定模块503,用于确定所述客户端生产资源文件与所述服务端生产资源文件一致,且所述源代码资源文件的代码快照与历史源代码资源文件的代码快照一致;A determination module 503, configured to determine 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;

反馈模块504,用于采用浏览器加载所述测试软件,并基于所述浏览器的显示内容,反馈所述测试软件的测试结果。The feedback module 504 is configured to load the test software by using a browser, and feed back the test result of the test software based on the displayed content of the browser.

在本发明的一个实施例中,接收模块501,具体用于将所述测试软件与所述分布式版本控制系统关联,所述分布式版本控制系统接收所述测试软件。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.

在本发明的一个实施例中,构建模块502,具体用于根据所述源代码资源文件的生产资源代码,安装所述生产资源代码对应的生产资源文件,以构建服务端生产资源文件。In an embodiment of the present invention, the building module 502 is specifically configured to install 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 the server production resource file.

在本发明的一个实施例中,确定模块503,具体用于基于所述源代码资源文件的版本标识,在服务端中指定的历史代码资源文件;In an embodiment of the present invention, the determining module 503 is specifically configured to specify the historical code resource file in the server based on the version identifier of the source code resource file;

采用浏览模拟器,分别结合所述源代码资源文件和所述指定的历史源代码资源文件,获取所述源代码资源文件的代码快照和所述历史源代码资源文件的代码快照;Using a browsing simulator, the source code resource file and the designated historical source code resource file are respectively combined to obtain a code snapshot of the source code resource file and a code snapshot of the historical source code resource file;

确定源代码资源文件的代码快照与服务端中历史源代码资源文件的代码快照一致。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.

在本发明的一个实施例中,所述指定的历史代码资源文件包括与所述版本标识最近的历史代码资源文件。In an embodiment of the present invention, the specified historical code resource file includes a historical code resource file closest to the version identifier.

在本发明的一个实施例中,反馈模块504,具体用于采用浏览器执行所述测试软件,并基于所述浏览器渲染页面的显示内容,反馈所述测试软件的测试结果,所述渲染页面是所述源代码资源文件中的指定页面。In an embodiment of the present invention, the feedback module 504 is specifically configured to use a browser to execute the test software, and based on the browser to render the display content of the page, feedback the test result of the test software, and the rendered page is the specified page in the source code resource file.

在本发明的一个实施例中,反馈模块504,具体用于采用浏览器加载所述测试软件,并基于所述浏览器渲染显示内容失败;In an embodiment of the present invention, the feedback module 504 is specifically configured to use a browser to load the test software, and render and display the content failure based on the browser;

将所述浏览器的加载请求重定向至备份服务器,通过所述备份服务器中再次加载所述测试软件,反馈所述测试软件的测试结果。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.

图6示出了可以应用本发明实施例的测试软件的方法或测试软件的装置的示例性系统架构600。FIG. 6 shows an exemplary system architecture 600 of a method for testing software or an apparatus for testing software to which embodiments of the present invention may be applied.

如图6所示,系统架构600可以包括终端设备601、602、603,网络604和服务器605。网络604用以在终端设备601、602、603和服务器605之间提供通信链路的介质。网络604可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。As shown in FIG. 6 , the system architecture 600 may include terminal devices 601 , 602 , and 603 , a network 604 and a server 605 . The network 604 is a medium used to provide a communication link between the terminal devices 601 , 602 , 603 and the server 605 . Network 604 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.

用户可以使用终端设备601、602、603通过网络604与服务器605交互,以接收或发送消息等。终端设备601、602、603上可以安装有各种通讯客户端应用,例如购物类应用、网页浏览器应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等(仅为示例)。The user can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages and the like. Various communication client applications may be installed on the terminal devices 601 , 602 and 603 , such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (just examples).

终端设备601、602、603可以是具有显示屏并且支持网页浏览的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。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 computers, desktop computers, and the like.

服务器605可以是提供各种服务的服务器,例如对用户利用终端设备601、602、603所浏览的购物类网站提供支持的后台管理服务器(仅为示例)。后台管理服务器可以对接收到的产品信息查询请求等数据进行分析等处理,并将处理结果(例如目标推送信息、产品信息--仅为示例)反馈给终端设备。The server 605 may be a server that provides various services, such as a background management server that supports shopping websites browsed by the terminal devices 601 , 602 , and 603 (just an example). The background management server can analyze and process the received product information query request and other data, and feed back the processing results (such as target push information, product information—just an example) to the terminal device.

需要说明的是,本发明实施例所提供的测试软件的方法一般由服务器605执行,相应地,测试软件的装置一般设置于服务器605中。It should be noted that the method for testing software provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the apparatus for testing the software is generally set in the server 605 .

应该理解,图6中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。It should be understood that the numbers of terminal devices, networks and servers in FIG. 6 are merely illustrative. There can be any number of terminal devices, networks and servers according to implementation needs.

下面参考图7,其示出了适于用来实现本发明实施例的终端设备的计算机系统700的结构示意图。图7示出的终端设备仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。Referring next to FIG. 7 , it shows a schematic structural diagram of a computer system 700 suitable for implementing a terminal device according to an embodiment of the present invention. The terminal device shown in FIG. 7 is only an example, and should not impose any limitations on the functions and scope of use of the embodiments of the present invention.

如图7所示,计算机系统700包括中央处理单元(CPU)701,其可以根据存储在只读存储器(ROM)702中的程序或者从存储部分708加载到随机访问存储器(RAM)703中的程序而执行各种适当的动作和处理。在RAM 703中,还存储有系统700操作所需的各种程序和数据。CPU 701、ROM 702以及RAM 703通过总线704彼此相连。输入/输出(I/O)接口705也连接至总线704。As shown in FIG. 7, a computer system 700 includes a central processing unit (CPU) 701, which can be loaded into a random access memory (RAM) 703 according to a program stored in a read only memory (ROM) 702 or a program from a storage section 708 Instead, various appropriate actions and processes are performed. 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 through a bus 704 . An input/output (I/O) interface 705 is also connected to bus 704 .

以下部件连接至I/O接口705:包括键盘、鼠标等的输入部分706;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分707;包括硬盘等的存储部分708;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分709。通信部分709经由诸如因特网的网络执行通信处理。驱动器710也根据需要连接至I/O接口705。可拆卸介质711,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器710上,以便于从其上读出的计算机程序根据需要被安装入存储部分708。The following components are connected to the I/O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, 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, a modem, and 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, etc., is mounted on the drive 710 as needed so that a computer program read therefrom is installed into the storage section 708 as needed.

特别地,根据本发明公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本发明公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分709从网络上被下载和安装,和/或从可拆卸介质711被安装。在该计算机程序被中央处理单元(CPU)701执行时,执行本发明的系统中限定的上述功能。In particular, the processes described above with reference to the flowcharts may be implemented as computer software programs in accordance with the disclosed embodiments of the present invention. For example, embodiments disclosed herein include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart. In such an embodiment, the computer program may be downloaded and installed from the network via the communication portion 709 and/or installed from the removable medium 711 . When the computer program is executed by the central processing unit (CPU) 701, the above-described functions defined in the system of the present invention are executed.

需要说明的是,本发明所示的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本发明中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本发明中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples of computer readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. In the present invention, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device . Program code embodied on a computer readable medium may be transmitted using any suitable medium including, but not limited to, wireless, wireline, optical fiber 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 that contains one or more logical functions for implementing the specified functions executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks 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 is also noted that each block of the block diagrams or flowchart illustrations, and combinations of blocks in the block diagrams or flowchart illustrations, can be implemented in special purpose hardware-based systems that perform the specified functions or operations, or can be implemented using A combination of dedicated hardware and computer instructions is implemented.

描述于本发明实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的模块也可以设置在处理器中,例如,可以描述为:一种处理器包括接收模块、构建模块、确定模块和反馈模块。其中,这些模块的名称在某种情况下并不构成对该模块本身的限定,例如,接收模块还可以被描述为“用于响应于分布式版本控制系统中客户端提交代码成功消息,调用控制器通过网络应用程序编程接口,接收测试软件”。The modules involved in the embodiments of the present invention may be implemented in a software manner, and may also be implemented in a hardware manner. The described modules can also be provided in the processor, for example, it can be described as: a processor includes a receiving module, a building module, a determining module and a feedback module. Among them, the names of these modules do not constitute a limitation of the module itself under certain circumstances, for example, the receiving module can also be described as "used to respond to the client in the distributed version control system to submit the code successfully message, call the control The tester receives the test software through the web application programming interface”.

作为另一方面,本发明还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的设备中所包含的;也可以是单独存在,而未装配入该设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被一个该设备执行时,使得该设备包括:As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or may exist alone without being assembled into the device. The above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by a device, the device includes:

响应于分布式版本控制系统中客户端提交代码成功消息,调用控制器通过网络应用程序编程接口,接收测试软件,所述测试软件包括客户端生产资源文件和源代码资源文件;In response to the successful message of the client submitting the code in the distributed version control system, the controller is invoked to receive the test software through the network application programming interface, and the test software includes the client production resource file and the source code resource file;

根据所述源代码资源文件的生产资源代码,构建服务端生产资源文件;Build a server-side production resource file according to the 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 the code snapshot of the source code resource file is consistent with the code snapshot of the historical source code resource file;

采用浏览器加载所述测试软件,并基于所述浏览器的显示内容,反馈所述测试软件的测试结果。A browser is used to load the test software, and based on the displayed content of the browser, the test results of the test software are fed back.

根据本发明实施例的技术方案,响应于分布式版本控制系统中客户端提交代码成功消息,调用控制器通过网络应用程序编程接口,接收测试软件,所述测试软件包括客户端生产资源文件和源代码资源文件;根据所述源代码资源文件的生产资源代码,构建服务端生产资源文件;确定所述客户端生产资源文件与所述服务端生产资源文件一致,且所述源代码资源文件的代码快照与历史源代码资源文件的代码快照一致;采用浏览器加载所述测试软件,并基于所述浏览器的显示内容,反馈所述测试软件的测试结果。通过比较生产资源文件判断生产环境相同,以及比较代码快照保障已有代码一致,再以浏览器加载测试软件,以反馈测试结果。上述过程自动执行,无需人工干预,进而提高软件测试效率。According to the technical solution of the embodiment of the present invention, in response to the successful message of the code submitted by the client in the distributed version control system, the controller is invoked to receive the test software through the network application programming interface, and the test software includes the client production resource file and the source code. code resource file; build a server-side production resource file according to the production resource code of the source code resource file; determine that the client-side production resource file is consistent with the server-side production resource file, and the code of the source code resource file The snapshot is consistent with the code snapshot of the historical source code resource file; the browser is used to load the test software, and based on the displayed content of the browser, the test results of the test software are fed back. By comparing the production resource files, it is judged that the production environment is the same, and the code snapshots are compared to ensure that the existing code is consistent, and then the test software is loaded in the browser to feedback the test results. The above process is performed automatically without manual intervention, thereby improving the efficiency of software testing.

上述具体实施方式,并不构成对本发明保护范围的限制。本领域技术人员应该明白的是,取决于设计要求和其他因素,可以发生各种各样的修改、组合、子组合和替代。任何在本发明的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明保护范围之内。The above-mentioned specific embodiments do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principle of the present invention shall be included within 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.
CN202210831923.6A 2022-07-14 2022-07-14 Method, device, equipment and computer readable medium for testing software Pending CN115168212A (en)

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)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107704234A (en) * 2017-08-22 2018-02-16 北京三快在线科技有限公司 Front end engineering construction method, device, electronic equipment and readable storage medium storing program for executing
CN109284472A (en) * 2018-11-15 2019-01-29 福建省华渔教育科技有限公司 Front end webpage loading method, storage medium based on webpack
US10255065B1 (en) * 2017-12-29 2019-04-09 Semmle Limited Automatically building software projects
CN111694592A (en) * 2020-06-24 2020-09-22 深圳壹账通智能科技有限公司 Management method and system for project version release
CN111897568A (en) * 2020-07-06 2020-11-06 北京中关村银行股份有限公司 System checking method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107704234A (en) * 2017-08-22 2018-02-16 北京三快在线科技有限公司 Front end engineering construction method, device, electronic equipment and readable storage medium storing program for executing
US10255065B1 (en) * 2017-12-29 2019-04-09 Semmle Limited Automatically building software projects
CN109284472A (en) * 2018-11-15 2019-01-29 福建省华渔教育科技有限公司 Front end webpage loading method, storage medium based on webpack
CN111694592A (en) * 2020-06-24 2020-09-22 深圳壹账通智能科技有限公司 Management method and system for project version release
CN111897568A (en) * 2020-07-06 2020-11-06 北京中关村银行股份有限公司 System checking method, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
朱广福,王芳: "Web前端开发", 31 October 2020, 西南交通大学出版社, pages: 206 - 209 *

Similar Documents

Publication Publication Date Title
US11561889B2 (en) Orchestration for automated performance testing
CN108196915A (en) Code process method, equipment and storage medium based on application container engine
US9665656B2 (en) Automated service solution delivery
CN110851471B (en) Distributed log data processing method, device and system
CN111580926A (en) Model publishing method, model deployment method, apparatus, device and storage medium
CN113760729A (en) A code detection method and device
CN108664291A (en) The construction method and device of container group
CN111506904B (en) Method and device for online bug repair
CN112835568A (en) A project construction method and device
CN110717992B (en) Method, apparatus, computer system and readable storage medium for scheduling model
WO2019029451A1 (en) Method for publishing mobile applications and electronic apparatus
CN110888639A (en) Business code compiling and packaging method and device
CN110928571A (en) Business program development method and device
KR20210091327A (en) Batch processing method, apparatus, electronic device and readable storage medium of applet
CN111796851A (en) Client base library updating method and device, electronic equipment and storage medium
CN110806967B (en) Unit testing method and unit testing device
CN112559024A (en) Method and device for generating transaction code change list
CN111506339A (en) Method and device for processing change information of Software Development Kit (SDK)
CN112395194B (en) Method and device for accessing test platform
CN112783903B (en) Method and device for generating update log
CN112379973A (en) Heavy loading method and device
CN110825622A (en) Software testing method, device, equipment and computer readable medium
CN115934151A (en) Method and device for building multi-terminal small program
CN115168212A (en) Method, device, equipment and computer readable medium for testing software
US20230259347A1 (en) Container based generation of inputs for generic functions

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