



技术领域technical field
本发明实施例涉及计算机技术领域,尤其涉及一种测试案例生成方法、装置、服务器和介质。Embodiments of the present invention relate to the field of computer technologies, and in particular, to a method, apparatus, server, and medium for generating a test case.
背景技术Background technique
测试属于软件开发过程中的一个重要环节。经过案例测试,可以验证开发软件的稳定性和兼容性,发现软件错误和缺陷。只有测试通过了,开发软件才有机会上线推广。Testing is an important part of the software development process. After case testing, the stability and compatibility of the developed software can be verified, and software errors and defects can be found. Only after the test is passed, the development software has the opportunity to be launched online.
在开发过程中,通常会遇到一种测试场景中需要同时执行多个功能的测试。如果在每次测试过程中,均完全依赖开发人员进行各个测试程序的编写以及组合,不仅耗费人力成本,而且影响开发软件的测试效率。During development, it is common to encounter a test scenario where tests need to execute multiple functions simultaneously. If in each testing process, it is completely dependent on developers to write and combine various test programs, which not only consumes labor costs, but also affects the testing efficiency of the developed software.
发明内容SUMMARY OF THE INVENTION
本发明实施例提供一种测试案例生成方法、装置、服务器和介质,以实现基于测试需求自动生成测试案例的效果。Embodiments of the present invention provide a test case generation method, device, server and medium, so as to achieve the effect of automatically generating test cases based on test requirements.
第一方面,本发明实施例提供了一种测试案例生成方法,该方法包括:In a first aspect, an embodiment of the present invention provides a method for generating a test case, the method comprising:
基于获取的测试需求文档,识别测试过程涉及的至少一个测试案例类型;Identify at least one test case type involved in the testing process based on the acquired test requirements document;
根据所述至少一个测试案例类型,从测试案例库中抽取每个测试案例类型对应的测试子案例;According to the at least one test case type, extract a test subcase corresponding to each test case type from the test case database;
根据测试需求,将抽取的各个测试子案例进行拼接,得到目标测试案例。According to the test requirements, the extracted test sub-cases are spliced to obtain the target test case.
第二方面,本发明实施例还提供了一种测试案例生成装置,该装置包括:In a second aspect, an embodiment of the present invention further provides a test case generation device, the device comprising:
测试案例类型识别模块,用于基于获取的测试需求文档,识别测试过程涉及的至少一个测试案例类型;The test case type identification module is used to identify at least one test case type involved in the test process based on the acquired test requirement document;
测试子案例抽取模块,用于根据所述至少一个测试案例类型,从测试案例库中抽取每个测试案例类型对应的测试子案例;A test subcase extraction module, configured to extract a test subcase corresponding to each test case type from the test case library according to the at least one test case type;
目标测试案例生成模块,用于根据测试需求,将抽取的各个测试子案例进行拼接,得到目标测试案例。The target test case generation module is used for splicing the extracted test sub-cases according to the test requirements to obtain the target test case.
第三方面,本发明实施例还提供了一种服务器,包括:In a third aspect, an embodiment of the present invention further provides a server, including:
一个或多个处理器;one or more processors;
存储装置,用于存储一个或多个程序,storage means for storing one or more programs,
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如本发明任一实施例所述的测试案例生成方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the test case generation method according to any embodiment of the present invention.
第四方面,本发明实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如本发明任一实施例所述的测试案例生成方法。In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, implements the method for generating a test case according to any embodiment of the present invention.
本发明实施例通过分析测试需求文档,识别测试过程涉及的至少一个测试案例类型,然后从测试案例库中抽取每个测试案例类型对应的测试子案例,最后根据测试需求,将抽取的各个测试子案例进行合理拼接,便自动生成可适用于当前测试的完整目标测试案例,解决了现有测试案例生成过程耗费人力成本的问题,实现了基于测试需求自动生成测试案例的效果,减少了人力成本的消耗,进而提高了测试效率。The embodiment of the present invention identifies at least one test case type involved in the test process by analyzing the test requirement document, then extracts the test sub-case corresponding to each test case type from the test case database, and finally extracts each test sub-case according to the test requirement. Reasonable splicing of cases can automatically generate complete target test cases applicable to the current test, which solves the problem of labor cost in the existing test case generation process, realizes the effect of automatically generating test cases based on test requirements, and reduces labor costs. consumption, thereby improving the test efficiency.
附图说明Description of drawings
图1是本发明实施例一提供的测试案例生成方法的流程图;1 is a flowchart of a test case generation method provided in Embodiment 1 of the present invention;
图2是本发明实施例二提供的测试案例生成方法的流程图;2 is a flowchart of a test case generation method provided by Embodiment 2 of the present invention;
图3是本发明实施例三提供的测试案例生成装置的结构示意图;3 is a schematic structural diagram of a test case generation device provided in Embodiment 3 of the present invention;
图4是本发明实施例四提供的一种服务器的结构示意图。FIG. 4 is a schematic structural diagram of a server according to Embodiment 4 of the present invention.
具体实施方式Detailed ways
下面结合附图和实施例对本发明作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本发明,而非对本发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本发明相关的部分而非全部结构。The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention. In addition, it should be noted that, for the convenience of description, the drawings only show some but not all structures related to the present invention.
实施例一Example 1
图1是本发明实施例一提供的测试案例生成方法的流程图,本实施例可适用于基于测试需求生成测试案例的情况,该方法可以由测试案例生成装置来执行,该装置可以采用软件和/或硬件的方式实现,并可集成在服务器上。FIG. 1 is a flowchart of a test case generation method provided in Embodiment 1 of the present invention. This embodiment is applicable to the situation where test cases are generated based on test requirements. The method can be executed by a test case generation device, and the device can use software and / or hardware, and can be integrated on the server.
如图1所示,本实施例提供的测试案例生成方法可以包括:As shown in FIG. 1 , the test case generation method provided by this embodiment may include:
S110、基于获取的测试需求文档,识别测试过程涉及的至少一个测试案例类型。S110. Identify at least one test case type involved in the test process based on the acquired test requirement document.
测试需求文档是基于测试需求描述当前的具体测试规则。该测试需求文档可以是测试人员根据测试需求直接输入的描述性文本,也可以是测试人员通过语音输入后经转换得到的文本。测试需求文档输入时可以按照预先设定的文本格式进行输入,以提高后续识别测试案例类型的效率。预先设定的文本格式中可以包括特定的分隔符,以实现语句的分割。文本格式具体可以由测试人员进行灵活设置,本实施例不作具体限定。The test requirements document describes the current specific test rules based on the test requirements. The test requirement document may be a descriptive text directly input by the tester according to the test requirement, or may be a text converted by the tester after inputting by voice. When the test requirement document is input, it can be input according to the preset text format, so as to improve the efficiency of subsequent identification of test case types. The preset text format can include specific delimiters to realize the segmentation of sentences. The text format can be flexibly set by the tester, which is not specifically limited in this embodiment.
通过对获取的测试需求文档进行文本分析,确定出当前测试过程涉及的至少一个测试案例类型。通常,根据不同的应用开发,软件或者应用程序的一个测试过程会涉及多个应用功能,因此,一次测试过程便涉及到多个测试子任务,每一个测试子任务对应一个测试案例类型。需要说明的是,本实施例方法可以同时获取多个测试需求文档,并同步进行识别处理,确定出每个测试需求对应的测试案例类型。At least one test case type involved in the current testing process is determined by text analysis of the acquired test requirement document. Usually, according to different application development, a test process of software or application program will involve multiple application functions. Therefore, a test process involves multiple test subtasks, and each test subtask corresponds to a test case type. It should be noted that, the method of this embodiment can simultaneously acquire multiple test requirement documents, and perform identification processing synchronously, so as to determine the test case type corresponding to each test requirement.
可选的,基于获取的测试需求文档,识别测试过程涉及的至少一个测试案例类型,包括:Optionally, based on the acquired test requirement document, identify at least one test case type involved in the test process, including:
提取获取的测试需求文档中的关键词;Extract the keywords in the acquired test requirement document;
根据关键词确定测试过程涉及的至少一个测试案例类型。Determine at least one test case type involved in the testing process according to the keyword.
本实施例中,可以利用任意关键词提取方法,例如基于词频-逆向文件频率(TF-IDF)的关键词提取方法、基于主题模型(Topic-model)的关键词提取方法和快速自动关键字提取(Rapid Automatic Keyword Extraction,RAKE)方法等,对测试需求文档进行分析,提取出至少一个关键词,然后结合文档语义,确定出当前测试过程涉及的至少一个测试案例类型。In this embodiment, any keyword extraction method can be used, such as a keyword extraction method based on term frequency-inverse document frequency (TF-IDF), a keyword extraction method based on topic-model (topic-model), and fast automatic keyword extraction (Rapid Automatic Keyword Extraction, RAKE) method, etc., analyze the test requirement document, extract at least one keyword, and then combine the document semantics to determine at least one test case type involved in the current test process.
示例性的,下面针对某理财应用的618理财活动测试需求,对本实施例的测试案例类型识别进行示例性说明,618理财活动测试需求如下:Exemplarily, the following is an exemplary description of the test case type identification in this embodiment for the 618 financial management activity test requirements of a financial management application. The 618 financial management activity test requirements are as follows:
1)共有3种面额的购物卡A,全部仅限于首笔投资的用户领取。点击进入默认是50元的购物卡A,每两秒换一次礼品。理财用户可以通过左右滑动更换礼品。1) There are 3 kinds of denominations of shopping card A, all of which are only available to users who make their first investment. Click to enter the shopping card A, which is 50 yuan by default, and exchange gifts every two seconds. Financial users can change gifts by swiping left and right.
2)点击活动规则可弹出规则弹窗,点击“理财领取”后,首先需判断理财用户的登录状态,若理财用户未登录则弹出登录框,当理财用户登录或注册完成后直接跳转到对应理财产品的转入页面,并自动帮助理财用户输入领取礼品的最低金额。2) Click on the activity rules to pop up the rules pop-up window. After clicking "Wealth Management Collection", you must first determine the login status of the wealth management user. If the wealth management user is not logged in, a login box will pop up. The transfer page of wealth management products, and automatically help wealth management users to input the minimum amount to receive gifts.
测试人员基于上述测试需求可将如下测试需求文档录入服务器中:1|618理财活动需求|共有3种面额的购物卡A,全部仅限于首笔投资的用户领取。点击进入默认是50元购物卡A,每两秒换一次礼品。理财用户可以通过左右滑动更换礼品。|点击活动规则可弹出规则弹窗,点击“理财领取”后,首先需判断理财用户的登录状态,若理财用户未登录则弹出登录框,当理财用户登录或注册完后直接跳转到对应理财产品的转入页面,并自动帮助理财用户输入领取礼品的最低金额。Based on the above test requirements, testers can enter the following test requirements documents into the server: 1|618 Financial Activity Requirements|There are 3 kinds of denominations of shopping card A, all of which are limited to users who make the first investment. Click to enter the default is 50 yuan shopping card A, a gift every two seconds. Financial users can change gifts by swiping left and right. |Click on the activity rules to pop up the rules pop-up window. After clicking "Wealth Management Collection", you need to first determine the login status of the wealth management user. If the wealth management user is not logged in, a login box will pop up. When the wealth management user logs in or completes registration, it will directly jump to the corresponding wealth management The transfer-in page of the product, and automatically help wealth management users enter the minimum amount to receive gifts.
对上述测试需求文档进行分析,提取的关键词包括但不限于:理财活动、礼品和登录,基于语义继续对关键词进行分类,基于关键词分类结果,可以确定当前测试过程涉及的测试案例类型包括理财礼品增送类测试案例和用户登录类测试案例。Analyze the above test requirement documents, extract keywords including but not limited to: financial activities, gifts and login, continue to classify keywords based on semantics, and based on the results of keyword classification, it can be determined that the types of test cases involved in the current test process include: Additional test cases for wealth management gifts and user login test cases.
S120、根据至少一个测试案例类型,从测试案例库中抽取每个测试案例类型对应的测试子案例。S120. According to at least one test case type, extract a test subcase corresponding to each test case type from the test case database.
当确定测试案例类型后,在测试案例库中进行类型匹配,若匹配成功,则抽取出与测试案例类型对应的测试子案例,以用于当前测试。其中,测试案例库是按照测试案例类型,将可以共用的历史测试案例进行拆分后并分类存储得到或者将历史测试案例进行整体性存储得到。当测试案例库中存在当前需求的测试案例类型,直接从中调取相应类型的测试案例框架即可,可以省去测试人员重复编写该测试程序的流程,从而减少测试人员的工作量。After the test case type is determined, type matching is performed in the test case library. If the matching is successful, a test sub-case corresponding to the test case type is extracted for the current test. Among them, the test case database is obtained by dividing the shared historical test cases according to the test case type and storing them by classification, or by storing the historical test cases as a whole. When there is a test case type currently required in the test case library, the corresponding type of test case framework can be directly called from it, which can save the tester the process of repeatedly writing the test program, thereby reducing the tester's workload.
S130、根据测试需求,将抽取的各个测试子案例进行拼接,得到目标测试案例。S130. According to the test requirements, splicing the extracted test sub-cases to obtain a target test case.
测试子案例的拼接过程,不仅包括各个测试子案例对应的测试框架组合过程,还包括基于测试需求文档,将各个测试子案例中涉及的测试参数更新为当前测试参数,从而得到目标测试案例,执行当前测试任务。其中,各个测试子案例的拼接顺序并无严格限定,依据不同拼接顺序得到的目标测试案例,可以得到不同的测试结果,进而可以多角度地发现应用开发过程中存在的问题。例如,针对上述某理财应用的618理财活动测试需求,在测试过程中可以首先执行理财礼品增送类测试子案例,后执行用户登录类测试子案例;也可以首先执行用户登录类测试子案例,后执行理财礼品增送类测试子案例。The splicing process of test sub-cases not only includes the test framework combination process corresponding to each test sub-case, but also includes updating the test parameters involved in each test sub-case to the current test parameters based on the test requirement document, so as to obtain the target test case and execute it. The current test task. Among them, the splicing order of each test sub-case is not strictly limited, and different test results can be obtained according to the target test cases obtained in different splicing orders, and then problems existing in the application development process can be found from multiple angles. For example, according to the 618 financial activity test requirements of a financial management application mentioned above, during the test process, the test sub-case of the additional delivery of financial gifts can be executed first, and then the user login test sub-case can be executed; or the user login test sub-case can be executed first. Then implement the test sub-case of the additional delivery of wealth management gifts.
进一步的,根据测试需求,将抽取的各个测试子案例进行拼接,得到目标测试案例,包括:Further, according to the test requirements, the extracted test sub-cases are spliced to obtain the target test cases, including:
根据测试需求,将抽取的各个测试子案例进行拼接,得到候选测试案例;According to the test requirements, splicing the extracted test sub-cases to obtain candidate test cases;
根据提取的关键词,对候选测试案例进行调整,得到目标测试案例。According to the extracted keywords, the candidate test cases are adjusted to obtain the target test cases.
其中,通过对测试需求文档进行分析,不仅得到关键词,还分析出对应于每种类型的关键词的测试参数,利用关键词对应的测试参数对候选测试案例进行细节调整,从而得到目标测试案例。例如,在上述示例中,对应于关键词“理财活动”和“礼品”的测试参数包括:日期-618、礼品对象-购物卡A、礼品数量-3种等。Among them, by analyzing the test requirements document, not only the keywords, but also the test parameters corresponding to each type of keywords are analyzed, and the candidate test cases are adjusted in detail by using the test parameters corresponding to the keywords, so as to obtain the target test case. . For example, in the above example, the test parameters corresponding to the keywords "financial activities" and "gifts" include: date-618, gift object-shopping card A, gift quantity-3 types, and so on.
由于目标测试案例生成的过程中不需要依赖测试人员手动编写测试案例,因此,面对大量的测试需求,可以节省人力成本,省去测试人员重复编写测试程序的流程,进而有助于提高测试效率。Since there is no need to rely on testers to manually write test cases in the process of target test case generation, in the face of a large number of test requirements, labor costs can be saved, and testers can be saved from the process of repeatedly writing test programs, thereby helping to improve test efficiency. .
在上述技术方案的基础上,可选的,根据测试需求,将抽取的各个测试子案例进行拼接,得到目标测试案例,包括:基于测试需求和抽取的各个测试子案例对应的执行顺序,将各个测试子案例进行拼接,得到目标测试案例。On the basis of the above technical solution, optionally, according to the test requirements, splicing the extracted test sub-cases to obtain the target test case, including: based on the test requirements and the execution order corresponding to the extracted test sub-cases, The test sub-cases are spliced to obtain the target test case.
测试子案例的执行顺序是指应用开发过程中对应的各个应用功能的正常执行顺序,例如在正常的执行顺序下,首先进行用户登录然后领取理财礼品,因此,用户登录类测试子案例的执行顺序要早于理财礼品增送类测试子案例。无论是拼接得到目标测试案例还是拼接得到候选测试案例,均可依据各个测试子案例对应的执行顺序进行拼接。The execution sequence of the test sub-cases refers to the normal execution sequence of the corresponding application functions during the application development process. For example, in the normal execution sequence, the user logs in first and then receives financial gifts. Therefore, the execution sequence of the user login test sub-cases is It should be earlier than the test sub-case of the additional delivery of wealth management gifts. Whether the target test case is obtained by splicing or the candidate test case is obtained by splicing, the splicing can be performed according to the execution order corresponding to each test sub-case.
可选的,该方法还包括:获取用户对目标测试案例的评审结果,并基于评审结果对目标测试案例进行调整。该用户即指测试人员,用户评审是为了进一步确保自动生成的目标测试案例的逻辑正确性与稳定性,避免得到的测试结果不可靠。评审结果包括测试人员对目标测试案例的评分以及目标测试案例存在的错误或者不合理之处。基于评审结果,获取测试人员输入的相应调整指令,该调整指令包括修改、新增或者删除等,从而实现对目标测试案例的再次调整。Optionally, the method further includes: obtaining a user's review result on the target test case, and adjusting the target test case based on the review result. The user refers to the tester, and the user review is to further ensure the logical correctness and stability of the automatically generated target test cases, and to avoid unreliable test results. The review results include the tester's score on the target test case and the errors or unreasonable aspects of the target test case. Based on the review results, the corresponding adjustment instructions input by the tester are obtained, and the adjustment instructions include modification, addition or deletion, etc., so as to realize the re-adjustment of the target test case.
本实施例的技术方案通过分析测试需求文档,识别测试过程涉及的至少一个测试案例类型,然后从测试案例库中抽取每个测试案例类型对应的测试子案例,最后根据测试需求,将抽取的各个测试子案例进行合理拼接,便自动生成可适用于当前测试的完整目标测试案例,解决了现有测试案例生成过程耗费人力成本的问题,实现了基于测试需求自动生成测试案例的效果,减少了人力成本的消耗,进而提高了测试效率。The technical solution of this embodiment identifies at least one test case type involved in the test process by analyzing the test requirement document, then extracts test sub-cases corresponding to each test case type from the test case database, and finally, according to the test requirements, extracts each Reasonable splicing of test sub-cases can automatically generate complete target test cases applicable to the current test, which solves the problem of labor-intensive cost in the existing test case generation process, realizes the effect of automatically generating test cases based on test requirements, and reduces labor costs. Cost consumption, thereby improving test efficiency.
实施例二Embodiment 2
图2是本发明实施例二提供的测试案例生成方法的流程图,本实施例是在上述实施例的基础上进一步进行优化与扩展。如图2所示,该方法可以包括:FIG. 2 is a flowchart of a method for generating a test case provided in Embodiment 2 of the present invention. This embodiment is further optimized and expanded on the basis of the foregoing embodiment. As shown in Figure 2, the method may include:
S210、基于获取的测试需求文档,识别测试过程涉及的至少一个测试案例类型。S210. Identify at least one test case type involved in the test process based on the acquired test requirement document.
S220、根据至少一个测试案例类型,确定每个测试案例类型在测试案例库中是否存在对应的测试子案例。S220. Determine, according to at least one test case type, whether each test case type has a corresponding test subcase in the test case database.
依据在测试案例库中的类型匹配结果,对于在测试案例库中存在对应的测试子案例的测试案例类型,执行S230;对于在测试案例库中不存在对应的测试子案例的测试案例类型,执行S240。According to the type matching result in the test case library, for the test case type for which the corresponding test subcase exists in the test case library, execute S230; for the test case type for which there is no corresponding test subcase in the test case library, execute S240.
S230、针对在测试案例库中存在对应的测试子案例的测试案例类型,从测试案例库中抽取与该测试案例类型对应的测试子案例。S230. For a test case type for which a corresponding test subcase exists in the test case database, extract a test subcase corresponding to the test case type from the test case database.
S240、针对在测试案例库中不存在对应的测试子案例的目标测试案例类型,获取用户输入的与目标测试案例类型对应的测试案例片段。S240. For a target test case type that does not have a corresponding test sub-case in the test case database, acquire a test case segment corresponding to the target test case type input by the user.
即当测试案例库中不存在相应的测试子案例时,便需要测试人员手动完成测试案例片段的输入。测试案例片段即用于完成目标测试案例类型对应的测试子任务。That is, when the corresponding test sub-case does not exist in the test case library, the tester needs to manually complete the input of the test case fragment. The test case fragment is used to complete the test subtask corresponding to the target test case type.
可选的,该方法还包括:将测试案例片段存储至测试案例库中,并将目标测试案例类型更新至测试案例库的测试案例类型中。通过将用户当前输入的测试案例片段存储至测试案例库中,可以实现对测试案例库内容的更新与完善,当后续测试过程中需要相同类型的测试案例时,便可直接调用。Optionally, the method further includes: storing the test case fragments in the test case library, and updating the target test case type to the test case type of the test case library. By storing the test case fragments currently input by the user into the test case library, the content of the test case library can be updated and improved, and when the same type of test case is needed in the subsequent testing process, it can be called directly.
S250、将测试案例片段与从测试案例库中抽取的测试子案例进行拼接,得到目标测试案例。S250, splicing the test case fragments with the test sub-cases extracted from the test case library to obtain the target test case.
具体的,可以根据测试案例片段和提取的测试子案例的执行顺序进行拼接,得到完整测试框架,然后结合测试需求文档进行测试框架的细节调整,例如测试参数更新等,得到适用于当前测试的目标测试案例。Specifically, the test case fragments and the extracted test sub-cases can be spliced together according to the execution order to obtain a complete test framework, and then the details of the test framework can be adjusted in combination with the test requirement document, such as test parameter update, etc., to obtain the target suitable for the current test. Test Case.
本实施例的技术方案通过分析测试需求文档,识别测试过程涉及的至少一个测试案例类型;针对在测试案例库中存在对应的测试子案例的测试案例类型,从测试案例库中抽取与之对应的测试子案例,针对在测试案例库中不存在对应的测试子案例的目标测试案例类型,获取用户输入的与之对应的测试案例片段;将测试案例片段和抽取的测试子案例进行合理拼接,得到适用于当前测试的完整目标测试案例,即通过部分测试子案例的抽取与部分测试案例片段的手动输入相结合,解决了现有测试案例生成过程耗费人力成本的问题,实现了完整测试案例的自动生成,减少了人力成本的消耗,进而提高了测试效率;同时,通过将测试人员输入的测试案例片段更新至测试案例库中,实现了测试案例库内容的更新与完善,为后续测试任务的执行提供了便利性。The technical solution of this embodiment identifies at least one test case type involved in the test process by analyzing the test requirement document; for the test case type that has corresponding test subcases in the test case library, extract the corresponding test case type from the test case library Test sub-cases, for the target test case types that do not have corresponding test sub-cases in the test case database, obtain the corresponding test case fragments input by the user; reasonably splicing the test case fragments and the extracted test sub-cases to obtain The complete target test case applicable to the current test, that is, the combination of the extraction of some test sub-cases and the manual input of some test case fragments solves the problem of labor cost in the existing test case generation process, and realizes the automation of the complete test case. Generated, reducing the consumption of labor costs, thereby improving the test efficiency; at the same time, by updating the test case fragments input by the testers to the test case library, the content of the test case library is updated and improved, and the execution of subsequent test tasks is realized. Convenience is provided.
实施例三Embodiment 3
图3是本发明实施例三提供的测试案例生成装置的结构示意图,本实施例可适用于基于测试需求生成测试案例的情况。该装置可以采用软件和/或硬件的方式实现,并可集成在服务器上。3 is a schematic structural diagram of an apparatus for generating a test case provided in Embodiment 3 of the present invention, and this embodiment is applicable to the case where a test case is generated based on a test requirement. The device can be implemented in software and/or hardware, and can be integrated on a server.
如图3所示,本实施例提供的测试案例生成装置可以包括测试案例类型识别模块310、测试子案例抽取模块320和目标测试案例生成模块330,其中:As shown in FIG. 3 , the test case generation apparatus provided in this embodiment may include a test case
测试案例类型识别模块310,用于基于获取的测试需求文档,识别测试过程涉及的至少一个测试案例类型;A test case
测试子案例抽取模块320,用于根据至少一个测试案例类型,从测试案例库中抽取每个测试案例类型对应的测试子案例;a test
目标测试案例生成模块330,用于根据测试需求,将抽取的各个测试子案例进行拼接,得到目标测试案例。The target test
可选的,测试案例类型识别模块310包括:Optionally, the test case
关键词提取单元,用于提取获取的测试需求文档中的关键词;A keyword extraction unit, used for extracting keywords in the acquired test requirement document;
测试案例类型确定单元,用于根据关键词确定测试过程涉及的至少一个测试案例类型。The test case type determination unit is used for determining at least one test case type involved in the test process according to the keyword.
可选的,目标测试案例生成模块330包括:Optionally, the target test
测试子案例拼接子单元,用于根据测试需求,将抽取的各个测试子案例进行拼接,得到候选测试案例;The test sub-case splicing sub-unit is used to splicing the extracted test sub-cases according to the test requirements to obtain candidate test cases;
候选测试案例调整子单元,用于根据提取的关键词,对候选测试案例进行调整,得到目标测试案例。The candidate test case adjustment subunit is used to adjust the candidate test cases according to the extracted keywords to obtain the target test cases.
可选的,目标测试案例生成模块330具体用于:Optionally, the target test
基于测试需求和抽取的各个测试子案例对应的执行顺序,将各个测试子案例进行拼接,得到目标测试案例。Based on the test requirements and the execution order corresponding to each extracted test sub-case, each test sub-case is spliced to obtain the target test case.
可选的,该装置还包括:Optionally, the device further includes:
测试案例片段获取模块,用于针对在所述测试案例库中不存在对应的测试子案例的目标测试案例类型,获取用户输入的与目标测试案例类型对应的测试案例片段;A test case fragment acquisition module, configured to acquire a test case fragment corresponding to the target test case type input by a user for a target test case type that does not have a corresponding test subcase in the test case library;
相应的,目标测试案例生成模块330还用于:Correspondingly, the target test
将测试案例片段与从测试案例库中抽取的测试子案例进行拼接,得到目标测试案例。The test case fragments are spliced with the test sub-cases extracted from the test case library to obtain the target test case.
可选的,该装置还包括:Optionally, the device further includes:
测试案例库类型更新模块,用于将测试案例片段存储至测试案例库中,并将目标测试案例类型更新至测试案例库的测试案例类型中。The test case library type update module is used to store test case fragments in the test case library, and update the target test case type to the test case type of the test case library.
可选的,该装置还包括:Optionally, the device further includes:
目标测试案例调整模块,用于获取用户对目标测试案例的评审结果,并基于评审结果对目标测试案例进行调整。The target test case adjustment module is used to obtain the user's review result on the target test case, and adjust the target test case based on the review result.
本发明实施例所提供的测试案例生成装置可执行本发明任意实施例所提供的测试案例生成方法,具备执行方法相应的功能模块和有益效果。本实施例中未详尽描述的内容可以参考本发明方法实施例中的描述。The test case generation apparatus provided by the embodiment of the present invention can execute the test case generation method provided by any embodiment of the present invention, and has corresponding functional modules and beneficial effects of the execution method. For the content not described in detail in this embodiment, reference may be made to the description in the method embodiment of the present invention.
实施例四Embodiment 4
图4是本发明实施例四提供的一种服务器的结构示意图。图4示出了适于用来实现本发明实施方式的示例性服务器412的框图。图4显示的服务器412仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。FIG. 4 is a schematic structural diagram of a server according to Embodiment 4 of the present invention. Figure 4 shows a block diagram of an
如图4所示,服务器412以通用服务器的形式表现。服务器412的组件可以包括但不限于:一个或者多个处理器416,存储装置428,连接不同系统组件(包括存储装置428和处理器416)的总线418。As shown in FIG. 4,
总线418表示几类总线结构中的一种或多种,包括存储装置总线或者存储装置控制器,外围总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(Industry SubversiveAlliance,ISA)总线,微通道体系结构(Micro Channel Architecture,MAC)总线,增强型ISA总线、视频电子标准协会(Video Electronics Standards Association,VESA)局域总线以及外围组件互连(Peripheral Component Interconnect,PCI)总线。
服务器412典型地包括多种计算机系统可读介质。这些介质可以是任何能够被服务器412访问的可用介质,包括易失性和非易失性介质,可移动的和不可移动的介质。
存储装置428可以包括易失性存储器形式的计算机系统可读介质,例如随机存取存储器(Random Access Memory,RAM)430和/或高速缓存存储器432。服务器412可以进一步包括其它可移动/不可移动的、易失性/非易失性计算机系统存储介质。仅作为举例,存储系统434可以用于读写不可移动的、非易失性磁介质(图4未显示,通常称为“硬盘驱动器”)。尽管图4中未示出,可以提供用于对可移动非易失性磁盘(例如“软盘”)读写的磁盘驱动器,以及对可移动非易失性光盘,例如只读光盘(Compact Disc Read-Only Memory,CD-ROM),数字视盘(Digital Video Disc-Read Only Memory,DVD-ROM)或者其它光介质)读写的光盘驱动器。在这些情况下,每个驱动器可以通过一个或者多个数据介质接口与总线418相连。存储装置428可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序模块被配置以执行本发明各实施例的功能。
具有一组(至少一个)程序模块442的程序/实用工具440,可以存储在例如存储装置428中,这样的程序模块442包括但不限于操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。程序模块442通常执行本发明所描述的实施例中的功能和/或方法。A program/
服务器412也可以与一个或多个外部设备414(例如键盘、指向终端、显示器424等)通信,还可与一个或者多个使得用户能与该服务器412交互的终端通信,和/或与使得该服务器412能与一个或多个其它计算终端进行通信的任何终端(例如网卡,调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口422进行。并且,服务器412还可以通过网络适配器420与一个或者多个网络(例如局域网(Local Area Network,LAN),广域网(Wide AreaNetwork,WAN)和/或公共网络,例如因特网)通信。如图4所示,网络适配器420通过总线418与服务器412的其它模块通信。应当明白,尽管图中未示出,可以结合服务器412使用其它硬件和/或软件模块,包括但不限于:微代码、终端驱动器、冗余处理器、外部磁盘驱动阵列、磁盘阵列(Redundant Arrays of Independent Disks,RAID)系统、磁带驱动器以及数据备份存储系统等。The
处理器416通过运行存储在存储装置428中的程序,从而执行各种功能应用以及数据处理,例如实现本发明任意实施例所提供的测试案例生成方法,该方法可以包括:The
基于获取的测试需求文档,识别测试过程涉及的至少一个测试案例类型;Identify at least one test case type involved in the testing process based on the acquired test requirements document;
根据所述至少一个测试案例类型,从测试案例库中抽取每个测试案例类型对应的测试子案例;According to the at least one test case type, extract a test subcase corresponding to each test case type from the test case database;
根据测试需求,将抽取的各个测试子案例进行拼接,得到目标测试案例。According to the test requirements, the extracted test sub-cases are spliced to obtain the target test case.
实施例五Embodiment 5
本发明实施例五还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如本发明任意实施例所提供的测试案例生成方法,该方法可以包括:Embodiment 5 of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, implements the test case generation method provided by any embodiment of the present invention, and the method may include:
基于获取的测试需求文档,识别测试过程涉及的至少一个测试案例类型;Identify at least one test case type involved in the testing process based on the acquired test requirements document;
根据所述至少一个测试案例类型,从测试案例库中抽取每个测试案例类型对应的测试子案例;According to the at least one test case type, extract a test subcase corresponding to each test case type from the test case database;
根据测试需求,将抽取的各个测试子案例进行拼接,得到目标测试案例。According to the test requirements, the extracted test sub-cases are spliced to obtain the target test case.
本发明实施例的计算机存储介质,可以采用一个或多个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本文件中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。The computer storage medium in the embodiments of the present invention may adopt any combination of one or more computer-readable mediums. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples (a non-exhaustive list) of computer readable storage media include: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), Erasable Programmable Read Only Memory (EPROM or Flash), fiber optics, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。A computer-readable signal medium may include a propagated data signal in baseband or as part of a carrier wave, with computer-readable program code embodied thereon. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .
计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括——但不限于无线、电线、光缆、RF等等,或者上述的任意合适的组合。Program code embodied on a computer readable medium may be transmitted using any suitable medium, including - but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
可以以一种或多种程序设计语言或其组合来编写用于执行本发明操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或终端上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, but also conventional Procedural programming language - such as the "C" language or similar programming language. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or terminal. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through Internet connection).
注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。Note that the above are only preferred embodiments of the present invention and applied technical principles. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and can also include more other equivalent embodiments without departing from the concept of the present invention. The scope is determined by the scope of the appended claims.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910053129.1ACN109815147B (en) | 2019-01-21 | 2019-01-21 | Test case generation method, device, server and medium |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910053129.1ACN109815147B (en) | 2019-01-21 | 2019-01-21 | Test case generation method, device, server and medium |
| Publication Number | Publication Date |
|---|---|
| CN109815147A CN109815147A (en) | 2019-05-28 |
| CN109815147Btrue CN109815147B (en) | 2022-06-24 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201910053129.1AActiveCN109815147B (en) | 2019-01-21 | 2019-01-21 | Test case generation method, device, server and medium |
| Country | Link |
|---|---|
| CN (1) | CN109815147B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110221969A (en)* | 2019-05-21 | 2019-09-10 | 深圳壹账通智能科技有限公司 | A kind of page function test method and relevant apparatus |
| CN112783758B (en)* | 2019-11-11 | 2024-02-27 | 阿里云计算有限公司 | Test case library and feature library generation method, device and storage medium |
| CN111427790A (en)* | 2020-03-26 | 2020-07-17 | 中国建设银行股份有限公司 | Test method, test device, terminal equipment and storage medium |
| CN111459830B (en)* | 2020-04-07 | 2024-03-08 | 建信金融科技有限责任公司 | Test case generation method and device |
| CN111813654B (en)* | 2020-05-28 | 2024-11-12 | 平安科技(深圳)有限公司 | A test case citation method and device |
| CN112132176B (en)* | 2020-08-14 | 2024-11-26 | 中信银行股份有限公司 | A differential extraction method, device, electronic device and computer-readable storage medium |
| CN112256566B (en)* | 2020-09-28 | 2024-03-05 | 中国建设银行股份有限公司 | Fresh-keeping method and device for test cases |
| CN113204497A (en)* | 2021-06-03 | 2021-08-03 | 中国银行股份有限公司 | Test case generation method and device, electronic equipment and computer storage medium |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101989227A (en)* | 2009-08-04 | 2011-03-23 | 中兴通讯股份有限公司 | Test case generating method and device |
| CN103353859A (en)* | 2013-07-26 | 2013-10-16 | 浪潮电子信息产业股份有限公司 | Test case reusing method based on XML |
| CN107957957A (en)* | 2017-12-28 | 2018-04-24 | 网易(杭州)网络有限公司 | The acquisition methods and device of test case |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9940222B2 (en)* | 2015-11-20 | 2018-04-10 | General Electric Company | System and method for safety-critical software automated requirements-based test case generation |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101989227A (en)* | 2009-08-04 | 2011-03-23 | 中兴通讯股份有限公司 | Test case generating method and device |
| CN103353859A (en)* | 2013-07-26 | 2013-10-16 | 浪潮电子信息产业股份有限公司 | Test case reusing method based on XML |
| CN107957957A (en)* | 2017-12-28 | 2018-04-24 | 网易(杭州)网络有限公司 | The acquisition methods and device of test case |
| Publication number | Publication date |
|---|---|
| CN109815147A (en) | 2019-05-28 |
| Publication | Publication Date | Title |
|---|---|---|
| CN109815147B (en) | Test case generation method, device, server and medium | |
| CN110852065B (en) | Document auditing method, device, system, equipment and storage medium | |
| US9766868B2 (en) | Dynamic source code generation | |
| US9619209B1 (en) | Dynamic source code generation | |
| US20140164303A1 (en) | Method of answering questions and scoring answers using structured knowledge mined from a corpus of data | |
| US8311800B1 (en) | Systems and methods for detecting incorrect translations of terms in a computing string | |
| US20130246520A1 (en) | Recognizing Social Media Posts, Comments, or other Texts as Business Recommendations or Referrals | |
| CN110858172A (en) | A kind of automatic test code generation method and device | |
| CN110688111A (en) | Configuration method, device, server and storage medium for business process | |
| CN110049118A (en) | Information push method, device, equipment and storage medium | |
| CN108073429A (en) | A kind of means of payment collocation method, device, equipment and storage medium | |
| CN112162922A (en) | Method, device, server and storage medium for determining difference of new and old systems | |
| US11995562B2 (en) | Integrating documentation knowledge with log mining for system diagnosis | |
| CN112131296B (en) | Data exploration method and device, electronic equipment and storage medium | |
| CN113238796A (en) | Code reconstruction method, device, equipment and storage medium | |
| CN116248412A (en) | Shared data resource abnormality detection method, system, equipment, memory and product | |
| CN108399128A (en) | A kind of generation method of user data, device, server and storage medium | |
| US9910889B2 (en) | Rapid searching and matching of data to a dynamic set of signatures facilitating parallel processing and hardware acceleration | |
| US11797538B2 (en) | Message correlation extraction for mainframe operation | |
| CN117897735A (en) | Automatic language identification in image-based documents | |
| US11163833B2 (en) | Discovering and displaying business artifact and term relationships | |
| CN114416781A (en) | Data searching method and device, electronic equipment and storage medium | |
| CN110458743B (en) | Community management method, device, equipment and storage medium based on big data analysis | |
| CN115061921A (en) | Automatic test method, device, electronic equipment and readable storage medium | |
| CN107133868A (en) | Fund classifying method, device, terminal and storage medium |
| 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 |