[go: up one dir, main page]

CN114297071A - Quality evaluation method and device for automatic test case - Google Patents

Quality evaluation method and device for automatic test case Download PDF

Info

Publication number
CN114297071A
CN114297071A CN202111642151.3A CN202111642151A CN114297071A CN 114297071 A CN114297071 A CN 114297071A CN 202111642151 A CN202111642151 A CN 202111642151A CN 114297071 A CN114297071 A CN 114297071A
Authority
CN
China
Prior art keywords
test
data
quality
code coverage
test case
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
CN202111642151.3A
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.)
Jilin Yillion Bank Co ltd
Original Assignee
Jilin Yillion Bank 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 Jilin Yillion Bank Co ltd filed Critical Jilin Yillion Bank Co ltd
Priority to CN202111642151.3A priority Critical patent/CN114297071A/en
Publication of CN114297071A publication Critical patent/CN114297071A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a quality evaluation method and a quality evaluation device for an automatic test case, wherein the method comprises the following steps: executing all the test cases in the test case set; obtaining code coverage data of all node services in a distributed system; determining a test quality for the set of test cases based on the code coverage data. According to the scheme, index data capable of reflecting the automatic test cases and the software quality is obtained by collecting distributed micro-service operation period data, the effect of the automatic test cases is evaluated, the test quality and the test efficiency in the software research and development process are improved, and the effect of completing the software version quality evaluation and the test process through the same number of cases or fewer automatic test cases is achieved.

Description

自动化测试案例的质量评估方法及装置Quality assessment method and device for automated test cases

技术领域technical field

本发明涉及软件开发技术领域,更具体的说,是涉及一种自动化测试案例的质量评估方法及装置。The invention relates to the technical field of software development, and more particularly, to a quality evaluation method and device for automated test cases.

背景技术Background technique

软件系统架构逐渐由集中式架构向分布式架构转变,新建系统多采用分布式框架以及微服务架构进行开发。系统上线后随着业务发展以及持续的研发投入,微服务模块逐渐的增多,系统复杂程度成指数级上升。为了在质量可控的前提下保障软件研发流程的效率,针对分布式系统以及持续运营系统的研发迭代特点,软件研发团队和测试团队大都会引入自动化测试系统用于系统迭代过程中的质量保障以及回归测试。在实际实践的过程中,随着业务代码的增加以及相关的测试需求,测试案例量也大幅增加;但随着案例的增多,测试过程和质量并没有随着案例数量的增加而得到上升。因此,需要提供一种技术评估手段,针对自动化测试案例的效果进行评估。The software system architecture is gradually changing from a centralized architecture to a distributed architecture, and new systems are mostly developed using distributed frameworks and microservices architectures. After the system goes online, with business development and continuous R&D investment, the number of microservice modules gradually increases, and the complexity of the system increases exponentially. In order to ensure the efficiency of the software R&D process under the premise of controllable quality, according to the R&D iteration characteristics of distributed systems and continuous operation systems, software R&D teams and test teams will mostly introduce automated testing systems for quality assurance in the system iteration process and Regression Testing. In the process of actual practice, with the increase of business code and related testing requirements, the number of test cases has also increased significantly; but with the increase of cases, the test process and quality have not improved with the increase of the number of cases. Therefore, it is necessary to provide a technical evaluation method to evaluate the effect of automated test cases.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明提供如下技术方案:In view of this, the present invention provides the following technical solutions:

一种自动化测试案例的质量评估方法,包括:A quality assessment method for automated test cases, including:

执行测试案例集合中所有的测试案例;Execute all test cases in the test case collection;

获得分布式系统中所有节点服务的代码覆盖度数据;Obtain the code coverage data of all node services in the distributed system;

基于所述代码覆盖度数据确定所述测试案例集合的测试质量。A test quality of the set of test cases is determined based on the code coverage data.

可选的,所述获得分布式系统中所有节点服务的代码覆盖度数据,包括:Optionally, the obtaining code coverage data of all node services in the distributed system includes:

通过挂载在分布式系统中各个节点的数据采集组件在所述测试案例执行结束后采集所述分布式系统中所有节点服务的代码覆盖度数据;Collect the code coverage data of all node services in the distributed system after the execution of the test case is completed by the data collection component mounted on each node in the distributed system;

其中,所述数据采集组件基于预先在版本库制定的配置文件,在开发环境中通过启动脚本加载实现。Wherein, the data acquisition component is implemented by loading a startup script in a development environment based on a configuration file previously formulated in the version library.

可选的,还包括:Optionally, also include:

在所述数据采集组件采集获得的代码覆盖度数据下载完成后,控制所述数据采集组件的采集数据归零。After the download of the code coverage data collected by the data collection component is completed, the collected data of the data collection component is controlled to return to zero.

可选的,所述基于所述代码覆盖度数据确定所述测试案例集合的测试质量,包括:Optionally, determining the test quality of the test case set based on the code coverage data includes:

通过HTTP调用CI/CD工具开放应用程序编程接口API,调起预先配置在所述CI/CD工具中的构建任务,实现所述测试案例集合的测试质量的确定。The CI/CD tool open application programming interface API is invoked through HTTP, and the construction task preconfigured in the CI/CD tool is invoked, so as to realize the determination of the test quality of the test case set.

可选的,所述基于所述代码覆盖度数据确定所述测试案例集合的测试质量,包括:Optionally, determining the test quality of the test case set based on the code coverage data includes:

从版本库拉取源代码,并基于所述源代码执行编译构建,所述源代码为所述测试案例集合的测试服务对应的源代码;Pull source code from the repository, and execute compilation and construction based on the source code, where the source code is the source code corresponding to the test service of the test case set;

拉取所述代码覆盖度数据;Pull the code coverage data;

汇总所述源代码和所述代码覆盖度数据,得到所述测试案例集合的测试质量。Summarize the source code and the code coverage data to obtain the test quality of the test case set.

可选的,在所述获得分布式系统中所有节点服务的代码覆盖度数据后,还包括:Optionally, after obtaining the code coverage data of all node services in the distributed system, the method further includes:

基于所述测试案例的案例执行数据和所述代码覆盖度数据确定相关数据指标关联性,所述相关数据指标关联性用于指导后续测试案例的设计。Relevant data indicator associations are determined based on the case execution data of the test case and the code coverage data, and the relevant data indicator associations are used to guide the design of subsequent test cases.

可选的,所述代码覆盖度数据包括代码覆盖率和版本增量代码覆盖率。Optionally, the code coverage data includes code coverage and version incremental code coverage.

一种自动化测试案例的质量评估装置,包括:A quality assessment device for automated test cases, comprising:

案例执行模块,用于执行测试案例集合中所有的测试案例;The case execution module is used to execute all test cases in the test case collection;

数据获得模块,用于获得分布式系统中所有节点服务的代码覆盖度数据;The data acquisition module is used to obtain the code coverage data of all node services in the distributed system;

质量确定模块,用于基于所述代码覆盖度数据确定所述测试案例集合的测试质量。A quality determination module, configured to determine the test quality of the test case set based on the code coverage data.

可选的,所述数据获得模块具体用于:通过挂载在分布式系统中各个节点的数据采集组件在所述测试案例执行结束后采集所述分布式系统中所有节点服务的代码覆盖度数据;Optionally, the data acquisition module is specifically configured to: collect the code coverage data of all node services in the distributed system after the execution of the test case is completed by using the data acquisition component mounted on each node in the distributed system. ;

其中,所述数据采集组件基于预先在版本库制定的配置文件,在开发环境中通过启动脚本加载实现。Wherein, the data acquisition component is implemented by loading a startup script in a development environment based on a configuration file previously formulated in the version library.

可选的,所述质量确定模块包括:Optionally, the quality determination module includes:

代码拉取模块,用于从版本库拉取源代码,并基于所述源代码执行编译构建,所述源代码为所述测试案例集合的测试服务对应的源代码;a code pulling module, used for pulling source code from the repository, and performing compilation and construction based on the source code, where the source code is the source code corresponding to the test service of the test case set;

数据拉取模块,用于拉取所述代码覆盖度数据;a data pulling module for pulling the code coverage data;

数据处理模块,用于汇总所述源代码和所述代码覆盖度数据,得到所述测试案例集合的测试质量。A data processing module, configured to summarize the source code and the code coverage data to obtain the test quality of the test case set.

经由上述的技术方案可知,与现有技术相比,本发明实施例公开了一种自动化测试案例的质量评估方法及装置,方法包括:执行测试案例集合中所有的测试案例;获得分布式系统中所有节点服务的代码覆盖度数据;基于所述代码覆盖度数据确定所述测试案例集合的测试质量。上述方案通过采集分布式微服务运行期数据的方式得到一种可以体现自动化测试案例和软件质量的指标数据,针对自动化测试案例的效果进行评估,有助于提升测试质量以及软件研发流程中的测试效率,实现通过同等案例或者更少的自动化测试案例数量完成软件版本质量评估以及测试流程的效果。It can be known from the above technical solutions that, compared with the prior art, the embodiment of the present invention discloses a quality assessment method and device for an automated test case. The method includes: executing all the test cases in the test case set; Code coverage data for all node services; determining the test quality of the set of test cases based on the code coverage data. The above solution obtains an indicator data that can reflect the automated test cases and software quality by collecting the data during the running period of distributed microservices, and evaluates the effect of the automated test cases, which helps to improve the test quality and the test efficiency in the software R&D process. , to achieve the effect of completing the software version quality assessment and testing process through the same number of automated test cases or less.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention. For those of ordinary skill in the art, other drawings can also be obtained according to the provided drawings without creative work.

图1为本申请实施例公开的一种自动化测试案例的质量评估方法的流程图;1 is a flowchart of a quality assessment method for an automated test case disclosed in an embodiment of the application;

图2为本申请实施例公开的一种确定测试案例集合的测试质量的流程图;FIG. 2 is a flowchart for determining the test quality of a test case set disclosed by an embodiment of the present application;

图3为本申请实施例公开的另一种自动化测试案例的质量评估方法的流程图;3 is a flowchart of another method for evaluating the quality of an automated test case disclosed in an embodiment of the application;

图4为本申请实施例公开的测试案例的质量评估整体架构部署实现示意图;FIG. 4 is a schematic diagram of the implementation of the overall architecture deployment of the quality assessment of the test case disclosed in the embodiment of the present application;

图5为本申请实施例公开的一种自动化测试案例的质量评估装置的结构示意图;5 is a schematic structural diagram of a quality assessment device for an automated test case disclosed in an embodiment of the application;

图6为本申请实施例公开的一种质量确定模块的结构示意图。FIG. 6 is a schematic structural diagram of a quality determination module disclosed in an embodiment of the present application.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

图1为本申请实施例公开的一种自动化测试案例的质量评估方法的流程图,参见图1所示,自动化测试案例的质量评估方法可以包括:1 is a flowchart of a method for evaluating the quality of an automated test case disclosed in an embodiment of the present application. Referring to FIG. 1 , the method for evaluating the quality of an automated test case may include:

步骤101:执行测试案例集合中所有的测试案例。Step 101: Execute all test cases in the test case set.

测试案例集合中包括多个测试案例,这些测试案例的测试对象为同一服务。在对被测服务进行测试时,需要将对应测试案例集合中所有的测试案例都执行。The test case collection includes multiple test cases, and the test objects of these test cases are the same service. When testing the service under test, all test cases in the corresponding test case collection need to be executed.

步骤102:获得分布式系统中所有节点服务的代码覆盖度数据。Step 102: Obtain code coverage data of all node services in the distributed system.

关于代码覆盖度,是一种案例覆盖的评测手段,在开发过程中原来经常由开发人员自己在本地运行测试后通过相关工具导出形成报告,例如:通过执行10个正向、反向测试案例,可以把所有业务代码行都执行到,即意味着这10个案例的测试代码覆盖度为100%。通常认为测试案例执行后代码覆盖度越高则测试案例覆盖较好,测试质量较高。Regarding code coverage, it is an evaluation method for case coverage. In the development process, developers often run tests locally and export them through relevant tools to form reports. For example, by executing 10 forward and reverse test cases, All business code lines can be executed, which means that the test code coverage of these 10 cases is 100%. It is generally believed that the higher the code coverage after the test case is executed, the better the test case coverage and the higher the test quality.

其中的代码覆盖度数据,可以是微服务运行期间的一些数据,例如可以但不限制为微服务节点的交易量、JVM运行参数、指标以及人工添加的一些数据采集点数据等。The code coverage data can be some data during the operation of the microservice, such as, but not limited to, the transaction volume of the microservice node, JVM operating parameters, indicators, and some manually added data collection point data.

本申请中,在测试案例集合中所有的测试案例都执行结束后,才会获得分布式系统中所有节点服务的代码覆盖度数据。传统的覆盖度采集的阶段均处于代码构建过程的后阶段,通过CI(Continuous Integration,持续集成)/CD(Continuous Delivery,持续交付)工具在构建完成后通过本地执行单元测试案例来实现代码采集,而这种方式并不能真实反馈代码部署后测试环境的质量情况,并未与自动化测试相结合。而本申请实施例中,通过在自动化测试结束后,也即测试案例集合中所有的测试案例执行结束后再采集相关数据并进行分析的方式,可以有效的评估测试环境自动化测试案例的有效性,从而保障测试质量。In this application, the code coverage data of all node services in the distributed system will be obtained only after all the test cases in the test case set are executed. The traditional coverage collection stage is in the latter stage of the code construction process. Through CI (Continuous Integration, continuous integration) / CD (Continuous Delivery, continuous delivery) tools, code collection is achieved by locally executing unit test cases after the construction is completed. However, this method does not provide real feedback on the quality of the test environment after code deployment, and is not integrated with automated testing. However, in the embodiment of the present application, after the automated test is completed, that is, after the execution of all the test cases in the test case set, the relevant data is collected and analyzed, so that the validity of the automated test case in the test environment can be effectively evaluated. This ensures test quality.

步骤103:基于所述代码覆盖度数据确定所述测试案例集合的测试质量。Step 103: Determine the test quality of the test case set based on the code coverage data.

在获得代码覆盖度数据后,可以基于代码覆盖度数据进行相应的统计分析,得到可以体现自动化测试案例和软件质量的指标数据,可以指引自动化测试案例的设计和实施,提升测试质量并最终反馈到软件研发迭代的过程管理中并最终提升软件质量,也即确定测试案例集合的测试质量,帮助相应人员更好的安排处理后续的测试工作,提升测试工作效率。After the code coverage data is obtained, corresponding statistical analysis can be performed based on the code coverage data to obtain indicator data that can reflect the automated test cases and software quality, which can guide the design and implementation of automated test cases, improve the test quality, and finally feedback to the During the process management of software R&D iteration and ultimately improve the software quality, that is, to determine the test quality of the test case set, help the corresponding personnel to better arrange and handle the subsequent test work, and improve the test work efficiency.

本实施例所述自动化测试案例的质量评估方法,通过采集分布式微服务运行期数据的方式得到一种可以体现自动化测试案例和软件质量的指标数据,针对自动化测试案例的效果进行评估,有助于提升测试质量以及软件研发流程中的测试效率,实现通过同等案例或者更少的自动化测试案例数量完成软件版本质量评估以及测试流程的效果。The quality evaluation method of the automated test case described in this embodiment obtains index data that can reflect the quality of the automated test case and software by collecting distributed microservice runtime data, and evaluates the effect of the automated test case, which is helpful for Improve the test quality and test efficiency in the software development process, and achieve the effect of completing the software version quality assessment and test process through the same number of automated test cases or less.

上述实施例中,所述获得分布式系统中所有节点服务的代码覆盖度数据,可以包括:通过挂载在分布式系统中各个节点的数据采集组件在所述测试案例执行结束后采集所述分布式系统中所有节点服务的代码覆盖度数据;其中,所述数据采集组件基于预先在版本库制定的配置文件,在开发环境中通过启动脚本加载实现。In the above embodiment, the obtaining the code coverage data of all node services in the distributed system may include: collecting the distribution data after the execution of the test case is completed by using the data collection component mounted on each node in the distributed system. The code coverage data of all node services in the system; wherein, the data acquisition component is implemented by loading a startup script in the development environment based on the configuration file pre-established in the version library.

基于以上内容,自动化测试案例的质量评估方法还可以包括:在所述数据采集组件采集获得的代码覆盖度数据下载完成后,控制所述数据采集组件的采集数据归零,以备下次循环使用。Based on the above content, the quality assessment method for an automated test case may further include: after the code coverage data collected by the data collection component is downloaded, controlling the collected data of the data collection component to return to zero for the next cycle use .

一个实现中,所述基于所述代码覆盖度数据确定所述测试案例集合的测试质量,可以包括:通过HTTP调用CI/CD工具开放应用程序编程接口API,调起预先配置在所述CI/CD工具中的构建任务,实现所述测试案例集合的测试质量的确定。In one implementation, the determining the test quality of the test case set based on the code coverage data may include: calling the CI/CD tool open application programming interface API through HTTP, and calling up the pre-configured in the CI/CD. A build task in the tool that implements the determination of the test quality of the set of test cases.

图2为本申请实施例公开的一种确定测试案例集合的测试质量的流程图,结合图2所示,所述基于所述代码覆盖度数据确定所述测试案例集合的测试质量,可以包括:FIG. 2 is a flowchart of determining the test quality of a test case set disclosed in an embodiment of the present application. With reference to FIG. 2 , the determining the test quality of the test case set based on the code coverage data may include:

步骤201:从版本库拉取源代码,并基于所述源代码执行编译构建。Step 201: Pull source code from the repository, and perform compilation and construction based on the source code.

其中,所述源代码为所述测试案例集合的测试服务对应的源代码。The source code is the source code corresponding to the test service of the test case set.

步骤202:拉取所述代码覆盖度数据。Step 202: Pull the code coverage data.

步骤203:汇总所述源代码和所述代码覆盖度数据,得到所述测试案例集合的测试质量。Step 203: Summarize the source code and the code coverage data to obtain the test quality of the test case set.

确定测试案例集合的测试质量的具体实现将在后面的一个实例中详细说明,在此不再过多介绍。The specific implementation of determining the test quality of the test case set will be described in detail in a later example, and will not be described here.

图3为本申请实施例公开的另一种自动化测试案例的质量评估方法的流程图。参见图3所示,一个实现中,方法可以包括:FIG. 3 is a flowchart of another method for evaluating the quality of an automated test case disclosed in an embodiment of the present application. Referring to Figure 3, in one implementation, the method may include:

步骤301:执行测试案例集合中所有的测试案例。Step 301: Execute all test cases in the test case set.

步骤302:获得分布式系统中所有节点服务的代码覆盖度数据。Step 302: Obtain code coverage data of all node services in the distributed system.

步骤303:基于所述代码覆盖度数据确定所述测试案例集合的测试质量。Step 303: Determine the test quality of the test case set based on the code coverage data.

步骤304:基于所述测试案例的案例执行数据和所述代码覆盖度数据确定相关数据指标关联性。Step 304: Determine the correlation of relevant data indicators based on the case execution data of the test case and the code coverage data.

其中,所述相关数据指标关联性用于指导后续测试案例的设计。所述代码覆盖度数据包括代码覆盖率和版本增量代码覆盖率。The correlation of the relevant data indicators is used to guide the design of subsequent test cases. The code coverage data includes code coverage and version incremental code coverage.

该实现中,可以通过观测版本的缺陷数据来应证该指标关联性的效果。其中,缺陷数据是指每个迭代版本产生通过人工测试产生的缺陷数,可以通过缺陷级别、数量来反应版本质量。在分布式微服务架构下,自动化测试可以提高测试效率,通过自动化测试案例增加以及通过自动采集覆盖度数据评估自动化案例质量,和人工测试结果对比,可以得出前述指标采集评估的有效性。In this implementation, the effect of the correlation of the indicator can be verified by observing the defect data of the version. Among them, the defect data refers to the number of defects generated by manual testing in each iterative version, and the quality of the version can be reflected by the defect level and quantity. Under the distributed microservice architecture, automated testing can improve test efficiency. By increasing the number of automated test cases and evaluating the quality of automated cases by automatically collecting coverage data, and comparing with manual test results, the effectiveness of the aforementioned indicator collection and evaluation can be obtained.

针对分布式微服务架构的应用系统,在引入自动化测试案例平台后,通过接口API调用实现案例的自动发送和案例的管理等相关功能,由于分布式系统会部署在多个计算机系统上,通过在各节点针对每个服务挂载测试代码覆盖度采集插件,在自动化测试案例测试完成后,通过调度统一的代码覆盖度采集程序完成各个节点服务的数据采集并汇总并展示,针对应用程序的设计逻辑,通过针对性的增加测试案例来持续提升自动化测试结果的覆盖度数据,最终建立了自动化测试案例、覆盖度以及版本测试结果缺陷的关联观测数据,用于评估该方法的实际有效性,最终实现通过较少的测试案例达到较好的测试质量,保障软件开发升级的质量。For the application system of the distributed microservice architecture, after the introduction of the automated test case platform, related functions such as automatic case sending and case management are realized through the interface API call. Since the distributed system will be deployed on multiple computer systems, through the The node mounts the test code coverage collection plug-in for each service. After the automated test case test is completed, the data collection of each node service is collected, summarized and displayed by scheduling the unified code coverage collection program. For the design logic of the application, Continuously improve the coverage data of automated test results by adding test cases in a targeted manner, and finally establish the associated observation data of automated test cases, coverage, and version test results defects, which are used to evaluate the actual effectiveness of the method. Fewer test cases achieve better test quality and ensure the quality of software development and upgrades.

实际应用中,自动化测试案例的质量评估方法的实施方案的整体主要体现在分布式系统架构、集中式数据采集和分析以及整合自动化测试平台的功能等方面。In practical applications, the overall implementation scheme of the quality assessment method for automated test cases is mainly reflected in the distributed system architecture, centralized data collection and analysis, and the integration of functions of automated test platforms.

图4为本申请实施例公开的测试案例的质量评估整体架构部署实现示意图,结合图4所示,在一个具体实现中:FIG. 4 is a schematic diagram of the deployment and implementation of the overall architecture of the quality assessment of the test case disclosed in the embodiment of the present application. With reference to FIG. 4 , in a specific implementation:

方案整体流程由软件版本库上进行的软件版本管理触发,通过提交代码合并请求触发分布式服务应用的自动构建和部署工作。本方案面向分布式微服务,特点是节点多,部署复杂,从本身开发效率提升上,建立代码提交,构建,部署,自动化测试,测试覆盖度采集这个自动化流程是一个有效的提升效能的流水线方式。通过在版本库制定相应的配置文件,实现在FAT/UAT等开发环境通过启动脚本加载jacoco(第三方组件)代理的方式实现挂载jacoco代码覆盖度统计插件实现代码覆盖度数据的采集。其中的Jacoco是一款支持从运行态服务节点动态挂载后通过代理业务类,在业务类代码执行时记录代码运行数据的一个工具。The overall process of the solution is triggered by software version management on the software version library, and the automatic construction and deployment of distributed service applications is triggered by submitting code merge requests. This solution is oriented to distributed microservices, which is characterized by many nodes and complex deployment. From the improvement of its own development efficiency, the automatic process of code submission, construction, deployment, automated testing, and test coverage collection is an effective pipeline method to improve performance. By formulating the corresponding configuration file in the version library, the jacoco code coverage statistics plug-in can be mounted to realize the collection of code coverage data by loading the jacoco (third-party component) agent in the development environment such as FAT/UAT by starting the script. Among them, Jacoco is a tool that supports dynamic mounting from the running state service node through the proxy business class, and records the code running data when the business class code is executed.

自动部署完成后,通过自动部署平台触发或人工触发整体测试案例的执行。自动化测试平台执行全部所需案例后,通过HTTP调用jenkins(一个开源的CI/CD工具)开放应用程序编程接口API,调起事先配置在jenkins上的构建任务。After the automatic deployment is completed, the execution of the overall test case is triggered by the automatic deployment platform or manually. After the automated test platform executes all the required cases, it calls the Jenkins (an open source CI/CD tool) open application programming interface API through HTTP, and invokes the build tasks configured on Jenkins in advance.

构建任务启动后,先从GitLab(版本管理软件)版本库拉取目标服务同样版本的源代码执行编译构建,然后通过TCP连接到目标服务jacoco服务端口实现覆盖度数据下载并通过指令让目标服务jacoco采集数据归零。After the build task is started, first pull the source code of the same version of the target service from the GitLab (version management software) repository to execute the compilation and build, and then connect to the target service jacoco service port through TCP to download the coverage data and let the target service jacoco through the instruction Collect data to zero.

Jenkins在构建过程和采集完成后,通过执行工程配置文件中sonar((一个开源平台,用于管理源代码的质量))maven(java项目构建系统)插件配置的sonar服务地址、目标工程ID、安全认证ID等实现汇总的应用服务本次自动化测试代码覆盖度数据的上传。After the build process and collection are completed, Jenkins executes the sonar service address, target project ID, security The certification ID and other implementations implement the upload of the aggregated application service code coverage data for this automated test.

通过sonarqube(一个开源平台,用于管理源代码的质量)页面端即可查看软件工程应用服务模块的测试代码覆盖度数据,同时提供时间周期和版本迭代汇总的相关数据用于分析。结合相关案例执行数据以及代码覆盖率以及版本增量代码覆盖率等相关数据,即可以建立相关数据指标关联性,可以通过观测该数据指标变化评估软件迭代过程的质量水平。关联性体现在自动化测试案例数量和代码覆盖度数据结合后,可以有针对性的针对没有被覆盖的代码行设计转本的测试案例,从而在增加案例数量的同时,提升代码覆盖度。Through sonarqube (an open source platform for managing the quality of source code), the test code coverage data of software engineering application service modules can be viewed on the page side, and the relevant data of time cycle and version iteration summary are provided for analysis. Combined with relevant case execution data, code coverage, version incremental code coverage and other related data, the correlation of relevant data indicators can be established, and the quality level of the software iteration process can be evaluated by observing the changes in the data indicators. The correlation is reflected in the combination of the number of automated test cases and the code coverage data, so that the converted test cases can be designed for the lines of code that are not covered, so as to increase the number of cases and improve the code coverage.

通过sonarqube提供的代码文件详细覆盖情况,即可以针对性的设计相关测试案例并加入自动化案例集中,并在下次迭代执行中提升覆盖度数据指标。通过不断提升覆盖度来提升自动化测试的质量保障能力,从实现软件质量提升的最初目的。Through the detailed coverage of the code files provided by sonarqube, relevant test cases can be designed in a targeted manner and added to the automated case set, and the coverage data indicators can be improved in the next iteration execution. Improve the quality assurance capability of automated testing by continuously improving coverage, from the original purpose of software quality improvement.

通过以上方案,可以有效整合研发和测试环节,解决无效测试案例的资源投入,可以整体提升研发测试效率。传统方案中,测试局限于接口功能黑盒测试,实现自动化测试案例800余条,实际代码覆盖度采集数据为平均20~25%并未能覆盖大部分布式交互的情况。而本申请方案中,可以结合覆盖度数据以及代码文件覆盖度执行情况,针对性的设计案例120余个即可达到整体代码覆盖率50%以上的效果,同时通过版本缺陷数量观测实现了-30%缺陷减少,整体通过提升自动化案例质量大幅减少了版本优化升级的测试工作,提升了软件研发迭代效率。Through the above solutions, the R&D and testing links can be effectively integrated, the resource input of invalid test cases can be solved, and the overall R&D testing efficiency can be improved. In the traditional solution, the test is limited to the black-box test of the interface function, and more than 800 automated test cases are realized. The actual code coverage collection data is 20-25% on average and fails to cover most of the distributed interactions. In this application scheme, the coverage data and code file coverage implementation can be combined, and more than 120 targeted design cases can achieve an overall code coverage rate of more than 50%. % Defects are reduced. Overall, by improving the quality of automated cases, the test work for version optimization and upgrade has been greatly reduced, and the efficiency of software R&D iteration has been improved.

本申请技术方案针对分布式系统设计,通过配置文件、环境管理等方面解决分布式服务的数据采集以及汇总功能。此外,技术方案整体通过集成开源软件以及框架而实现,方案实现简单并具有一定的普适性和推广价值。The technical solution of the present application is designed for a distributed system, and solves the data collection and aggregation functions of distributed services through configuration files, environment management and other aspects. In addition, the overall technical solution is realized by integrating open source software and frameworks. The solution is simple to implement and has certain universality and promotion value.

对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。For the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, Certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

上述本发明公开的实施例中详细描述了方法,对于本发明的方法可采用多种形式的装置实现,因此本发明还公开了一种装置,下面给出具体的实施例进行详细说明。The method is described in detail in the above disclosed embodiments of the present invention, and the method of the present invention can be implemented by various forms of devices. Therefore, the present invention also discloses a device, and specific embodiments are given below for detailed description.

图5为本申请实施例公开的一种自动化测试案例的质量评估装置的结构示意图,参见图5所示,自动化测试案例的质量评估装置50可以包括:FIG. 5 is a schematic structural diagram of an apparatus for evaluating the quality of an automated test case disclosed in an embodiment of the present application. Referring to FIG. 5 , the apparatus for evaluating the quality of an automated test case 50 may include:

案例执行模块501,用于执行测试案例集合中所有的测试案例。The case execution module 501 is used for executing all test cases in the test case set.

数据获得模块502,用于获得分布式系统中所有节点服务的代码覆盖度数据。The data obtaining module 502 is configured to obtain the code coverage data of all node services in the distributed system.

质量确定模块503,用于基于所述代码覆盖度数据确定所述测试案例集合的测试质量。A quality determination module 503, configured to determine the test quality of the test case set based on the code coverage data.

本实施例所述自动化测试案例的质量评估装置,通过采集分布式微服务运行期数据的方式得到一种可以体现自动化测试案例和软件质量的指标数据,针对自动化测试案例的效果进行评估,有助于提升测试质量以及软件研发流程中的测试效率,实现通过同等案例或者更少的自动化测试案例数量完成软件版本质量评估以及测试流程的效果。The quality evaluation device of the automated test case described in this embodiment obtains index data that can reflect the quality of the automated test case and software by collecting distributed microservice runtime data, and evaluates the effect of the automated test case, which is helpful for Improve the test quality and test efficiency in the software development process, and achieve the effect of completing the software version quality assessment and test process through the same number of automated test cases or less.

一个实现中,所述数据获得模块具体用于:通过挂载在分布式系统中各个节点的数据采集组件在所述测试案例执行结束后采集所述分布式系统中所有节点服务的代码覆盖度数据。其中,所述数据采集组件基于预先在版本库制定的配置文件,在开发环境中通过启动脚本加载实现。In one implementation, the data acquisition module is specifically configured to: collect the code coverage data of all node services in the distributed system after the execution of the test case is completed through the data acquisition component mounted on each node in the distributed system. . Wherein, the data acquisition component is implemented by loading a startup script in a development environment based on a configuration file previously formulated in the version library.

一个实现中,数据获得模块还用于:在所述数据采集组件采集获得的代码覆盖度数据下载完成后,控制所述数据采集组件的采集数据归零。In one implementation, the data acquisition module is further configured to: after the download of the code coverage data acquired by the data acquisition component is completed, control the acquisition data of the data acquisition component to return to zero.

一个实现中,质量确定模块具体用于:通过HTTP调用CI/CD工具开放应用程序编程接口API,调起预先配置在所述CI/CD工具中的构建任务,实现所述测试案例集合的测试质量的确定。In one implementation, the quality determination module is specifically used for: calling the CI/CD tool open application programming interface API through HTTP, calling up the construction task preconfigured in the CI/CD tool, and realizing the test quality of the test case collection. ok.

图6为本申请实施例公开的一种质量确定模块的结构示意图。结合图6所示,一个实现中,所述质量确定模块503包括:FIG. 6 is a schematic structural diagram of a quality determination module disclosed in an embodiment of the present application. 6, in one implementation, the quality determination module 503 includes:

代码拉取模块601,用于从版本库拉取源代码,并基于所述源代码执行编译构建,所述源代码为所述测试案例集合的测试服务对应的源代码。The code pulling module 601 is configured to pull source code from the repository, and execute compilation and construction based on the source code, where the source code is the source code corresponding to the test service of the test case set.

数据拉取模块602,用于拉取所述代码覆盖度数据。A data pulling module 602 is configured to pull the code coverage data.

数据处理模块603,用于汇总所述源代码和所述代码覆盖度数据,得到所述测试案例集合的测试质量。The data processing module 603 is configured to summarize the source code and the code coverage data to obtain the test quality of the test case set.

一个实现中,自动化测试案例的质量评估装置还包括:指标关联模块,用于基于所述测试案例的案例执行数据和所述代码覆盖度数据确定相关数据指标关联性,所述相关数据指标关联性用于指导后续测试案例的设计。In one implementation, the quality assessment device for an automated test case further includes an indicator association module, configured to determine the correlation of relevant data indicators based on the case execution data of the test case and the code coverage data, and the correlation of the relevant data indicators. Used to guide the design of subsequent test cases.

上述实施例中的所述的任意一种自动化测试案例的质量评估装置包括处理器和存储器,上述实施例中的案例执行模块、数据获得模块、质量确定模块、代码拉取模块、数据拉取模块、数据处理模块等均作为程序模块存储在存储器中,由处理器执行存储在所述存储器中的上述程序模块来实现相应的功能。The quality assessment device for any automated test case described in the foregoing embodiment includes a processor and a memory. In the foregoing embodiment, a case execution module, a data acquisition module, a quality determination module, a code pulling module, and a data pulling module are included. , data processing modules, etc. are all stored in the memory as program modules, and the processor executes the above-mentioned program modules stored in the memory to realize corresponding functions.

处理器中包含内核,由内核去存储器中调取相应的程序模块。内核可以设置一个或多个,通过调整内核参数来实现回访数据的处理。The processor includes a kernel, and the kernel calls the corresponding program module from the memory. The kernel can set one or more, and realize the processing of return data by adjusting the kernel parameters.

存储器可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM),存储器包括至少一个存储芯片。Memory may include non-persistent memory in computer readable media, random access memory (RAM) and/or non-volatile memory, such as read only memory (ROM) or flash memory (flash RAM), the memory including at least one memory chip.

本发明实施例提供了一种存储介质,其上存储有程序,该程序被处理器执行时实现上述实施例中所述的自动化测试案例的质量评估方法。Embodiments of the present invention provide a storage medium on which a program is stored, and when the program is executed by a processor, implements the method for evaluating the quality of an automated test case described in the foregoing embodiments.

本发明实施例提供了一种处理器,所述处理器用于运行程序,其中,所述程序运行时执行上述实施例中所述的自动化测试案例的质量评估方法。An embodiment of the present invention provides a processor for running a program, wherein when the program runs, the method for evaluating the quality of an automated test case described in the foregoing embodiment is executed.

进一步,本实施例提供了一种电子设备,包括处理器以及存储器。其中存储器用于存储所述处理器的可执行指令,所述处理器配置为经由执行所述可执行指令来执行上述实施例中所述的自动化测试案例的质量评估方法。Further, this embodiment provides an electronic device including a processor and a memory. The memory is used for storing executable instructions of the processor, and the processor is configured to execute the quality assessment method of the automated test case described in the above embodiments by executing the executable instructions.

本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant part can be referred to the description of the method.

还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should also be noted that in this document, relational terms such as first and second are used only to distinguish one entity or operation from another, and do not necessarily require or imply those entities or operations There is no such actual relationship or order between them. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device that includes a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.

结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of a method or algorithm described in conjunction with the embodiments disclosed herein may be directly implemented in hardware, a software module executed by a processor, or a combination of the two. A software module can be placed in random access memory (RAM), internal memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other in the technical field. in any other known form of storage medium.

对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments enables any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A quality evaluation method for an automated test case is characterized by comprising the following steps:
executing all the test cases in the test case set;
obtaining code coverage data of all node services in a distributed system;
determining a test quality for the set of test cases based on the code coverage data.
2. The method for automatically evaluating the quality of a test case according to claim 1, wherein the obtaining code coverage data of all node services in the distributed system comprises:
acquiring code coverage data of all node services in the distributed system after the execution of the test case is finished through a data acquisition component mounted on each node in the distributed system;
the data acquisition component is realized by loading a start script in a development environment based on a configuration file which is made in a version library in advance.
3. The method for automatically evaluating the quality of test cases of claim 2, further comprising:
and after the code coverage data acquired by the data acquisition assembly is downloaded, controlling the acquired data of the data acquisition assembly to return to zero.
4. The method of claim 1, wherein determining the test quality of the set of test cases based on the code coverage data comprises:
and calling an open Application Programming Interface (API) of the CI/CD tool through HTTP, calling a construction task which is pre-configured in the CI/CD tool, and determining the test quality of the test case set.
5. The method of claim 1, wherein determining the test quality of the set of test cases based on the code coverage data comprises:
pulling a source code from a version library, and executing compiling construction based on the source code, wherein the source code is a source code corresponding to the test service of the test case set;
pulling the code coverage data;
and summarizing the source codes and the code coverage data to obtain the test quality of the test case set.
6. The method for automatically evaluating the quality of a test case according to claim 1, further comprising, after obtaining the code coverage data of all node services in the distributed system:
determining a correlation data index correlation based on the case execution data of the test case and the code coverage data, the correlation data index correlation being used to guide the design of subsequent test cases.
7. The method for quality assessment of automated test cases according to any of claims 1 to 6, wherein said code coverage data comprises code coverage and version delta code coverage.
8. An automated test case quality assessment apparatus, comprising:
the case execution module is used for executing all the test cases in the test case set;
the data acquisition module is used for acquiring code coverage data of all node services in the distributed system;
a quality determination module to determine a test quality of the set of test cases based on the code coverage data.
9. The apparatus for quality assessment of automated test cases of claim 8, wherein the data acquisition module is specifically configured to: acquiring code coverage data of all node services in the distributed system after the execution of the test case is finished through a data acquisition component mounted on each node in the distributed system;
the data acquisition component is realized by loading a start script in a development environment based on a configuration file which is made in a version library in advance.
10. The automated test case quality assessment apparatus of claim 8, wherein said quality determination module comprises:
the code pulling module is used for pulling a source code from the version library and executing compiling construction based on the source code, wherein the source code is the source code corresponding to the test service of the test case set;
the data pulling module is used for pulling the code coverage data;
and the data processing module is used for summarizing the source code and the code coverage data to obtain the test quality of the test case set.
CN202111642151.3A 2021-12-29 2021-12-29 Quality evaluation method and device for automatic test case Pending CN114297071A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111642151.3A CN114297071A (en) 2021-12-29 2021-12-29 Quality evaluation method and device for automatic test case

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111642151.3A CN114297071A (en) 2021-12-29 2021-12-29 Quality evaluation method and device for automatic test case

Publications (1)

Publication Number Publication Date
CN114297071A true CN114297071A (en) 2022-04-08

Family

ID=80970790

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111642151.3A Pending CN114297071A (en) 2021-12-29 2021-12-29 Quality evaluation method and device for automatic test case

Country Status (1)

Country Link
CN (1) CN114297071A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104391795A (en) * 2014-12-03 2015-03-04 北京京东尚科信息技术有限公司 Method and system for automatically testing coverage rate in distributed system
US20170132119A1 (en) * 2015-09-25 2017-05-11 EMC IP Holding Company LLC Method and device for retrieving test case based on code coverage
CN109614341A (en) * 2018-12-29 2019-04-12 微梦创科网络科技(中国)有限公司 A method and system for testing code coverage
CN112214414A (en) * 2020-10-29 2021-01-12 平安银行股份有限公司 Coverage rate processing method, device, equipment and medium based on automatic test
CN112817865A (en) * 2021-02-24 2021-05-18 福建天泉教育科技有限公司 Coverage precision test method and system based on componentized distributed system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104391795A (en) * 2014-12-03 2015-03-04 北京京东尚科信息技术有限公司 Method and system for automatically testing coverage rate in distributed system
US20170132119A1 (en) * 2015-09-25 2017-05-11 EMC IP Holding Company LLC Method and device for retrieving test case based on code coverage
CN109614341A (en) * 2018-12-29 2019-04-12 微梦创科网络科技(中国)有限公司 A method and system for testing code coverage
CN112214414A (en) * 2020-10-29 2021-01-12 平安银行股份有限公司 Coverage rate processing method, device, equipment and medium based on automatic test
CN112817865A (en) * 2021-02-24 2021-05-18 福建天泉教育科技有限公司 Coverage precision test method and system based on componentized distributed system

Similar Documents

Publication Publication Date Title
CN102880546B (en) Software integration testing method and system based on extensible markup language (XML) database
US9740594B2 (en) Automated debug trace specification
US8024615B2 (en) Steady state computer testing
US20180246803A1 (en) Targeted software testing
US20140013306A1 (en) Computer Load Generator Marketplace
US20130282545A1 (en) Marketplace for Monitoring Services
US20140013308A1 (en) Application Development Environment with Services Marketplace
CN107302475A (en) The method of testing and device of a kind of Based on Distributed storage cluster
CN102866944B (en) Pressure testing system and method
US9672139B2 (en) Debugging in a production environment
CN102597970A (en) Systems and methods for resource leak detection
CN110196809B (en) Interface testing method and device
CN111782207B (en) Task stream code generation method, device, equipment and storage medium
CN105426310A (en) Method and apparatus for detecting performance of target process
CN111290936A (en) Interface testing method and device
EP2913757A1 (en) Method, system, and computer software product for test automation
CN114116509B (en) Program analysis method, device, electronic device and storage medium
CN107729239A (en) A kind of code coverage statistical method, system, device and computer-readable storage medium
CN114297071A (en) Quality evaluation method and device for automatic test case
CN110134498A (en) A method and device for evaluating application compatibility
CN106294053A (en) A kind of internal memory performance method of testing and device
US20160013989A1 (en) Service discovery and/or effort estimation in networked computing environments
CN116578282A (en) Code generation method, device, electronic equipment and medium
CN114817016A (en) A kind of script performance testing method and device
CN113360373A (en) Test method for full traversal of Activity page of mobile application

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