






技术领域technical field
本公开涉及软件测试领域,尤其涉及一种软件测试方法、系统、存储介质及计算机设备。The present disclosure relates to the field of software testing, and in particular, to a software testing method, system, storage medium and computer device.
背景技术Background technique
在软件测试领域中,测试用例(Test Case)用于对软件进行测试任务的描述。换言之,测试用例是为某个特定目标而编写的一组测试输入、执行条件以及预期结果,以用于核实软件是否满足某个特定需求。In the field of software testing, test cases (Test Cases) are used to describe software testing tasks. In other words, a test case is a set of test inputs, execution conditions, and expected results written for a specific goal to verify that the software satisfies a specific requirement.
相关技术中,测试人员为软件编写的测试用例在生成后会一直被保留下来。相应地,在测试该软件的功能时,相关技术通常采取的做法是回归该软件全部功能对应的测试用例,即回归当前的全量测试用例。这种处理方式会极大地增加测试人员的工作量,使得测试的时间成本和人力成本骤增。举例来说,时下随着产品需求的不断增加,测试人员为该软件编写的测试用例可能会越来越多,相应地,在回归该软件的测试用例时所需的时间也会随之增加,进而导致测试项目组需要不断增加测试人员来满足业务需求。In the related art, the test cases written by the tester for the software will always be retained after being generated. Correspondingly, when testing the functions of the software, the method usually adopted by related technologies is to return to the test cases corresponding to all the functions of the software, that is, to return to the current full test cases. This processing method will greatly increase the workload of the testers, causing the time cost and labor cost of the test to increase sharply. For example, with the continuous increase of product demand nowadays, testers may write more and more test cases for the software, correspondingly, the time required to return the test cases of the software will also increase accordingly, As a result, the test project team needs to continuously increase the number of testers to meet the business needs.
鉴于以上情况,为了降低回归测试用例的时间成本和人力成本,时下亟需一种新的软件测试方案。In view of the above situation, in order to reduce the time cost and labor cost of regression test cases, a new software testing solution is urgently needed.
发明内容SUMMARY OF THE INVENTION
本公开提供一种软件测试方法、系统、存储介质及计算机设备,极大地降低了回归测试用例的时间成本和人力成本。本公开的技术方案如下:The present disclosure provides a software testing method, system, storage medium and computer equipment, which greatly reduces the time cost and labor cost of regression test cases. The technical solutions of the present disclosure are as follows:
根据本公开实施例的第一方面,提供一种软件测试方法,所述方法包括:According to a first aspect of the embodiments of the present disclosure, there is provided a software testing method, the method comprising:
确定待测试软件的测试用例集合中包含的测试用例对应的软件功能;Determine the software functions corresponding to the test cases included in the test case set of the software to be tested;
获取所述测试用例集合中包含的测试用例对应的测试优先级分值;其中,所述测试优先级分值用于反映所述测试用例的重要级别;Obtain the test priority score corresponding to the test case included in the test case set; wherein, the test priority score is used to reflect the importance level of the test case;
按照所述测试优先级分值,在所述测试用例集合中确定部分软件功能对应的测试用例进行回归测试;According to the test priority score, determine the test cases corresponding to some software functions in the test case set for regression testing;
其中,所述测试优先级分值是基于所述测试用例的基础属性数据确定;所述基础属性数据包括:所述测试用例对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度。Wherein, the test priority score is determined based on the basic attribute data of the test case; the basic attribute data includes: the priority of the software function corresponding to the test case, the number of lines of code changes, the amount of included functions, the underlying Code volume, historical bug count, and use case similarity.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
根据所述测试用例集合中包含的测试用例各自对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度,为所述测试用例集合中包含的测试用例分别配置测试优先级分值。According to the priority of the software functions corresponding to the test cases contained in the test case set, the number of lines of code change, the amount of included functions, the amount of underlying code, the number of historical errors and the similarity of the test cases, the test cases contained in the test case set are Test cases are configured with test priority scores respectively.
在一种可能的实现方式中,所述根据所述测试用例集合中包含的测试用例各自对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度,为所述测试用例集合中包含的测试用例分别配置测试优先级分值,包括:In a possible implementation manner, according to the priority of the software functions corresponding to the test cases included in the test case set, the number of lines of code changes, the amount of included functions, the amount of underlying code, the number of historical errors and the similarity of the use cases The test priority scores are respectively configured for the test cases included in the test case set, including:
对于所述测试用例集合中的任意一条测试用例,每当所述测试用例的基础属性数据满足第一条件集合中的一项条件时,为所述测试用例进行一次分值累加;将最终得到的累加结果作为所述测试用例的测试优先级分值;For any test case in the test case set, whenever the basic attribute data of the test case satisfies a condition in the first condition set, a score accumulation is performed for the test case; The accumulated result is used as the test priority score of the test case;
其中,所述第一条件集合包括:所述测试用例对应的代码变更行数大于第一阈值;所述测试用例对应的历史错误数大于第二阈值;所述测试用例对应的软件功能的优先级大于第一级别;所述测试用例对应的用例相似度大于第一百分比;所述测试用例对应的包含函数量大于第三阈值;所述测试用例对应的底层代码量大于第四阈值。The first condition set includes: the number of code change lines corresponding to the test case is greater than a first threshold; the number of historical errors corresponding to the test case is greater than a second threshold; the priority of the software function corresponding to the test case greater than the first level; the similarity of the use cases corresponding to the test cases is greater than the first percentage; the amount of included functions corresponding to the test cases is greater than the third threshold; the amount of underlying code corresponding to the test cases is greater than the fourth threshold.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
对于所述测试用例集合中的任意一条测试用例,响应于所述测试用例满足第二条件集合中的条件,删除所述测试用例;For any test case in the test case set, in response to the test case satisfying the conditions in the second condition set, delete the test case;
其中,所述第二条件集合包括:所述测试用例对应的代码被删除;所述测试用例对应的代码包含在所述测试用例集合的其他测试用例对应的代码中;所述测试用例对应的软件功能被删除;所述测试用例对应的测试优先级分值低于目标阈值;所述测试用例对应的用例相似度大于目标百分比。The second condition set includes: the code corresponding to the test case is deleted; the code corresponding to the test case is included in the code corresponding to other test cases in the test case set; the software corresponding to the test case The function is deleted; the test priority score corresponding to the test case is lower than the target threshold; the similarity degree of the test case corresponding to the test case is greater than the target percentage.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
对于所述测试用例集合中的任意一条测试用例,在执行所述测试用例的过程中,收集所述待测试软件的项目代码中的被执行代码;响应于所述测试用例执行完毕,停止收集代码;将所述被执行代码确定为所述测试用例对应的代码。For any test case in the test case set, in the process of executing the test case, collect the executed code in the project code of the software to be tested; in response to the completion of the test case execution, stop collecting the code ; Determine the executed code as the code corresponding to the test case.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
在所述待测试软件的项目代码中每个方法的第一行均添加一行指定代码;其中,一行指定代码中包含一个方法对应的包名、类名和方法名;A line of specified code is added to the first line of each method in the project code of the software to be tested; wherein, a line of specified code includes a package name, class name and method name corresponding to a method;
在执行所述测试用例的过程中,将通过目标代码分析框架获取到的被执行代码对应的包名、类名和方法名,作为所述测试用例对应的代码的包名、类名和方法名。In the process of executing the test case, the package name, class name and method name corresponding to the executed code obtained through the target code analysis framework are used as the package name, class name and method name of the code corresponding to the test case.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
显示多个测试用例模板;Display multiple test case templates;
在所述多个测试用例模板中确定被用户选中的目标测试用例模板;determining the target test case template selected by the user from the multiple test case templates;
获取用户输入的待创建测试用例对应的前置条件、软件功能、期待输出结果和优先级信息;其中,所述前置条件用于指示执行所述待创建测试用例需要满足的条件;Obtain the preconditions, software functions, expected output results and priority information corresponding to the test case to be created input by the user; wherein, the preconditions are used to indicate the conditions that need to be satisfied to execute the test case to be created;
根据获取到的用户输入信息和所述目标测试用例模板进行测试用例创建。A test case is created according to the obtained user input information and the target test case template.
根据本公开实施例的第二方面,提供一种软件测试系统,所述系统包括:According to a second aspect of the embodiments of the present disclosure, there is provided a software testing system, the system comprising:
软件功能确定模块,被配置为确定待测试软件的测试用例集合中包含的测试用例对应的软件功能;a software function determination module, configured to determine the software functions corresponding to the test cases included in the test case set of the software to be tested;
获取模块,被配置为获取所述测试用例集合中包含的测试用例对应的测试优先级分值;其中,所述测试优先级分值用于反映所述测试用例的重要级别;an obtaining module, configured to obtain the test priority score corresponding to the test case included in the test case set; wherein, the test priority score is used to reflect the importance level of the test case;
测试模块,被配置为按照所述测试优先级分值,在所述测试用例集合中确定部分软件功能对应的测试用例进行回归测试;a test module, configured to perform regression testing by determining, in the test case set, test cases corresponding to some software functions according to the test priority score;
其中,所述测试优先级分值是基于所述测试用例的基础属性数据确定;所述基础属性数据包括:所述测试用例对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度。Wherein, the test priority score is determined based on the basic attribute data of the test case; the basic attribute data includes: the priority of the software function corresponding to the test case, the number of lines of code changes, the amount of included functions, the underlying Code volume, historical bug count, and use case similarity.
在一种可能的实现方式中,所述系统还包括:In a possible implementation, the system further includes:
优先级确定模块,被配置为根据所述测试用例集合中包含的测试用例各自对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度,为所述测试用例集合中包含的测试用例分别配置测试优先级分值。The priority determination module is configured to, according to the priority of the software functions corresponding to the test cases included in the test case set, the number of lines of code change, the amount of included functions, the amount of underlying code, the number of historical errors and the similarity of the use cases, as The test cases included in the test case set are respectively configured with test priority scores.
在一种可能的实现方式中,所述优先级确定模块,被配置为:In a possible implementation manner, the priority determination module is configured to:
对于所述测试用例集合中的任意一条测试用例,每当所述测试用例的基础属性数据满足第一条件集合中的一项条件时,为所述测试用例进行一次分值累加;将最终得到的累加结果作为所述测试用例的测试优先级分值;For any test case in the test case set, whenever the basic attribute data of the test case satisfies a condition in the first condition set, a score accumulation is performed for the test case; The accumulated result is used as the test priority score of the test case;
其中,所述第一条件集合包括:所述测试用例对应的代码变更行数大于第一阈值;所述测试用例对应的历史错误数大于第二阈值;所述测试用例对应的软件功能的优先级大于第一级别;所述测试用例对应的用例相似度大于第一百分比;所述测试用例对应的包含函数量大于第三阈值;所述测试用例对应的底层代码量大于第四阈值。The first condition set includes: the number of code change lines corresponding to the test case is greater than a first threshold; the number of historical errors corresponding to the test case is greater than a second threshold; the priority of the software function corresponding to the test case greater than the first level; the similarity of the use cases corresponding to the test cases is greater than the first percentage; the amount of included functions corresponding to the test cases is greater than the third threshold; the amount of underlying code corresponding to the test cases is greater than the fourth threshold.
在一种可能的实现方式中,所述系统还包括:In a possible implementation, the system further includes:
删除模块,被配置为对于所述测试用例集合中的任意一条测试用例,响应于所述测试用例满足第二条件集合中的条件,删除所述测试用例;a deletion module, configured to, for any test case in the test case set, delete the test case in response to the test case satisfying the conditions in the second condition set;
其中,所述第二条件集合包括:所述测试用例对应的代码被删除;所述测试用例对应的代码包含在所述测试用例集合的其他测试用例对应的代码中;所述测试用例对应的软件功能被删除;所述测试用例对应的测试优先级分值低于目标阈值;所述测试用例对应的用例相似度大于目标百分比。The second condition set includes: the code corresponding to the test case is deleted; the code corresponding to the test case is included in the code corresponding to other test cases in the test case set; the software corresponding to the test case The function is deleted; the test priority score corresponding to the test case is lower than the target threshold; the similarity degree of the test case corresponding to the test case is greater than the target percentage.
在一种可能的实现方式中,所述系统还包括:In a possible implementation, the system further includes:
对应关系确定模块,被配置为:对于所述测试用例集合中的任意一条测试用例,在执行所述测试用例的过程中,收集所述待测试软件的项目代码中的被执行代码;响应于所述测试用例执行完毕,停止收集代码;将所述被执行代码确定为所述测试用例对应的代码。The corresponding relationship determination module is configured to: for any test case in the test case set, in the process of executing the test case, collect the executed code in the project code of the software to be tested; After the execution of the test case is completed, the code collection is stopped; the executed code is determined as the code corresponding to the test case.
在一种可能的实现方式中,所述对应关系确定模块,被配置为:In a possible implementation manner, the corresponding relationship determination module is configured to:
在所述待测试软件的项目代码中每个方法的第一行均添加一行指定代码;其中,一行指定代码中包含一个方法对应的包名、类名和方法名;A line of specified code is added to the first line of each method in the project code of the software to be tested; wherein, a line of specified code includes a package name, class name and method name corresponding to a method;
在执行所述测试用例的过程中,将通过目标代码分析框架获取到的被执行代码对应的包名、类名和方法名,作为所述测试用例对应的代码的包名、类名和方法名。In the process of executing the test case, the package name, class name and method name corresponding to the executed code obtained through the target code analysis framework are used as the package name, class name and method name of the code corresponding to the test case.
在一种可能的实现方式中,所述系统还包括:In a possible implementation, the system further includes:
创建模块,被配置为显示多个测试用例模板;在所述多个测试用例模板中确定被用户选中的目标测试用例模板;获取用户输入的待创建测试用例对应的前置条件、软件功能、期待输出结果和优先级信息;其中,所述前置条件用于指示执行所述待创建测试用例需要满足的条件;根据获取到的用户输入信息和所述目标测试用例模板进行测试用例创建。The creation module is configured to display multiple test case templates; the target test case template selected by the user is determined in the multiple test case templates; the preconditions, software functions, expectations corresponding to the test cases to be created input by the user are obtained Output results and priority information; wherein, the preconditions are used to indicate the conditions that need to be met to execute the to-be-created test case; and the test case is created according to the obtained user input information and the target test case template.
根据本公开实施例的第三方面,提供一种计算机设备,包括:According to a third aspect of the embodiments of the present disclosure, there is provided a computer device, comprising:
处理器;processor;
用于存储所述处理器可执行指令的存储器;a memory for storing the processor-executable instructions;
其中,所述处理器被配置为执行所述指令,以实现上述的软件测试方法。Wherein, the processor is configured to execute the instructions to implement the above-mentioned software testing method.
根据本公开实施例的第四方面,提供一种计算机可读存储介质,当所述存储介质中的指令由计算机设备的处理器执行时,使得计算机设备能够执行上述的软件测试方法。According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, when instructions in the storage medium are executed by a processor of a computer device, the computer device can execute the above software testing method.
根据本公开实施例的第五方面,提供一种计算机程序产品,当所述计算机程序产品中的指令由计算机设备的处理器执行时,使得计算机设备能够执行上述的软件测试方法。According to a fifth aspect of the embodiments of the present disclosure, there is provided a computer program product, which enables the computer device to execute the above-mentioned software testing method when the instructions in the computer program product are executed by the processor of the computer device.
本公开的实施例提供的技术方案至少带来以下有益效果:The technical solutions provided by the embodiments of the present disclosure bring at least the following beneficial effects:
在软件测试过程中,本公开实施例实现了基于测试用例集合中测试用例对应的测试优先级分值,筛选部分软件功能对应的测试用例进行回归测试,极大地减少了需要进行回归测试的测试用例数量。另外,测试优先级分值是基于测试用例的基础属性数据确定的;而基础属性数据包括:测试用例对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度。由于综合了多方面因素来评定测试用例的优先级,因此得到的测试优先级分值较为精准,基于精准的测试优先级分值能够在测试用例集合中准确筛选出部分测试用例进行回归测试,极大地降低了回归测试用例的时间成本和人力成本。In the process of software testing, the embodiments of the present disclosure realize that based on the test priority scores corresponding to the test cases in the test case set, the test cases corresponding to some software functions are screened for regression testing, which greatly reduces the number of test cases that need to be subjected to regression testing. quantity. In addition, the test priority score is determined based on the basic attribute data of the test case; and the basic attribute data includes: the priority of the software function corresponding to the test case, the number of lines of code changes, the amount of included functions, the amount of underlying code, and the number of historical errors and use case similarity. Due to the combination of various factors to evaluate the priority of test cases, the obtained test priority scores are relatively accurate. Based on the accurate test priority scores, some test cases can be accurately screened out of the test case set for regression testing. Greatly reduces the time cost and labor cost of regression test cases.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理,并不构成对本公开的不当限定。The accompanying drawings, which are incorporated into and constitute a part of this specification, illustrate embodiments consistent with the present disclosure, and together with the description, serve to explain the principles of the present disclosure and do not unduly limit the present disclosure.
图1是根据一示例性实施例示出的一种测试用例的生命周期流程的示意图。FIG. 1 is a schematic diagram of a life cycle process of a test case according to an exemplary embodiment.
图2是根据一示例性实施例示出的另一种测试用例的生命周期流程的示意图。FIG. 2 is a schematic diagram of another test case life cycle process according to an exemplary embodiment.
图3是根据一示例性实施例示出的一种软件测试方法的流程图。Fig. 3 is a flowchart of a software testing method according to an exemplary embodiment.
图4是根据一示例性实施例示出的另一种软件测试方法的流程图。Fig. 4 is a flowchart of another software testing method according to an exemplary embodiment.
图5是根据一示例性实施例示出的一种软件测试系统的框图。Fig. 5 is a block diagram of a software testing system according to an exemplary embodiment.
图6是根据一示例性实施例示出的另一种软件测试系统的框图。Fig. 6 is a block diagram of another software testing system according to an exemplary embodiment.
图7是根据一示例性实施例示出的一种计算机设备的框图。Fig. 7 is a block diagram of a computer device according to an exemplary embodiment.
具体实施方式Detailed ways
为了使本领域普通人员更好地理解本公开的技术方案,下面将结合附图,对本公开实施例中的技术方案进行清楚、完整地描述。In order to make those skilled in the art better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
需要说明的是,本公开的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本公开的实施例能够以除了在这里图示或描述的那些以外的顺序实施。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。It should be noted that the terms "first", "second" and the like in the description and claims of the present disclosure and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence. It is to be understood that the data so used may be interchanged under appropriate circumstances such that the embodiments of the disclosure described herein can be practiced in sequences other than those illustrated or described herein. The implementations described in the illustrative examples below are not intended to represent all implementations consistent with this disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as recited in the appended claims.
本公开所涉及的用户信息可以为经用户授权或者经过各方充分授权的信息。The user information involved in the present disclosure may be information authorized by the user or fully authorized by all parties.
在对本公开实施例进行详细解释说明之前,先对本公开实施例的名词术语进行介绍。Before explaining the embodiments of the present disclosure in detail, the terminology of the embodiments of the present disclosure will be introduced first.
测试用例:是指对软件进行测试任务的描述。示例性地,其内容包括测试目标、测试环境、输入数据、测试步骤、预期结果、测试脚本等,最终形成文档。换言之,测试用例是为某个特定目标而编写的一组测试输入、执行条件以及预期结果,以用于核实软件是否满足某个特定需求。Test case: refers to the description of the software testing task. Exemplarily, its contents include test objectives, test environments, input data, test steps, expected results, test scripts, etc., and finally form a document. In other words, a test case is a set of test inputs, execution conditions, and expected results written for a specific goal to verify that the software satisfies a specific requirement.
下面对本公开实施例提供的软件测试方法涉及的实施环境进行介绍。The implementation environment involved in the software testing method provided by the embodiments of the present disclosure will be introduced below.
本公开实施例提供的软件测试方法能够应用于软件测试系统(也被称为软件测试平台)。在一些实施方式中,该软件测试系统为全流程自动化测试系统。The software testing method provided by the embodiments of the present disclosure can be applied to a software testing system (also referred to as a software testing platform). In some embodiments, the software testing system is a full-process automated testing system.
在一些实施方式中,该软件测试系统包括测试前端和测试后端。其中,测试前端使用Bootstrap、jQuery、CSS(Cascading Style Sheets,层叠样式表)、HTML(HyperTextMarkupLanguage,超文本标记语言)等技术框架。测试后端使用Java语言、SpringBoot、Mybatis开源框架编写接口,数据库使用Mysql存储数据。In some embodiments, the software testing system includes a test front end and a test back end. Among them, the test front-end uses technical frameworks such as Bootstrap, jQuery, CSS (Cascading Style Sheets, Cascading Style Sheets), HTML (HyperTextMarkupLanguage, Hypertext Markup Language). The test backend uses Java language, SpringBoot, Mybatis open source framework to write interfaces, and the database uses Mysql to store data.
在软件测试流程中,该软件测试系统能够对测试用例的生命周期进行管理。In the software testing process, the software testing system can manage the life cycle of test cases.
在一些实施方式中,测试用例的生命周期流程如图1所示,即测试用例的生命周期包括:测试用例新建、测试用例执行、测试用例分析、测试用例优选和测试用例淘汰。In some embodiments, the life cycle process of a test case is shown in FIG. 1 , that is, the life cycle of a test case includes: test case creation, test case execution, test case analysis, test case selection, and test case elimination.
参见图2,测试用例新建步骤用于创建测试用例,且新创建的测试用例会进入到测试用例集合,本步骤即是根据用户需求创建测试用例集合;测试用例分析步骤用于分析出核心主干的测试用例从而形成回归用例集合;测试用例优选步骤用于去除重复的测试用例进而形成冒烟用例集合;在测试用例执行步骤,如果软件发生代码变更,则执行相关的测试用例进行测试,进而形成执行用例集合;测试用例淘汰步骤用于去除无用的测试用例,进而形成淘汰用例集合。Referring to Figure 2, the test case creation step is used to create a test case, and the newly created test case will enter the test case collection. This step is to create a test case collection according to user requirements; the test case analysis step is used to analyze the core backbone. The test case is used to form a regression case set; the test case optimization step is used to remove duplicate test cases to form a smoking case set; in the test case execution step, if the code changes in the software, the relevant test cases are executed for testing, and then the execution is formed. Use case collection; the test case elimination step is used to remove useless test cases, thereby forming a collection of eliminated use cases.
在本公开实施例中,该软件测试系统在软件测试过程中对测试用例的生命周期进行管理。另外,该软件测试系统还能够通过JavaParser技术分析出待测试软件的项目代码与测试用例之间的对应关系。另外,该软件测试系统对测试用例进行评级的因素包括但不限于:代码变更数(开发人员增加或删除代码导致的变更代码行数)、历史bug情况(历史出现的bug个数)、功能优先级、包含函数量(调用代码方法个数)、底层代码量(项目代码中的基础框架代码)。采用上述方案能够安全地删除无用的测试用例,并对测试用例进行评级,进而测试人员能够有针对性地回归测试用例,降低回归测试用例的时间成本和人力成本。In the embodiment of the present disclosure, the software testing system manages the life cycle of the test case during the software testing process. In addition, the software testing system can also analyze the correspondence between the project code of the software to be tested and the test case through the JavaParser technology. In addition, the software testing system ranks test cases based on factors including, but not limited to: number of code changes (number of lines of code changed due to developers adding or deleting code), historical bugs (number of bugs in history), function priority level, the amount of included functions (the number of calling code methods), and the amount of underlying code (the basic framework code in the project code). Using the above solution, useless test cases can be safely deleted, and test cases can be rated, so that testers can return test cases in a targeted manner, reducing the time cost and labor cost of regression test cases.
下面通过以下实施例对本公开实施例提供的软件测试方案进行详细地解释说明。The software testing solutions provided by the embodiments of the present disclosure will be explained in detail below through the following embodiments.
图3是根据一示例性实施例示出的一种软件测试方法的流程图,如图3所示,该方法用于软件测试系统,包括以下步骤。Fig. 3 is a flowchart of a software testing method according to an exemplary embodiment. As shown in Fig. 3 , the method is used in a software testing system and includes the following steps.
在步骤301中,确定待测试软件的测试用例集合中包含的测试用例对应的软件功能。In
在步骤302中,获取测试用例集合中包含的测试用例对应的测试优先级分值;其中,测试优先级分值用于反映测试用例的重要级别;其中,测试优先级分值是基于测试用例的基础属性数据确定;基础属性数据包括:测试用例对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度。In
在步骤303中,按照测试优先级分值,在测试用例集合中确定部分软件功能对应的测试用例进行回归测试。In
本公开实施例提供的方法,在软件测试过程中,本公开实施例实现了基于测试用例集合中测试用例对应的测试优先级分值,筛选部分软件功能对应的测试用例进行回归测试,极大地减少了需要进行回归测试的测试用例数量。另外,测试优先级分值是基于测试用例的基础属性数据确定的;而基础属性数据包括:测试用例对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度。由于综合了多方面因素来评定测试用例的优先级,因此得到的测试优先级分值较为精准,基于精准的测试优先级分值能够在测试用例集合中准确筛选出部分测试用例进行回归测试,极大地降低了回归测试用例的时间成本和人力成本。In the method provided by the embodiments of the present disclosure, in the process of software testing, the embodiments of the present disclosure realize that based on the test priority scores corresponding to the test cases in the test case set, the test cases corresponding to some software functions are screened for regression testing, which greatly reduces the number of test cases. The number of test cases that need to be regression tested. In addition, the test priority score is determined based on the basic attribute data of the test case; and the basic attribute data includes: the priority of the software function corresponding to the test case, the number of lines of code changes, the amount of included functions, the amount of underlying code, and the number of historical errors and use case similarity. Due to the combination of various factors to evaluate the priority of test cases, the obtained test priority scores are relatively accurate. Based on the accurate test priority scores, some test cases can be accurately screened out of the test case set for regression testing. Greatly reduces the time cost and labor cost of regression test cases.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
根据所述测试用例集合中包含的测试用例各自对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度,为所述测试用例集合中包含的测试用例分别配置测试优先级分值。According to the priority of the software functions corresponding to the test cases contained in the test case set, the number of lines of code change, the amount of included functions, the amount of underlying code, the number of historical errors and the similarity of the test cases, the test cases contained in the test case set are Test cases are configured with test priority scores respectively.
在一种可能的实现方式中,所述根据所述测试用例集合中包含的测试用例各自对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度,为所述测试用例集合中包含的测试用例分别配置测试优先级分值,包括:In a possible implementation manner, according to the priority of the software functions corresponding to the test cases included in the test case set, the number of lines of code changes, the amount of included functions, the amount of underlying code, the number of historical errors and the similarity of the use cases The test priority scores are respectively configured for the test cases included in the test case set, including:
对于所述测试用例集合中的任意一条测试用例,每当所述测试用例的基础属性数据满足第一条件集合中的一项条件时,为所述测试用例进行一次分值累加;将最终得到的累加结果作为所述测试用例的测试优先级分值;For any test case in the test case set, whenever the basic attribute data of the test case satisfies a condition in the first condition set, a score accumulation is performed for the test case; The accumulated result is used as the test priority score of the test case;
其中,所述第一条件集合包括:所述测试用例对应的代码变更行数大于第一阈值;所述测试用例对应的历史错误数大于第二阈值;所述测试用例对应的软件功能的优先级大于第一级别;所述测试用例对应的用例相似度大于第一百分比;所述测试用例对应的包含函数量大于第三阈值;所述测试用例对应的底层代码量大于第四阈值。The first condition set includes: the number of code change lines corresponding to the test case is greater than a first threshold; the number of historical errors corresponding to the test case is greater than a second threshold; the priority of the software function corresponding to the test case greater than the first level; the similarity of the use cases corresponding to the test cases is greater than the first percentage; the amount of included functions corresponding to the test cases is greater than the third threshold; the amount of underlying code corresponding to the test cases is greater than the fourth threshold.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
对于所述测试用例集合中的任意一条测试用例,响应于所述测试用例满足第二条件集合中的条件,删除所述测试用例;For any test case in the test case set, in response to the test case satisfying the conditions in the second condition set, delete the test case;
其中,所述第二条件集合包括:所述测试用例对应的代码被删除;所述测试用例对应的代码包含在所述测试用例集合的其他测试用例对应的代码中;所述测试用例对应的软件功能被删除;所述测试用例对应的测试优先级分值低于目标阈值;所述测试用例对应的用例相似度大于目标百分比。The second condition set includes: the code corresponding to the test case is deleted; the code corresponding to the test case is included in the code corresponding to other test cases in the test case set; the software corresponding to the test case The function is deleted; the test priority score corresponding to the test case is lower than the target threshold; the similarity degree of the test case corresponding to the test case is greater than the target percentage.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
对于所述测试用例集合中的任意一条测试用例,在执行所述测试用例的过程中,收集所述待测试软件的项目代码中的被执行代码;响应于所述测试用例执行完毕,停止收集代码;将所述被执行代码确定为所述测试用例对应的代码。For any test case in the test case set, in the process of executing the test case, collect the executed code in the project code of the software to be tested; in response to the completion of the test case execution, stop collecting the code ; Determine the executed code as the code corresponding to the test case.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
在所述待测试软件的项目代码中每个方法的第一行均添加一行指定代码;其中,一行指定代码中包含一个方法对应的包名、类名和方法名;A line of specified code is added to the first line of each method in the project code of the software to be tested; wherein, a line of specified code includes a package name, class name and method name corresponding to a method;
在执行所述测试用例的过程中,将通过目标代码分析框架获取到的被执行代码对应的包名、类名和方法名,作为所述测试用例对应的代码的包名、类名和方法名。In the process of executing the test case, the package name, class name and method name corresponding to the executed code obtained through the target code analysis framework are used as the package name, class name and method name of the code corresponding to the test case.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
显示多个测试用例模板;Display multiple test case templates;
在所述多个测试用例模板中确定被用户选中的目标测试用例模板;determining the target test case template selected by the user from the multiple test case templates;
获取用户输入的待创建测试用例对应的前置条件、软件功能、期待输出结果和优先级信息;其中,所述前置条件用于指示执行所述待创建测试用例需要满足的条件;Obtain the preconditions, software functions, expected output results and priority information corresponding to the test case to be created input by the user; wherein, the preconditions are used to indicate the conditions that need to be satisfied to execute the test case to be created;
根据获取到的用户输入信息和所述目标测试用例模板进行测试用例创建。A test case is created according to the obtained user input information and the target test case template.
上述所有可选技术方案,可以采用任意结合形成本公开的可选实施例,在此不再一一赘述。All the above-mentioned optional technical solutions can be combined arbitrarily to form optional embodiments of the present disclosure, which will not be repeated here.
图4是根据一示例性实施例示出的一种软件测试方法的流程图,下面从创建测试用例、分析测试用例、执行测试用例和淘汰测试用例几个方面对本公开实施例提供的软件测试方案进行说明。如图4所示,该方法用于软件测试系统,包括以下步骤。FIG. 4 is a flow chart of a software testing method according to an exemplary embodiment. The software testing solution provided by the embodiments of the present disclosure is carried out from the following aspects: creating test cases, analyzing test cases, executing test cases, and eliminating test cases. illustrate. As shown in Figure 4, the method is used in a software testing system, including the following steps.
创建测试用例Create test cases
在步骤401中,软件测试系统显示多个测试用例模板;在多个测试用例模板中确定被用户选中的目标测试用例模板;获取用户输入的待创建测试用例对应的前置条件、软件功能、期待输出结果和优先级信息;根据获取到的用户输入信息和目标测试用例模板进行测试用例创建。In
其中,待创建测试用例的前置条件用于指示执行待创建测试用例需要满足的条件;即指示待测试用例需要满足哪些条件,比如数据库的访问权限。Among them, the preconditions of the test case to be created are used to indicate the conditions that need to be met to execute the test case to be created; that is, to indicate which conditions the test case needs to meet, such as the access authority of the database.
在一些实施方式中,在创建测试用例过程中,软件测试系统会提供多个测试用例模板,并通过测试前端显示多个测试用例模板,即本公开实施例支持测试人员在线编写测试用例。其中,创建测试用例的步骤包括但不限于:In some embodiments, in the process of creating test cases, the software testing system will provide multiple test case templates and display multiple test case templates through the test front end, that is, the embodiments of the present disclosure support testers to write test cases online. Among them, the steps of creating test cases include but are not limited to:
4011、测试人员在显示的多个测试用例模板中选择自己需要的测试模板,其中,被测试人员选中的测试用例模板在本文中也被称为目标测试用例模板。4011. The tester selects the test template he needs from the multiple displayed test case templates, wherein the test case template selected by the tester is also referred to as the target test case template in this document.
4012、测试人员向该软件测试系统输入待创建测试用例需要满足哪些条件、对应的软件功能和期待输出的结果。4012 , the tester inputs into the software testing system what conditions need to be met for the test case to be created, the corresponding software function, and the expected output result.
4013、软件测试系统获取测试人员为待创建测试用例标注的优先级。4013. The software testing system obtains the priority marked by the tester for the test case to be created.
在一些实施方式中,此处软件测试系统获取到的测试用例的优先级是根据产品需求文档中的用户需求确定的。其中,优先级的标注比如为p1、p2、p3等。其中,p1指示的优先级等级最高,以此类推,序号越大指示的优先级等级越低。In some embodiments, the priority of the test cases obtained by the software testing system is determined according to the user requirements in the product requirements document. Among them, the labels of the priority are, for example, p1, p2, p3, and so on. Among them, the priority level indicated by p1 is the highest, and so on. The higher the sequence number, the lower the priority level.
另外,创建的测试用例通常为文本格式,本公开实施例对此不进行具体限定。In addition, the created test case is usually in a text format, which is not specifically limited in this embodiment of the present disclosure.
另外,创建的测试用例用于测试某一款软件的软件功能。在一些实施方式中,待测试软件可以为手机上安装的App(Application,应用程序)。In addition, the created test cases are used to test the software functions of a certain piece of software. In some embodiments, the software to be tested may be an App (Application, application program) installed on the mobile phone.
分析测试用例Analyze test cases
在步骤402中,软件测试系统根据该测试用例集合中包含的测试用例各自对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度,为测试用例集合中包含的测试用例分别配置测试优先级分值。In
其中,测试优先级分值用于反映测试用例的重要级别。Among them, the test priority score is used to reflect the importance level of the test case.
在本公开实施例中,会综合多方面的因素来对测试用例进行优先级评定。In the embodiment of the present disclosure, multiple factors are integrated to perform priority evaluation on test cases.
在一些实施方式中,对每个测试用例进行优先级评定的因素包括但不限于:该测试用例对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度。其中,上述几方面因素也被称为该测试用例的基础属性数据。In some embodiments, the factors for prioritizing each test case include, but are not limited to: the priority of the software function corresponding to the test case, the number of lines of code changes, the amount of included functions, the amount of underlying code, the number of historical errors, and Use case similarity. Among them, the above factors are also called the basic attribute data of the test case.
其中,一个测试用例对应待测试软件的项目代码中的一部分代码;历史错误数是指历史执行该测试用例时产生的错误数量;该测试用例对应的软件功能的优先级用于反映该测试用例对应的软件功能的重要程度;该测试用例对应的用例相似度用于描述该测试用例与测试用例集合中其他测试用例之间的相似程度;该测试用例对应的包含函数量是指测该试用例对应的代码包含的方法个数;该测试用例对应的底层代码量是指待测试软件的项目代码中的基础框架代码。Among them, a test case corresponds to a part of the code of the project code of the software to be tested; the number of historical errors refers to the number of errors generated during the historical execution of the test case; the priority of the software function corresponding to the test case is used to reflect the corresponding The degree of importance of the software function; the similarity of the test case corresponding to the test case is used to describe the degree of similarity between the test case and other test cases in the test case set; the amount of included functions corresponding to the test case refers to the test case corresponding to the test case. The number of methods contained in the code; the underlying code amount corresponding to the test case refers to the basic framework code in the project code of the software to be tested.
在一些实施方式中,软件测试系统会先确定该测试用例集合中包含的每个测试用例对应的软件功能;之后,根据每个测试用例对应的软件功能的重要程度,来确定每个测试用例对应的软件功能的优先级。In some embodiments, the software testing system will first determine the software function corresponding to each test case included in the test case set; then, according to the importance of the software function corresponding to each test case, determine the corresponding software function of each test case the priority of the software features.
在一些实施方式中,每个测试用例对应的软件功能的优先级可以通过标注L1、L2、L3等来区别;其中,L1指示的优先级等级最高,以此类推,序号越大指示的优先级等级越低。In some embodiments, the priority of the software function corresponding to each test case can be distinguished by marking L1, L2, L3, etc.; wherein, L1 indicates the highest priority, and so on, the higher the serial number indicates the priority The lower the level.
在一些实施方式中,根据该测试用例集合中包含的测试用例各自对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度,为该测试用例集合中包含的测试用例分别配置测试优先级分值,包括:In some embodiments, according to the priority of the software function, the number of code change lines, the amount of included functions, the amount of underlying code, the number of historical errors, and the similarity of the test cases included in the test case set, the test case is the test case. The test cases contained in the collection are configured with test priority scores, including:
对于测试用例集合中的任意一条测试用例,每当该测试用例的基础属性数据满足第一条件集合中的一项条件时,为该测试用例进行一次分值累加;将最终得到的累加结果作为该测试用例的测试优先级分值。For any test case in the test case set, whenever the basic attribute data of the test case satisfies a condition in the first condition set, a score accumulation is performed for the test case; the final accumulated result is used as the The test priority score for the test case.
在一些实施方式中,第一条件集合包括但不限于:In some embodiments, the first set of conditions includes, but is not limited to:
a、该测试用例对应的代码变更行数大于第一阈值。a. The number of code change lines corresponding to the test case is greater than the first threshold.
其中,第一阈值的取值可以为200行,本公开实施例对此不进行具体限定。The value of the first threshold may be 200 lines, which is not specifically limited in this embodiment of the present disclosure.
b、该测试用例对应的历史错误数大于第二阈值。b. The number of historical errors corresponding to the test case is greater than the second threshold.
其中,第二阈值的取值可以为5个,本公开实施例对此不进行具体限定。The value of the second threshold may be 5, which is not specifically limited in this embodiment of the present disclosure.
c、该测试用例对应的软件功能的优先级大于第一级别。c. The priority of the software function corresponding to the test case is greater than the first level.
其中,第一级别可以为最高优先级级别,本公开实施例对此不进行具体限定。The first level may be the highest priority level, which is not specifically limited in this embodiment of the present disclosure.
d、该测试用例对应的用例相似度大于第一百分比。d. The similarity of the test case corresponding to the test case is greater than the first percentage.
其中,第一百分比可以为70%,本公开实施例对此不进行具体限定。The first percentage may be 70%, which is not specifically limited in this embodiment of the present disclosure.
e、该测试用例对应的包含函数量大于第三阈值。e. The amount of included functions corresponding to the test case is greater than the third threshold.
其中,第三阈值的取值可以为10个,本公开实施例对此不进行具体限定。The value of the third threshold may be 10, which is not specifically limited in this embodiment of the present disclosure.
f、该测试用例对应的底层代码量大于第四阈值。f. The amount of underlying code corresponding to the test case is greater than the fourth threshold.
其中,第四阈值的取值可以为200行,本公开实施例对此不进行具体限定。The value of the fourth threshold may be 200 rows, which is not specifically limited in this embodiment of the present disclosure.
在一些实施方式中,在分析测试用例时,软件测试系统通过代码变更数(比如超过200行)、历史bug数(比如5个)、对应的软件功能的优先级(比如p1)、用例相似度(比如70%重合)、包含函数量(比如10个)、底层代码量(比如200行)等6个维度来评定各个测试用例的优先级。In some embodiments, when analyzing test cases, the software testing system analyzes the number of code changes (such as more than 200 lines), the number of historical bugs (such as 5), the priority of the corresponding software function (such as p1), and the similarity of the use case. (such as 70% coincidence), the amount of functions included (such as 10), and the amount of underlying code (such as 200 lines) to evaluate the priority of each test case.
在一些实施方式中,对于任意一个测试用例,每满足一个维度为该测试用例累加一个10分,将最终累加的总分数作为该测试用例的测试优先级分值,最后根据各个测试用例的测试优先级分值对全部测试用例进行排序。In some embodiments, for any test case, 10 points are accumulated for the test case for each dimension that is satisfied, and the final accumulated total score is used as the test priority score of the test case, and finally the test priority value of each test case is used. The grading value sorts all test cases.
执行测试用例Execute test cases
在步骤403中,软件测试系统获取该测试用例集合中包含的测试用例对应的测试优先级分值;按照测试优先级分值,在该测试用例集合中确定部分软件功能对应的测试用例进行回归测试。In
在执行测试用例过程中,软件测试系统能够通过测试用例来测试软件的某个功能,在此过程中,通过以下操作选择测试用例进行测试:In the process of executing the test case, the software testing system can test a certain function of the software through the test case. During this process, the test case is selected for testing through the following operations:
获取该测试用例集合中包含的各个测试用例对应的测试优先级分值;之后,按照测试优先级分值,在该测试用例集合中确定部分软件功能对应的测试用例进行回归测试。Obtain the test priority score corresponding to each test case included in the test case set; then, according to the test priority score, determine the test cases corresponding to some software functions in the test case set for regression testing.
在一些实施方式中,上述部分软件功能对应的测试用例可以是;测试优先级分值大于一定阈值的测试用例;或者,测试优先级分值排在TopN的测试用例,本公开实施例对此不进行具体限定。其中,N的取值为正整数。In some embodiments, the test cases corresponding to some of the above-mentioned software functions may be; test cases with a test priority score greater than a certain threshold; or, test cases with a test priority score ranked in TopN, which are not covered by the embodiments of the present disclosure. Make specific restrictions. Among them, the value of N is a positive integer.
淘汰测试用例Eliminate test cases
在步骤404中,对于测试用例集合中的任意一条测试用例,响应于该测试用例满足第二条件集合中的条件,软件测试系统删除该测试用例。In
在一些实施方式中,在淘汰测试用例之前,本公开实施例还包括:确定该测试用例集合中包含的测试用例与待测试软件的项目代码之间的对应关系。其中,本公开实施例通过JavaParser技术分析出代码与测试用例的对应关系。In some implementations, before eliminating the test case, the embodiments of the present disclosure further include: determining the correspondence between the test case included in the test case set and the project code of the software to be tested. Among them, the embodiment of the present disclosure analyzes the corresponding relationship between the code and the test case by using the JavaParser technology.
4041、对于该测试用例集合中的任意一条测试用例,在执行该测试用例的过程中,收集待测试软件的项目代码中的被执行代码;响应于该测试用例执行完毕,停止收集代码;将被执行代码确定为该测试用例对应的代码。4041. For any test case in the test case set, in the process of executing the test case, collect the executed code in the project code of the software to be tested; in response to the completion of the test case execution, stop collecting the code; The execution code is determined to be the code corresponding to the test case.
4042、在待测试软件的项目代码中每个方法的第一行均添加一行代码(也被称为指定代码);其中,该行代码中包含相应方法对应的包名、类名和方法名。这样在执行测试用例的过程中,将通过JavaParser分析框架获取到的被执行代码对应的包名、类名和方法名,作为该测试用例对应的代码的包名、类名和方法名。4042. Add a line of code (also referred to as specified code) to the first line of each method in the project code of the software to be tested; wherein the line of code includes the package name, class name, and method name corresponding to the corresponding method. In this way, in the process of executing the test case, the package name, class name and method name corresponding to the executed code obtained through the JavaParser analysis framework are used as the package name, class name and method name of the code corresponding to the test case.
其中,Javapasser是一个可以将Java源码解析为一棵语法树,然后基于这棵语法树对Java代码进行分析和修改的工具。在一些实施方式中,通过JavaParser技术可以将项目源代码存储在指定目录位置,通过Javaparser解析器对项目源代码的源代码结构进行解析,将项目源代码转换为源码树,以便于对目标软件项目下的所有类进行分析,查找出目标软件项目下的类名、方法名等信息。Among them, Javapasser is a tool that can parse Java source code into a syntax tree, and then analyze and modify Java code based on this syntax tree. In some embodiments, the project source code can be stored in a specified directory location through the JavaParser technology, the source code structure of the project source code can be parsed through the Javaparser parser, and the project source code can be converted into a source tree, so as to facilitate the analysis of the target software project All classes under the target software project are analyzed to find out the class name, method name and other information under the target software project.
在一些实施方式中,第二条件集合包括但不限于:In some embodiments, the second set of conditions includes, but is not limited to:
a、该测试用例对应的代码被删除。即该测试用例所属的代码被删除。a. The code corresponding to the test case is deleted. That is, the code to which the test case belongs is deleted.
b、该测试用例对应的代码包含在测试用例集合的其他测试用例对应的代码中。b. The code corresponding to the test case is included in the code corresponding to other test cases in the test case set.
c、该测试用例对应的软件功能被删除。c. The software function corresponding to the test case is deleted.
d、该测试用例对应的测试优先级分值低于目标阈值。d. The test priority score corresponding to the test case is lower than the target threshold.
e、该测试用例对应的用例相似度大于目标百分比。e. The similarity of the test case corresponding to the test case is greater than the target percentage.
在一些实施方式中,目标百分比的取值为70%、80%或90%等,本公开实施例对此不进行具体限定。In some embodiments, the target percentage is 70%, 80%, or 90%, etc., which is not specifically limited in the embodiments of the present disclosure.
本公开实施例提供的方法,在软件测试过程中,实现了基于测试用例集合中测试用例对应的测试优先级分值,筛选部分软件功能对应的测试用例进行回归测试,极大地减少了需要进行回归测试的测试用例数量。另外,测试优先级分值是基于测试用例的基础属性数据确定的;而基础属性数据包括:测试用例对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度。由于综合了多方面因素来评定测试用例的优先级,因此得到的测试优先级分值较为精准,基于精准的测试优先级分值能够在测试用例集合中准确筛选出部分测试用例进行回归测试,极大地降低了回归测试用例的时间成本和人力成本。In the method provided by the embodiments of the present disclosure, in the software testing process, based on the test priority score corresponding to the test case in the test case set, the test cases corresponding to some software functions are screened for regression testing, which greatly reduces the need for regression testing. The number of test cases to test. In addition, the test priority score is determined based on the basic attribute data of the test case; and the basic attribute data includes: the priority of the software function corresponding to the test case, the number of lines of code changes, the amount of included functions, the amount of underlying code, and the number of historical errors and use case similarity. Due to the combination of various factors to evaluate the priority of test cases, the obtained test priority scores are relatively accurate. Based on the accurate test priority scores, some test cases can be accurately screened out of the test case set for regression testing. Greatly reduces the time cost and labor cost of regression test cases.
在一些实施方式中,对于测试用例优先级的评定因素,不同的软件项目可以略有差异。另外,对于不同开发语言,可以使用不同的技术框架来获取代码与测试用例的对应关系。In some implementations, different software projects may differ slightly in the evaluation factors for test case priority. In addition, for different development languages, different technical frameworks can be used to obtain the correspondence between codes and test cases.
图5是根据一示例性实施例示出的一种软件测试系统的框图。参照图5,该系统包括软件功能确定模块501,获取模块502和测试模块503。Fig. 5 is a block diagram of a software testing system according to an exemplary embodiment. Referring to FIG. 5 , the system includes a software
软件功能确定模块501,被配置为确定待测试软件的测试用例集合中包含的测试用例对应的软件功能;The software
获取模块502,被配置为获取所述测试用例集合中包含的测试用例对应的测试优先级分值;其中,所述测试优先级分值用于反映所述测试用例的重要级别;The obtaining
测试模块503,被配置为按照所述测试优先级分值,在所述测试用例集合中确定部分软件功能对应的测试用例进行回归测试;The
其中,所述测试优先级分值是基于所述测试用例的基础属性数据确定;所述基础属性数据包括:所述测试用例对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度。Wherein, the test priority score is determined based on the basic attribute data of the test case; the basic attribute data includes: the priority of the software function corresponding to the test case, the number of lines of code changes, the amount of included functions, the underlying Code volume, historical bug count, and use case similarity.
本公开实施例提供的系统,在软件测试过程中,实现了基于测试用例集合中测试用例对应的测试优先级分值,筛选部分软件功能对应的测试用例进行回归测试,极大地减少了需要进行回归测试的测试用例数量;其中,测试优先级分值用于反映测试用例的重要级别。另外,测试优先级分值是基于测试用例的基础属性数据确定的;而基础属性数据包括:测试用例对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度。由于综合了多方面因素来评定测试用例的优先级,因此得到的测试优先级分值较为精准,基于精准的测试优先级分值能够在测试用例集合中准确筛选出部分测试用例进行回归测试,极大地降低了回归测试用例的时间成本和人力成本。In the system provided by the embodiments of the present disclosure, in the software testing process, based on the test priority scores corresponding to the test cases in the test case set, the test cases corresponding to some software functions are screened for regression testing, which greatly reduces the need for regression testing. The number of test cases tested; where the test priority score is used to reflect the importance level of the test cases. In addition, the test priority score is determined based on the basic attribute data of the test case; and the basic attribute data includes: the priority of the software function corresponding to the test case, the number of lines of code changes, the amount of included functions, the amount of underlying code, and the number of historical errors and use case similarity. Due to the combination of various factors to evaluate the priority of test cases, the obtained test priority scores are relatively accurate. Based on the accurate test priority scores, some test cases can be accurately screened out of the test case set for regression testing. Greatly reduces the time cost and labor cost of regression test cases.
在一种可能的实现方式中,参见图6,所述系统还包括:In a possible implementation, referring to FIG. 6 , the system further includes:
优先级确定模块504,被配置为根据所述测试用例集合中包含的测试用例各自对应的软件功能的优先级、代码变更行数、包含函数量、底层代码量、历史错误数和用例相似度,为所述测试用例集合中包含的测试用例分别配置测试优先级分值。The
在一种可能的实现方式中,所述优先级确定模块504,被配置为:In a possible implementation manner, the
对于所述测试用例集合中的任意一条测试用例,每当所述测试用例的基础属性数据满足第一条件集合中的一项条件时,为所述测试用例进行一次分值累加;将最终得到的累加结果作为所述测试用例的测试优先级分值;For any test case in the test case set, whenever the basic attribute data of the test case satisfies a condition in the first condition set, a score accumulation is performed for the test case; The accumulated result is used as the test priority score of the test case;
其中,所述第一条件集合包括:所述测试用例对应的代码变更行数大于第一阈值;所述测试用例对应的历史错误数大于第二阈值;所述测试用例对应的软件功能的优先级大于第一级别;所述测试用例对应的用例相似度大于第一百分比;所述测试用例对应的包含函数量大于第三阈值;所述测试用例对应的底层代码量大于第四阈值。The first condition set includes: the number of code change lines corresponding to the test case is greater than a first threshold; the number of historical errors corresponding to the test case is greater than a second threshold; the priority of the software function corresponding to the test case greater than the first level; the similarity of the use cases corresponding to the test cases is greater than the first percentage; the amount of included functions corresponding to the test cases is greater than the third threshold; the amount of underlying code corresponding to the test cases is greater than the fourth threshold.
在一种可能的实现方式中,所述系统还包括:In a possible implementation, the system further includes:
删除模块505,被配置为对于所述测试用例集合中的任意一条测试用例,响应于所述测试用例满足第二条件集合中的条件,删除所述测试用例;The
其中,所述第二条件集合包括:所述测试用例对应的代码被删除;所述测试用例对应的代码包含在所述测试用例集合的其他测试用例对应的代码中;所述测试用例对应的软件功能被删除;所述测试用例对应的测试优先级分值低于目标阈值;所述测试用例对应的用例相似度大于目标百分比。The second condition set includes: the code corresponding to the test case is deleted; the code corresponding to the test case is included in the code corresponding to other test cases in the test case set; the software corresponding to the test case The function is deleted; the test priority score corresponding to the test case is lower than the target threshold; the similarity degree of the test case corresponding to the test case is greater than the target percentage.
在一种可能的实现方式中,所述系统还包括:In a possible implementation, the system further includes:
对应关系确定模块506,被配置为:对于所述测试用例集合中的任意一条测试用例,在执行所述测试用例的过程中,收集所述待测试软件的项目代码中的被执行代码;响应于所述测试用例执行完毕,停止收集代码;将所述被执行代码确定为所述测试用例对应的代码。The corresponding
在一种可能的实现方式中,所述对应关系确定模块506,被配置为:In a possible implementation manner, the corresponding
在所述待测试软件的项目代码中每个方法的第一行均添加一行指定代码;其中,一行指定代码中包含一个方法对应的包名、类名和方法名;A line of specified code is added to the first line of each method in the project code of the software to be tested; wherein, a line of specified code includes a package name, class name and method name corresponding to a method;
在执行所述测试用例的过程中,将通过目标代码分析框架获取到的被执行代码对应的包名、类名和方法名,作为所述测试用例对应的代码的包名、类名和方法名。In the process of executing the test case, the package name, class name and method name corresponding to the executed code obtained through the target code analysis framework are used as the package name, class name and method name of the code corresponding to the test case.
在一种可能的实现方式中,所述系统还包括:In a possible implementation, the system further includes:
创建模块507,被配置为显示多个测试用例模板;在所述多个测试用例模板中确定被用户选中的目标测试用例模板;获取用户输入的待创建测试用例对应的前置条件、软件功能、期待输出结果和优先级信息;其中,所述前置条件用于指示执行所述待创建测试用例需要满足的条件;根据获取到的用户输入信息和所述目标测试用例模板进行测试用例创建。The
上述所有可选技术方案,可以采用任意结合形成本公开的可选实施例,在此不再一一赘述。关于上述实施例中的系统,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。All the above-mentioned optional technical solutions can be combined arbitrarily to form optional embodiments of the present disclosure, which will not be repeated here. Regarding the system in the above-mentioned embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be described in detail here.
图7示出了本公开一个示例性实施例提供的一种计算机设备700的结构框图。通常,设备700包括有:处理器701和存储器702。FIG. 7 shows a structural block diagram of a
处理器701可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器701可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。处理器701也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central ProcessingUnit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器701可以在集成有GPU(Graphics Processing Unit,图像处理器),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器701还可以包括AI(Artificial Intelligence,人工智能)处理器,该AI处理器用于处理有关机器学习的计算操作。The
存储器702可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器702还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。在一些实施例中,存储器702中的非暂态的计算机可读存储介质用于存储至少一个指令,该至少一个指令用于被处理器701所执行以实现本公开中方法实施例提供的软件测试方法。
在一些实施例中,设备700还可选包括有:外围设备接口703和至少一个外围设备。处理器701、存储器702和外围设备接口703之间可以通过总线或信号线相连。各个外围设备可以通过总线、信号线或电路板与外围设备接口703相连。具体地,外围设备包括:显示屏705和电源709。In some embodiments, the
外围设备接口703可被用于将I/O(Input/Output,输入/输出)相关的至少一个外围设备连接到处理器701和存储器702。在一些实施例中,处理器701、存储器702和外围设备接口703被集成在同一芯片或电路板上;在一些其他实施例中,处理器701、存储器702和外围设备接口703中的任意一个或两个可以在单独的芯片或电路板上实现,本实施例对此不加以限定。The
显示屏704用于显示UI(User Interface,用户界面)。该UI可以包括图形、文本、图标、视频及其它们的任意组合。当显示屏704是触摸显示屏时,显示屏704还具有采集在显示屏704的表面或表面上方的触摸信号的能力。该触摸信号可以作为控制信号输入至处理器701进行处理。此时,显示屏704还可以用于提供虚拟按钮和/或虚拟键盘,也称软按钮和/或软键盘。在一些实施例中,显示屏704可以为一个,设置设备700的前面板;显示屏704可以采用LCD(Liquid Crystal Display,液晶显示屏)、OLED(Organic Light-Emitting Diode,有机发光二极管)等材质制备。The
电源705用于为设备700中的各个组件进行供电。电源705可以是交流电、直流电、一次性电池或可充电电池。当电源705包括可充电电池时,该可充电电池可以是有线充电电池或无线充电电池。有线充电电池是通过有线线路充电的电池,无线充电电池是通过无线线圈充电的电池。该可充电电池还可以用于支持快充技术。
本领域技术人员可以理解,图7中示出的结构并不构成对设备700的限定,可以包括比图示更多或更少的组件,或者组合某些组件,或者采用不同的组件布置。Those skilled in the art can understand that the structure shown in FIG. 7 does not constitute a limitation on the
在示例性实施例中,还提供了一种包括指令的计算机可读存储介质,例如包括指令的存储器,上述指令可由计算机设备700的处理器执行以完成上述软件测试方法。可选地,存储介质可以是非临时性计算机可读存储介质,例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, a computer-readable storage medium including instructions, such as a memory including instructions, is also provided, and the instructions are executable by the processor of the
在示例性实施例中,还提供了一种计算机程序产品,所述计算机程序产品中的指令由计算机设备700的处理器执行时,使得计算机设备700能够执行如上述方法实施例中的软件测试方法。In an exemplary embodiment, a computer program product is also provided. When the instructions in the computer program product are executed by the processor of the
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本公开的其它实施方案。本申请旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求指出。Other embodiments of the present disclosure will readily suggest themselves to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or techniques in the technical field not disclosed by the present disclosure . The specification and examples are to be regarded as exemplary only, with the true scope and spirit of the disclosure being indicated by the following claims.
应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来限制。It is to be understood that the present disclosure is not limited to the precise structures described above and illustrated in the accompanying drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010735831.9ACN111858371A (en) | 2020-07-28 | 2020-07-28 | Software testing method, system, storage medium and computer equipment |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010735831.9ACN111858371A (en) | 2020-07-28 | 2020-07-28 | Software testing method, system, storage medium and computer equipment |
| Publication Number | Publication Date |
|---|---|
| CN111858371Atrue CN111858371A (en) | 2020-10-30 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010735831.9APendingCN111858371A (en) | 2020-07-28 | 2020-07-28 | Software testing method, system, storage medium and computer equipment |
| Country | Link |
|---|---|
| CN (1) | CN111858371A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111753760A (en)* | 2020-06-28 | 2020-10-09 | 北京百度网讯科技有限公司 | Model generation method, device, electronic device and storage medium |
| CN112597046A (en)* | 2020-12-29 | 2021-04-02 | 上海商汤智能科技有限公司 | Test method, test device, computer equipment and storage medium |
| CN112631843A (en)* | 2020-12-22 | 2021-04-09 | 北京百度网讯科技有限公司 | Equipment testing method and device, electronic equipment, readable medium and product |
| CN112905480A (en)* | 2021-03-19 | 2021-06-04 | 腾讯科技(深圳)有限公司 | Test script generation method and device, storage medium and electronic equipment |
| CN113190439A (en)* | 2021-04-22 | 2021-07-30 | 北京百度网讯科技有限公司 | Test case execution method and device and electronic equipment |
| CN113254354A (en)* | 2021-07-02 | 2021-08-13 | 南昌航空大学 | Test case recommendation method and device, readable storage medium and electronic equipment |
| CN113391998A (en)* | 2021-06-01 | 2021-09-14 | 北京沃东天骏信息技术有限公司 | Regression testing method, device, electronic equipment and storage medium |
| CN113760769A (en)* | 2021-09-13 | 2021-12-07 | 北京百度网讯科技有限公司 | Test case processing method and device, electronic equipment and storage medium |
| CN113886252A (en)* | 2021-09-30 | 2022-01-04 | 四川大学 | Regression test case priority determination method based on thermodynamic diagram |
| CN114218076A (en)* | 2021-12-01 | 2022-03-22 | 浙江中控技术股份有限公司 | Smartauto-based fast iterative software testing method and system |
| CN115248783A (en)* | 2022-09-26 | 2022-10-28 | 江西萤火虫微电子科技有限公司 | Software testing method, system, readable storage medium and computer device |
| CN115422095A (en)* | 2022-11-07 | 2022-12-02 | 易方信息科技股份有限公司 | Regression test case recommendation method, device, equipment and medium |
| CN116383092A (en)* | 2023-05-31 | 2023-07-04 | 北京中科卓信软件测评技术中心 | Effective test case multiplexing method and device for software fuzzy test |
| CN118606218A (en)* | 2024-08-07 | 2024-09-06 | 恒生电子股份有限公司 | Test case selection method and device |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107193739A (en)* | 2017-05-23 | 2017-09-22 | 张泽祎 | A kind of black box regression testing method |
| CN107515826A (en)* | 2017-08-28 | 2017-12-26 | 广州阿里巴巴文学信息技术有限公司 | Test case accurate recommendation method, device, system, equipment and storage medium |
| CN107544905A (en)* | 2017-08-22 | 2018-01-05 | 中国农业银行股份有限公司 | The optimization method and system of regression test case collection |
| CN108694123A (en)* | 2018-05-14 | 2018-10-23 | 中国平安人寿保险股份有限公司 | A kind of regression testing method, computer readable storage medium and terminal device |
| CN109344048A (en)* | 2018-08-17 | 2019-02-15 | 中国平安人寿保险股份有限公司 | A kind of test method, storage medium and server |
| CN110262956A (en)* | 2018-03-12 | 2019-09-20 | 中移(苏州)软件技术有限公司 | A kind of test cases selection method and device |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107193739A (en)* | 2017-05-23 | 2017-09-22 | 张泽祎 | A kind of black box regression testing method |
| CN107544905A (en)* | 2017-08-22 | 2018-01-05 | 中国农业银行股份有限公司 | The optimization method and system of regression test case collection |
| CN107515826A (en)* | 2017-08-28 | 2017-12-26 | 广州阿里巴巴文学信息技术有限公司 | Test case accurate recommendation method, device, system, equipment and storage medium |
| CN110262956A (en)* | 2018-03-12 | 2019-09-20 | 中移(苏州)软件技术有限公司 | A kind of test cases selection method and device |
| CN108694123A (en)* | 2018-05-14 | 2018-10-23 | 中国平安人寿保险股份有限公司 | A kind of regression testing method, computer readable storage medium and terminal device |
| CN109344048A (en)* | 2018-08-17 | 2019-02-15 | 中国平安人寿保险股份有限公司 | A kind of test method, storage medium and server |
| Title |
|---|
| 林连进,谢怀民: "《21世纪大学计算机专业教材 UML自动化测试技术》", vol. 1, 31 August 2018, 西安:西安交通大学出版社, pages: 307 - 310* |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111753760A (en)* | 2020-06-28 | 2020-10-09 | 北京百度网讯科技有限公司 | Model generation method, device, electronic device and storage medium |
| CN112631843A (en)* | 2020-12-22 | 2021-04-09 | 北京百度网讯科技有限公司 | Equipment testing method and device, electronic equipment, readable medium and product |
| CN112597046A (en)* | 2020-12-29 | 2021-04-02 | 上海商汤智能科技有限公司 | Test method, test device, computer equipment and storage medium |
| CN112905480A (en)* | 2021-03-19 | 2021-06-04 | 腾讯科技(深圳)有限公司 | Test script generation method and device, storage medium and electronic equipment |
| CN112905480B (en)* | 2021-03-19 | 2024-12-27 | 腾讯科技(深圳)有限公司 | Test script generation method, device, storage medium and electronic device |
| CN113190439A (en)* | 2021-04-22 | 2021-07-30 | 北京百度网讯科技有限公司 | Test case execution method and device and electronic equipment |
| CN113190439B (en)* | 2021-04-22 | 2024-03-22 | 北京百度网讯科技有限公司 | Execution method and device of test case and electronic equipment |
| CN113391998A (en)* | 2021-06-01 | 2021-09-14 | 北京沃东天骏信息技术有限公司 | Regression testing method, device, electronic equipment and storage medium |
| CN113254354A (en)* | 2021-07-02 | 2021-08-13 | 南昌航空大学 | Test case recommendation method and device, readable storage medium and electronic equipment |
| CN113760769B (en)* | 2021-09-13 | 2023-11-07 | 北京百度网讯科技有限公司 | Test case processing method and device, electronic equipment and storage medium |
| CN113760769A (en)* | 2021-09-13 | 2021-12-07 | 北京百度网讯科技有限公司 | Test case processing method and device, electronic equipment and storage medium |
| CN113886252B (en)* | 2021-09-30 | 2023-05-23 | 四川大学 | Regression test case priority determining method based on thermodynamic diagram |
| CN113886252A (en)* | 2021-09-30 | 2022-01-04 | 四川大学 | Regression test case priority determination method based on thermodynamic diagram |
| CN114218076A (en)* | 2021-12-01 | 2022-03-22 | 浙江中控技术股份有限公司 | Smartauto-based fast iterative software testing method and system |
| CN115248783A (en)* | 2022-09-26 | 2022-10-28 | 江西萤火虫微电子科技有限公司 | Software testing method, system, readable storage medium and computer device |
| CN115422095A (en)* | 2022-11-07 | 2022-12-02 | 易方信息科技股份有限公司 | Regression test case recommendation method, device, equipment and medium |
| CN116383092A (en)* | 2023-05-31 | 2023-07-04 | 北京中科卓信软件测评技术中心 | Effective test case multiplexing method and device for software fuzzy test |
| CN116383092B (en)* | 2023-05-31 | 2023-08-01 | 北京中科卓信软件测评技术中心 | Effective test case multiplexing method and device for software fuzzy test |
| CN118606218A (en)* | 2024-08-07 | 2024-09-06 | 恒生电子股份有限公司 | Test case selection method and device |
| CN118606218B (en)* | 2024-08-07 | 2024-12-03 | 恒生电子股份有限公司 | Test case selection method and device |
| Publication | Publication Date | Title |
|---|---|---|
| CN111858371A (en) | Software testing method, system, storage medium and computer equipment | |
| Gorelick et al. | High Performance Python: Practical Performant Programming for Humans | |
| US9703681B2 (en) | Performance optimization tip presentation during debugging | |
| US8726226B2 (en) | Integrated work lists for engineering project change management | |
| CN111832236A (en) | A chip regression test method, system, electronic device and storage medium | |
| US9021440B1 (en) | System and method for automated test script generation | |
| US8719745B2 (en) | Method and system for automatically establishing hierarchical parameterized cell (PCELL) debugging environment | |
| US9202005B2 (en) | Development and debug environment in a constrained random verification | |
| US10592211B2 (en) | Generation of application behaviors | |
| US10541042B2 (en) | Level-crossing memory trace inspection queries | |
| CN111797157B (en) | Data processing method, system, electronic device and storage medium | |
| US11221881B2 (en) | Computer resource leak detection | |
| CN108920382B (en) | Test case generation method and device, storage medium and server | |
| US20170168913A9 (en) | Method and system for testing of applications in asset management software | |
| US8838559B1 (en) | Data mining through property checks based upon string pattern determinations | |
| CN111158656A (en) | Method and device for generating test codes based on fruit tree method | |
| CN114968817A (en) | Method, device, equipment and storage medium for evaluating code change influence range | |
| US9280627B1 (en) | GUI based verification at multiple abstraction levels | |
| CN112380800B (en) | Online FPGA (field programmable gate array) experimental platform for automatic evaluation and related method | |
| US20030177471A1 (en) | System and method for graphically developing a program | |
| US10969429B1 (en) | System and method for debugging in concurrent fault simulation | |
| Poole | Debugging and testing | |
| CN114896824A (en) | Joint simulation integration test verification method and device, readable storage medium and equipment | |
| US11487561B1 (en) | Post simulation debug and analysis using a system memory model | |
| CN108960433B (en) | Method and system for running machine learning modeling process |
| 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 | ||
| RJ01 | Rejection of invention patent application after publication | Application publication date:20201030 | |
| RJ01 | Rejection of invention patent application after publication |