WO2019056726A1 - 一种测试用例创建方法、装置、设备及存储介质 - Google Patents

一种测试用例创建方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2019056726A1
WO2019056726A1 PCT/CN2018/080850 CN2018080850W WO2019056726A1 WO 2019056726 A1 WO2019056726 A1 WO 2019056726A1 CN 2018080850 W CN2018080850 W CN 2018080850W WO 2019056726 A1 WO2019056726 A1 WO 2019056726A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
test case
drag
keyword
test
Prior art date
Application number
PCT/CN2018/080850
Other languages
English (en)
French (fr)
Inventor
伍朗
伍振亮
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019056726A1 publication Critical patent/WO2019056726A1/zh

Links

Images

Classifications

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

Definitions

  • the present application relates to the field of automated testing technologies, and in particular, to a test case creation method, apparatus, device, and storage medium.
  • the script developer needs to write a separate automated test script for the use case, and then run the script to test using the automated test tool. Once the test case is changed, the tester reprograms.
  • This test method requires high staff programming ability, high resource consumption, and low work efficiency.
  • the purpose of the application is to provide a test case creation method, device, device and storage medium, which can realize the creation of test cases by drag and drop, and realize automatic generation of test scripts, and the use cases are no longer affected by the ability of the person to program. .
  • test case creation method includes:
  • Reading the test case database dividing the code corresponding to the execution action of the test case in the test case database into different modules, so that each module forms a movable block on the screen and displays it in the form of a keyword;
  • the keywords are arranged and combined to form different test cases
  • test case creation device includes:
  • the keyword generating module is configured to read the test case database, and divide the code corresponding to the execution action of the test case in the test case database into different modules, so that each module forms a movable block on the screen and performs the keyword form display;
  • the test case generation module arranges and combines the keywords according to the user's drag and drop operation on the keywords to form different test cases;
  • the test script generation module arranges and combines the keywords according to the user's drag and drop operation on different keywords to form different test cases;
  • Validate the module to verify the code integrity of the automated test script so that the code of the automated test script conforms to the code of the automated test tool code specification.
  • a third aspect of the present application provides a terminal device including a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, the processor executing the computer readable instructions Implement the following steps:
  • Reading the test case database dividing the code corresponding to the execution action of the test case in the test case database into different modules, so that each module forms a movable block on the screen and displays in the form of a keyword;
  • the keywords are arranged and combined according to a drag operation of the keyword by the user to form a test case
  • a fourth aspect of the present application provides one or more non-transitory readable storage mediums storing computer readable instructions, the computer readable instructions being executed by one or more processors such that the one or more processes Perform the following steps:
  • Reading the test case database dividing the code corresponding to the execution action of the test case in the test case database into different modules, so that each module forms a movable block on the screen and displays in the form of a keyword;
  • the keywords are arranged and combined according to a drag operation of the keyword by the user to form a test case
  • FIG. 1 is a flowchart of a method for creating a test case provided by an embodiment of the present application
  • step S40 is a specific flowchart provided by an implementation manner of step S40 in a method for creating a test case according to an embodiment of the present application
  • FIG. 3 is a specific flowchart of step S20 in a method for creating a test case according to an embodiment of the present application
  • FIG. 5 is a schematic structural diagram of a test case creation apparatus according to another embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a test case creation apparatus according to another embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a verification module in a test case creation apparatus according to another embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a terminal device according to another embodiment of the present disclosure.
  • FIG. 9 is a schematic diagram of a terminal device in this embodiment.
  • test case creation method includes:
  • Step S10 Read the test case database, and divide the code corresponding to the execution action of the test case in the test case database into different modules, so that each module forms a movable block on the screen and displays it in the form of a keyword.
  • step S10 the test case in the test case database is read, and the read mode can be connected to a certain tool.
  • the test case management tool can be connected to read the test case; the test case is divided into blocks, and the test case database is used.
  • the code corresponding to the execution action of the test case is divided into different modules, the divided module is the unit of the minimum code that implements one function, and the keyword is the name in the code mapping table corresponding to the operation command in the test case.
  • the keyword library is updated according to the update of the read test case database.
  • the keyword library is updated by connecting test case management tools, by networking or manually importing a batch of test cases.
  • Step S20 Arranging and combining the keywords according to the drag operation of the keyword by the user to form a test case.
  • step S20 when the user's drag operation on the keyword is detected, for example, when the user detects that the user pulls a certain keyword with the mouse, the keyword is moved according to the location dragged by the user, and the user is dragged.
  • the trick is, on the surface, the reorganization of the keyword, which is actually the reorganization of the code that is disrupted by the module, and is the process of generating new test cases. For example, a user can create a new use case by dragging "Start, Log in, Last Record, Resume Play, Time Set, End".
  • Step S30 Find the corresponding test script code according to the keywords in the test case and generate an automated test script.
  • step S30 the corresponding test script code is searched based on the keywords in the test case and an automated test script is generated.
  • search scripts There are several ways to find test scripts. For example, look up keywords and code mapping tables based on keywords in test cases. Generate automated test scripts. This step relies on automated test tools. Common automated test tools are available, Quicktest. Professional, IBM Rational Functional Tester, and Silk Test. For example, the script in this embodiment defaults to generating code for the automated test tool tool tool IBM Rational Functional Tester.
  • Step S40 Verify the code integrity of the automated test script so that the code of the automated test script conforms to the code of the automated test tool code specification.
  • step S40 it is checked whether the automatically generated script is complete and has a syntax error.
  • the method includes:
  • Step S401 Add the generated test case information.
  • Step S402. Add exception handling code in the outer layer of the automated test script, and the exception handling code is try-catch code.
  • Step S403. Check whether the automated test script has a syntax error according to the try-catch code. If not, execute step S405 to directly generate the final version; if yes, execute step S404.
  • Step S404 Issue an error prompt, so that the tester can modify according to the error prompt.
  • Step S405. The final version is directly generated.
  • the embodiment of the present application provides a test case creation method, which decomposes the read test case into different modules, and the corresponding keyword of each module is displayed on the screen, and the keywords are arranged according to the user dragging operation on the keyword. Combine to form different test cases, find the corresponding test script code according to the keywords in the formed test case and generate an automated test script, verify the code integrity of the automated test script, and make the code of the automated test script conform to the automated test tool code specification. Code.
  • This method allows the modules of the code to form a keyword dictionary and visualize it, greatly reducing the requirement for creating test cases for human programming.
  • the keywords are arranged and combined according to the drag operation of the user by the user to form different test cases, including:
  • Step S201 Obtain a drag operation performed by the user, and obtain a drag prompt information corresponding to the keyword of the drag operation.
  • step S201 when the user drags the keyword, the prompt information corresponding to the keyword is detected at this time, and the prompt information may be prompt information carried by the keyword itself, such as a keyword rule, etc., or may be Some hints that the user defines themselves before the hyperactive keyword, such as the logical location to which the keyword belongs.
  • Step S202 Display the drag prompt information, and move the drag prompt information according to the movement track of the drag operation, so that the user can view the drag prompt information during the performing the operation. .
  • step S202 when the keyword is dragged, the prompt information moves with the drag track.
  • the color of the text in the prompt information is different from the color of the keyword
  • the font size of the text in the prompt information is different from the font size of the keyword, for example, when the keyword color and the font are black number four, the prompt information
  • the text color and font in the red color are five. This embodiment is advantageous for the user to see the prompt information at any time and is not confused with the keyword.
  • the method includes:
  • Step S2021. When dragging the keyword to some location, the drag prompt information displays a parameter prompt to prompt the user to set different parameters.
  • step S2021 when dragging the keyword to some position, in order to adapt to the position, some parameters in the keyword internal code need to be modified, and at this time, the parameter modification prompt may be issued, and the user may set the parameter according to the requirement. .
  • an error dragging prompt message is issued to prompt.
  • step S2022 the main reason for the error prompt is that the code logic hidden under the keyword does not work in the order of dragging, prompting the user to change the location or replace the keyword.
  • the prompt information of the keyword is displayed, so that the user can form the test case more accurately according to the prompt information, and the efficiency of the user to create the test case is provided.
  • test case creation method further includes:
  • Step S301 When the identifier of the source file of the dragged keyword is modified, generating a mapping relationship including the identifier of the use case, the source code file related to the keyword, and the statement line covered by the use case in the source file. Coverage logo.
  • Step S302. Detecting the coverage identifier of the statement line in the keyword, the use case of the found keyword with the coverage flag is determined as a use case requiring regression, and the use case is returned.
  • the step S301 includes: generating an identifier of the use case, a source code file related to the keyword, and an overlay identifier of the statement line covered by the use case in the source file, including:
  • step A4 The content of the keyword covering information generated by step A3 is summarized, and the coverage information file related to the use case is obtained, and the coverage information file related to the use case includes each related source code file of the use case and is covered in each related source file.
  • the coverage identifier of the statement line is
  • A5 According to the use case identifier and the content of the use case related coverage information file, generate a mapping relationship including: the identifier of the use case, the source code file related to the keyword, and the statement line covered by the use case in the source file. logo.
  • an overlay flag is generated when the information of the statement line in the source file is modified, and a mapping relationship between the use case, the keyword, and the modified statement is generated based on the overlay flag, and the coverage is found according to the overlay identifier of the statement line.
  • the mapping relationship of the flag only determines the use case corresponding to the use case identifier in the found mapping relationship as a use case requiring regression. Compared with the prior art, the use case that needs regression can be quickly and accurately located.
  • test case creation device 50 includes:
  • the keyword generating module 501 is configured to read the test case database, and divide the code corresponding to the execution action of the test case in the test case database into different modules, each module forming a movable block on the screen and performing the keyword form display;
  • the test case generation module 502 arranges and combines the keywords according to the user's drag and drop operation on different keywords to form different test cases;
  • the test case script generating module 503 arranges and combines the keywords according to the user's dragging operation on different keywords to form different test cases;
  • the verification module 504 verifies the code integrity of the automated test script so that the code of the automated test script conforms to the code of the automated test tool code specification.
  • test case creation device 50 further includes:
  • the prompt information module 505 is configured to obtain a drag operation performed by the user, and obtain the drag prompt information corresponding to the keyword of the drag operation, display the obtained drag prompt information, and perform the drag operation according to the drag operation
  • the moving track moves the drag prompt information to enable the user to view the drag prompt information during the drag operation.
  • the verification module 504 includes:
  • the test case information adding unit 510 is configured to add test case information, including: a test case name and an ID;
  • the exception handling code adding unit 511 is configured to add an exception processing code to the outer layer of the automated test script, where the exception handling code is a try-catch code;
  • the error verification unit 512 is configured to verify whether the automated test script has a syntax and a writing error according to the try-catch code, and if the verification fails, issue an error prompt, and if passed, generate a final automated test script.
  • Another embodiment of the present application provides one or more non-volatile readable storage media storing computer readable instructions.
  • the one or more non-transitory readable storage mediums storing computer readable instructions, when executed by one or more processors, causing one or more processors to execute the test cases in the above embodiments Create a method, to avoid duplication, no longer repeat here.
  • the functions of the modules/units in the test case creation device in the above embodiments are implemented when the computer readable instructions are executed by the processor. To avoid repetition, details are not described herein again.
  • non-volatile readable storage media storing computer readable instructions may comprise: any entity or device capable of carrying the computer readable instructions, a recording medium, a USB flash drive, a mobile hard drive, a magnetic Discs, optical discs, computer memories, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier signals, and telecommunications signals.
  • Figure 9 is a schematic diagram of a terminal device in this embodiment.
  • the terminal device 6 includes a processor 60, a memory 61, and computer readable instructions 62 stored in the memory 61 and operable on the processor 60.
  • the processor 60 executes the various steps of the test case creation method in the above-described embodiments when the computer readable instructions 62 are executed, such as steps S10, S20, S30, and S40 shown in FIG.
  • the processor 60 executes the computer readable instructions 62
  • the functions of each module/unit of the test case creation device in the above embodiment are implemented, as shown in FIG. 6, the keyword generation module 501, the test case generation module 502, and the test case script generation module. 503. Verify the function of module 504.

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)
  • User Interface Of Digital Computer (AREA)

Abstract

一种测试用例创建方法、装置、设备及存储介质,测试用例创建方法包括:读取测试用例数据库,将测试用例数据库中的测试用例的执行动作所对应的代码分成不同模块,使每个模块在屏幕上形成可移动块并以关键字的形式进行显示(S10);根据用户对所述关键字的拖拽操作对关键字进行排列组合,形成测试用例(S20);根据测试用例中的关键字查找对应的测试脚本代码并生成自动化测试脚本(S30);验证所述自动化测试脚本的代码完整性,使自动化测试脚本的代码符合自动化测试工具代码规范的代码(S40),通过这种操作,大大降低了创建测试用例的难度,使代码可视化,让普通人员也能创建测试用例。

Description

一种测试用例创建方法、装置、设备及存储介质
本申请以2017年9月21日提交的申请号为201710857301.X,名称为“一种测试用例创建方法、装置、设备及存储介质”的中国发明专利申请为基础,并要求其优先权。
技术领域
本申请涉及自动化测试技术领域,尤其涉及一种测试用例创建方法、装置、设备及存储介质。
背景技术
目前,自动化测试中,测试人员编写完用例以后,还需要脚本开发人员单独编写一条针对此用例的自动化测试脚本,然后使用自动化测试工具运行脚本进行测试,测试用例一旦变更,又要测试人员重新编程,这种测试方法对人员编程能力要求高,资源耗费大,工作效率低。
发明内容
本申请的目的在于提供一种测试用例创建方法、装置、设备及存储介质,能够用拖拽的方式实现测试用例的创建,并且实现测试脚本的自动化生成,创建用例不再受人员编程能力的影响。
本申请是这样实现的,本申请第一方面提供一种测试用例创建方法,所述测试用例创建方法包括:
读取测试用例数据库,将测试用例数据库中的测试用例的执行动作所对应的代码分成不同模块,使每个模块在屏幕上形成可移动块并以关键字的形式进行显示;
根据用户对关键字的拖拽操作对关键字进行排列组合,形成不同的测试用 例;
根据测试用例中的关键字查找对应的测试脚本代码并生成自动化测试脚本;
验证自动化测试脚本的代码完整性,使自动化测试脚本的代码符合自动化测试工具代码规范的代码。
本申请第二方面提供一种测试用例创建装置,所述测试用例创建装置包括:
关键字生成模块,用于读取测试用例数据库,将测试用例数据库中的测试用例的执行动作所对应的代码分成不同模块,使每个模块在屏幕上形成可移动块并以关键字的形式进行显示;
测试用例生成模块,根据用户对关键字的拖拽操作对关键字进行排列组合,形成不同的测试用例;
测试脚本生成模块,根据用户对不同关键字的拖拽操作对关键字进行排列组合,形成不同的测试用例;
验证模块,验证自动化测试脚本的代码完整性,使自动化测试脚本的代码符合自动化测试工具代码规范的代码。
本申请第三方面提供一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:
读取测试用例数据库,将所述测试用例数据库中的测试用例的执行动作所对应的代码分成不同模块,使每个模块在屏幕上形成可移动块并以关键字的形式进行显示;
根据用户对所述关键字的拖拽操作对关键字进行排列组合,形成测试用例;
根据所述测试用例中的关键字查找对应的测试脚本代码并生成自动化测试脚本;
验证所述自动化测试脚本的代码完整性,使所述自动化测试脚本的代码符合自动化测试工具代码规范的代码。
本申请第四方面提供一个或多个存储有计算机可读指令的非易失性可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:
读取测试用例数据库,将所述测试用例数据库中的测试用例的执行动作所对应的代码分成不同模块,使每个模块在屏幕上形成可移动块并以关键字的形式进行显示;
根据用户对所述关键字的拖拽操作对关键字进行排列组合,形成测试用例;
根据所述测试用例中的关键字查找对应的测试脚本代码并生成自动化测试脚本;
验证所述自动化测试脚本的代码完整性,使所述自动化测试脚本的代码符合自动化测试工具代码规范的代码。
本申请的一个或多个实施例的细节在下面的附图及描述中提出。本申请的其他特征和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本申请一种实施例提供的一种测试用例创建方法的流程图;
图2是本申请一种实施例提供的一种测试用例创建方法中的步骤S40的一种实施方式提供的具体流程图;
图3是本申请一种实施例提供的一种测试用例创建方法中的步骤S20的具体流程图;
图4是本申请一种实施例提供的一种测试用例创建方法中的另一种实施方式提供的具体流程图;
图5是本申请另一种实施例提供的一种测试用例创建装置的结构示意图;
图6是本申请另一种实施例提供的一种测试用例创建装置的结构示意图;
图7是本申请另一种实施例提供的一种测试用例创建装置中的验证模块的结构示意图;
图8是本申请另一种实施例提供的终端设备的结构示意图;
图9是本实施例中终端设备示意图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
为了说明本申请的技术方案,下面通过具体实施例来进行说明。
本申请实施例提供一种测试用例创建方法,如图1所示,该测试用例创建方法包括:
步骤S10.读取测试用例数据库,将测试用例数据库中的测试用例的执行动作所对应的代码分成不同模块,使每个模块在屏幕上形成可移动块并以关键字的形式进行显示。
在步骤S10中,读取测试用例数据库中的测试用例,读取方式可以连接某种工具,例如,可以连接测试用例管理工具来读取测试用例;对测试用例进行分块,是将测试用例数据库中的测试用例的执行动作所对应的代码分成不同模块,分成的模块是实现一个功能的最小代码的单元,关键字是与测试用例中的操作命令对应的代码映射表中的名称。例如:
Figure PCTCN2018080850-appb-000001
Figure PCTCN2018080850-appb-000002
上述代码是修改条滚行条的用例,其中<style type="text/css">body{scrollbar-face-color:#330033;}</style>,为实现一个功能的最小代码单元;每个模块生成可移动块并以关键字的形式进行显示,是代码可视化的步骤,例如,以关键字‘滚动条表面颜色设定’显示的可移动块,其下面隐藏的代码为<style type="text/css">body{scrollbar-face-color:#330033;}</style>。
需要说明的是,关键字库根据读取到的测试用例数据库的更新而更新。例如,通过连接的测试用例管理工具,通过联网或者人工导入一批测试用例,则对关键字库进行更新。
步骤S20.根据用户对所述关键字的拖拽操作对关键字进行排列组合,形成测试用例。
在步骤S20中,当检测到用户对所述关键字的拖拽操作,例如,检测到用户用鼠标拉动某个关键字时,使该关键字按照用户拖动的地点进行移动,对于用户的拖拽行为,表面上是对关键字的重组,实际上是按模块打乱的代码的重组,是生成新的测试用例的过程。例如,用户通过拖拽“开始、登录、上次记录、继续播放、时间设置、结束”,即可创建一个新的用例。
步骤S30.根据测试用例中的关键字查找对应的测试脚本代码并生成自动化测试脚本。
在步骤S30中,根据测试用例中的关键字查找对应的测试脚本代码并生成自动化测试脚本。测试脚本的查找方法有多种,例如,根据测试用例中的关键字在关键字与代码映射表中查找;生成自动化测试脚本,这一步骤依赖于自动化测试工具,常见的自动化测试工具有,Quicktest Professional、IBM Rational Functional Tester和Silk Test等。例如,本实施例中的脚本默认是生成针对IBM Rational Functional Tester这个自动化测试工具工具的代码。
步骤S40.验证所述自动化测试脚本的代码完整性,使自动化测试脚本的代码符合自动化测试工具代码规范的代码。
在步骤S40中,是检查自动化生成的脚本是否完整和是否有语法错误。
对于上述实施例中的步骤S40,作为一种实施方式,如图2所示,包括:
步骤S401.添加生成的测试用例信息。
步骤S402.在自动化测试脚本的外层添加异常处理代码,异常处理代码为try-catch代码。
步骤S403.根据try-catch代码检查自动化测试脚本是否有语法错误,若无,则执行步骤S405,直接生成最终版本;若有,则执行步骤S404。
如果try正确就会直接完成测试,如果try错误就会走catch代码,进而检测出语法是否错误。
步骤S404.发出错误提示,使测试人员根据错误提示进行修改。
步骤S405.直接生成最终版本。
本申请实施例提供一种测试用例创建方法,将读取到得测试用例分解成不同的模块,每个模块对应关键字在屏幕上显示,根据用户对关键字的拖拽操作对关键字进行排列组合,形成不同的测试用例,根据形成的测试用例中的关键字查找对应的测试脚本代码并生成自动化测试脚本,验证自动化测试脚本的代码完整性,使自动化测试脚本的代码符合自动化测试工具代码规范的代码。这种方法使代码组成的模块形成关键字词典,并使其可视化,大大降低了创建测试用例对人员编程能力的要求。
对于上述实施例中的步骤S20,作为一种实施方式,如图3所示,根据用户对关键字的拖拽操作对关键字进行排列组合,形成不同的测试用例,包括:
步骤S201.获取用户进行的拖拽操作,并获取拖拽操作的关键字对应的拖拽提示信息。
在步骤S201中,当用户对关键字进行拖动时,此时检测关键字对应的提示信息,该提示信息可以是关键字自身带有的提示信息,例如关键字的规则等等, 也可以是用户在多动关键字前自行定义的一些提示,例如关键字所属的逻辑位置等等。
步骤S202.显示所述拖拽提示信息,并根据所述拖拽操作的移动轨迹移动所述拖拽提示信息,以使用户在进行所述拽操作的过程中能够查看到所述拖拽提示信息。
在步骤S202中,当拖拽着关键字移动时,提示信息随着拖拽轨迹而移动。作为一种实施例,提示信息中文字的颜色不同于关键字的颜色,并且提示信息中文字的字体大小不同于关键字的字体大小,例如,关键字颜色和字体为黑色四号时,提示信息中的文字颜色和字体为红色小五。本实施例有利于用户时刻看到提示信息,且不与关键字相混淆。
对于上述实施例中的步骤S202,作为一种实施方式,如图4所示,包括:
步骤S2021.当拖拽关键字到某些位置时,所述拖拽提示信息显示参数提示以提示用户设置不同的参数。
在步骤S2021中,当拖拽关键字到某些位置时,为了适应该位置,需要对关键字内部代码中的某些参数进行修改,此时可以发出修改参数提示,用户可以根据需求自行设置参数。
步骤S2022.当关键字被拖拽到的位置不符合逻辑时,发出错误拖拽提示信息进行提示。
在步骤S2022中,出现错误提示的主要原因是关键字下隐藏的代码逻辑按照拖拽的顺序行不通,提示用户更换位置或者更换关键字。
本申请实施例在用户拖拽关键字时,显示关键字的提示信息,使用户根据提示信息更准确的对关键字进行组成形成测试用例,提供了用户创建测试用例的效率。
作为另一种实施方式,如图5所示,该测试用例创建方法还包括:
步骤S301.当被拖拽的关键字的源码文件的标识发生修改时,生成包含以 下内容的映射关系:该用例的标识、该关键字相关的源码文件以及该源码文件中被用例覆盖的语句行的覆盖标识。
步骤S302.检测关键字中语句行的覆盖标识,则查找到的具有覆盖标志的关键字所在的用例确定为需要回归的用例,回归该用例。
步骤S301中生成包含:生成用例的标识、该关键字相关的源码文件、以及该源码文件中被用例覆盖的语句行的覆盖标识,包括:
A1.在每个用例运行结束后,记录该用例的标识。
A2.生成该用例相关的源码文件;
A3.针对该用例相关的每一关键字的源码文件,生成包含该用例在该源码文件覆盖的语句行标识的语句覆盖信息的关键字;
A4.汇总步骤A3生成的各个语句覆盖信息的关键字包含的内容,得到用例相关的覆盖率信息文件,用例相关的覆盖率信息文件包含该用例各个相关的源码文件以及在各个相关的源码文件覆盖的语句行的覆盖标识。
A5.根据用例的标识以及用例相关的覆盖率信息文件包含的内容,生成包含以下内容的映射关系:该用例的标识、该关键字相关的源码文件、以及该源码文件中被用例覆盖的语句行的标识。
本申请实施例中在源码文件中语句行的信息发生修改时生成覆盖标志,并基于该覆盖标志生成用例、关键字以及修改语句之间的映射关系,根据该语句行的覆盖标识查找包含该覆盖标志的映射关系,仅将查找到的映射关系中的用例标识对应的用例确定为需要回归的用例,相比于现有技术,能够快速、准确定位出需要回归的用例。
本申请另一种实施例提供一种测试用例创建装置50,如图6所示,测试用例创建装置50包括:
关键字生成模块501,用于读取测试用例数据库,将测试用例数据库中的测试用例的执行动作所对应的代码分成不同模块,每个模块在屏幕上形成可移 动块并以关键字的形式进行显示;
测试用例生成模块502,根据用户对不同关键字的拖拽操作对关键字进行排列组合,形成不同的测试用例;
测试用例脚本生成模块503,根据用户对不同关键字的拖拽操作对关键字进行排列组合,形成不同的测试用例;
验证模块504,验证自动化测试脚本的代码完整性,使自动化测试脚本的代码符合自动化测试工具代码规范的代码。
进一步的,如图7所示,测试用例创建装置50还包括:
提示信息模块505,用于获取用户进行的拖拽操作,并获取所述拖拽操作的关键字对应的拖拽提示信息,显示所述获取的拖拽提示信息,并根据所述拖拽操作的移动轨迹移动所述拖拽提示信息,以使用户在进行所述拖拽操作的过程中能够查看到所述拖拽提示信息。
进一步的,如图8所示,验证模块504包括:
测试用例信息添加单元510,用于添加测试用例信息,包括:测试用例名称和ID;
异常处理代码添加单元511,用于在所述自动化测试脚本的外层添加异常处理代码,所述异常处理代码为try-catch代码;
错误验证单元512,用于根据所述try-catch代码验证所述自动化测试脚本是否有语法和编写错误,若验证不通过,则发出错误提示,若通过,则生成最终的自动化测试脚本。
上述终端设备中模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
本申请另一种实施例提供一个或多个存储有计算机可读指令的非易失性可读存储介质。该一个或多个存储有计算机可读指令的非易失性可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行上述 实施例中的测试用例创建方法,为避免重复,这里不再赘述。或者,该计算机可读指令被处理器执行时实现上述实施例中测试用例创建装置中各模块/单元的功能,为避免重复,这里不再赘述。
可以理解地,一个或多个存储有计算机可读指令的非易失性可读存储介质可以包括:能够携带所述计算机可读指令的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号和电信信号等。
图9是本实施例中终端设备的示意图。如图9所示,终端设备6包括处理器60、存储器61以及存储在存储器61中并可在处理器60上运行的计算机可读指令62。处理器60执行计算机可读指令62时实现上述实施例中测试用例创建方法的各个步骤,例如图1所示的步骤S10、S20、S30和S40。或者,处理器60执行计算机可读指令62时实现上述实施例中测试用例创建装置各模块/单元的功能,如图6所示关键字生成模块501、测试用例生成模块502、测试用例脚本生成模块503、验证模块504的功能。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (20)

  1. 一种测试用例创建方法,其特征在于,所述测试用例创建方法包括:
    读取测试用例数据库,将所述测试用例数据库中的测试用例的执行动作所对应的代码分成不同模块,使每个模块在屏幕上形成可移动块并以关键字的形式进行显示;
    根据用户对所述关键字的拖拽操作对关键字进行排列组合,形成测试用例;
    根据所述测试用例中的关键字查找对应的测试脚本代码并生成自动化测试脚本;
    验证所述自动化测试脚本的代码完整性,使所述自动化测试脚本的代码符合自动化测试工具代码规范的代码。
  2. 如权利要求1所述的测试用例创建方法,其特征在于,所述模块为实现一个功能的最小代码的单元;
    所述关键字是与测试用例中的操作命令对应的代码映射表中的名称。
  3. 如权利要求1所述的测试用例创建方法,其特征在于,根据用户对不同关键字的拖拽操作对关键字进行排列组合,包括:
    获取用户进行的拖拽操作,并获取所述拖拽操作的关键字对应的拖拽提示信息;
    显示所述拖拽提示信息,并根据所述拖拽操作的移动轨迹移动所述拖拽提示信息,以使用户在进行所述拽操作的过程中能够查看到所述拖拽提示信息。
  4. 如权利要求3所述的测试用例创建方法,其特征在于,根据所述拖拽操作的移动轨迹移动所述拖拽提示信息,以使用户在进行所述拖拽操作的过程中能够查看到所述拖拽提示信息,包括:
    当拖拽关键字到某些位置时,所述拖拽提示信息显示参数提示以提示用户设置不同的参数;
    当所述关键字被拖拽到的位置不符合逻辑时,发出错误拖拽提示信息进行提示。
  5. 如权利要求1所述的测试用例创建方法,其特征在于,验证所述自动化测试脚本的代码完整性,使自动化测试脚本的代码符合自动化测试工具代码规范的代码,包括:
    添加所述测试用例信息,包括:测试用例名称和ID;
    在所述自动化测试脚本的外层添加异常处理代码,所述异常处理代码为try-catch代码;
    根据所述try-catch代码验证自动化测试脚本是否有语法和编写错误,若验证不通过,则发出错误提示,若验证通过,则生成最终的测试脚本。
  6. 一种测试用例创建装置,其特征在于,包括:
    关键字生成模块,用于读取测试用例数据库,将所述测试用例数据库中的测试用例的执行动作所对应的代码分成不同模块,使每个模块在屏幕上形成可移动块并以关键字的形式进行显示;
    测试用例生成模块,根据用户对不同关键字的拖拽操作对关键字进行排列组合,形成不同的测试用例;
    测试用例脚本生成模块,根据用户对不同关键字的拖拽操作对关键字进行排列组合,形成不同的测试用例;
    验证模块,验证所述自动化测试脚本的代码完整性,使所述自动化测试脚本的代码符合自动化测试工具代码规范的代码。
  7. 如权利要求6所述的测试用例创建装置,其特征在于,所述模块为实现一个功能的最小代码的单元;
    所述关键字是与测试用例中的操作命令对应的代码映射表中的名称。
  8. 如权利要求6所述的测试用例创建装置,其特征在于,所述测试用例创建装置还包括:
    提示信息模块,用于获取用户进行的拖拽操作,并获取所述拖拽操作的关键字对应的拖拽提示信息,显示所述获取的拖拽提示信息,并根据所述拖拽操作的移动轨迹移动所述拖拽提示信息,以使用户在进行所述拖拽操作的过程中 能够查看到所述拖拽提示信息。
  9. 如权利要求8所述的测试用例创建装置,其特征在于,所述提示信息模块具体用于:
    当拖拽关键字到某些位置时,所述拖拽提示信息显示参数提示以提示用户设置不同的参数;
    当所述关键字被拖拽到的位置不符合逻辑时,发出错误拖拽提示信息进行提示。
  10. 如权利要求6所述的测试用例创建装置,其特征在于,所述验证模块包括:
    测试用例信息添加单元,用于添加测试用例信息,包括:测试用例名称和ID;
    异常处理代码添加单元,用于在所述自动化测试脚本的外层添加异常处理代码,所述异常处理代码为try-catch代码;
    错误验证单元,用于根据所述try-catch代码验证所述自动化测试脚本是否有语法和编写错误,若验证不通过,则发出错误提示,若验证通过,则生成最终的自动化测试脚本。
  11. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:
    读取测试用例数据库,将所述测试用例数据库中的测试用例的执行动作所对应的代码分成不同模块,使每个模块在屏幕上形成可移动块并以关键字的形式进行显示;
    根据用户对所述关键字的拖拽操作对关键字进行排列组合,形成测试用例;
    根据所述测试用例中的关键字查找对应的测试脚本代码并生成自动化测试脚本;
    验证所述自动化测试脚本的代码完整性,使所述自动化测试脚本的代码符 合自动化测试工具代码规范的代码。
  12. 如权利要求11所述的终端设备,其特征在于,所述模块为实现一个功能的最小代码的单元;
    所述关键字是与测试用例中的操作命令对应的代码映射表中的名称。
  13. 如权利要求11所述的终端设备,其特征在于,根据用户对不同关键字的拖拽操作对关键字进行排列组合,包括:
    获取用户进行的拖拽操作,并获取所述拖拽操作的关键字对应的拖拽提示信息;
    显示所述拖拽提示信息,并根据所述拖拽操作的移动轨迹移动所述拖拽提示信息,以使用户在进行所述拽操作的过程中能够查看到所述拖拽提示信息。
  14. 如权利要求13所述的终端设备,其特征在于,根据所述拖拽操作的移动轨迹移动所述拖拽提示信息,以使用户在进行所述拖拽操作的过程中能够查看到所述拖拽提示信息,包括:
    当拖拽关键字到某些位置时,所述拖拽提示信息显示参数提示以提示用户设置不同的参数;
    当所述关键字被拖拽到的位置不符合逻辑时,发出错误拖拽提示信息进行提示。
  15. 如权利要求11所述的终端设备,其特征在于,验证所述自动化测试脚本的代码完整性,使自动化测试脚本的代码符合自动化测试工具代码规范的代码,包括:
    添加所述测试用例信息,包括:测试用例名称和ID;
    在所述自动化测试脚本的外层添加异常处理代码,所述异常处理代码为try-catch代码;
    根据所述try-catch代码验证自动化测试脚本是否有语法和编写错误,若验证不通过,则发出错误提示,若验证通过,则生成最终的测试脚本。
  16. 一个或多个存储有计算机可读指令的非易失性可读存储介质,其特征 在于,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:
    读取测试用例数据库,将所述测试用例数据库中的测试用例的执行动作所对应的代码分成不同模块,使每个模块在屏幕上形成可移动块并以关键字的形式进行显示;
    根据用户对所述关键字的拖拽操作对关键字进行排列组合,形成测试用例;
    根据所述测试用例中的关键字查找对应的测试脚本代码并生成自动化测试脚本;
    验证所述自动化测试脚本的代码完整性,使所述自动化测试脚本的代码符合自动化测试工具代码规范的代码。
  17. 如权利要求16所述的非易失性可读存储介质,其特征在于,所述模块为实现一个功能的最小代码的单元;
    所述关键字是与测试用例中的操作命令对应的代码映射表中的名称。
  18. 如权利要求16所述的非易失性可读存储介质,其特征在于,根据用户对不同关键字的拖拽操作对关键字进行排列组合,包括:
    获取用户进行的拖拽操作,并获取所述拖拽操作的关键字对应的拖拽提示信息;
    显示所述拖拽提示信息,并根据所述拖拽操作的移动轨迹移动所述拖拽提示信息,以使用户在进行所述拽操作的过程中能够查看到所述拖拽提示信息。
  19. 如权利要求18所述的非易失性可读存储介质,其特征在于,根据所述拖拽操作的移动轨迹移动所述拖拽提示信息,以使用户在进行所述拖拽操作的过程中能够查看到所述拖拽提示信息,包括:
    当拖拽关键字到某些位置时,所述拖拽提示信息显示参数提示以提示用户设置不同的参数;
    当所述关键字被拖拽到的位置不符合逻辑时,发出错误拖拽提示信息进行提示。
  20. 如权利要求16所述的非易失性可读存储介质,其特征在于,验证所述自动化测试脚本的代码完整性,使自动化测试脚本的代码符合自动化测试工具代码规范的代码,包括:
    添加所述测试用例信息,包括:测试用例名称和ID;
    在所述自动化测试脚本的外层添加异常处理代码,所述异常处理代码为try-catch代码;
    根据所述try-catch代码验证自动化测试脚本是否有语法和编写错误,若验证不通过,则发出错误提示,若验证通过,则生成最终的测试脚本。
PCT/CN2018/080850 2017-09-21 2018-03-28 一种测试用例创建方法、装置、设备及存储介质 WO2019056726A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710857301.XA CN108255702A (zh) 2017-09-21 2017-09-21 一种测试用例创建方法、装置、设备及存储介质
CN201710857301.X 2017-09-21

Publications (1)

Publication Number Publication Date
WO2019056726A1 true WO2019056726A1 (zh) 2019-03-28

Family

ID=62722218

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/080850 WO2019056726A1 (zh) 2017-09-21 2018-03-28 一种测试用例创建方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN108255702A (zh)
WO (1) WO2019056726A1 (zh)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109783354A (zh) * 2018-12-14 2019-05-21 深圳壹账通智能科技有限公司 应用***的功能测试方法、终端设备及介质
CN111459810A (zh) * 2020-03-25 2020-07-28 南阳柯丽尔科技有限公司 构建应用程序的方法、编程设备和计算机可读存储介质
CN112286813B (zh) * 2020-10-30 2023-12-12 上海纳恩汽车技术股份有限公司 一种用例关键字的自动化生成***及方法
CN112506756B (zh) * 2020-11-11 2023-06-06 东风汽车集团有限公司 一种车辆控制器测试用例脚本生成方法和装置
CN112527655B (zh) * 2020-12-16 2024-06-25 平安银行股份有限公司 软件版本质量异常检测方法、装置、电子设备及存储介质
CN113760730B (zh) * 2021-01-27 2024-07-16 北京京东振世信息技术有限公司 一种自动化测试的方法和装置
CN113220595B (zh) * 2021-06-11 2023-10-03 中国农业银行股份有限公司 测试方法及设备
CN113626326B (zh) * 2021-08-09 2022-02-11 三峡高科信息技术有限责任公司 一种基于图像识别的拖拽式的零代码前端自动化测试***
CN113742238B (zh) * 2021-09-14 2024-05-14 南方电网数字平台科技(广东)有限公司 一种测试用例的生成方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102567193A (zh) * 2010-12-09 2012-07-11 北京新媒传信科技有限公司 测试用例转化为自动化测试脚本的方法及***
CN102722437A (zh) * 2012-05-29 2012-10-10 北京空间飞行器总体设计部 一种基于组件与脚本的航天器测试***及测试方法
CN103441900A (zh) * 2013-08-27 2013-12-11 上海新炬网络技术有限公司 集中式跨平台自动化测试***及其控制方法
CN104461855A (zh) * 2013-09-22 2015-03-25 腾讯科技(北京)有限公司 一种Web自动化测试方法、***及装置
WO2016078335A1 (zh) * 2014-11-18 2016-05-26 中兴通讯股份有限公司 自动化脚本的编写方法和装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103034582B (zh) * 2011-09-28 2016-03-16 腾讯科技(深圳)有限公司 定位回归用例的方法和***
US20130339332A1 (en) * 2012-06-18 2013-12-19 Mark Ellery Ogram News reporting system
CN103530041A (zh) * 2013-08-19 2014-01-22 贝壳网际(北京)安全技术有限公司 一种拖拽处理方法、装置和终端设备
CN104932980B (zh) * 2015-06-30 2018-10-23 北京奇虎科技有限公司 软件自动测试方法及装置
CN106649097B (zh) * 2016-11-04 2019-01-22 江苏电力信息技术有限公司 一种基于对象分离管理的移动自动化测试方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102567193A (zh) * 2010-12-09 2012-07-11 北京新媒传信科技有限公司 测试用例转化为自动化测试脚本的方法及***
CN102722437A (zh) * 2012-05-29 2012-10-10 北京空间飞行器总体设计部 一种基于组件与脚本的航天器测试***及测试方法
CN103441900A (zh) * 2013-08-27 2013-12-11 上海新炬网络技术有限公司 集中式跨平台自动化测试***及其控制方法
CN104461855A (zh) * 2013-09-22 2015-03-25 腾讯科技(北京)有限公司 一种Web自动化测试方法、***及装置
WO2016078335A1 (zh) * 2014-11-18 2016-05-26 中兴通讯股份有限公司 自动化脚本的编写方法和装置

Also Published As

Publication number Publication date
CN108255702A (zh) 2018-07-06

Similar Documents

Publication Publication Date Title
WO2019056726A1 (zh) 一种测试用例创建方法、装置、设备及存储介质
WO2019104917A1 (zh) 基金***测试用例的测试方法、装置、设备及存储介质
US10146672B2 (en) Method and system for automated user interface (UI) testing through model driven techniques
US20190303269A1 (en) Methods and systems for testing visual aspects of a web page
BR112015011537B1 (pt) Método e dispositivo de armazenamento para associação de metadados com código fonte
TW201405306A (zh) 測試用例創建系統及方法
US9715440B2 (en) Test scope determination based on code change(s)
US20070192754A1 (en) Method for treating design errors of a layout of an integrated circuit
WO2019109553A1 (zh) 功能及性能测试脚本的创建方法、装置、设备及存储介质
US9135591B1 (en) Analysis and assessment of software library projects
US10380011B2 (en) Method, apparatus, and computer-readable medium for performing functional testing of software
US10209984B2 (en) Identifying a defect density
US8572436B2 (en) Computing device and method for managing motherboard test
CN104572463A (zh) 测试接口信息的方法及装置
US8898649B2 (en) Application program analysis method, analysis system and recording medium for identifying a contributing factor for an invalid operation of an application program
CN111966580A (zh) 基于人工智能的自动化测试方法、装置、设备和存储介质
US20170075789A1 (en) Method and apparatus for generating, capturing, storing, and loading debug information for failed tests scripts
EP2951680B1 (en) Acquiring identification of an application lifecycle management entity associated with similar code
US8589734B2 (en) Verifying correctness of processor transactions
US20160239407A1 (en) Small scale integration test generation
KR102067504B1 (ko) 임시 머리글의 생성을 통해 자동필터 기능을 실행하는 스프레드시트 문서 편집 장치 및 그 동작 방법
TWI393897B (zh) 整合測試方法及其系統
Lavoie et al. A case study of TTCN-3 test scripts clone analysis in an industrial telecommunication setting
CN108614704B (zh) 代码编译方法及装置
JP2016126700A (ja) プログラム検証装置、プログラム検証方法及びプログラム検証プログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18859501

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 24.09.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18859501

Country of ref document: EP

Kind code of ref document: A1