CN111651358B - Method for generating test cases, software testing method, device and server - Google Patents

Method for generating test cases, software testing method, device and server Download PDF

Info

Publication number
CN111651358B
CN111651358B CN202010509905.7A CN202010509905A CN111651358B CN 111651358 B CN111651358 B CN 111651358B CN 202010509905 A CN202010509905 A CN 202010509905A CN 111651358 B CN111651358 B CN 111651358B
Authority
CN
China
Prior art keywords
parameter
user data
use case
test
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.)
Active
Application number
CN202010509905.7A
Other languages
Chinese (zh)
Other versions
CN111651358A (en
Inventor
孙文东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202010509905.7A priority Critical patent/CN111651358B/en
Publication of CN111651358A publication Critical patent/CN111651358A/en
Application granted granted Critical
Publication of CN111651358B publication Critical patent/CN111651358B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3698Environments for analysis, debugging or testing of software

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明提供了一种生成测试用例的方法、软件测试方法、装置和服务器,如果需要生成目标软件的测试用例,根据该目标软件的用户的相关操作数据,确定测试用例的参数值;根据这些参数值生成测试用例的配置文件,进而生成测试用例。该方法根据目标软件的真实的用户操作数据,自动生成测试用例,相对于人工编写测试用例的方式,真实的用户操作数据,使得生成的测试用例与目标软件的实际应用场景相匹配,从而提高了软件测试的准确性和可靠性;同时,也提高了测试用例的生成效率。

The present invention provides a method for generating test cases, a software testing method, a device and a server. If a test case for a target software needs to be generated, the parameter values of the test case are determined according to the relevant operation data of the user of the target software; a configuration file of the test case is generated according to these parameter values, and then the test case is generated. The method automatically generates test cases according to the real user operation data of the target software. Compared with the method of manually writing test cases, the real user operation data makes the generated test cases match the actual application scenarios of the target software, thereby improving the accuracy and reliability of software testing; at the same time, the generation efficiency of test cases is also improved.

Description

生成测试用例的方法、软件测试方法、装置和服务器Method for generating test cases, software testing method, device and server

技术领域Technical Field

本发明涉及软件测试技术领域,尤其是涉及一种生成测试用例的方法、软件测试方法、装置和服务器。The present invention relates to the technical field of software testing, and in particular to a method for generating test cases, a software testing method, a device and a server.

背景技术Background technique

自动化测试,是软件生命周期的一个组成部分。在软件开发的各个阶段中,都可以通过测试用例对软件进行自动化测试。自动化测试所使用的测试用例,大多通过人工编写得到;然后再从编写的测试用例中,基于待测试软件的覆盖率测试指标自动选取一部分测试用例,或者通过人工借助经验选择一部分测试用例,以测试上述待测试软件。由于测试用例由人工编写得到,一方面耗时耗力,另一方面,很难与软件的实际应用场景相匹配,测试的准确性和可靠性较低。Automated testing is an integral part of the software life cycle. At each stage of software development, software can be automatically tested through test cases. Most of the test cases used in automated testing are written manually; then, from the written test cases, a part of the test cases are automatically selected based on the coverage test indicators of the software to be tested, or a part of the test cases are selected manually with the help of experience to test the software to be tested. Since the test cases are written manually, it is time-consuming and labor-intensive on the one hand, and it is difficult to match the actual application scenarios of the software on the other hand, so the accuracy and reliability of the test are low.

发明内容Summary of the invention

有鉴于此,本发明的目的在于提供一种生成测试用例的方法、软件测试方法、装置和服务器,以提高生成测试用例的效率,同时提高软件测试的准确性和可靠性。In view of this, an object of the present invention is to provide a method for generating test cases, a software testing method, an apparatus and a server to improve the efficiency of generating test cases while improving the accuracy and reliability of software testing.

第一方面,本发明实施例提供了一种生成测试用例的方法,所述方法包括:如果需要生成目标软件的测试用例,根据所述目标软件的用户数据,确定所述测试用例的参数值;其中,所述用户数据包括:所述目标软件的用户操作所述目标软件的操作数据;根据所述参数值生成所述测试用例的配置文件;根据所述配置文件生成所述测试用例。In a first aspect, an embodiment of the present invention provides a method for generating a test case, the method comprising: if a test case for a target software needs to be generated, determining a parameter value of the test case based on user data of the target software; wherein the user data comprises: operation data of a user of the target software operating the target software; generating a configuration file for the test case based on the parameter value; and generating the test case based on the configuration file.

进一步的,所述测试用例包括至少一个用例参数;所述根据所述目标软件的用户数据,确定所述测试用例的参数值的步骤,包括:如果需要根据所述用户数据确定所述用例参数的参数值,获取与所述用例参数相关的用户数据;根据与所述用例参数相关的用户数据,确定所述用例参数的参数值。Furthermore, the test case includes at least one use case parameter; the step of determining the parameter value of the test case based on the user data of the target software includes: if it is necessary to determine the parameter value of the use case parameter based on the user data, obtaining user data related to the use case parameter; determining the parameter value of the use case parameter based on the user data related to the use case parameter.

进一步的,所述用例参数设置有标识符;所述标识符用于指示:所述用例参数的参数值根据所述用户数据确定,或者所述用例参数的参数值为指定值;所述如果需要根据所述用户数据确定所述用例参数的参数值,获取与所述用例参数相关的用户数据的步骤,包括:查询所述用例参数的标识符,如果所述用例参数的标识符指示所述用例参数的参数值根据所述用户数据确定,获取与所述用例参数相关的用户数据。Furthermore, the use case parameter is provided with an identifier; the identifier is used to indicate that: the parameter value of the use case parameter is determined according to the user data, or the parameter value of the use case parameter is a specified value; if the parameter value of the use case parameter needs to be determined according to the user data, the step of obtaining the user data related to the use case parameter comprises: querying the identifier of the use case parameter, and if the identifier of the use case parameter indicates that the parameter value of the use case parameter is determined according to the user data, obtaining the user data related to the use case parameter.

进一步的,所述用户数据预先存储在预设的关系型数据库中;所述用户数据中的至少一部分数据同步在预设的缓存数据库中;所述获取与所述用例参数相关的用户数据的步骤,包括:从所述缓存数据库中获取与所述用例参数相关的用户数据;如果从所述缓存数据库中获取不到与所述用例参数相关的用户数据,通过所述缓存数据库,从所述关系型数据库中获取与所述用例参数相关的用户数据。Furthermore, the user data is pre-stored in a preset relational database; at least a portion of the user data is synchronized in a preset cache database; the step of obtaining user data related to the use case parameters includes: obtaining user data related to the use case parameters from the cache database; if the user data related to the use case parameters cannot be obtained from the cache database, obtaining user data related to the use case parameters from the relational database through the cache database.

进一步的,根据与所述用例参数相关的用户数据,确定所述用例参数的参数值的步骤,包括:从所述用户数据中获取所述用例参数的备选参数值;如果所述备选参数值包括多种,根据所述备选参数值的大小,从多种所述备选参数值中确定所述用例参数的参数值。Furthermore, the step of determining the parameter value of the use case parameter based on user data related to the use case parameter includes: obtaining alternative parameter values of the use case parameter from the user data; if the alternative parameter values include multiple values, determining the parameter value of the use case parameter from the multiple alternative parameter values based on the sizes of the alternative parameter values.

进一步的,根据所述参数值生成所述测试用例的配置文件的步骤,包括:将所述参数值填入至所述参数值对应的用例参数中;根据所述用例参数,以及所述用例参数对应的参数值,生成所述测试用例的配置文件。Furthermore, the step of generating a configuration file of the test case according to the parameter value includes: filling the parameter value into the use case parameter corresponding to the parameter value; generating the configuration file of the test case according to the use case parameter and the parameter value corresponding to the use case parameter.

进一步的,根据所述配置文件生成所述测试用例的步骤之后,所述方法还包括:按照预设的时间间隔,获取所述目标软件的更新用户数据;根据所述更新用户数据,更新所述测试用例。Furthermore, after the step of generating the test case according to the configuration file, the method further includes: obtaining updated user data of the target software at preset time intervals; and updating the test case according to the updated user data.

第二方面,本发明实施例提供了一种软件测试方法,所述方法包括:如果需要测试目标软件,获取所述目标软件的测试用例;通过所述测试用例对所述目标软件进行测试,得到测试结果;其中,所述目标软件的测试用例,通过下述方式生成:根据所述目标软件的用户数据,确定所述测试用例的参数值;其中,所述用户数据包括:所述目标软件的用户操作所述目标软件的操作数据;根据所述参数值生成所述测试用例的配置文件;根据所述配置文件生成所述测试用例。In a second aspect, an embodiment of the present invention provides a software testing method, the method comprising: if it is necessary to test the target software, obtaining a test case of the target software; testing the target software through the test case to obtain a test result; wherein the test case of the target software is generated in the following manner: determining a parameter value of the test case based on user data of the target software; wherein the user data comprises: operation data of the user of the target software operating the target software; generating a configuration file of the test case based on the parameter value; and generating the test case based on the configuration file.

进一步的,通过所述测试用例对所述目标软件进行测试的步骤之后,所述方法还包括:将所述测试结果发送至指定的测试结果接收地址。Furthermore, after the step of testing the target software through the test case, the method further includes: sending the test result to a designated test result receiving address.

第三方面,本发明实施例提供了一种生成测试用例的装置,所述装置包括:第一确定模块,用于如果需要生成目标软件的测试用例,根据所述目标软件的用户数据,确定所述测试用例的参数值;其中,所述用户数据包括:所述目标软件的用户操作所述目标软件的操作数据;第一生成模块,用于根据所述参数值生成所述测试用例的配置文件;第二生成模块,用于根据所述配置文件生成所述测试用例。In a third aspect, an embodiment of the present invention provides a device for generating test cases, the device comprising: a first determination module, for determining parameter values of the test cases according to user data of the target software if a test case for target software needs to be generated; wherein the user data comprises: operation data of the user of the target software operating the target software; a first generation module, for generating a configuration file of the test case according to the parameter value; and a second generation module, for generating the test case according to the configuration file.

第四方面,本发明实施例提供了一种软件测试装置,所述装置包括:获取模块,用于如果需要测试目标软件,获取所述目标软件的测试用例;第二确定模块,用于通过所述测试用例对所述目标软件进行测试,得到测试结果;其中,所述目标软件的测试用例,通过下述方式生成:根据所述目标软件的用户数据,确定所述测试用例的参数值;其中,所述用户数据包括:所述目标软件的用户操作所述目标软件的操作数据;根据所述参数值生成所述测试用例的配置文件;根据所述配置文件生成所述测试用例。In a fourth aspect, an embodiment of the present invention provides a software testing device, comprising: an acquisition module, used to acquire a test case of the target software if it is necessary to test the target software; a second determination module, used to test the target software through the test case to obtain a test result; wherein the test case of the target software is generated in the following manner: determining a parameter value of the test case based on user data of the target software; wherein the user data includes: operation data of the user of the target software operating the target software; generating a configuration file of the test case based on the parameter value; and generating the test case based on the configuration file.

第五方面,本发明实施例提供了一种服务器,包括处理器和存储器,所述存储器存储有能够被所述处理器执行的机器可执行指令,所述处理器执行所述机器可执行指令以实现上述第一方面任一项所述的生成测试用例的方法,或者上述第二方面任一项所述的软件测试方法。In a fifth aspect, an embodiment of the present invention provides a server, comprising a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for generating test cases described in any one of the first aspect above, or the software testing method described in any one of the second aspect above.

第六方面,本发明实施例提供了一种机器可读存储介质,该机器可读存储介质存储有机器可执行指令,该机器可执行指令在被处理器调用和执行时,机器可执行指令促使处理器实现上述第一方面任一项所述的生成测试用例的方法,或者上述第二方面任一项所述的软件测试方法。In the sixth aspect, an embodiment of the present invention provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the method for generating test cases described in any one of the first aspects above, or the software testing method described in any one of the second aspects above.

本发明提供的生成测试用例的方法、软件测试方法、装置和服务器,如果需要生成目标软件的测试用例,根据该目标软件的用户的相关操作数据,确定测试用例的参数值;根据这些参数值生成测试用例的配置文件,进而生成测试用例。该方法根据目标软件的真实的用户操作数据,自动生成测试用例,相对于人工编写测试用例的方式,真实的用户操作数据,使得生成的测试用例与目标软件的实际应用场景相匹配,从而提高了软件测试的准确性和可靠性;同时,也提高了测试用例的生成效率。The method for generating test cases, the software testing method, the device and the server provided by the present invention, if it is necessary to generate test cases for target software, determine the parameter values of the test cases according to the relevant operation data of the users of the target software; generate the configuration files of the test cases according to these parameter values, and then generate the test cases. The method automatically generates test cases according to the real user operation data of the target software. Compared with the method of manually writing test cases, the real user operation data makes the generated test cases match the actual application scenarios of the target software, thereby improving the accuracy and reliability of software testing; at the same time, it also improves the efficiency of test case generation.

本发明的其他特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本发明而了解。本发明的目的和其他优点在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

为使本发明的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本发明具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施方式,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

图1为本发明实施例提供的一种生成测试用例的方法的流程图;FIG1 is a flow chart of a method for generating a test case provided by an embodiment of the present invention;

图2为本发明实施例提供的另一种生成测试用例的方法的流程图;FIG2 is a flow chart of another method for generating test cases provided by an embodiment of the present invention;

图3为本发明实施例提供的另一种生成测试用例的方法的流程图;FIG3 is a flowchart of another method for generating test cases provided by an embodiment of the present invention;

图4为本发明实施例提供的另一种生成测试用例的方法的流程图;FIG4 is a flowchart of another method for generating test cases provided by an embodiment of the present invention;

图5为本发明实施例提供的一种软件测试方法的流程图;FIG5 is a flow chart of a software testing method provided by an embodiment of the present invention;

图6为本发明实施例提供的另一种软件测试方法的流程图;FIG6 is a flow chart of another software testing method provided by an embodiment of the present invention;

图7为本发明实施例提供的一种生成测试用例的装置的结构示意图;FIG7 is a schematic diagram of the structure of a device for generating test cases provided by an embodiment of the present invention;

图8为本发明实施例提供的一种软件测试装置的结构示意图;FIG8 is a schematic diagram of the structure of a software testing device provided by an embodiment of the present invention;

图9为本发明实施例提供的一种服务器的结构示意图。FIG. 9 is a schematic diagram of the structure of a server provided in an embodiment of the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合附图对本发明的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

在当前软件测试行业中,自动化测试是软件生命周期的一个组成部分,在回归测试以及持续集成测试中占有无可替代的地位,在软件开发的各个阶段都可以通过测试用例对软件进行自动化测试,因此,通过正确的方式选择合理的测试用例非常重要。当前自动化测试所使用的测试用例,大多通过人工编写得到,目前主要采用以下两种方式从编写的测试用例中选取测试用例:In the current software testing industry, automated testing is an integral part of the software life cycle and plays an irreplaceable role in regression testing and continuous integration testing. Test cases can be used to perform automated testing on software at all stages of software development. Therefore, it is very important to select reasonable test cases in the right way. Most of the test cases currently used in automated testing are written manually. Currently, the following two methods are mainly used to select test cases from written test cases:

方式一,人工借助经验选择一部分测试用例,但是,该方式无法保证覆盖率,无法确定覆盖全部场景,并且,随着时间推移会生成大量冗余;比如,对于产品来说,产品功能是不断更新的,例如机房新增了机型A,需要根据机型A配置与机型A相匹配的测试用例,随着时间推移,如果后续需要将机型A替换为新的机型B,则需要根据机型B配置与机型B相匹配的测试用例,这时虽然不再需要机型A,但是仍然保留有机型A相匹配的测试用例,从而产生冗余。Method 1 is to manually select some test cases based on experience. However, this method cannot guarantee coverage and cannot ensure that all scenarios are covered. In addition, a large amount of redundancy will be generated over time. For example, for products, product functions are constantly updated. For example, if model A is newly added to the computer room, test cases matching model A need to be configured based on model A. As time goes by, if model A needs to be replaced with new model B, test cases matching model B need to be configured based on model B. At this time, although model A is no longer needed, test cases matching model A are still retained, resulting in redundancy.

方式二,通过待测试软件的覆盖率测试指标自动选取一部分测试用例,基于一些策略来验证少量测试用例,其中,覆盖率测试指标可以理解为针对开发代码的覆盖率;上述策略可以是基于修改部分、基于风险程度或基于操作剖面等;虽然采用该方式所选取的测试用例的覆盖面较全,但是,该方式执行覆盖面较大,执行效率低,而且无法覆盖异常场景。Method 2: automatically select a part of test cases through the coverage test index of the software to be tested, and verify a small number of test cases based on some strategies, where the coverage test index can be understood as the coverage of the development code; the above strategies can be based on the modified part, the risk level or the operation profile, etc.; although the coverage of the test cases selected by this method is more comprehensive, the execution coverage of this method is large, the execution efficiency is low, and it cannot cover abnormal scenarios.

由于测试用例由人工编写得到,一方面,需要通过人为从config(配置文件)中获取参数,将参数放到自动化脚本中,操作较繁琐,智能化较低;另一方面,很难与软件的实际应用场景相匹配,测试的准确性和可靠性较低。Since the test cases are written manually, on the one hand, it is necessary to manually obtain parameters from the config (configuration file) and put the parameters into the automated script, which is cumbersome and less intelligent; on the other hand, it is difficult to match the actual application scenarios of the software, and the accuracy and reliability of the test are low.

基于此,本发明实施例提供的一种生成测试用例的方法、软件测试方法、装置和服务器,该技术可以应用于需要生成测试用例的应用中,或者需要通过测试用例对待测试软件进行测试的应用中。为便于对本实施例进行理解,首先对本发明实施例所公开的一种生成测试用例的方法进行详细介绍,如图1所示,该方法包括如下步骤:Based on this, the embodiments of the present invention provide a method for generating test cases, a software testing method, a device and a server. The technology can be applied to applications that need to generate test cases, or applications that need to test software to be tested through test cases. To facilitate understanding of this embodiment, a method for generating test cases disclosed in an embodiment of the present invention is first introduced in detail. As shown in Figure 1, the method includes the following steps:

步骤S102,如果需要生成目标软件的测试用例,根据该目标软件的用户数据,确定测试用例的参数值;其中,该用户数据包括:目标软件的用户操作目标软件的操作数据。Step S102, if a test case of the target software needs to be generated, the parameter value of the test case is determined according to the user data of the target software; wherein the user data includes: operation data of the user of the target software operating the target software.

上述目标软件可以理解为需要进行功能测试的软件产品;上述测试用例可以理解为对一项特定的软件产品进行测试任务的描述,其中通常包括测试方案、方法、技术或策略等;在对目标软件进行自动化测试时,测试用例可以是通过java(一种面向对象编程语言)或python(一种跨平台的计算机程序设计语言)等语言借助testng(一种开源自动化测试框架)等框架生成辅助人工测试的工具;上述参数值可以理解为与测试用例相关的具体数值,比如,并发开机数量、mongodb(一种基于分布式文件存储的数据库)添加安全组数量等;上述操作数据可以包括用户购买的mongodb数量、用户对实例进行更配的次数等;在实际实现时,如果需要生成目标软件的测试用例,可以根据使用该目标软件的用户的相关操作数据,确定与测试用例相关的参数值。The above-mentioned target software can be understood as a software product that needs to be functionally tested; the above-mentioned test case can be understood as a description of a test task for a specific software product, which usually includes a test plan, method, technology or strategy, etc.; when performing automated testing on the target software, the test case can be a tool for assisting manual testing generated by using languages such as java (an object-oriented programming language) or python (a cross-platform computer programming language) with the help of frameworks such as testng (an open source automated testing framework); the above-mentioned parameter values can be understood as specific values related to the test case, such as the number of concurrent startups, the number of security groups added to mongodb (a database based on distributed file storage), etc.; the above-mentioned operation data may include the number of mongodb purchased by the user, the number of times the user has reconfigured the instance, etc.; in actual implementation, if it is necessary to generate a test case for the target software, the parameter value related to the test case can be determined based on the relevant operation data of the user who uses the target software.

步骤S104,根据上述参数值生成上述测试用例的配置文件。Step S104: Generate a configuration file for the test case according to the parameter values.

上述配置文件可以理解为能对测试用例的相关参数进行配置的文件;当根据目标软件的用户数据,确定测试用例的参数值后,可以根据该参数值,生成与该测试用例相匹配的配置文件。The above configuration file can be understood as a file that can configure the relevant parameters of the test case; after the parameter value of the test case is determined according to the user data of the target software, a configuration file matching the test case can be generated according to the parameter value.

步骤S106,根据上述配置文件生成测试用例。Step S106, generating a test case according to the above configuration file.

在实际实现时,可以通过自动化脚本读取配置文件,根据所读取的配置文件中的相关数据,生成测试用例。In actual implementation, the configuration file can be read through an automated script, and test cases can be generated based on relevant data in the read configuration file.

本发明实施例提供的一种生成测试用例的方法,如果需要生成目标软件的测试用例,根据该目标软件的用户的相关操作数据,确定测试用例的参数值;根据这些参数值生成测试用例的配置文件,进而生成测试用例。该方法根据目标软件的真实的用户操作数据,自动生成测试用例,相对于人工编写测试用例的方式,真实的用户操作数据,使得生成的测试用例与目标软件的实际应用场景相匹配,从而提高了软件测试的准确性和可靠性;同时,也提高了测试用例的生成效率。A method for generating a test case provided by an embodiment of the present invention, if a test case for a target software needs to be generated, the parameter values of the test case are determined according to the relevant operation data of the user of the target software; a configuration file of the test case is generated according to these parameter values, and then the test case is generated. The method automatically generates test cases according to the real user operation data of the target software. Compared with the method of manually writing test cases, the real user operation data makes the generated test cases match the actual application scenarios of the target software, thereby improving the accuracy and reliability of software testing; at the same time, the generation efficiency of test cases is also improved.

本发明实施例还提供了另一种生成测试用例的方法,该方法在上述实施例方法的基础上实现;该方法重点描述根据目标软件的用户数据,确定测试用例的参数值的具体过程,具体对应下述步骤S202至步骤S204。An embodiment of the present invention also provides another method for generating a test case, which is implemented on the basis of the method of the above embodiment; the method focuses on describing the specific process of determining the parameter value of the test case according to the user data of the target software, which specifically corresponds to the following steps S202 to S204.

该方法中,测试用例包括至少一个用例参数;该用例参数可以理解为需要进行测试用例设计的参数项,比如:并发开机数量或mongodb添加安全组数量等;用例参数通常设置有标识符;该标识符用于指示:用例参数的参数值根据用户数据确定,或者用例参数的参数值为指定值;在实际实现时,有些用例参数的参数值需要根据用户数据确定,然后自动生成测试用例;而有些用例参数的参数值的确定方式比较灵活,可以不需要根据用户数据确定,比如可以人工设定相应的指定值等;可以以boolean类型值作为标识符,以对用例参数进行标识,通过boolean类型值控制是否需要根据用户数据确定用例参数的参数值;该boolean类型值可以是0或1,通常测试工程师会预先设定好boolean类型值分别为0和1时,所对应的用例参数的参数值的确定方式,比如,当boolean类型值是1时,表示用例参数的参数值可以根据用户数据确定,当boolean类型值是0时,表示用例参数的参数值可以是人工设定的指定值等。In the method, the test case includes at least one test case parameter; the test case parameter can be understood as a parameter item that needs to be designed for the test case, such as: the number of concurrent startups or the number of security groups added to mongodb; the test case parameter is usually provided with an identifier; the identifier is used to indicate: the parameter value of the test case parameter is determined according to user data, or the parameter value of the test case parameter can be a specified value; in actual implementation, the parameter values of some test case parameters need to be determined according to user data, and then the test case is automatically generated; while the parameter values of some test case parameters are determined in a more flexible manner and do not need to be determined according to user data, such as manually setting the corresponding specified value, etc.; a boolean type value can be used as an identifier to identify the test case parameter, and the boolean type value is used to control whether the parameter value of the test case parameter needs to be determined according to user data; the boolean type value can be 0 or 1, and usually the test engineer will pre-set the method for determining the parameter value of the corresponding use case parameter when the boolean type value is 0 and 1 respectively, for example, when the boolean type value is 1, it means that the parameter value of the use case parameter can be determined according to user data, and when the boolean type value is 0, it means that the parameter value of the use case parameter can be a manually set specified value, etc.

用户数据预先存储在预设的关系型数据库中;用户数据中的至少一部分数据同步在预设的缓存数据库中;该关系型数据库可以是MySQL(其中,SQL英文全称为StructuredQuery Language,表示一种结构化查询语言),该缓存数据库可以是redis(RemoteDictionary Server,远程字典服务),当然也可以根据需求选择其他关系型数据库或其他缓存数据库;在实际实现时,可以预先通过工具获取线上用户数据,并将获取到的用户数据存储到指定的关系型数据库中,如可以存储到MySQL数据库中。User data is pre-stored in a preset relational database; at least a portion of the user data is synchronized in a preset cache database; the relational database may be MySQL (SQL is the full name of Structured Query Language), and the cache database may be redis (Remote Dictionary Server). Of course, other relational databases or other cache databases may be selected as required. In actual implementation, online user data may be obtained in advance through a tool, and the obtained user data may be stored in a specified relational database, such as a MySQL database.

如图2所示,该方法包括如下步骤:As shown in FIG2 , the method comprises the following steps:

步骤S202,如果需要根据用户数据确定用例参数的参数值,获取与该用例参数相关的用户数据。Step S202: if it is necessary to determine the parameter value of the use case parameter according to the user data, obtain the user data related to the use case parameter.

该步骤S202具体可以包括:查询用例参数的标识符,如果用例参数的标识符指示用例参数的参数值根据用户数据确定,获取与用例参数相关的用户数据。The step S202 may specifically include: querying the identifier of the use case parameter, and if the identifier of the use case parameter indicates that the parameter value of the use case parameter is determined according to user data, acquiring user data related to the use case parameter.

在实际实现时,当需要生成目标软件的测试用例时,考虑到测试用例中通常包括至少一个用例参数,一般需要先查询该用例参数所对应的标识符,以确认该用例参数的参数值的确定方式;比如,如果是以boolean类型值作为标识符,且预先设定当boolean类型值是1时,表示用例参数的参数值可以根据用户数据确定;这时,如果查询到boolean类型值是1,则可以获取与用例参数相关的用户数据。In actual implementation, when it is necessary to generate a test case for the target software, considering that the test case usually includes at least one use case parameter, it is generally necessary to first query the identifier corresponding to the use case parameter to confirm the method for determining the parameter value of the use case parameter; for example, if a boolean type value is used as the identifier, and it is pre-set that when the boolean type value is 1, it means that the parameter value of the use case parameter can be determined based on user data; at this time, if the boolean type value queried is 1, the user data related to the use case parameter can be obtained.

考虑到用户数据存储位置的差异,获取与用例参数相关的用户数据的步骤具体可以通过下述步骤一和步骤二实现:Considering the differences in user data storage locations, the steps for obtaining user data related to use case parameters can be specifically implemented through the following steps 1 and 2:

步骤一,从缓存数据库中获取与用例参数相关的用户数据。Step 1: Get user data related to the use case parameters from the cache database.

在实际实现时,用户数据存储到预设的关系型数据库中后,关系型数据库通常会同步部分数据到缓存数据库中,比如,MySQL数据库通常会同步部分数据到redis数据库中;对于一些常规操作,如果redis数据库中包含了常规操作所需要的用户数据,则可以通过自动化脚本直接从redis数据库中获取常规操作所对应的用例参数相关的用户数据。In actual implementation, after the user data is stored in the preset relational database, the relational database usually synchronizes part of the data to the cache database. For example, the MySQL database usually synchronizes part of the data to the redis database. For some routine operations, if the redis database contains the user data required for the routine operations, the user data related to the use case parameters corresponding to the routine operations can be directly obtained from the redis database through automated scripts.

步骤二,如果从缓存数据库中获取不到与用例参数相关的用户数据,通过该缓存数据库,从关系型数据库中获取与用例参数相关的用户数据。Step 2: If the user data related to the use case parameters cannot be obtained from the cache database, the user data related to the use case parameters is obtained from the relational database through the cache database.

由于缓存数据库中只同步了用户数据中的一部分数据,因此,对于一些用例参数相关的用户数据,可能自动化代码并不能从缓存数据库中获取到所需要的用户数据,而关系型数据库中包含了完整的用户数据,这时,可以通过自动化代码先从关系型数据库中获取用例参数相关的用户数据,更新到缓存数据库中,然后再从更新后的缓存数据库中获取用例参数相关的用户数据;比如,如果从redis数据库中获取不到所需要的用户数据,可以先从MySQL数据库中获取到该用户数据,然后更新到redis数据库中,再从更新后的redis数据库中获取所需要的用户数据。Since only a part of the user data is synchronized in the cache database, the automated code may not be able to obtain the required user data related to some use case parameters from the cache database, while the relational database contains complete user data. In this case, the automated code can be used to first obtain the user data related to the use case parameters from the relational database, update it to the cache database, and then obtain the user data related to the use case parameters from the updated cache database; for example, if the required user data cannot be obtained from the redis database, the user data can be obtained from the MySQL database first, then updated to the redis database, and then the required user data can be obtained from the updated redis database.

步骤S204,根据与用例参数相关的用户数据,确定该用例参数的参数值。具体的,该步骤S204可以通过下述步骤三至步骤四来实现:Step S204, determining the parameter value of the use case parameter according to the user data related to the use case parameter. Specifically, step S204 can be implemented by the following steps 3 to 4:

步骤三,从用户数据中获取用例参数的备选参数值。Step three: Obtain candidate parameter values for the use case parameters from user data.

上述备选参数值可以理解为与用例参数相关的参数值,用户数据中通常包含用例参数的一个或多个备选参数值;可以通过编写自动化代码,从缓存数据库,如redis数据库中,获取用例参数的备选参数值;比如,以用例参数为并发开机数量为例进行说明,获取一定时间内用户并发开机数量,将获取到的数量值插入到关系型数据库,并同步至缓存数据库中,这时通常可以从缓存数据库中获取到该时间段内,多个不同时间点所对应的并发开机数量的多个数量值,多个数量值即为上述备选参数值,在实际实现时,多个数量值可以是相同的数据值,也可以是不同的数据值。The above-mentioned alternative parameter values can be understood as parameter values related to the use case parameters. User data usually contains one or more alternative parameter values for the use case parameters. The alternative parameter values of the use case parameters can be obtained from a cache database, such as a redis database, by writing automated code. For example, taking the use case parameter as the number of concurrent startups as an example, the number of concurrent startups of users within a certain period of time is obtained, the obtained number value is inserted into the relational database, and synchronized to the cache database. At this time, multiple number values of the number of concurrent startups corresponding to multiple different time points within the time period can usually be obtained from the cache database. The multiple number values are the above-mentioned alternative parameter values. In actual implementation, the multiple number values can be the same data value or different data values.

步骤四,如果上述备选参数值包括多种,根据备选参数值的大小,从多种备选参数值中确定用例参数的参数值。Step 4: If the above candidate parameter values include multiple ones, determine the parameter value of the use case parameter from the multiple candidate parameter values according to the size of the candidate parameter values.

可以通过自动化代码对上述获取到的用例参数的备选参数值进行筛选,如果上述备选参数值包括多种大小不同的数据值,可以对多种备选参数值进行比较,得到比较结果,根据需求从该比较结果中选取满足要求的备选参数值作为用例参数的参数值;比如,仍以用例参数为并发开机数量为例进行说明,如果获取到的并发开机数量的多个数量值中包括多种不同的数据值,可以从中选取并发开机数量所对应的最大的数据值,作为用例参数的参数值;再比如,有10个用户,每个用户都使用同一个目标软件,假如其中有9个用户只对自己的实例操作了一次,第10个用户对自己的实例操作了100次,那获取的就是100次的实例,也可以理解为,同种类型的数据,可以按照数据值的大小进行筛选,从中选取满足要求的数据值,一般选取的是最大值。The alternative parameter values of the use case parameters obtained above can be screened through automated code. If the alternative parameter values include multiple data values of different sizes, the multiple alternative parameter values can be compared to obtain comparison results, and the alternative parameter values that meet the requirements are selected from the comparison results as the parameter values of the use case parameters according to the requirements; for example, still taking the use case parameter as the number of concurrent startups as an example, if the multiple numbers of concurrent startups obtained include multiple different data values, the largest data value corresponding to the number of concurrent startups can be selected as the parameter value of the use case parameter; for another example, there are 10 users, each of whom uses the same target software. If 9 of the users only operate their own instances once, and the 10th user operates his own instance 100 times, then 100 instances are obtained. It can also be understood that the same type of data can be screened according to the size of the data value, and the data value that meets the requirements is selected, and the maximum value is generally selected.

步骤S206,根据参数值生成测试用例的配置文件。Step S206: Generate a configuration file for the test case according to the parameter values.

步骤S208,根据配置文件生成测试用例。Step S208: Generate test cases according to the configuration file.

上述生成测试用例的方法,测试用例包括至少一个用例参数;如果需要根据用户数据确定用例参数的参数值,首先获取与用例参数相关的用户数据;然后根据获取到的用户数据,确定用例参数的参数值。最后根据这些参数值生成测试用例的配置文件,进而生成测试用例。该方法根据目标软件的真实的用户操作数据,自动生成测试用例,相对于人工编写测试用例的方式,真实的用户操作数据,使得生成的测试用例与目标软件的实际应用场景相匹配,从而提高了软件测试的准确性和可靠性;同时,也提高了测试用例的生成效率。In the above method for generating test cases, the test case includes at least one test case parameter; if the parameter value of the test case parameter needs to be determined according to user data, firstly, the user data related to the test case parameter is obtained; then, the parameter value of the test case parameter is determined according to the obtained user data. Finally, a configuration file of the test case is generated according to these parameter values, and then the test case is generated. The method automatically generates test cases according to the real user operation data of the target software. Compared with the method of manually writing test cases, the real user operation data makes the generated test cases match the actual application scenarios of the target software, thereby improving the accuracy and reliability of software testing; at the same time, it also improves the efficiency of test case generation.

本发明实施例还提供了另一种生成测试用例的方法,该方法在上述实施例方法的基础上实现;该方法重点描述根据参数值生成测试用例的配置文件的具体过程,具体对应下述步骤S304至步骤S306。如图3所示,该方法包括如下步骤:The embodiment of the present invention also provides another method for generating a test case, which is implemented on the basis of the method of the above embodiment; the method focuses on describing the specific process of generating a configuration file of a test case according to parameter values, which specifically corresponds to the following steps S304 to S306. As shown in FIG3 , the method includes the following steps:

步骤S302,如果需要生成目标软件的测试用例,根据目标软件的用户数据,确定测试用例的参数值;其中,用户数据包括:目标软件的用户操作目标软件的操作数据。Step S302, if a test case of the target software needs to be generated, the parameter value of the test case is determined according to the user data of the target software; wherein the user data includes: operation data of the user of the target software operating the target software.

步骤S304,将参数值填入至参数值对应的用例参数中。Step S304, fill the parameter value into the use case parameter corresponding to the parameter value.

在实际实现时,可以通过自动化脚本从缓存数据库中获取上述测试用例的参数值,考虑到测试用例通常包括至少一个用例参数,可以将获取到的参数值填入至所对应的用例参数中,比如,仍以用例参数为并发开机数量为例进行说明,如果将并发开机数量所对应的最大的数量值,作为用例参数的参数值,可以通过自动化脚本从缓存数据库中读取该最大的数量值,并填入至并发开机数量对应的用例参数中。In actual implementation, the parameter values of the above test cases can be obtained from the cache database through an automated script. Considering that a test case usually includes at least one use case parameter, the obtained parameter value can be filled in the corresponding use case parameter. For example, taking the use case parameter as the number of concurrent startups as an example, if the maximum number value corresponding to the number of concurrent startups is used as the parameter value of the use case parameter, the maximum number value can be read from the cache database through an automated script and filled in the use case parameter corresponding to the number of concurrent startups.

步骤S306,根据用例参数,以及用例参数对应的参数值,生成测试用例的配置文件。Step S306: Generate a configuration file for the test case based on the use case parameters and parameter values corresponding to the use case parameters.

上述配置文件可以是conf文件,在实际实现时,可以通过自动化代码,根据已填入参数值的用例参数,自动生成测试用例的配置文件。The above configuration file may be a conf file. In actual implementation, the configuration file of the test case may be automatically generated through automation code according to the test case parameters with filled parameter values.

步骤S308,根据配置文件生成测试用例。Step S308: Generate test cases according to the configuration file.

在实际实现时,可以通过自动化脚本读取配置文件,如读取conf文件,利用读取到的数据,自动生成测试用例,以对目标软件进行测试,比如可以用于每日的巡检或回归测试任务,其中,回归测试可以理解为一种能够检测到回归bug的受控实验,也可以理解为在修改了旧代码后,重新进行测试以确认修改没有引入新的错误或导致其他代码产生错误;该测试用例可以是自动化代码的形式,其中通常包括检查点等。In actual implementation, the configuration file can be read through an automated script, such as reading a conf file, and the read data can be used to automatically generate test cases to test the target software. For example, it can be used for daily inspections or regression testing tasks. Regression testing can be understood as a controlled experiment that can detect regression bugs, or it can be understood as retesting after modifying the old code to confirm that the modification has not introduced new errors or caused errors in other codes; the test case can be in the form of automated code, which usually includes checkpoints, etc.

下面以用户选择的mongodb添加安全组数量为用例参数进行测试用例设计,首先获取一定时间内用户为mongodb添加安全组的数量,通常可以获取到多个数量值,对获取到的多个数量值进行对比,从中选取最大的数量值以获取最大安全组数量,可以通过自动化脚本从缓存数据库中读取该最大的数量值,并填入至mongodb添加安全组对应的用例参数中,通过自动化代码自动生成测试用例的配置文件,如conf文件,自动化脚本读取该conf文件,自动生成完整的自动化测试用例。The following test case design is based on the number of mongodb security groups added by the user selected as the use case parameter. First, the number of security groups added by users to mongodb within a certain period of time is obtained. Usually, multiple quantity values can be obtained. The multiple quantity values obtained are compared, and the largest quantity value is selected to obtain the maximum number of security groups. The maximum quantity value can be read from the cache database through an automated script and filled into the use case parameter corresponding to mongodb adding security groups. The test case configuration file, such as the conf file, is automatically generated through the automated code. The automated script reads the conf file and automatically generates a complete automated test case.

上述生成测试用例的方法,如果需要生成目标软件的测试用例,根据该目标软件的用户的相关操作数据,确定测试用例的参数值;将参数值填入至参数值对应的用例参数中,根据用例参数,以及用例参数对应的参数值,生成测试用例的配置文件,进而生成测试用例。该方法根据目标软件的真实的用户操作数据,自动生成测试用例,相对于人工编写测试用例的方式,真实的用户操作数据,使得生成的测试用例与目标软件的实际应用场景相匹配,从而提高了软件测试的准确性和可靠性;同时,也提高了测试用例的生成效率。In the above method for generating test cases, if it is necessary to generate test cases for the target software, the parameter values of the test cases are determined according to the relevant operation data of the users of the target software; the parameter values are filled into the use case parameters corresponding to the parameter values, and the configuration files of the test cases are generated according to the use case parameters and the parameter values corresponding to the use case parameters, thereby generating the test cases. This method automatically generates test cases according to the real user operation data of the target software. Compared with the method of manually writing test cases, the real user operation data makes the generated test cases match the actual application scenarios of the target software, thereby improving the accuracy and reliability of software testing; at the same time, it also improves the efficiency of test case generation.

本发明实施例还提供了另一种生成测试用例的方法,该方法在上述实施例方法的基础上实现;该方法重点描述根据目标软件的更新用户数据,更新测试用例的具体过程,具体对应下述步骤S408至步骤S410,如图4所示,该方法包括如下步骤:The embodiment of the present invention also provides another method for generating test cases, which is implemented on the basis of the method of the above embodiment; the method focuses on describing the specific process of updating the test cases according to the updated user data of the target software, which specifically corresponds to the following steps S408 to S410, as shown in FIG4, and the method includes the following steps:

步骤S402,如果需要生成目标软件的测试用例,根据目标软件的用户数据,确定测试用例的参数值;其中,用户数据包括:目标软件的用户操作目标软件的操作数据。Step S402, if a test case of the target software needs to be generated, the parameter value of the test case is determined according to the user data of the target software; wherein the user data includes: operation data of the user of the target software operating the target software.

步骤S404,根据参数值生成测试用例的配置文件。Step S404: Generate a configuration file for the test case according to the parameter values.

步骤S406,根据配置文件生成测试用例。Step S406: Generate test cases according to the configuration file.

步骤S408,按照预设的时间间隔,获取目标软件的更新用户数据。Step S408: acquiring updated user data of the target software at a preset time interval.

上述预设的时间间隔可以根据实际需求进行设定,比如该时间间隔可以是每天、每小时等,也可以是实时获取目标软件的更新用户数据,该更新用户数据可以理解为目标软件的用户操作目标软件时所产生的新的操作数据;在实际实现时,考虑到目标软件的用户操作目标软件时的操作数据是不断更新的,需要按照预设时间间隔,获取该目标软件的更新用户数据,比如可以每日获取线上用户数据,获取用户最新行为,以保证所生成的测试用例场景的可靠性。The above-mentioned preset time interval can be set according to actual needs. For example, the time interval can be daily, hourly, etc., or it can be real-time acquisition of updated user data of the target software. The updated user data can be understood as new operation data generated when the user of the target software operates the target software. In actual implementation, considering that the operation data of the user of the target software when operating the target software is constantly updated, it is necessary to obtain the updated user data of the target software according to the preset time interval. For example, online user data can be obtained daily to obtain the latest user behavior to ensure the reliability of the generated test case scenario.

步骤S410,根据上述更新用户数据,更新测试用例。Step S410: Update the test case according to the above updated user data.

当获取到目标软件的更新用户数据后,可以根据该更新用户数据,确定测试用例的更新参数值,然后根据该更新参数值生成该测试用例的更新配置文件,进而根据该更新配置文件更新测试用例。After the updated user data of the target software is obtained, the updated parameter values of the test case can be determined according to the updated user data, and then an updated configuration file of the test case is generated according to the updated parameter values, and then the test case is updated according to the updated configuration file.

上述生成测试用例的方法,如果需要生成目标软件的测试用例,根据该目标软件的用户的相关操作数据,确定测试用例的参数值;根据这些参数值生成测试用例的配置文件,进而生成测试用例;根据获取到的目标软件的更新用户数据,更新测试用例。该方法将线上用户数据进行保存处理,实时获取用户最新动态,获取用户数据后自动生成测试用例,不需要人工编写用例和自动化脚本,既保证了测试用例场景的高可靠性,又节省了生成测试用例的时间,提高了测试效率,保证了自动化测试中所使用的用户数据即为用户操作,准确性高;对于持续集成测试、添加新功能后的回归测试,以及后续的线上场景实时回放等,可以直接进行自动化的执行,不需要人工再去选取测试用例,极大的提高了测试用例的智能化。The above method for generating test cases, if it is necessary to generate test cases for the target software, determines the parameter values of the test cases according to the relevant operation data of the users of the target software; generates a configuration file for the test cases according to these parameter values, and then generates the test cases; updates the test cases according to the updated user data of the target software obtained. This method saves and processes online user data, obtains the latest user dynamics in real time, and automatically generates test cases after obtaining user data. It does not require manual writing of test cases and automation scripts, which not only ensures the high reliability of the test case scenarios, but also saves the time of generating test cases, improves the testing efficiency, and ensures that the user data used in the automated testing is the user operation with high accuracy; for continuous integration testing, regression testing after adding new functions, and subsequent real-time playback of online scenarios, etc., it can be directly executed automatically without manual selection of test cases, which greatly improves the intelligence of test cases.

发明实施例提供了一种软件测试方法,该方法在上述实施例方法的基础上实现;如图5所示,该方法包括如下步骤:The embodiment of the invention provides a software testing method, which is implemented on the basis of the method in the above embodiment; as shown in FIG5 , the method includes the following steps:

步骤S502,如果需要测试目标软件,获取目标软件的测试用例;其中,目标软件的测试用例,通过下述方式生成:根据目标软件的用户数据,确定测试用例的参数值;其中,用户数据包括:目标软件的用户操作目标软件的操作数据;根据参数值生成测试用例的配置文件;根据配置文件生成测试用例。Step S502, if the target software needs to be tested, obtain the test case of the target software; wherein the test case of the target software is generated in the following manner: determine the parameter value of the test case according to the user data of the target software; wherein the user data includes: the operation data of the user of the target software operating the target software; generate a configuration file of the test case according to the parameter value; generate the test case according to the configuration file.

步骤S504,通过测试用例对目标软件进行测试,得到测试结果。Step S504: test the target software using the test case to obtain the test result.

上述测试结果可以理解为,在根据测试用例中的测试方法对目标软件进行测试后,所得到的目标软件的实际测试结果,根据该实际测试结果可以确认目标软件中,该测试用例所对应的软件功能是否满足软件需求等。The above test results can be understood as the actual test results of the target software obtained after testing the target software according to the test method in the test case. Based on the actual test results, it can be confirmed whether the software function corresponding to the test case in the target software meets the software requirements, etc.

本发明实施例提供的一种软件测试方法,如果需要测试目标软件,可以通过获取到的该目标软件的测试用例,对该目标软件进行测试,得到测试结果;其中,目标软件的测试用例,可以通过下述方式生成:根据该目标软件的用户的相关操作数据,确定测试用例的参数值;根据这些参数值生成测试用例的配置文件,进而生成测试用例。该方法根据目标软件的真实的用户操作数据,自动生成测试用例,相对于人工编写测试用例的方式,真实的用户操作数据,使得生成的测试用例与目标软件的实际应用场景相匹配,从而提高了软件测试的准确性和可靠性;同时,也提高了测试用例的生成效率。A software testing method provided by an embodiment of the present invention can test the target software by acquiring the test case of the target software to obtain the test result; wherein the test case of the target software can be generated in the following manner: determining the parameter value of the test case according to the relevant operation data of the user of the target software; generating a configuration file of the test case according to these parameter values, and then generating the test case. The method automatically generates the test case according to the real user operation data of the target software. Compared with the method of manually writing the test case, the real user operation data makes the generated test case match the actual application scenario of the target software, thereby improving the accuracy and reliability of the software test; at the same time, it also improves the efficiency of generating the test case.

本发明实施例还提供了另一种软件测试方法,该方法在上述实施例方法的基础上实现;如图6所示,该方法包括如下步骤:The embodiment of the present invention further provides another software testing method, which is implemented on the basis of the method in the above embodiment; as shown in FIG6 , the method comprises the following steps:

步骤S602,如果需要测试目标软件,获取目标软件的测试用例;其中,目标软件的测试用例,通过下述方式生成:根据目标软件的用户数据,确定测试用例的参数值;其中,用户数据包括:目标软件的用户操作目标软件的操作数据;根据参数值生成测试用例的配置文件;根据配置文件生成测试用例。Step S602, if the target software needs to be tested, obtain the test case of the target software; wherein the test case of the target software is generated in the following manner: determine the parameter value of the test case according to the user data of the target software; wherein the user data includes: the operation data of the user of the target software operating the target software; generate a configuration file of the test case according to the parameter value; generate the test case according to the configuration file.

步骤S604,通过测试用例对目标软件进行测试,得到测试结果。Step S604: test the target software using the test case to obtain the test result.

步骤S606,将测试结果发送至指定的测试结果接收地址。Step S606: Send the test result to a designated test result receiving address.

上述测试结果接收地址可以包括工作群或邮箱等,可以根据实际需求指定该测试结果接收地址,以使该测试结果接收地址所对应的人员可以获取到该测试结果,进而可以对测试结果进行分析,以改进目标软件中,该测试用例对应的软件功能;在实际实现时,可以将自动化代码与jenkins服务器相结合,在jenkins服务器上执行根据大数据生成的自动化测试用例,jenkins服务器调用测试用例的自动化脚本,通过测试用例的自动化脚本验证目标软件,并将测试结果以报告的形式发送至jenkins服务器所配置的工作群和邮箱等;jenkins服务器有一些自带功能,如定时构建功能,通过该功能可以设定定时规则,设置完成后,构建任务就会按照所设置的时间定时执行,可以节省人力;另外还有邮件发送功能,可视化报告功能等。一般情况下,获取用户数据、生成测试用例和执行测试用例通常都是在一台设备上运行,比如,在jenkins服务器中运行。The test result receiving address may include a work group or an email address, etc. The test result receiving address may be specified according to actual needs so that the personnel corresponding to the test result receiving address can obtain the test result, and then the test result can be analyzed to improve the software function corresponding to the test case in the target software; in actual implementation, the automation code can be combined with the jenkins server, and the automated test case generated according to the big data is executed on the jenkins server. The jenkins server calls the automation script of the test case, verifies the target software through the automation script of the test case, and sends the test result in the form of a report to the work group and email address configured by the jenkins server, etc.; the jenkins server has some built-in functions, such as the timed build function, through which the timed rules can be set. After the setting is completed, the build task will be executed regularly according to the set time, which can save manpower; in addition, there are email sending functions, visual report functions, etc. In general, obtaining user data, generating test cases, and executing test cases are usually run on one device, for example, in the jenkins server.

上述软件测试方法,如果需要测试目标软件,可以通过获取到的该目标软件的测试用例,对该目标软件进行测试,得到测试结果;将测试结果发送至指定的测试结果接收地址。该方法根据目标软件的真实的用户操作数据,自动生成测试用例,相对于人工编写测试用例的方式,真实的用户操作数据,使得生成的测试用例与目标软件的实际应用场景相匹配,从而提高了软件测试的准确性和可靠性;同时,也提高了测试用例的生成效率。The above software testing method, if it is necessary to test the target software, can test the target software by obtaining the test case of the target software to obtain the test result; and send the test result to the specified test result receiving address. This method automatically generates test cases based on the real user operation data of the target software. Compared with the method of manually writing test cases, the real user operation data makes the generated test cases match the actual application scenarios of the target software, thereby improving the accuracy and reliability of software testing; at the same time, it also improves the efficiency of test case generation.

本发明实施例提供了一种生成测试用例的装置的结构示意图,如图7所示,该装置包括:第一确定模块70,用于如果需要生成目标软件的测试用例,根据目标软件的用户数据,确定测试用例的参数值;其中,用户数据包括:目标软件的用户操作目标软件的操作数据;第一生成模块71,用于根据参数值生成测试用例的配置文件;第二生成模块72,用于根据配置文件生成测试用例。An embodiment of the present invention provides a structural schematic diagram of a device for generating test cases, as shown in Figure 7, the device includes: a first determination module 70, which is used to determine the parameter value of the test case according to the user data of the target software if a test case for the target software needs to be generated; wherein the user data includes: the operation data of the user of the target software operating the target software; a first generation module 71, which is used to generate a configuration file of the test case according to the parameter value; and a second generation module 72, which is used to generate a test case according to the configuration file.

本发明实施例提供的一种生成测试用例的装置,如果需要生成目标软件的测试用例,根据该目标软件的用户的相关操作数据,确定测试用例的参数值;根据这些参数值生成测试用例的配置文件,进而生成测试用例。该装置根据目标软件的真实的用户操作数据,自动生成测试用例,相对于人工编写测试用例的方式,真实的用户操作数据,使得生成的测试用例与目标软件的实际应用场景相匹配,从而提高了软件测试的准确性和可靠性;同时,也提高了测试用例的生成效率。The embodiment of the present invention provides a device for generating test cases. If it is necessary to generate test cases for target software, the parameter values of the test cases are determined according to the relevant operation data of the user of the target software; a configuration file of the test cases is generated according to these parameter values, and then the test cases are generated. The device automatically generates test cases according to the real user operation data of the target software. Compared with the method of manually writing test cases, the real user operation data makes the generated test cases match the actual application scenarios of the target software, thereby improving the accuracy and reliability of software testing; at the same time, the efficiency of test case generation is also improved.

进一步的,测试用例包括至少一个用例参数;第一确定模块70还用于:如果需要根据用户数据确定用例参数的参数值,获取与用例参数相关的用户数据;根据与用例参数相关的用户数据,确定用例参数的参数值。Furthermore, the test case includes at least one use case parameter; the first determination module 70 is also used to: if it is necessary to determine the parameter value of the use case parameter based on user data, obtain user data related to the use case parameter; and determine the parameter value of the use case parameter based on the user data related to the use case parameter.

进一步的,用例参数设置有标识符;标识符用于指示:用例参数的参数值根据用户数据确定,或者用例参数的参数值为指定值;第一确定模块70还用于:查询用例参数的标识符,如果用例参数的标识符指示用例参数的参数值根据用户数据确定,获取与用例参数相关的用户数据。Furthermore, the use case parameter is provided with an identifier; the identifier is used to indicate that: the parameter value of the use case parameter is determined according to user data, or the parameter value of the use case parameter is a specified value; the first determination module 70 is also used to: query the identifier of the use case parameter, if the identifier of the use case parameter indicates that the parameter value of the use case parameter is determined according to user data, obtain user data related to the use case parameter.

进一步的,用户数据预先存储在预设的关系型数据库中;用户数据中的至少一部分数据同步在预设的缓存数据库中;第一确定模块70还用于:从缓存数据库中获取与用例参数相关的用户数据;如果从缓存数据库中获取不到与用例参数相关的用户数据,通过缓存数据库,从关系型数据库中获取与用例参数相关的用户数据。Furthermore, user data is pre-stored in a preset relational database; at least a portion of the user data is synchronized in a preset cache database; the first determination module 70 is also used to: obtain user data related to the use case parameters from the cache database; if the user data related to the use case parameters cannot be obtained from the cache database, obtain the user data related to the use case parameters from the relational database through the cache database.

进一步的,第一确定模块70还用于:从用户数据中获取用例参数的备选参数值;如果备选参数值包括多种,根据备选参数值的大小,从多种备选参数值中确定用例参数的参数值。Furthermore, the first determination module 70 is also used to: obtain candidate parameter values of the use case parameter from the user data; if the candidate parameter values include multiple types, determine the parameter value of the use case parameter from the multiple candidate parameter values according to the size of the candidate parameter values.

进一步的,第一生成模块71还用于:将参数值填入至参数值对应的用例参数中;根据用例参数,以及用例参数对应的参数值,生成测试用例的配置文件。Furthermore, the first generating module 71 is also used to: fill the parameter value into the use case parameter corresponding to the parameter value; and generate a configuration file of the test case according to the use case parameter and the parameter value corresponding to the use case parameter.

进一步的,该装置还用于:按照预设的时间间隔,获取目标软件的更新用户数据;根据更新用户数据,更新测试用例。Furthermore, the device is also used to: obtain updated user data of the target software at preset time intervals; and update test cases according to the updated user data.

本发明实施例所提供的生成测试用例的装置,其实现原理及产生的技术效果和前述生成测试用例的方法实施例相同,为简要描述,生成测试用例的装置实施例部分未提及之处,可参考前述生成测试用例的方法实施例中相应内容。The device for generating test cases provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment for generating test cases. For the sake of brief description, for matters not mentioned in the embodiment of the device for generating test cases, reference may be made to the corresponding contents in the aforementioned method embodiment for generating test cases.

本发明实施例提供了一种软件测试装置的结构示意图,如图8所示,该装置包括:获取模块80,用于如果需要测试目标软件,获取目标软件的测试用例;第二确定模块81,用于通过测试用例对目标软件进行测试,得到测试结果;其中,目标软件的测试用例,通过下述方式生成:根据目标软件的用户数据,确定测试用例的参数值;其中,用户数据包括:目标软件的用户操作目标软件的操作数据;根据参数值生成测试用例的配置文件;根据配置文件生成测试用例。An embodiment of the present invention provides a structural schematic diagram of a software testing device, as shown in Figure 8, the device includes: an acquisition module 80, which is used to acquire the test case of the target software if the target software needs to be tested; a second determination module 81, which is used to test the target software through the test case to obtain the test result; wherein the test case of the target software is generated in the following manner: determining the parameter value of the test case according to the user data of the target software; wherein the user data includes: operation data of the user of the target software operating the target software; generating a configuration file of the test case according to the parameter value; generating the test case according to the configuration file.

本发明实施例提供的一种软件测试装置,如果需要测试目标软件,可以通过获取到的该目标软件的测试用例,对该目标软件进行测试,得到测试结果;其中,目标软件的测试用例,可以通过下述方式生成:根据该目标软件的用户的相关操作数据,确定测试用例的参数值;根据这些参数值生成测试用例的配置文件,进而生成测试用例。该装置根据目标软件的真实的用户操作数据,自动生成测试用例,相对于人工编写测试用例的方式,真实的用户操作数据,使得生成的测试用例与目标软件的实际应用场景相匹配,从而提高了软件测试的准确性和可靠性;同时,也提高了测试用例的生成效率。A software testing device provided by an embodiment of the present invention can test the target software by acquiring the test case of the target software to obtain the test result if the target software needs to be tested; wherein the test case of the target software can be generated in the following manner: determining the parameter value of the test case according to the relevant operation data of the user of the target software; generating a configuration file of the test case according to these parameter values, and then generating the test case. The device automatically generates the test case according to the real user operation data of the target software. Compared with the method of manually writing the test case, the real user operation data makes the generated test case match the actual application scenario of the target software, thereby improving the accuracy and reliability of the software test; at the same time, it also improves the efficiency of generating the test case.

进一步的,该装置还用于:将测试结果发送至指定的测试结果接收地址。Furthermore, the device is also used to: send the test result to a designated test result receiving address.

本发明实施例所提供的软件测试装置,其实现原理及产生的技术效果和前述软件测试方法实施例相同,为简要描述,软件测试装置实施例部分未提及之处,可参考前述软件测试方法实施例中相应内容。The software testing device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned software testing method embodiment. For the sake of brief description, for matters not mentioned in the software testing device embodiment, reference may be made to the corresponding contents in the aforementioned software testing method embodiment.

本发明实施例还提供了一种服务器,参见图9所示,该服务器包括处理器130和存储器131,该存储器131存储有能够被处理器130执行的机器可执行指令,该处理器130执行机器可执行指令以实现上述生成测试用例的方法或者上述软件测试方法。An embodiment of the present invention also provides a server, as shown in Figure 9, the server includes a processor 130 and a memory 131, the memory 131 stores machine executable instructions that can be executed by the processor 130, and the processor 130 executes the machine executable instructions to implement the above-mentioned method of generating test cases or the above-mentioned software testing method.

进一步地,图9所示的服务器还包括总线132和通信接口133,处理器130、通信接口133和存储器131通过总线132连接。Furthermore, the server shown in FIG. 9 further includes a bus 132 and a communication interface 133 , and the processor 130 , the communication interface 133 and the memory 131 are connected via the bus 132 .

其中,存储器131可能包含高速随机存取存储器(RAM,Random Access Memory),也可能还包括非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器。通过至少一个通信接口133(可以是有线或者无线)实现该系统网元与至少一个其他网元之间的通信连接,可以使用互联网,广域网,本地网,城域网等。总线132可以是ISA总线、PCI总线或EISA总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图9中仅用一个双向箭头表示,但并不表示仅有一根总线或一种类型的总线。The memory 131 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 133 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 132 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one bidirectional arrow is used in FIG9, but it does not mean that there is only one bus or one type of bus.

处理器130可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器130中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器130可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(DigitalSignal Processor,简称DSP)、专用集成电路(Application Specific IntegratedCircuit,简称ASIC)、现场可编程门阵列(Field-Programmable Gate Array,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本发明实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器131,处理器130读取存储器131中的信息,结合其硬件完成前述实施例的方法的步骤。The processor 130 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 130. The above processor 130 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 131, and the processor 130 reads the information in the memory 131 and completes the steps of the method of the above embodiment in combination with its hardware.

本发明实施例还提供了一种机器可读存储介质,该机器可读存储介质存储有机器可执行指令,该机器可执行指令在被处理器调用和执行时,该机器可执行指令促使处理器实现上述生成测试用例的方法,或者软件测试方法,具体实现可参见方法实施例,在此不再赘述。An embodiment of the present invention also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned method for generating test cases, or software testing method. The specific implementation can be found in the method embodiment, which will not be repeated here.

本发明实施例所提供的生成测试用例的方法、软件测试方法、装置和服务器的计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令可用于执行前面方法实施例中所述的方法,具体实现可参见方法实施例,在此不再赘述。The computer program products of the method for generating test cases, software testing method, device and server provided in the embodiments of the present invention include a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.

所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

最后应说明的是:以上实施例,仅为本发明的具体实施方式,用以说明本发明的技术方案,而非对其限制,本发明的保护范围并不局限于此,尽管参照前述实施例对本发明进行了详细的说明,本领域技术人员应当理解:任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本发明实施例技术方案的精神和范围,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims (10)

1.一种生成测试用例的方法,其特征在于,所述方法包括:1. A method for generating a test case, characterized in that the method comprises: 如果需要生成目标软件的测试用例,根据所述目标软件的用户数据,确定所述测试用例的参数值;其中,所述用户数据包括:所述目标软件的用户操作所述目标软件的操作数据;所述操作数据包括用户购买的mongodb数量以及所述用户对所述目标软件对应实例更配的次数;If a test case of the target software needs to be generated, the parameter value of the test case is determined according to the user data of the target software; wherein the user data includes: the operation data of the user of the target software operating the target software; the operation data includes the number of mongodb purchased by the user and the number of times the user has configured the corresponding instance of the target software; 根据所述参数值生成所述测试用例的配置文件;Generate a configuration file for the test case according to the parameter value; 根据所述配置文件生成所述测试用例;Generate the test case according to the configuration file; 根据所述参数值生成所述测试用例的配置文件的步骤,包括:The step of generating a configuration file for the test case according to the parameter value comprises: 将所述参数值填入至所述参数值对应的用例参数中;所述参数值为与所述测试用例相关的具体数据;Fill the parameter value into the test case parameter corresponding to the parameter value; the parameter value is specific data related to the test case; 根据所述用例参数,以及所述用例参数对应的参数值,生成所述测试用例的配置文件;Generate a configuration file for the test case according to the test case parameters and parameter values corresponding to the test case parameters; 所述测试用例包括至少一个用例参数;The test case includes at least one test case parameter; 所述根据所述目标软件的用户数据,确定所述测试用例的参数值的步骤,包括:The step of determining the parameter value of the test case according to the user data of the target software comprises: 如果需要根据所述用户数据确定所述用例参数的参数值,获取与所述用例参数相关的用户数据;If it is necessary to determine the parameter value of the use case parameter according to the user data, obtaining the user data related to the use case parameter; 根据与所述用例参数相关的用户数据,确定所述用例参数的参数值;Determining a parameter value of the use case parameter based on user data related to the use case parameter; 所述用例参数设置有标识符;所述标识符用于指示:所述用例参数的参数值根据所述用户数据确定,或者所述用例参数的参数值为指定值;The use case parameter is provided with an identifier; the identifier is used to indicate that: the parameter value of the use case parameter is determined according to the user data, or the parameter value of the use case parameter is a specified value; 所述如果需要根据所述用户数据确定所述用例参数的参数值,获取与所述用例参数相关的用户数据的步骤,包括:If it is necessary to determine the parameter value of the use case parameter according to the user data, the step of obtaining the user data related to the use case parameter includes: 查询所述用例参数的标识符,如果所述用例参数的标识符指示所述用例参数的参数值根据所述用户数据确定,获取与所述用例参数相关的用户数据。The identifier of the use case parameter is queried, and if the identifier of the use case parameter indicates that the parameter value of the use case parameter is determined according to the user data, the user data related to the use case parameter is acquired. 2.根据权利要求1所述的方法,其特征在于,所述用户数据预先存储在预设的关系型数据库中;所述用户数据中的至少一部分数据同步在预设的缓存数据库中;2. The method according to claim 1, characterized in that the user data is pre-stored in a preset relational database; at least a portion of the user data is synchronized in a preset cache database; 所述获取与所述用例参数相关的用户数据的步骤,包括:The step of obtaining user data related to the use case parameters includes: 从所述缓存数据库中获取与所述用例参数相关的用户数据;Acquire user data related to the use case parameters from the cache database; 如果从所述缓存数据库中获取不到与所述用例参数相关的用户数据,通过所述缓存数据库,从所述关系型数据库中获取与所述用例参数相关的用户数据。If the user data related to the use case parameters cannot be obtained from the cache database, the user data related to the use case parameters are obtained from the relational database through the cache database. 3.根据权利要求1所述的方法,其特征在于,根据与所述用例参数相关的用户数据,确定所述用例参数的参数值的步骤,包括:3. The method according to claim 1, wherein the step of determining the parameter value of the use case parameter according to the user data related to the use case parameter comprises: 从所述用户数据中获取所述用例参数的备选参数值;Acquire candidate parameter values of the use case parameters from the user data; 如果所述备选参数值包括多种,根据所述备选参数值的大小,从多种所述备选参数值中确定所述用例参数的参数值。If the candidate parameter values include multiple types, the parameter value of the use case parameter is determined from the multiple candidate parameter values according to the size of the candidate parameter values. 4.根据权利要求1所述的方法,其特征在于,根据所述配置文件生成所述测试用例的步骤之后,所述方法还包括:4. The method according to claim 1, characterized in that after the step of generating the test case according to the configuration file, the method further comprises: 按照预设的时间间隔,获取所述目标软件的更新用户数据;Obtaining updated user data of the target software at preset time intervals; 根据所述更新用户数据,更新所述测试用例。The test case is updated according to the updated user data. 5.一种软件测试方法,其特征在于,所述方法包括:5. A software testing method, characterized in that the method comprises: 如果需要测试目标软件,获取所述目标软件的测试用例;If the target software needs to be tested, obtain the test case of the target software; 通过所述测试用例对所述目标软件进行测试,得到测试结果;Testing the target software through the test case to obtain a test result; 其中,所述目标软件的测试用例,通过下述方式生成:根据所述目标软件的用户数据,确定所述测试用例的参数值;其中,所述用户数据包括:所述目标软件的用户操作所述目标软件的操作数据;所述操作数据包括用户购买的mongodb数量以及所述用户对所述目标软件对应实例更配的次数;根据所述参数值生成所述测试用例的配置文件;根据所述配置文件生成所述测试用例;根据所述参数值生成所述测试用例的配置文件的步骤,包括:将所述参数值填入至所述参数值对应的用例参数中;所述参数值为与所述测试用例相关的具体数据;根据所述用例参数,以及所述用例参数对应的参数值,生成所述测试用例的配置文件;所述测试用例包括至少一个用例参数;所述根据所述目标软件的用户数据,确定所述测试用例的参数值的步骤,包括:如果需要根据所述用户数据确定所述用例参数的参数值,获取与所述用例参数相关的用户数据;根据与所述用例参数相关的用户数据,确定所述用例参数的参数值;所述用例参数设置有标识符;所述标识符用于指示:所述用例参数的参数值根据所述用户数据确定,或者所述用例参数的参数值为指定值;所述如果需要根据所述用户数据确定所述用例参数的参数值,获取与所述用例参数相关的用户数据的步骤,包括:查询所述用例参数的标识符,如果所述用例参数的标识符指示所述用例参数的参数值根据所述用户数据确定,获取与所述用例参数相关的用户数据。Wherein, the test case of the target software is generated in the following manner: determining the parameter value of the test case according to the user data of the target software; wherein, the user data includes: the operation data of the user of the target software operating the target software; the operation data includes the number of mongodb purchased by the user and the number of times the user has reconfigured the corresponding instance of the target software; generating the configuration file of the test case according to the parameter value; generating the test case according to the configuration file; the step of generating the configuration file of the test case according to the parameter value includes: filling the parameter value into the use case parameter corresponding to the parameter value; the parameter value is specific data related to the test case; generating the configuration file of the test case according to the use case parameter and the parameter value corresponding to the use case parameter; the test case includes at least one a use case parameter; the step of determining the parameter value of the test case according to the user data of the target software comprises: if the parameter value of the use case parameter needs to be determined according to the user data, obtaining the user data related to the use case parameter; determining the parameter value of the use case parameter according to the user data related to the use case parameter; the use case parameter is provided with an identifier; the identifier is used to indicate: the parameter value of the use case parameter is determined according to the user data, or the parameter value of the use case parameter is a specified value; the step of obtaining the user data related to the use case parameter if the parameter value of the use case parameter needs to be determined according to the user data comprises: querying the identifier of the use case parameter, and if the identifier of the use case parameter indicates that the parameter value of the use case parameter is determined according to the user data, obtaining the user data related to the use case parameter. 6.根据权利要求5所述的方法,其特征在于,通过所述测试用例对所述目标软件进行测试的步骤之后,所述方法还包括:将所述测试结果发送至指定的测试结果接收地址。6. The method according to claim 5 is characterized in that after the step of testing the target software through the test case, the method further comprises: sending the test result to a designated test result receiving address. 7.一种生成测试用例的装置,其特征在于,所述装置包括:7. A device for generating a test case, characterized in that the device comprises: 第一确定模块,用于如果需要生成目标软件的测试用例,根据所述目标软件的用户数据,确定所述测试用例的参数值;其中,所述用户数据包括:所述目标软件的用户操作所述目标软件的操作数据;所述操作数据包括用户购买的mongodb数量以及所述用户对所述目标软件对应实例更配的次数;The first determination module is used to determine the parameter value of the test case according to the user data of the target software if a test case of the target software needs to be generated; wherein the user data includes: the operation data of the user of the target software operating the target software; the operation data includes the number of MongoDB purchased by the user and the number of times the user has configured the corresponding instance of the target software; 第一生成模块,用于根据所述参数值生成所述测试用例的配置文件;A first generating module, used to generate a configuration file of the test case according to the parameter value; 第二生成模块,用于根据所述配置文件生成所述测试用例;A second generating module, used to generate the test case according to the configuration file; 所述第一生成模块还用于:The first generating module is also used for: 将所述参数值填入至所述参数值对应的用例参数中;所述参数值为与所述测试用例相关的具体数据;Fill the parameter value into the test case parameter corresponding to the parameter value; the parameter value is specific data related to the test case; 根据所述用例参数,以及所述用例参数对应的参数值,生成所述测试用例的配置文件;Generate a configuration file for the test case according to the test case parameters and parameter values corresponding to the test case parameters; 所述测试用例包括至少一个用例参数;The test case includes at least one test case parameter; 第一确定模块还用于:如果需要根据所述用户数据确定所述用例参数的参数值,获取与所述用例参数相关的用户数据;根据与所述用例参数相关的用户数据,确定所述用例参数的参数值;The first determination module is further used for: if it is necessary to determine the parameter value of the use case parameter according to the user data, obtaining the user data related to the use case parameter; determining the parameter value of the use case parameter according to the user data related to the use case parameter; 所述用例参数设置有标识符;所述标识符用于指示:所述用例参数的参数值根据所述用户数据确定,或者所述用例参数的参数值为指定值;第一确定模块还用于:查询所述用例参数的标识符,如果所述用例参数的标识符指示所述用例参数的参数值根据所述用户数据确定,获取与所述用例参数相关的用户数据。The use case parameter is set with an identifier; the identifier is used to indicate: the parameter value of the use case parameter is determined according to the user data, or the parameter value of the use case parameter is a specified value; the first determination module is also used to: query the identifier of the use case parameter, if the identifier of the use case parameter indicates that the parameter value of the use case parameter is determined according to the user data, obtain the user data related to the use case parameter. 8.一种软件测试装置,其特征在于,所述装置包括:8. A software testing device, characterized in that the device comprises: 获取模块,用于如果需要测试目标软件,获取所述目标软件的测试用例;An acquisition module is used to acquire test cases of the target software if the target software needs to be tested; 第二确定模块,用于通过所述测试用例对所述目标软件进行测试,得到测试结果;A second determination module is used to test the target software through the test case to obtain a test result; 其中,所述目标软件的测试用例,通过下述方式生成:根据所述目标软件的用户数据,确定所述测试用例的参数值;其中,所述用户数据包括:所述目标软件的用户操作所述目标软件的操作数据;所述操作数据包括用户购买的mongodb数量以及所述用户对所述目标软件对应实例更配的次数;根据所述参数值生成所述测试用例的配置文件;根据所述配置文件生成所述测试用例;根据所述参数值生成所述测试用例的配置文件的步骤,包括:将所述参数值填入至所述参数值对应的用例参数中;所述参数值为与所述测试用例相关的具体数据;根据所述用例参数,以及所述用例参数对应的参数值,生成所述测试用例的配置文件;所述测试用例包括至少一个用例参数;所述根据所述目标软件的用户数据,确定所述测试用例的参数值的步骤,包括:如果需要根据所述用户数据确定所述用例参数的参数值,获取与所述用例参数相关的用户数据;根据与所述用例参数相关的用户数据,确定所述用例参数的参数值;所述用例参数设置有标识符;所述标识符用于指示:所述用例参数的参数值根据所述用户数据确定,或者所述用例参数的参数值为指定值;所述如果需要根据所述用户数据确定所述用例参数的参数值,获取与所述用例参数相关的用户数据的步骤,包括:查询所述用例参数的标识符,如果所述用例参数的标识符指示所述用例参数的参数值根据所述用户数据确定,获取与所述用例参数相关的用户数据。Wherein, the test case of the target software is generated in the following manner: determining the parameter value of the test case according to the user data of the target software; wherein, the user data includes: the operation data of the user of the target software operating the target software; the operation data includes the number of mongodb purchased by the user and the number of times the user has reconfigured the corresponding instance of the target software; generating the configuration file of the test case according to the parameter value; generating the test case according to the configuration file; the step of generating the configuration file of the test case according to the parameter value includes: filling the parameter value into the use case parameter corresponding to the parameter value; the parameter value is specific data related to the test case; generating the configuration file of the test case according to the use case parameter and the parameter value corresponding to the use case parameter; the test case includes at least one a use case parameter; the step of determining the parameter value of the test case according to the user data of the target software comprises: if the parameter value of the use case parameter needs to be determined according to the user data, obtaining the user data related to the use case parameter; determining the parameter value of the use case parameter according to the user data related to the use case parameter; the use case parameter is provided with an identifier; the identifier is used to indicate: the parameter value of the use case parameter is determined according to the user data, or the parameter value of the use case parameter is a specified value; the step of obtaining the user data related to the use case parameter if the parameter value of the use case parameter needs to be determined according to the user data comprises: querying the identifier of the use case parameter, and if the identifier of the use case parameter indicates that the parameter value of the use case parameter is determined according to the user data, obtaining the user data related to the use case parameter. 9.一种服务器,其特征在于,包括处理器和存储器,所述存储器存储有能够被所述处理器执行的机器可执行指令,所述处理器执行所述机器可执行指令以实现权利要求1-4任一项所述的生成测试用例的方法,或者权利要求5-6任一项所述的软件测试方法。9. A server, characterized in that it includes a processor and a memory, the memory storing machine executable instructions that can be executed by the processor, and the processor executing the machine executable instructions to implement the method for generating test cases described in any one of claims 1-4, or the software testing method described in any one of claims 5-6. 10.一种机器可读存储介质,其特征在于,该机器可读存储介质存储有机器可执行指令,该机器可执行指令在被处理器调用和执行时,机器可执行指令促使处理器实现权利要求1-4任一项所述的生成测试用例的方法,或者权利要求5-6任一项所述的软件测试方法。10. A machine-readable storage medium, characterized in that the machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the method for generating test cases described in any one of claims 1-4, or the software testing method described in any one of claims 5-6.
CN202010509905.7A 2020-06-05 2020-06-05 Method for generating test cases, software testing method, device and server Active CN111651358B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010509905.7A CN111651358B (en) 2020-06-05 2020-06-05 Method for generating test cases, software testing method, device and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010509905.7A CN111651358B (en) 2020-06-05 2020-06-05 Method for generating test cases, software testing method, device and server

Publications (2)

Publication Number Publication Date
CN111651358A CN111651358A (en) 2020-09-11
CN111651358B true CN111651358B (en) 2024-04-12

Family

ID=72343518

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010509905.7A Active CN111651358B (en) 2020-06-05 2020-06-05 Method for generating test cases, software testing method, device and server

Country Status (1)

Country Link
CN (1) CN111651358B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112346965B (en) * 2020-10-12 2024-05-17 天津五八到家货运服务有限公司 Test case distribution method, device and storage medium
CN112738500A (en) * 2020-11-14 2021-04-30 武汉风行在线技术有限公司 Method and device for automatically generating test case on smart television
CN114328214B (en) * 2021-12-27 2023-05-12 深圳市六度人和科技有限公司 Efficiency improving method and device for interface test case of reporting software and computer equipment

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7158907B1 (en) * 2004-08-04 2007-01-02 Spirent Communications Systems and methods for configuring a test setup
CN105512036A (en) * 2015-12-12 2016-04-20 天津南大通用数据技术股份有限公司 Test template for automatically generating test case according to preset rules and test method
CN106708723A (en) * 2015-11-13 2017-05-24 阿里巴巴集团控股有限公司 Testing and verifying methods and apparatuses
WO2017113912A1 (en) * 2015-12-30 2017-07-06 中兴通讯股份有限公司 Physical layer software automation test method and device
CN108470004A (en) * 2018-04-09 2018-08-31 平安普惠企业管理有限公司 Test script generation method, test method, device, equipment and storage medium
CN109086199A (en) * 2018-06-22 2018-12-25 网宿科技股份有限公司 A kind of automation generates the method for test script, terminal and can storage medium
CN109684209A (en) * 2018-12-17 2019-04-26 北京奇虎科技有限公司 A kind of method for generating test case, device and electronic equipment
CN109992508A (en) * 2019-03-22 2019-07-09 恒生电子股份有限公司 Test exemple automation generation method, device and electronic equipment
WO2020000706A1 (en) * 2018-06-25 2020-01-02 平安科技(深圳)有限公司 Database comparison-based interface testing method and system, device and storage medium
CN110990269A (en) * 2019-11-26 2020-04-10 苏宁云计算有限公司 Interface testing method, device and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9529699B2 (en) * 2013-06-11 2016-12-27 Wipro Limited System and method for test data generation and optimization for data driven testing

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7158907B1 (en) * 2004-08-04 2007-01-02 Spirent Communications Systems and methods for configuring a test setup
CN106708723A (en) * 2015-11-13 2017-05-24 阿里巴巴集团控股有限公司 Testing and verifying methods and apparatuses
CN105512036A (en) * 2015-12-12 2016-04-20 天津南大通用数据技术股份有限公司 Test template for automatically generating test case according to preset rules and test method
WO2017113912A1 (en) * 2015-12-30 2017-07-06 中兴通讯股份有限公司 Physical layer software automation test method and device
CN108470004A (en) * 2018-04-09 2018-08-31 平安普惠企业管理有限公司 Test script generation method, test method, device, equipment and storage medium
CN109086199A (en) * 2018-06-22 2018-12-25 网宿科技股份有限公司 A kind of automation generates the method for test script, terminal and can storage medium
WO2020000706A1 (en) * 2018-06-25 2020-01-02 平安科技(深圳)有限公司 Database comparison-based interface testing method and system, device and storage medium
CN109684209A (en) * 2018-12-17 2019-04-26 北京奇虎科技有限公司 A kind of method for generating test case, device and electronic equipment
CN109992508A (en) * 2019-03-22 2019-07-09 恒生电子股份有限公司 Test exemple automation generation method, device and electronic equipment
CN110990269A (en) * 2019-11-26 2020-04-10 苏宁云计算有限公司 Interface testing method, device and system

Also Published As

Publication number Publication date
CN111651358A (en) 2020-09-11

Similar Documents

Publication Publication Date Title
CN111651358B (en) Method for generating test cases, software testing method, device and server
CN110708210B (en) Cloud test configuration method and device, computer equipment and storage medium
CN108446223B (en) An automated testing method for business scenarios based on dynamic compilation
CN110347085B (en) Automated test system, method, vehicle, and computer-readable medium
CN114201346B (en) A HIL test method, device and electronic equipment for CAN communication interface
CN110188036A (en) A software testing method and device
CN103049374B (en) Automatic testing method and device
CN104750601A (en) A kind of test method and device
WO2007001108A1 (en) System for providing feature-oriented software product line engineering environment
CN105005295A (en) Test system and test method for control logic
CN110134598B (en) Batch processing method, device and system
CN109683923B (en) Method and system for checking configuration file version of power distribution automation system
CN110908903B (en) A Test Method Based on Editable YAML File
CN110297749B (en) Method and terminal for testing new function
CN114297088A (en) Test method, device, equipment and medium for front-end vue framework components
CN110032781B (en) Editing time sequence constraint method and device, computer equipment and storage medium
CN117850866A (en) Data verification test method and system
CN114358889B (en) Business order processing method, device, computer equipment and medium
CN107102938A (en) The update method and device of test script
JP2020013239A (en) Model inspection device and design rule alteration support method
CN107589966A (en) The method and apparatus of management code in software development system
CN110968342B (en) Version comparison method, device and system
CN115757172A (en) Test execution method and device, storage medium and computer equipment
CN109240906B (en) Database configuration information adaptation method and device, computer equipment and storage medium
TWI773939B (en) Version management system, version management method, and non-transitory computer readable storage medium for version management method

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
GR01 Patent grant
GR01 Patent grant