WO2019227708A1 - Online debugging apparatus and method for test case, and computer-readable storage medium - Google Patents

Online debugging apparatus and method for test case, and computer-readable storage medium Download PDF

Info

Publication number
WO2019227708A1
WO2019227708A1 PCT/CN2018/102104 CN2018102104W WO2019227708A1 WO 2019227708 A1 WO2019227708 A1 WO 2019227708A1 CN 2018102104 W CN2018102104 W CN 2018102104W WO 2019227708 A1 WO2019227708 A1 WO 2019227708A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
debugging
test
code
case
Prior art date
Application number
PCT/CN2018/102104
Other languages
French (fr)
Chinese (zh)
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 WO2019227708A1 publication Critical patent/WO2019227708A1/en

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/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/362Software debugging

Definitions

  • the present application relates to the field of computer technology, and in particular, to an online debugging device and method for a test case, and a computer-readable storage medium.
  • the present application provides an online debugging device, method and computer-readable storage medium for test cases, the main purpose of which is to solve the technical problems that the existing debugging methods cannot accurately and completely reflect the test situation.
  • the present application provides an online debugging device for a test case.
  • the device includes a memory and a processor.
  • the memory stores a case debugging program that can be run on the processor.
  • the case debugging program is When the processor executes, the following steps are implemented:
  • the case editing interface is displayed for the user to edit the test case
  • a debugging task is established according to the debugging instruction and parameters of the debugging task are determined;
  • the debugging task is added to the task queue, and the currently executing machine in the cluster of executive machines retrieves and executes the debugging task from the task queue according to a preset task scheduling mechanism, so that The system tests and the execution machine writes the task data back to the preset database;
  • the task data is read from the preset database and displayed.
  • this application also provides an online debugging method of a test case, which method includes:
  • the case editing interface is displayed for the user to edit the test case
  • a debugging task is established according to the debugging instruction and parameters of the debugging task are determined;
  • the debugging task is added to the task queue, and the currently executing machine in the cluster of executive machines retrieves and executes the debugging task from the task queue according to a preset task scheduling mechanism, so that The system tests and the execution machine writes the task data back to the preset database;
  • the task data is read from the preset database and displayed.
  • the present application also provides a computer-readable storage medium, where the computer-readable storage medium stores a case debugging program, and the case debugging program may be executed by one or more processors to implement Steps of the online debugging method of the test case as described above.
  • the online debugging device, method, and computer-readable storage medium of the test case provided in this application, when a case editing instruction sent by a user based on a user terminal is detected, the case editing interface is displayed for the user to edit the test case, and the user is obtained based on the case editing
  • the test case edited by the interface stores the code of the test case to the code base.
  • a debugging instruction triggered based on the test case is detected, a debugging task is established and the parameters of the debugging task are determined according to the debugging instruction, and the debugging task is added to the task queue.
  • the currently idle execution machines call and execute debugging tasks from the task queue according to a preset task scheduling mechanism to test the system under test, that is, the user writes and completes a test case Afterwards, there is no need to set up a test environment locally.
  • the case can be executed by the cluster of actuators to debug the case. This can ensure that the debug environment of the test case is consistent with the actual test environment.
  • the task data is written back to the preset database. After the commissioning task is completed, read from the preset database Take task data and display it to accurately and completely present the test situation for testers to understand the test situation of the case.
  • FIG. 1 is a schematic diagram of a preferred embodiment of an online debugging device for a test case of this application
  • FIG. 2 is a schematic diagram of a program module of a case debugging program in an embodiment of an online debugging device of a test case of this application;
  • FIG. 3 is a flowchart of a first embodiment of an online debugging method for a test case of this application.
  • FIG. 1 is a schematic diagram of a preferred embodiment of an online debugging device in a test case of this application.
  • the online debugging device 1 of the test case may be a PC (Personal Computer) or a terminal device such as a smart phone, a tablet computer, or a portable computer.
  • PC Personal Computer
  • terminal device such as a smart phone, a tablet computer, or a portable computer.
  • the online debugging device 1 of this test case includes at least a memory 11, a processor 12, a network interface 13, and a communication bus 14.
  • the memory 11 includes at least one type of readable storage medium.
  • the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (for example, SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like.
  • the memory 11 may be an internal storage unit of the online debugging device 1 of the test case in some embodiments, such as a hard disk of the online debugging device 1 of the test case.
  • the memory 11 may also be an external storage device of the online debugging device 1 of the test case in other embodiments, such as a plug-in hard disk and a smart memory card (SMC) provided on the online debugging device 1 of the test case. Secure Digital (SD) card, Flash Card, etc.
  • SD Secure Digital
  • Flash Card etc.
  • the memory 11 may include both an internal storage unit of the online debugging device 1 of the test case and an external storage device.
  • the memory 11 can be used not only to store the application software and various types of data installed in the online debugging device 1 of the test case, such as the code of the case debug program 01, but also to temporarily store the data that has been or will be output.
  • the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments, and is configured to run program codes or processes stored in the memory 11 Data, such as the case debug program 01.
  • the network interface 13 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and is generally used to establish a communication connection between the device 1 and other electronic devices.
  • a standard wired interface such as a WI-FI interface
  • the communication bus 14 is used to implement connection communication between these components.
  • FIG. 1 only shows the online debugging device 1 with the test cases of the components 11-14 and the case debug program 01, but it should be understood that it is not required to implement all the illustrated components, and more or less can be implemented instead s component.
  • the device 1 may further include a user interface.
  • the user interface may include a display, an input unit such as a keyboard, and the optional user interface may further include a standard wired interface and a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch-type liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light emitting diode) touch device, or the like.
  • the display may also be appropriately referred to as a display screen or a display unit, for displaying information processed in the online debugging device 1 of the test case, and for displaying a visual user interface.
  • the case debug program 01 is stored in the memory 11; when the processor 12 executes the case debug program 01 stored in the memory 11, the following steps are implemented:
  • a case editing interface is displayed for the user to edit a test case.
  • the online debugging device in this embodiment establishes a communication connection with the user terminal as a server, and provides an online editing function and an online debugging function of the test case.
  • the on-line debugging device is connected to the executive machine cluster and controls the execution case of the executive machine cluster, where the executive machine cluster includes a plurality of executive machines.
  • the online debugging device When the online debugging device receives the case editing instruction, the case editing interface is displayed for the user to write For a test case, after the user writes the case, the online debugging device obtains the code of the test case written by the user based on the case editing interface, and stores the code in the code base after associating the number of the test case.
  • This preset code library is used to store the code of test cases written and uploaded by testers.
  • the above case editing instruction may be a new case instruction or a case modification instruction, and the user triggers the corresponding instruction according to the controls on the display interface of the user terminal. If it is a new case instruction, the case editing interface is displayed directly; if it is a case modification instruction, when a case editing instruction sent by the user based on the user terminal is detected, the test case corresponding to the editing instruction is determined; The code of the test case is described, the case editing interface is displayed, and the found code is displayed on the case editing interface for users to edit the code of the test case online.
  • a debugging task is established according to the debugging instruction and parameters of the debugging task are determined.
  • the online debugging device detects a debugging instruction sent by the user terminal, determines a test case corresponding to the debugging instruction, establishes a corresponding debugging task, and determines task parameters of the task.
  • the task parameters mainly include but are not limited to the following: the number of execution machines executing the task, task ID, task status, and the like.
  • the task status includes the following states throughout the debugging cycle of the debugging task: pending status, execution status, and execution completion status.
  • the number of execution machines in the task parameters can be set by the tester according to the specific requirements of the test case.
  • the debugging task is added to the task queue, and the currently executing machine in the cluster of executive machines retrieves and executes the debugging task from the task queue according to a preset task scheduling mechanism, so that The system tests and the execution machine writes the task data back to the preset database.
  • the online debugging device may receive debugging tasks sent by multiple user terminals. Therefore, there may be multiple debugging tasks in the task queue that are being executed or to be executed, and the status of the execution machines in the execution machine cluster is also different. In the idle state, there are also executives that are processing debugging tasks. Therefore, after adding a task, the idle execution machine in the execution machine cluster needs to take the task from the task queue and execute it according to a preset task scheduling mechanism. Specifically, this step may include the following detailed steps:
  • the state of the debugging task is marked as a pending state; whenever it is detected that an execution machine calls the debugging task, it is determined whether the status task of the debugging task is Pending status; if the task status of the debugging task is pending status, add status information of the debugging task called by the execution machine to the debugging task, and call the debugging task and download the code from the code
  • the status of the debugging task is modified to the execution status; if the status task of the debugging task is the execution status, a calling task is sent to the execution machine Failure response information; when it is detected that the state of the debugging task is the execution state, controlling the preset number of execution machines to execute the debugging task to test the system under test.
  • the management of the execution machine scheduling tasks is realized through the management of the task status.
  • the idle execution machine is allowed to call the task and download the corresponding one from the code base.
  • the code of the test case when the number of execution machines that have called the task has reached the set preset number, the state of the task is modified to the execution state, and other execution machines are no longer allowed to call the task.
  • the multiple execution machines that called the task execute the test case synchronously, and each of the execution machines writes back the task data obtained by executing the test case to a preset Database.
  • the database is a time series database.
  • the task data is read from the preset database and displayed.
  • the online debugging device After the execution of the debugging task is completed, the online debugging device reads the result data of the task execution from the database and displays it, so that the tester can modify the script of the test case according to the displayed result data, and generate log data according to the execution of the task. And show. If the tester determines that the test case needs to be modified through analysis of the task data, the test case can be sent based on the user terminal. If the online debugging device receives the case modification command triggered based on the task data, the code is sent from the code. The code of the test case is obtained from the library and displayed for the user to modify the code according to the task data; if the modification of the code is detected, the modified code update is stored in the code library.
  • the above-mentioned online debugging device provides a unified debugging environment for test cases. After the test cases are written by testers, they can be uploaded directly to the device. The device stores the code and establishes debugging tasks. The actual test environment runs the test in a consistent operating environment. Code and feedback the results of the code to the user terminal, that is, testers do not need to set up a test environment locally, which not only saves the trouble of setting up a test environment, improves the efficiency of writing test cases, but also ensures the debugging environment and The unification of the actual test environment makes the debugging results of the test cases more accurate.
  • the on-line debugging device for a test case displayed a case editing interface for the user to edit a test case when a case editing instruction sent by the user based on the user terminal is detected, and obtains a test case edited by the user based on the case editing interface.
  • the code of this test case is stored in the code base.
  • a debugging instruction triggered based on the test case is detected, a debugging task is established and the parameters of the debugging task are determined according to the debugging instruction.
  • the debugging task is added to the task queue and executed by the cluster of actuators.
  • the currently executing machine in the idle state calls and executes debugging tasks from the task queue according to a preset task scheduling mechanism to test the system under test, that is, after the user writes a test case, it does not need to be built locally
  • the test environment can be executed by the executive cluster to debug the case. It can ensure that the debug environment of the test case is consistent with the actual test environment.
  • the task data is written back to the preset database. The task data is read from the database and displayed to achieve Accurately and completely present the test situation for testers to understand the test situation of the case.
  • the device also provides an online modification function for the test scenario.
  • the case debugging program may also be executed by the processor to implement the following steps: upon receiving the user, sending based on the user terminal When a test scenario modification instruction is received, obtain a scene parameter from the test scenario modification instruction and determine a test scenario corresponding to the scene modification instruction; obtain a test code that matches the test scenario from a code library, and modify the scenario parameter.
  • the test code stores the modified test code update in the code base.
  • the scenario parameters may include, but are not limited to, the following data: the number of virtual users allowed to start the test, and the test duration.
  • the effect diagram when the scenario is executed is displayed according to a preset visual display mode.
  • the test scenario set by the user is to gradually increase the number of test tasks to N within a preset time period T.
  • a scenario code suitable for such a dynamic test scenario is set in the system in advance, and the user can set it
  • the system modifies the corresponding values in the scene code, generates a scene code that matches the scene, and stores it.
  • the case debugging program may also be divided into one or more modules, and the one or more modules are stored in the memory 11 and processed by one or more processors (this embodiment is The processor 12) executes to complete this application.
  • the modules referred to in this application refer to a series of computer program instruction segments capable of performing specific functions, and are used to describe the execution process of the case debugging program in the online debugging device of the test case.
  • FIG. 2 it is a schematic diagram of a program module of a case debugging program in an embodiment of an online debugging device for a test case of this application.
  • the case debugging program can be divided into an interface display module 10 and a code acquisition module. 20.
  • the task establishment module 30, the task scheduling module 40, and the data display module 50 for example:
  • the interface display module 10 is configured to: when a case editing instruction sent by a user based on a user terminal is detected, display a case editing interface for the user to edit a test case;
  • the code obtaining module 20 is configured to: obtain a code of a test case written by a user based on the case editing interface, and store the code in a code base;
  • the task establishing module 30 is configured to: when a debugging instruction triggered based on the test case is detected, establish a debugging task according to the debugging instruction and determine parameters of the debugging task;
  • the task scheduling module 40 is configured to add the debugging task to a task queue, and an executive machine currently in an idle state in an executive machine cluster retrieves and executes the task queue from the task queue according to a preset task scheduling mechanism. Debug the task to test the system under test, and the task machine writes the task data back to the preset database;
  • the data display module 50 is configured to: if it is detected that the debugging task is completed, read the task data from the preset database and display it.
  • the above-mentioned interface display module 10, code acquisition module 20, task establishment module 30, task scheduling module 40, and data display module 50 and other program modules are executed to implement functions or operation steps that are substantially the same as those in the foregoing embodiment, and are not repeated here .
  • FIG. 3 is a flowchart of a first embodiment of an online debugging method for a test case of this application. The method may be performed by a device, which may be implemented by software and / or hardware.
  • the online debugging method of the test case includes:
  • step S10 when a case editing instruction sent by the user based on the user terminal is detected, a case editing interface is displayed for the user to edit the test case.
  • step S20 the code of the test case written by the user based on the case editing interface is acquired, and the code is stored in the code base.
  • the online debugging device serves as a server to establish a communication connection with the user terminal, and provides online editing functions and online debugging functions for test cases.
  • the on-line debugging device is connected to the executive machine cluster and controls the execution case of the executive machine cluster, where the executive machine cluster includes a plurality of executive machines.
  • the online debugging device When the online debugging device receives the case editing instruction, the case editing interface is displayed for the user to write For a test case, after the user writes the case, the online debugging device obtains the code of the test case written by the user based on the case editing interface, and stores the code in the code base after associating the number of the test case.
  • This preset code library is used to store the code of test cases written and uploaded by testers.
  • the above case editing instruction may be a new case instruction or a case modification instruction, and the user triggers the corresponding instruction according to the controls on the display interface of the user terminal. If it is a new case instruction, the case editing interface is displayed directly; if it is a case modification instruction, when a case editing instruction sent by the user based on the user terminal is detected, the test case corresponding to the editing instruction is determined; The code of the test case is described, the case editing interface is displayed, and the found code is displayed on the case editing interface for users to edit the code of the test case online.
  • step S30 when a debugging instruction triggered based on the test case is detected, a debugging task is established according to the debugging instruction and parameters of the debugging task are determined.
  • the online debugging device detects a debugging instruction sent by the user terminal, determines a test case corresponding to the debugging instruction, establishes a corresponding debugging task, and determines task parameters of the task.
  • the task parameters mainly include but are not limited to the following: the number of execution machines executing the task, task ID, task status, and the like.
  • the task status includes the following states throughout the debugging cycle of the debugging task: pending status, execution status, and execution completion status.
  • the number of execution machines in the task parameters can be set by the tester according to the specific requirements of the test case.
  • step S40 the debugging task is added to the task queue, and the currently executing machine in the cluster of executing machines is called from the task queue and executed according to a preset task scheduling mechanism to The system under test is tested, and the task data is written back to the preset database by the execution machine.
  • step S40 may include the following detailed steps:
  • the state of the debugging task is marked as a pending state; whenever it is detected that an execution machine calls the debugging task, it is determined whether the status task of the debugging task is Pending status; if the task status of the debugging task is pending status, add status information of the debugging task called by the execution machine to the debugging task, and call the debugging task and download the code from the code
  • the status of the debugging task is modified to the execution status; if the status task of the debugging task is the execution status, a calling task is sent to the execution machine Failure response information; when it is detected that the state of the debugging task is the execution state, controlling the preset number of execution machines to execute the debugging task to test the system under test.
  • the management of the execution machine scheduling tasks is realized through the management of the task status.
  • the idle execution machine is allowed to call the task and download the corresponding one from the code base.
  • the code of the test case when the number of execution machines that have called the task has reached the set preset number, the state of the task is modified to the execution state, and other execution machines are no longer allowed to call the task.
  • the multiple execution machines that called the task execute the test case synchronously, and each of the execution machines writes back the task data obtained by executing the test case to a preset Database.
  • the database is a time series database.
  • step S50 if the completion of the debugging task is detected, the task data is read from the preset database and displayed.
  • the online debugging device After the execution of the debugging task is completed, the online debugging device reads the result data of the task execution from the database and displays it, so that the tester can modify the script of the test case according to the displayed result data, and generate log data according to the execution of the task. And show. If the tester determines that the test case needs to be modified through analysis of the task data, the test case can be sent based on the user terminal. If the online debugging device receives the case modification command triggered based on the task data, the code is sent from the code. The code of the test case is obtained from the library and displayed for the user to modify the code according to the task data; if the modification of the code is detected, the modified code update is stored in the code library.
  • This method provides a unified debugging environment for test cases. After the test cases are written by testers, they can be uploaded directly to the device, and the device stores the code and establishes debugging tasks. The test code runs in a consistent test environment. And feedback the running results of the code to the user terminal, that is, testers do not need to set up a test environment locally, which not only saves the trouble of setting up a test environment, improves the efficiency of writing test cases, but also ensures the debugging environment and actual testing. The unification of the environment makes the debugging results of the test cases more accurate.
  • the online debugging method of the test case proposed in this embodiment when detecting a case editing instruction sent by the user based on the user terminal, displays a case editing interface for the user to edit the test case, and obtains the test case edited by the user based on the case editing interface, and The code of this test case is stored in the code base.
  • a debugging instruction triggered based on the test case is detected, a debugging task is established and the parameters of the debugging task are determined according to the debugging instruction.
  • the debugging task is added to the task queue and executed by the cluster of actuators.
  • the currently executing machine in the idle state calls and executes debugging tasks from the task queue according to a preset task scheduling mechanism to test the system under test, that is, after the user writes a test case, it does not need to be built locally
  • the test environment can be executed by the executive cluster to debug the case. It can ensure that the debug environment of the test case is consistent with the actual test environment.
  • the task data is written back to the preset database. The task data is read from the database and displayed to achieve Indeed presents a complete test cases for testing personnel to understand the situation test case.
  • the device further provides an online modification function for the test scenario.
  • the method further includes the following steps: upon receiving a user's test scenario modification instruction sent from the user terminal, Obtain a scenario parameter from the test scenario modification instruction, and determine the test scenario corresponding to the scenario modification instruction; obtain a test code that matches the test scenario from a code library, and modify the test code with the scenario parameter,
  • the test code update is stored in the code base.
  • the scenario parameters may include, but are not limited to, the following data: the number of virtual users allowed to start the test, and the test duration.
  • the effect diagram when the scenario is executed is displayed according to a preset visual display mode.
  • the test scenario set by the user is to gradually increase the number of test tasks to N within a preset time period T.
  • a scenario code suitable for such a dynamic test scenario is set in the system in advance, and the user can set it
  • the system modifies the corresponding values in the scene code, generates a scene code that matches the scene, and stores it.
  • an embodiment of the present application further provides a computer-readable storage medium.
  • the computer-readable storage medium stores a case debugging program, and the case debugging program may be executed by one or more processors to implement the following operations:
  • a case editing interface is displayed for the user to edit a test case; a code of a test case written by the user based on the case editing interface is obtained, and the code is stored in a code base
  • a debugging instruction triggered based on the test case a debugging task is established and parameters of the debugging task are determined according to the debugging instruction; the debugging task is added to a task queue, and the current
  • the idle execution machine retrieves and executes the debugging task from the task queue according to a preset task scheduling mechanism to test the system under test, and the execution machine writes the task data back to the preset database If it is detected that the debugging task is completed, read the task data from the preset database and display it.

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

Disclosed is an online debugging apparatus for a test case. The apparatus comprises a memory and a processor, wherein the memory stores a case debugging program that can be run on the processor, and the program implements the following steps when executed by the processor: when a case editing instruction sent by a user is detected, presenting a case editing interface; acquiring a code of the test case and storing same in a code library; when a debugging instruction triggered based on the test case is detected, establishing a debugging task and determining a parameter of the task; adding the debugging task to a task queue, and an execution machine cluster invoking the debugging task from the task queue and executing same, and writing task data back to a preset database; and if it is detected that the debugging task is completed, then reading the task data from the preset database and presenting same. Further provided are an online debugging method for a test case, and a computer-readable storage medium. The present application solves the technical problem of it being difficult for an existing debugging method to accurately and completely exhibit test conditions.

Description

测试案例的在线调试装置、方法及计算机可读存储介质Test case online debugging device and method, and computer-readable storage medium
本申请基于巴黎公约申明享有2018年05月31日递交的申请号为201810544750.3、名称为“测试案例的在线调试装置、方法及计算机可读存储介质”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。This application is based on the Paris Convention claiming priority to a Chinese patent application filed on May 31, 2018 with application number 201810544750.3 and entitled "On-line debugging device, method and computer-readable storage medium for test cases", the Chinese patent application The entire contents of the are incorporated herein by reference.
技术领域Technical field
本申请涉及计算机技术领域,尤其涉及一种测试案例的在线调试装置、方法及计算机可读存储介质。The present application relates to the field of computer technology, and in particular, to an online debugging device and method for a test case, and a computer-readable storage medium.
背景技术Background technique
现有的性能测试平台不支持在线调试功能,因此在测试案例的调试环节,一般都采用本地调用,即在本地搭建调试环境,对编辑的测试案例进行调试,但是由于本地搭建的调试环境难以保持与系统的实际应用环境一致,即测试案例调试时的运行环境与测试案例在实际测试的运行环境不同,导致存在难以准确完整地体现出测试情况的问题。Existing performance test platforms do not support online debugging. Therefore, in the debugging of test cases, local calls are generally used, that is, to set up a debugging environment locally to debug the edited test cases, but it is difficult to maintain the debugging environment built locally. Consistent with the actual application environment of the system, that is, the running environment when the test case is debugged is different from the running environment of the test case, which results in the problem that it is difficult to accurately and completely reflect the test situation.
发明内容Summary of the Invention
本申请提供一种测试案例的在线调试装置、方法及计算机可读存储介质,其主要目的在于解决现有的调试方法难以准确完整地体现出测试情况的技术问题。The present application provides an online debugging device, method and computer-readable storage medium for test cases, the main purpose of which is to solve the technical problems that the existing debugging methods cannot accurately and completely reflect the test situation.
为实现上述目的,本申请提供一种测试案例的在线调试装置,该装置包括存储器和处理器,所述存储器中存储有可在所述处理器上运行的案例调试程序,所述案例调试程序被所述处理器执行时实现如下步骤:To achieve the above purpose, the present application provides an online debugging device for a test case. The device includes a memory and a processor. The memory stores a case debugging program that can be run on the processor. The case debugging program is When the processor executes, the following steps are implemented:
当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例;When a user is detected based on a case editing instruction sent by the user terminal, the case editing interface is displayed for the user to edit the test case;
获取用户基于所述案例编辑界面编写的测试案例的代码,并将所述代码存储至代码库;Acquiring code of a test case written by a user based on the case editing interface, and storing the code in a code base;
当侦测到基于所述测试案例触发的调试指令时,根据所述调试指令建立 调试任务并确定该调试任务的参数;When a debugging instruction triggered based on the test case is detected, a debugging task is established according to the debugging instruction and parameters of the debugging task are determined;
将所述调试任务添加至任务队列中,由执行机集群中的当前处于空闲状态的执行机按照预设的任务调度机制从所述任务队列中调取并执行所述调试任务,以对被测系统进行测试,并由执行机将任务数据回写到预设数据库中;The debugging task is added to the task queue, and the currently executing machine in the cluster of executive machines retrieves and executes the debugging task from the task queue according to a preset task scheduling mechanism, so that The system tests and the execution machine writes the task data back to the preset database;
若检测到所述调试任务完成,从所述预设数据库中读取所述任务数据并展示。If the completion of the debugging task is detected, the task data is read from the preset database and displayed.
此外,为实现上述目的,本申请还提供一种测试案例的在线调试方法,该方法包括:In addition, in order to achieve the above purpose, this application also provides an online debugging method of a test case, which method includes:
当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例;When a user is detected based on a case editing instruction sent by the user terminal, the case editing interface is displayed for the user to edit the test case;
获取用户基于所述案例编辑界面编写的测试案例的代码,并将所述代码存储至代码库;Acquiring code of a test case written by a user based on the case editing interface, and storing the code in a code base;
当侦测到基于所述测试案例触发的调试指令时,根据所述调试指令建立调试任务并确定该调试任务的参数;When a debugging instruction triggered based on the test case is detected, a debugging task is established according to the debugging instruction and parameters of the debugging task are determined;
将所述调试任务添加至任务队列中,由执行机集群中的当前处于空闲状态的执行机按照预设的任务调度机制从所述任务队列中调取并执行所述调试任务,以对被测系统进行测试,并由执行机将任务数据回写到预设数据库中;The debugging task is added to the task queue, and the currently executing machine in the cluster of executive machines retrieves and executes the debugging task from the task queue according to a preset task scheduling mechanism, so that The system tests and the execution machine writes the task data back to the preset database;
若检测到所述调试任务完成,从所述预设数据库中读取所述任务数据并展示。If the completion of the debugging task is detected, the task data is read from the preset database and displayed.
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有案例调试程序,所述案例调试程序可被一个或者多个处理器执行,以实现如上所述的测试案例的在线调试方法的步骤。In addition, in order to achieve the above object, the present application also provides a computer-readable storage medium, where the computer-readable storage medium stores a case debugging program, and the case debugging program may be executed by one or more processors to implement Steps of the online debugging method of the test case as described above.
本申请提出的测试案例的在线调试装置、方法及计算机可读存储介质,当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例,获取用户基于案例编辑界面编辑的测试案例,将该测试案例的代码存储到代码库,当侦测到基于测试案例触发的调试指令时,根据调试指令建立调试任务并确定调试任务的参数,将调试任务添加至任务队列中,由执行机集群中的当前处于空闲状态的执行机按照预设的任务调度机制从任务队列中调取并执行调试任务,以对被测系统进行测试,也就是说,用户编写完成测试案例之后,不需要在本地搭建测试环境,可以由执行机集群 执行该案例以对案例进行调试,能够保证测试案例的调试环境与实际测试环境一致,同时将任务数据回写到预设数据库中,当调试任务完成后,从预设数据库中读取任务数据并展示,以实现准确完整地呈现出测试情况,以供测试人员了解案例的测试情况。The online debugging device, method, and computer-readable storage medium of the test case provided in this application, when a case editing instruction sent by a user based on a user terminal is detected, the case editing interface is displayed for the user to edit the test case, and the user is obtained based on the case editing The test case edited by the interface stores the code of the test case to the code base. When a debugging instruction triggered based on the test case is detected, a debugging task is established and the parameters of the debugging task are determined according to the debugging instruction, and the debugging task is added to the task queue. In the execution cluster, the currently idle execution machines call and execute debugging tasks from the task queue according to a preset task scheduling mechanism to test the system under test, that is, the user writes and completes a test case Afterwards, there is no need to set up a test environment locally. The case can be executed by the cluster of actuators to debug the case. This can ensure that the debug environment of the test case is consistent with the actual test environment. At the same time, the task data is written back to the preset database. After the commissioning task is completed, read from the preset database Take task data and display it to accurately and completely present the test situation for testers to understand the test situation of the case.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本申请测试案例的在线调试装置较佳实施例的示意图;FIG. 1 is a schematic diagram of a preferred embodiment of an online debugging device for a test case of this application;
图2为本申请测试案例的在线调试装置一实施例中案例调试程序的程序模块示意图;2 is a schematic diagram of a program module of a case debugging program in an embodiment of an online debugging device of a test case of this application;
图3为本申请测试案例的在线调试方法第一实施例的流程图。FIG. 3 is a flowchart of a first embodiment of an online debugging method for a test case of this application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The implementation, functional characteristics and advantages of the purpose of this application will be further described with reference to the embodiments and the drawings.
具体实施方式Detailed ways
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described herein are only used to explain the application, and are not used to limit the application.
本申请提供一种测试案例的在线调试装置。参照图1所示,为本申请测试案例的在线调试装置较佳实施例的示意图。This application provides an online debugging device for a test case. Refer to FIG. 1, which is a schematic diagram of a preferred embodiment of an online debugging device in a test case of this application.
在本实施例中,测试案例的在线调试装置1可以是PC(Personal Computer,个人电脑),也可以是智能手机、平板电脑、便携计算机等终端设备。In this embodiment, the online debugging device 1 of the test case may be a PC (Personal Computer) or a terminal device such as a smart phone, a tablet computer, or a portable computer.
该测试案例的在线调试装置1至少包括存储器11、处理器12,网络接口13,以及通信总线14。The online debugging device 1 of this test case includes at least a memory 11, a processor 12, a network interface 13, and a communication bus 14.
其中,存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器11在一些实施例中可以是测试案例的在线调试装置1的内部存储单元,例如该测试案例的在线调试装置1的硬盘。存储器11在另一些实施例中也可以是测试案例的在线调试装置1的外部存储设备,例如测试案例的在线调试装置1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器11还可以既包括测试案例的在线调试装置1的内部存储单元也包括外部存储设备。存储器11不仅可以用于存储安装于测试案例的在线调试装置1的应用软件及各类数据,例如案例调试程序01的代码等,还 可以用于暂时地存储已经输出或者将要输出的数据。The memory 11 includes at least one type of readable storage medium. The readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (for example, SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory 11 may be an internal storage unit of the online debugging device 1 of the test case in some embodiments, such as a hard disk of the online debugging device 1 of the test case. The memory 11 may also be an external storage device of the online debugging device 1 of the test case in other embodiments, such as a plug-in hard disk and a smart memory card (SMC) provided on the online debugging device 1 of the test case. Secure Digital (SD) card, Flash Card, etc. Further, the memory 11 may include both an internal storage unit of the online debugging device 1 of the test case and an external storage device. The memory 11 can be used not only to store the application software and various types of data installed in the online debugging device 1 of the test case, such as the code of the case debug program 01, but also to temporarily store the data that has been or will be output.
处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,例如执行案例调试程序01等。The processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments, and is configured to run program codes or processes stored in the memory 11 Data, such as the case debug program 01.
网络接口13可选的可以包括标准的有线接口、无线接口(如WI-FI接口),通常用于在该装置1与其他电子设备之间建立通信连接。The network interface 13 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and is generally used to establish a communication connection between the device 1 and other electronic devices.
通信总线14用于实现这些组件之间的连接通信。The communication bus 14 is used to implement connection communication between these components.
图1仅示出了具有组件11-14以及案例调试程序01的测试案例的在线调试装置1,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。FIG. 1 only shows the online debugging device 1 with the test cases of the components 11-14 and the case debug program 01, but it should be understood that it is not required to implement all the illustrated components, and more or less can be implemented instead s component.
可选地,该装置1还可以包括用户接口,用户接口可以包括显示器(Display)、输入单元比如键盘(Keyboard),可选的用户接口还可以包括标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在测试案例的在线调试装置1中处理的信息以及用于显示可视化的用户界面。Optionally, the device 1 may further include a user interface. The user interface may include a display, an input unit such as a keyboard, and the optional user interface may further include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-type liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light emitting diode) touch device, or the like. The display may also be appropriately referred to as a display screen or a display unit, for displaying information processed in the online debugging device 1 of the test case, and for displaying a visual user interface.
在图1所示的装置1实施例中,存储器11中存储有案例调试程序01;处理器12执行存储器11中存储的案例调试程序01时实现如下步骤:In the embodiment of the apparatus 1 shown in FIG. 1, the case debug program 01 is stored in the memory 11; when the processor 12 executes the case debug program 01 stored in the memory 11, the following steps are implemented:
当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例。When a user is detected based on a case editing instruction sent by a user terminal, a case editing interface is displayed for the user to edit a test case.
获取用户基于所述案例编辑界面编写的测试案例的代码,并将所述代码存储至代码库。Obtain the code of the test case written by the user based on the case editing interface, and store the code to a code base.
本实施例中的在线调试装置作为服务器与用户终端建立通讯连接,并提供测试案例的在线编辑功能和在线调试功能。此外,在线调试装置与执行机集群连接,并控制执行机集群执行测试案例,其中,执行机集群中包含有多台执行机。当用户需要编写新的测试案例或者对已编写的测试案例进行修改时,可以基于用户终端的显示界面触发案例编辑指令,在线调试装置在接收到案例编辑指令时,展示案例编辑界面以供用户编写测试案例,用户在案例编写完成后,在线调试装置获取用户基于案例编辑界面编写的测试案例的代 码,将该代码于该测试案例的编号关联后存储至代码库。该预先设置的代码库用于存储测试人员编写并上传的测试案例的代码。The online debugging device in this embodiment establishes a communication connection with the user terminal as a server, and provides an online editing function and an online debugging function of the test case. In addition, the on-line debugging device is connected to the executive machine cluster and controls the execution case of the executive machine cluster, where the executive machine cluster includes a plurality of executive machines. When the user needs to write a new test case or modify an already written test case, the case editing instruction can be triggered based on the display interface of the user terminal. When the online debugging device receives the case editing instruction, the case editing interface is displayed for the user to write For a test case, after the user writes the case, the online debugging device obtains the code of the test case written by the user based on the case editing interface, and stores the code in the code base after associating the number of the test case. This preset code library is used to store the code of test cases written and uploaded by testers.
可以理解的是,上述案例编辑指令可以是新建案例指令,可以是案例修改指令,用户根据用户终端的显示界面上的控件触发对应的指令。如果是新建案例指令,则直接显示案例编辑界面;如果是案例修改指令,当侦测到用户基于用户终端发送的案例编辑指令时,确定所述编辑指令对应的测试案例;从代码库中查找所述测试案例的代码,展示案例编辑界面,并将查找到的代码展示在所述案例编辑界面上,以供用户对所述测试案例的代码进行在线编辑。It can be understood that the above case editing instruction may be a new case instruction or a case modification instruction, and the user triggers the corresponding instruction according to the controls on the display interface of the user terminal. If it is a new case instruction, the case editing interface is displayed directly; if it is a case modification instruction, when a case editing instruction sent by the user based on the user terminal is detected, the test case corresponding to the editing instruction is determined; The code of the test case is described, the case editing interface is displayed, and the found code is displayed on the case editing interface for users to edit the code of the test case online.
当侦测到基于所述测试案例触发的调试指令时,根据所述调试指令建立调试任务并确定该调试任务的参数。When a debugging instruction triggered based on the test case is detected, a debugging task is established according to the debugging instruction and parameters of the debugging task are determined.
当在线调试装置检测到用户终端发送的调试指令时,确定该调试指令对应的测试案例,并建立对应的调试任务以及确定该任务的任务参数。其中,任务参数主要包括但不限于以下内容:执行该任务的执行机的数量、任务ID、任务状态等。任务状态在调试任务的整个调试周期中包含以下状态:待执行状态、执行状态以及执行完成状态。任务参数中的执行机的数量可以由测试人员根据该测试案例的具体需求来设置。When the online debugging device detects a debugging instruction sent by the user terminal, determines a test case corresponding to the debugging instruction, establishes a corresponding debugging task, and determines task parameters of the task. Among them, the task parameters mainly include but are not limited to the following: the number of execution machines executing the task, task ID, task status, and the like. The task status includes the following states throughout the debugging cycle of the debugging task: pending status, execution status, and execution completion status. The number of execution machines in the task parameters can be set by the tester according to the specific requirements of the test case.
将所述调试任务添加至任务队列中,由执行机集群中的当前处于空闲状态的执行机按照预设的任务调度机制从所述任务队列中调取并执行所述调试任务,以对被测系统进行测试,并由执行机将任务数据回写到预设数据库中。The debugging task is added to the task queue, and the currently executing machine in the cluster of executive machines retrieves and executes the debugging task from the task queue according to a preset task scheduling mechanism, so that The system tests and the execution machine writes the task data back to the preset database.
在创建调试任务之后,将该调试任务添加到任务队列中。在线调试装置会接收到多个用户终端发送的调试任务,因此,任务队列中可能有多个处于执行中或者待执行的调试任务,并且执行机集群中的执行机的状态也不同,可能有处于空闲状态的执行机,也有正在处理调试任务的执行机。因此,在添加任务后,需要由执行机集群中处于空闲状态的执行机按照预设的任务调度机制从任务队列中取任务并执行。具体地,该步骤可以包括如下细化步骤:After creating a debug task, add the debug task to the task queue. The online debugging device may receive debugging tasks sent by multiple user terminals. Therefore, there may be multiple debugging tasks in the task queue that are being executed or to be executed, and the status of the execution machines in the execution machine cluster is also different. In the idle state, there are also executives that are processing debugging tasks. Therefore, after adding a task, the idle execution machine in the execution machine cluster needs to take the task from the task queue and execute it according to a preset task scheduling mechanism. Specifically, this step may include the following detailed steps:
在将所述调试任务添加至任务队列之后,将所述调试任务的状态标记为待执行状态;每当检测到有执行机调取所述调试任务时,判断所述调试任务的状态任务是否为待执行状态;若所述调试任务的任务状态为待执行状态,则为所述调试任务添加该调试任务被该执行机调取的状态信息,并在调取所 述调试任务并从所述代码库下载对应代码的执行机的数量达到所述预设数量后,将所述调试任务的状态修改为执行状态;若所述调试任务的状态任务为执行状态,则向该执行机发送调取任务失败的响应信息;在检测到所述调试任务的状态为执行状态时,控制所述预设数量的执行机执行所述调试任务,以对被测系统进行测试。After the debugging task is added to the task queue, the state of the debugging task is marked as a pending state; whenever it is detected that an execution machine calls the debugging task, it is determined whether the status task of the debugging task is Pending status; if the task status of the debugging task is pending status, add status information of the debugging task called by the execution machine to the debugging task, and call the debugging task and download the code from the code After the number of execution machines corresponding to the library download reaches the preset number, the status of the debugging task is modified to the execution status; if the status task of the debugging task is the execution status, a calling task is sent to the execution machine Failure response information; when it is detected that the state of the debugging task is the execution state, controlling the preset number of execution machines to execute the debugging task to test the system under test.
在任务调度的过程中,通过对任务状态的管理实现对执行机调度任务的管理,在任务状态为待执行状态时,允许处于空闲状态的执行机调取该任务并从代码库中下载对应的测试案例的代码,当已经调取任务的执行机的数量已经达到设置的预设数量时,则将该任务的状态修改为执行状态,不再允许其他执行机调取该任务。并且,当检测到该任务的状态为执行状态时,由调取了该任务的多台执行机同步地执行该测试案例,并且各台执行机将执行测试案例得到的任务数据回写到预设数据库中。可选地,该数据库为时间序列数据库。In the task scheduling process, the management of the execution machine scheduling tasks is realized through the management of the task status. When the task status is pending, the idle execution machine is allowed to call the task and download the corresponding one from the code base. In the code of the test case, when the number of execution machines that have called the task has reached the set preset number, the state of the task is modified to the execution state, and other execution machines are no longer allowed to call the task. In addition, when it is detected that the status of the task is the execution status, the multiple execution machines that called the task execute the test case synchronously, and each of the execution machines writes back the task data obtained by executing the test case to a preset Database. Optionally, the database is a time series database.
若检测到所述调试任务完成,从所述预设数据库中读取所述任务数据并展示。If the completion of the debugging task is detected, the task data is read from the preset database and displayed.
在调试任务执行完成后,在线调试装置从该数据库中读取任务执行的结果数据并展示,以供测试人员根据展示的结果数据对测试案例的脚本进行修改,同时根据任务的执行情况生成日志数据并展示。如果测试人员通过对任务数据的分析,确定需要对测试案例进行修改,则可以基于用户终端发送案例修改指令,若在线调试装置接收到基于所述任务数据触发的案例修改指令时,从所述代码库中获取所述测试案例的代码并展示,以供用户根据所述任务数据对所述代码进行修改;若检测到代码修改完成,则将修改后的代码更新存储到所述代码库中。After the execution of the debugging task is completed, the online debugging device reads the result data of the task execution from the database and displays it, so that the tester can modify the script of the test case according to the displayed result data, and generate log data according to the execution of the task. And show. If the tester determines that the test case needs to be modified through analysis of the task data, the test case can be sent based on the user terminal. If the online debugging device receives the case modification command triggered based on the task data, the code is sent from the code. The code of the test case is obtained from the library and displayed for the user to modify the code according to the task data; if the modification of the code is detected, the modified code update is stored in the code library.
上述在线调试装置提供了一个统一的测试案例的调试环境,测试人员编写完成测试案例后,可以直接上传至该装置,由该装置存储代码并建立调试任务,在于实际测试环境一致运行环境中运行该代码,并将代码的运行结果反馈给用户终端,即测试人员不需要在本地搭建测试环境,不仅免去了测试环境的搭建的麻烦,提高了测试案例的编写的效率,而且保证了调试环境与实际测试环境的统一,使得对测试案例的调试结果更加准确。The above-mentioned online debugging device provides a unified debugging environment for test cases. After the test cases are written by testers, they can be uploaded directly to the device. The device stores the code and establishes debugging tasks. The actual test environment runs the test in a consistent operating environment. Code and feedback the results of the code to the user terminal, that is, testers do not need to set up a test environment locally, which not only saves the trouble of setting up a test environment, improves the efficiency of writing test cases, but also ensures the debugging environment and The unification of the actual test environment makes the debugging results of the test cases more accurate.
本实施例提出的测试案例的在线调试装置,当侦测到用户基于用户终端 发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例,获取用户基于案例编辑界面编辑的测试案例,将该测试案例的代码存储到代码库,当侦测到基于测试案例触发的调试指令时,根据调试指令建立调试任务并确定调试任务的参数,将调试任务添加至任务队列中,由执行机集群中的当前处于空闲状态的执行机按照预设的任务调度机制从任务队列中调取并执行调试任务,以对被测系统进行测试,也就是说,用户编写完成测试案例之后,不需要在本地搭建测试环境,可以由执行机集群执行该案例以对案例进行调试,能够保证测试案例的调试环境与实际测试环境一致,同时将任务数据回写到预设数据库中,当调试任务完成后,从预设数据库中读取任务数据并展示,以实现准确完整地呈现出测试情况,以供测试人员了解案例的测试情况。The on-line debugging device for a test case provided in this embodiment displays a case editing interface for the user to edit a test case when a case editing instruction sent by the user based on the user terminal is detected, and obtains a test case edited by the user based on the case editing interface. The code of this test case is stored in the code base. When a debugging instruction triggered based on the test case is detected, a debugging task is established and the parameters of the debugging task are determined according to the debugging instruction. The debugging task is added to the task queue and executed by the cluster of actuators. The currently executing machine in the idle state calls and executes debugging tasks from the task queue according to a preset task scheduling mechanism to test the system under test, that is, after the user writes a test case, it does not need to be built locally The test environment can be executed by the executive cluster to debug the case. It can ensure that the debug environment of the test case is consistent with the actual test environment. At the same time, the task data is written back to the preset database. The task data is read from the database and displayed to achieve Accurately and completely present the test situation for testers to understand the test situation of the case.
进一步地,在另一实施例中,该装置还提供对测试场景的在线修改功能,具体地,案例调试程序还可被所述处理器执行,以实现如下步骤:在接收到用户基于用户终端发送的测试场景修改指令时,从所述测试场景修改指令中获取场景参数,并确定所述场景修改指令对应的测试场景;从代码库中获取与测试场景匹配的测试代码,并所述场景参数修改所述测试代码,将修改后的所述测试代码更新存储至所述代码库。Further, in another embodiment, the device also provides an online modification function for the test scenario. Specifically, the case debugging program may also be executed by the processor to implement the following steps: upon receiving the user, sending based on the user terminal When a test scenario modification instruction is received, obtain a scene parameter from the test scenario modification instruction and determine a test scenario corresponding to the scene modification instruction; obtain a test code that matches the test scenario from a code library, and modify the scenario parameter. The test code stores the modified test code update in the code base.
其中,场景参数可以包括但不限于以下数据:允许开启测试的虚拟用户的数量,测试时长等。此外,用户设置完成测试场景后,按照预设的可视化展示方式展示该场景被执行时的效果图。例如,用户设置的测试场景为:在预设时长T内,将测试任务的数量逐渐增加到N个,在系统中预先设置有适用于这种动态化的测试场景的场景代码,用户可以设置好该场景中参数T、N的值,系统对场景代码中对应的值进行修改,生成符合该场景的场景代码后存储。The scenario parameters may include, but are not limited to, the following data: the number of virtual users allowed to start the test, and the test duration. In addition, after the user has set up the test scenario, the effect diagram when the scenario is executed is displayed according to a preset visual display mode. For example, the test scenario set by the user is to gradually increase the number of test tasks to N within a preset time period T. A scenario code suitable for such a dynamic test scenario is set in the system in advance, and the user can set it For the values of the parameters T and N in this scene, the system modifies the corresponding values in the scene code, generates a scene code that matches the scene, and stores it.
可选地,在其他的实施例中,案例调试程序还可以被分割为一个或者多个模块,一个或者多个模块被存储于存储器11中,并由一个或多个处理器(本实施例为处理器12)所执行以完成本申请,本申请所称的模块是指能够完成特定功能的一系列计算机程序指令段,用于描述案例调试程序在测试案例的在线调试装置中的执行过程。Optionally, in other embodiments, the case debugging program may also be divided into one or more modules, and the one or more modules are stored in the memory 11 and processed by one or more processors (this embodiment is The processor 12) executes to complete this application. The modules referred to in this application refer to a series of computer program instruction segments capable of performing specific functions, and are used to describe the execution process of the case debugging program in the online debugging device of the test case.
例如,参照图2所示,为本申请测试案例的在线调试装置一实施例中的案例调试程序的程序模块示意图,该实施例中,案例调试程序可以被分割为 界面展示模块10、代码获取模块20、任务建立模块30、任务调度模块40和数据展示模块50,示例性地:For example, referring to FIG. 2, it is a schematic diagram of a program module of a case debugging program in an embodiment of an online debugging device for a test case of this application. In this embodiment, the case debugging program can be divided into an interface display module 10 and a code acquisition module. 20. The task establishment module 30, the task scheduling module 40, and the data display module 50, for example:
界面展示模块10用于:当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例;The interface display module 10 is configured to: when a case editing instruction sent by a user based on a user terminal is detected, display a case editing interface for the user to edit a test case;
代码获取模块20用于:获取用户基于所述案例编辑界面编写的测试案例的代码,并将所述代码存储至代码库;The code obtaining module 20 is configured to: obtain a code of a test case written by a user based on the case editing interface, and store the code in a code base;
任务建立模块30用于:当侦测到基于所述测试案例触发的调试指令时,根据所述调试指令建立调试任务并确定该调试任务的参数;The task establishing module 30 is configured to: when a debugging instruction triggered based on the test case is detected, establish a debugging task according to the debugging instruction and determine parameters of the debugging task;
任务调度模块40用于:将所述调试任务添加至任务队列中,由执行机集群中的当前处于空闲状态的执行机按照预设的任务调度机制从所述任务队列中调取并执行所述调试任务,以对被测系统进行测试,并由执行机将任务数据回写到预设数据库中;The task scheduling module 40 is configured to add the debugging task to a task queue, and an executive machine currently in an idle state in an executive machine cluster retrieves and executes the task queue from the task queue according to a preset task scheduling mechanism. Debug the task to test the system under test, and the task machine writes the task data back to the preset database;
数据展示模块50用于:若检测到所述调试任务完成,从所述预设数据库中读取所述任务数据并展示。The data display module 50 is configured to: if it is detected that the debugging task is completed, read the task data from the preset database and display it.
上述界面展示模块10、代码获取模块20、任务建立模块30、任务调度模块40和数据展示模块50等程序模块被执行时所实现的功能或操作步骤与上述实施例大体相同,在此不再赘述。The above-mentioned interface display module 10, code acquisition module 20, task establishment module 30, task scheduling module 40, and data display module 50 and other program modules are executed to implement functions or operation steps that are substantially the same as those in the foregoing embodiment, and are not repeated here .
此外,本申请还提供一种测试案例的在线调试方法。参照图3所示,为本申请测试案例的在线调试方法第一实施例的流程图。该方法可以由一个装置执行,该装置可以由软件和/或硬件实现。In addition, this application also provides a method for online debugging of test cases. FIG. 3 is a flowchart of a first embodiment of an online debugging method for a test case of this application. The method may be performed by a device, which may be implemented by software and / or hardware.
在本实施例中,测试案例的在线调试方法包括:In this embodiment, the online debugging method of the test case includes:
步骤S10,当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例。In step S10, when a case editing instruction sent by the user based on the user terminal is detected, a case editing interface is displayed for the user to edit the test case.
步骤S20,获取用户基于所述案例编辑界面编写的测试案例的代码,并将所述代码存储至代码库。In step S20, the code of the test case written by the user based on the case editing interface is acquired, and the code is stored in the code base.
以下内容中以在线调试装置作为执行主体对本申请的方法实施例进行说明。在线调试装置作为服务器与用户终端建立通讯连接,并提供测试案例的在线编辑功能和在线调试功能。此外,在线调试装置与执行机集群连接,并控制执行机集群执行测试案例,其中,执行机集群中包含有多台执行机。当 用户需要编写新的测试案例或者对已编写的测试案例进行修改时,可以基于用户终端的显示界面触发案例编辑指令,在线调试装置在接收到案例编辑指令时,展示案例编辑界面以供用户编写测试案例,用户在案例编写完成后,在线调试装置获取用户基于案例编辑界面编写的测试案例的代码,将该代码于该测试案例的编号关联后存储至代码库。该预先设置的代码库用于存储测试人员编写并上传的测试案例的代码。The following describes the method embodiment of the present application by using an online debugging device as an execution subject. The online debugging device serves as a server to establish a communication connection with the user terminal, and provides online editing functions and online debugging functions for test cases. In addition, the on-line debugging device is connected to the executive machine cluster and controls the execution case of the executive machine cluster, where the executive machine cluster includes a plurality of executive machines. When the user needs to write a new test case or modify an already written test case, the case editing instruction can be triggered based on the display interface of the user terminal. When the online debugging device receives the case editing instruction, the case editing interface is displayed for the user to write For a test case, after the user writes the case, the online debugging device obtains the code of the test case written by the user based on the case editing interface, and stores the code in the code base after associating the number of the test case. This preset code library is used to store the code of test cases written and uploaded by testers.
可以理解的是,上述案例编辑指令可以是新建案例指令,可以是案例修改指令,用户根据用户终端的显示界面上的控件触发对应的指令。如果是新建案例指令,则直接显示案例编辑界面;如果是案例修改指令,当侦测到用户基于用户终端发送的案例编辑指令时,确定所述编辑指令对应的测试案例;从代码库中查找所述测试案例的代码,展示案例编辑界面,并将查找到的代码展示在所述案例编辑界面上,以供用户对所述测试案例的代码进行在线编辑。It can be understood that the above case editing instruction may be a new case instruction or a case modification instruction, and the user triggers the corresponding instruction according to the controls on the display interface of the user terminal. If it is a new case instruction, the case editing interface is displayed directly; if it is a case modification instruction, when a case editing instruction sent by the user based on the user terminal is detected, the test case corresponding to the editing instruction is determined; The code of the test case is described, the case editing interface is displayed, and the found code is displayed on the case editing interface for users to edit the code of the test case online.
步骤S30,当侦测到基于所述测试案例触发的调试指令时,根据所述调试指令建立调试任务并确定该调试任务的参数。In step S30, when a debugging instruction triggered based on the test case is detected, a debugging task is established according to the debugging instruction and parameters of the debugging task are determined.
当在线调试装置检测到用户终端发送的调试指令时,确定该调试指令对应的测试案例,并建立对应的调试任务以及确定该任务的任务参数。其中,任务参数主要包括但不限于以下内容:执行该任务的执行机的数量、任务ID、任务状态等。任务状态在调试任务的整个调试周期中包含以下状态:待执行状态、执行状态以及执行完成状态。任务参数中的执行机的数量可以由测试人员根据该测试案例的具体需求来设置。When the online debugging device detects a debugging instruction sent by the user terminal, determines a test case corresponding to the debugging instruction, establishes a corresponding debugging task, and determines task parameters of the task. Among them, the task parameters mainly include but are not limited to the following: the number of execution machines executing the task, task ID, task status, and the like. The task status includes the following states throughout the debugging cycle of the debugging task: pending status, execution status, and execution completion status. The number of execution machines in the task parameters can be set by the tester according to the specific requirements of the test case.
步骤S40,将所述调试任务添加至任务队列中,由执行机集群中的当前处于空闲状态的执行机按照预设的任务调度机制从所述任务队列中调取并执行所述调试任务,以对被测系统进行测试,并由执行机将任务数据回写到预设数据库中。In step S40, the debugging task is added to the task queue, and the currently executing machine in the cluster of executing machines is called from the task queue and executed according to a preset task scheduling mechanism to The system under test is tested, and the task data is written back to the preset database by the execution machine.
在创建调试任务之后,将该调试任务添加到任务队列中。在线调试装置会接收到多个用户终端发送的调试任务,因此,任务队列中可能有多个处于执行中或者待执行的调试任务,并且执行机集群中的执行机的状态也不同,可能有处于空闲状态的执行机,也有正在处理调试任务的执行机。因此,在添加任务后,需要由执行机集群中处于空闲状态的执行机按照预设的任务调 度机制从任务队列中取任务并执行。具体地,步骤S40可以包括如下细化步骤:After creating a debug task, add the debug task to the task queue. The online debugging device may receive debugging tasks sent by multiple user terminals. Therefore, there may be multiple debugging tasks in the task queue that are being executed or to be executed, and the status of the execution machines in the execution machine cluster is also different. In the idle state, there are also executives that are processing debugging tasks. Therefore, after adding a task, the idle execution machine in the execution machine cluster needs to take the task from the task queue and execute it according to the preset task scheduling mechanism. Specifically, step S40 may include the following detailed steps:
在将所述调试任务添加至任务队列之后,将所述调试任务的状态标记为待执行状态;每当检测到有执行机调取所述调试任务时,判断所述调试任务的状态任务是否为待执行状态;若所述调试任务的任务状态为待执行状态,则为所述调试任务添加该调试任务被该执行机调取的状态信息,并在调取所述调试任务并从所述代码库下载对应代码的执行机的数量达到所述预设数量后,将所述调试任务的状态修改为执行状态;若所述调试任务的状态任务为执行状态,则向该执行机发送调取任务失败的响应信息;在检测到所述调试任务的状态为执行状态时,控制所述预设数量的执行机执行所述调试任务,以对被测系统进行测试。After the debugging task is added to the task queue, the state of the debugging task is marked as a pending state; whenever it is detected that an execution machine calls the debugging task, it is determined whether the status task of the debugging task is Pending status; if the task status of the debugging task is pending status, add status information of the debugging task called by the execution machine to the debugging task, and call the debugging task and download the code from the code After the number of execution machines corresponding to the library download reaches the preset number, the status of the debugging task is modified to the execution status; if the status task of the debugging task is the execution status, a calling task is sent to the execution machine Failure response information; when it is detected that the state of the debugging task is the execution state, controlling the preset number of execution machines to execute the debugging task to test the system under test.
在任务调度的过程中,通过对任务状态的管理实现对执行机调度任务的管理,在任务状态为待执行状态时,允许处于空闲状态的执行机调取该任务并从代码库中下载对应的测试案例的代码,当已经调取任务的执行机的数量已经达到设置的预设数量时,则将该任务的状态修改为执行状态,不再允许其他执行机调取该任务。并且,当检测到该任务的状态为执行状态时,由调取了该任务的多台执行机同步地执行该测试案例,并且各台执行机将执行测试案例得到的任务数据回写到预设数据库中。可选地,该数据库为时间序列数据库。In the task scheduling process, the management of the execution machine scheduling tasks is realized through the management of the task status. When the task status is pending, the idle execution machine is allowed to call the task and download the corresponding one from the code base. In the code of the test case, when the number of execution machines that have called the task has reached the set preset number, the state of the task is modified to the execution state, and other execution machines are no longer allowed to call the task. In addition, when it is detected that the status of the task is the execution status, the multiple execution machines that called the task execute the test case synchronously, and each of the execution machines writes back the task data obtained by executing the test case to a preset Database. Optionally, the database is a time series database.
步骤S50,若检测到所述调试任务完成,从所述预设数据库中读取所述任务数据并展示。In step S50, if the completion of the debugging task is detected, the task data is read from the preset database and displayed.
在调试任务执行完成后,在线调试装置从该数据库中读取任务执行的结果数据并展示,以供测试人员根据展示的结果数据对测试案例的脚本进行修改,同时根据任务的执行情况生成日志数据并展示。如果测试人员通过对任务数据的分析,确定需要对测试案例进行修改,则可以基于用户终端发送案例修改指令,若在线调试装置接收到基于所述任务数据触发的案例修改指令时,从所述代码库中获取所述测试案例的代码并展示,以供用户根据所述任务数据对所述代码进行修改;若检测到代码修改完成,则将修改后的代码更新存储到所述代码库中。After the execution of the debugging task is completed, the online debugging device reads the result data of the task execution from the database and displays it, so that the tester can modify the script of the test case according to the displayed result data, and generate log data according to the execution of the task. And show. If the tester determines that the test case needs to be modified through analysis of the task data, the test case can be sent based on the user terminal. If the online debugging device receives the case modification command triggered based on the task data, the code is sent from the code. The code of the test case is obtained from the library and displayed for the user to modify the code according to the task data; if the modification of the code is detected, the modified code update is stored in the code library.
该方法提供了一个统一的测试案例的调试环境,测试人员编写完成测试 案例后,可以直接上传至该装置,由该装置存储代码并建立调试任务,在于实际测试环境一致运行环境中运行该代码,并将代码的运行结果反馈给用户终端,即测试人员不需要在本地搭建测试环境,不仅免去了测试环境的搭建的麻烦,提高了测试案例的编写的效率,而且保证了调试环境与实际测试环境的统一,使得对测试案例的调试结果更加准确。This method provides a unified debugging environment for test cases. After the test cases are written by testers, they can be uploaded directly to the device, and the device stores the code and establishes debugging tasks. The test code runs in a consistent test environment. And feedback the running results of the code to the user terminal, that is, testers do not need to set up a test environment locally, which not only saves the trouble of setting up a test environment, improves the efficiency of writing test cases, but also ensures the debugging environment and actual testing. The unification of the environment makes the debugging results of the test cases more accurate.
本实施例提出的测试案例的在线调试方法,当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例,获取用户基于案例编辑界面编辑的测试案例,将该测试案例的代码存储到代码库,当侦测到基于测试案例触发的调试指令时,根据调试指令建立调试任务并确定调试任务的参数,将调试任务添加至任务队列中,由执行机集群中的当前处于空闲状态的执行机按照预设的任务调度机制从任务队列中调取并执行调试任务,以对被测系统进行测试,也就是说,用户编写完成测试案例之后,不需要在本地搭建测试环境,可以由执行机集群执行该案例以对案例进行调试,能够保证测试案例的调试环境与实际测试环境一致,同时将任务数据回写到预设数据库中,当调试任务完成后,从预设数据库中读取任务数据并展示,以实现准确完整地呈现出测试情况,以供测试人员了解案例的测试情况。The online debugging method of the test case proposed in this embodiment, when detecting a case editing instruction sent by the user based on the user terminal, displays a case editing interface for the user to edit the test case, and obtains the test case edited by the user based on the case editing interface, and The code of this test case is stored in the code base. When a debugging instruction triggered based on the test case is detected, a debugging task is established and the parameters of the debugging task are determined according to the debugging instruction. The debugging task is added to the task queue and executed by the cluster of actuators. The currently executing machine in the idle state calls and executes debugging tasks from the task queue according to a preset task scheduling mechanism to test the system under test, that is, after the user writes a test case, it does not need to be built locally The test environment can be executed by the executive cluster to debug the case. It can ensure that the debug environment of the test case is consistent with the actual test environment. At the same time, the task data is written back to the preset database. The task data is read from the database and displayed to achieve Indeed presents a complete test cases for testing personnel to understand the situation test case.
进一步地,在另一实施例中,该装置还提供对测试场景的在线修改功能,具体地,该方法还包括如下步骤:在接收到用户基于用户终端发送的测试场景修改指令时,从所述测试场景修改指令中获取场景参数,并确定所述场景修改指令对应的测试场景;从代码库中获取与测试场景匹配的测试代码,并所述场景参数修改所述测试代码,将修改后的所述测试代码更新存储至所述代码库。其中,场景参数可以包括但不限于以下数据:允许开启测试的虚拟用户的数量,测试时长等。此外,用户设置完成测试场景后,按照预设的可视化展示方式展示该场景被执行时的效果图。例如,用户设置的测试场景为:在预设时长T内,将测试任务的数量逐渐增加到N个,在系统中预先设置有适用于这种动态化的测试场景的场景代码,用户可以设置好该场景中参数T、N的值,系统对场景代码中对应的值进行修改,生成符合该场景的场景代码后存储。Further, in another embodiment, the device further provides an online modification function for the test scenario. Specifically, the method further includes the following steps: upon receiving a user's test scenario modification instruction sent from the user terminal, Obtain a scenario parameter from the test scenario modification instruction, and determine the test scenario corresponding to the scenario modification instruction; obtain a test code that matches the test scenario from a code library, and modify the test code with the scenario parameter, The test code update is stored in the code base. The scenario parameters may include, but are not limited to, the following data: the number of virtual users allowed to start the test, and the test duration. In addition, after the user has set up the test scenario, the effect diagram when the scenario is executed is displayed according to a preset visual display mode. For example, the test scenario set by the user is to gradually increase the number of test tasks to N within a preset time period T. A scenario code suitable for such a dynamic test scenario is set in the system in advance, and the user can set it For the values of the parameters T and N in this scene, the system modifies the corresponding values in the scene code, generates a scene code that matches the scene, and stores it.
此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有案例调试程序,所述案例调试程序可被一个或多个处理器 执行,以实现如下操作:In addition, an embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a case debugging program, and the case debugging program may be executed by one or more processors to implement the following operations:
当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例;获取用户基于所述案例编辑界面编写的测试案例的代码,并将所述代码存储至代码库;当侦测到基于所述测试案例触发的调试指令时,根据所述调试指令建立调试任务并确定该调试任务的参数;将所述调试任务添加至任务队列中,由执行机集群中的当前处于空闲状态的执行机按照预设的任务调度机制从所述任务队列中调取并执行所述调试任务,以对被测系统进行测试,并由执行机将任务数据回写到预设数据库中;若检测到所述调试任务完成,从所述预设数据库中读取所述任务数据并展示。When a case editing instruction sent by a user based on a user terminal is detected, a case editing interface is displayed for the user to edit a test case; a code of a test case written by the user based on the case editing interface is obtained, and the code is stored in a code base When a debugging instruction triggered based on the test case is detected, a debugging task is established and parameters of the debugging task are determined according to the debugging instruction; the debugging task is added to a task queue, and the current The idle execution machine retrieves and executes the debugging task from the task queue according to a preset task scheduling mechanism to test the system under test, and the execution machine writes the task data back to the preset database If it is detected that the debugging task is completed, read the task data from the preset database and display it.
本申请计算机可读存储介质具体实施方式与上述测试案例的在线调试装置和方法各实施例基本相同,在此不作累述。The specific implementation of the computer-readable storage medium of the present application is basically the same as each embodiment of the online debugging device and method of the test case described above, and will not be repeated here.
需要说明的是,上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。并且本文中的术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。It should be noted that, the serial numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments. And the terms "including," "including," or any other variation thereof, are intended to cover non-exclusive inclusion, such that a process, device, article, or method that includes a series of elements includes not only those elements, but also The other elements listed, or those that are inherent to such a process, device, article, or method. Without more restrictions, an element limited by the sentence "including a ..." does not exclude that there are other identical elements in the process, device, article, or method that includes the element.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the methods in the above embodiments can be implemented by means of software plus a necessary universal hardware platform, and of course, also by hardware, but in many cases the former is better. Implementation. Based on such an understanding, the technical solution of the present application, in essence, or a part that contributes to the existing technology, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM) as described above. , Magnetic disk, optical disc), including a number of instructions to enable a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in the embodiments of the present application.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only preferred embodiments of the present application, and thus do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the description and drawings of the application, or directly or indirectly used in other related technical fields Are included in the scope of patent protection of this application.

Claims (20)

  1. 一种测试案例的在线调试装置,其特征在于,所述装置包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的案例调试程序,所述案例调试程序被所述处理器执行时实现如下步骤:An online debugging device for a test case, characterized in that the device includes a memory and a processor, and the memory stores a case debugging program that can be run on the processor, and the case debugging program is processed by the processor. Implement the following steps when the processor executes:
    当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例;When a user is detected based on a case editing instruction sent by the user terminal, the case editing interface is displayed for the user to edit the test case;
    获取用户基于所述案例编辑界面编写的测试案例的代码,并将所述代码存储至代码库;Acquiring code of a test case written by a user based on the case editing interface, and storing the code in a code base;
    当侦测到基于所述测试案例触发的调试指令时,根据所述调试指令建立调试任务并确定该调试任务的参数;When a debugging instruction triggered based on the test case is detected, a debugging task is established according to the debugging instruction and parameters of the debugging task are determined;
    将所述调试任务添加至任务队列中,由执行机集群中的当前处于空闲状态的执行机按照预设的任务调度机制从所述任务队列中调取并执行所述调试任务,以对被测系统进行测试,并由执行机将任务数据回写到预设数据库中;The debugging task is added to the task queue, and the currently executing machine in the cluster of executive machines retrieves and executes the debugging task from the task queue according to a preset task scheduling mechanism, so that The system tests and the execution machine writes the task data back to the preset database;
    若检测到所述调试任务完成,从所述预设数据库中读取所述任务数据并展示。If the completion of the debugging task is detected, the task data is read from the preset database and displayed.
  2. 如权利要求1所述的测试案例的在线调试装置,其特征在于,所述当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例的步骤包括:The online debugging device for a test case according to claim 1, wherein the step of displaying a case editing interface for the user to edit the test case when a case editing instruction sent by the user based on the user terminal is detected comprises:
    当侦测到用户基于用户终端发送的案例编辑指令时,确定所述编辑指令对应的测试案例;When a user is detected based on a case editing instruction sent by a user terminal, determining a test case corresponding to the editing instruction;
    从代码库中查找所述测试案例的代码,展示案例编辑界面,并将查找到的代码展示在所述案例编辑界面上,以供用户对所述测试案例的代码进行在线编辑。Find the code of the test case from the code base, display the case editing interface, and display the found code on the case editing interface for users to edit the code of the test case online.
  3. 如权利要求1所述的测试案例的在线调试装置,其特征在于,所述任务参数包括执行机的预设数量,所述在线调试程序还可被所述处理器执行,以实现如下步骤:The on-line debugging device for a test case according to claim 1, wherein the task parameters include a preset number of execution machines, and the on-line debugging program can also be executed by the processor to implement the following steps:
    在将所述调试任务添加至任务队列之后,将所述调试任务的状态标记为待执行状态;After adding the debugging task to a task queue, marking the status of the debugging task as a pending state;
    每当检测到有执行机调取所述调试任务时,判断所述调试任务的状态任务是否为待执行状态;Whenever it is detected that an execution machine calls the debugging task, determine whether the status task of the debugging task is a pending state;
    若所述调试任务的任务状态为待执行状态,则为所述调试任务添加该调试任务被该执行机调取的状态信息,并在调取所述调试任务并从所述代码库下载对应代码的执行机的数量达到所述预设数量后,将所述调试任务的状态修改为执行状态;If the task status of the debugging task is a pending status, add status information of the debugging task to be called by the execution machine for the debugging task, and call the debugging task and download the corresponding code from the code base. After the number of executing machines reaches the preset number, modifying the state of the debugging task to an execution state;
    若所述调试任务的状态任务为执行状态,则向该执行机发送调取任务失败的响应信息;If the state task of the debugging task is an execution state, sending a response message that the task fails to retrieve the task;
    在检测到所述调试任务的状态为执行状态时,控制所述预设数量的执行机执行所述调试任务,以对被测系统进行测试。When it is detected that the state of the debugging task is the execution state, controlling the preset number of execution machines to execute the debugging task to test the system under test.
  4. 如权利要求1所述的测试案例的在线调试装置,其特征在于,所述案例调试程序还可被所述处理器执行,以在所述若检测到所述调试任务完成,从所述预设数据库中读取所述任务数据并展示的步骤之后,还实现如下步骤:The online debugging device for a test case according to claim 1, wherein the case debugging program is further executable by the processor to, if the completion of the debugging task is detected, from the preset After reading the task data and displaying it in the database, the following steps are also implemented:
    若接收到基于所述任务数据触发的案例修改指令时,从所述代码库中获取所述测试案例的代码并展示,以供用户根据所述任务数据对所述代码进行修改;If a case modification instruction triggered based on the task data is received, the code of the test case is obtained from the code base and displayed for the user to modify the code according to the task data;
    若检测到代码修改完成,则将修改后的代码更新存储到所述代码库中。If the completion of the code modification is detected, the modified code update is stored in the code base.
  5. 如权利要求1所述的测试案例的在线调试装置,其特征在于,所述案例调试程序还可被所述处理器执行,以实现如下步骤:The online debugging device for a test case according to claim 1, wherein the case debugging program is further executed by the processor to implement the following steps:
    在接收到用户基于用户终端发送的测试场景修改指令时,从所述测试场景修改指令中获取场景参数,并确定所述场景修改指令对应的测试场景;When receiving a test scenario modification instruction sent by a user based on a user terminal, obtaining scene parameters from the test scenario modification instruction, and determining a test scenario corresponding to the scenario modification instruction;
    从代码库中获取与测试场景匹配的测试代码,并所述场景参数修改所述测试代码,将修改后的所述测试代码更新存储至所述代码库。Obtain a test code that matches the test scenario from the code base, modify the test code with the scene parameters, and store the modified test code update in the code base.
  6. 如权利要求2所述的测试案例的在线调试装置,其特征在于,所述案例调试程序还可被所述处理器执行,以实现如下步骤:The online debugging device for a test case according to claim 2, wherein the case debugging program is further executed by the processor to implement the following steps:
    在接收到用户基于用户终端发送的测试场景修改指令时,从所述测试场景修改指令中获取场景参数,并确定所述场景修改指令对应的测试场景;When receiving a test scenario modification instruction sent by a user based on a user terminal, obtaining scene parameters from the test scenario modification instruction, and determining a test scenario corresponding to the scenario modification instruction;
    从代码库中获取与测试场景匹配的测试代码,并所述场景参数修改所述测试代码,将修改后的所述测试代码更新存储至所述代码库。Obtain a test code that matches the test scenario from the code base, modify the test code with the scene parameters, and store the modified test code update in the code base.
  7. 如权利要求3所述的测试案例的在线调试装置,其特征在于,所述案例调试程序还可被所述处理器执行,以实现如下步骤:The online debugging device for a test case according to claim 3, wherein the case debugging program is further executed by the processor to implement the following steps:
    在接收到用户基于用户终端发送的测试场景修改指令时,从所述测试场 景修改指令中获取场景参数,并确定所述场景修改指令对应的测试场景;When receiving a test scenario modification instruction sent by a user based on a user terminal, obtaining scene parameters from the test scenario modification instruction, and determining a test scenario corresponding to the scenario modification instruction;
    从代码库中获取与测试场景匹配的测试代码,并所述场景参数修改所述测试代码,将修改后的所述测试代码更新存储至所述代码库。Obtain a test code that matches the test scenario from the code base, modify the test code with the scene parameters, and store the modified test code update in the code base.
  8. 一种测试案例的在线调试方法,其特征在于,所述方法包括:An online debugging method of a test case is characterized in that the method includes:
    当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例;When a user is detected based on a case editing instruction sent by the user terminal, the case editing interface is displayed for the user to edit the test case;
    获取用户基于所述案例编辑界面编写的测试案例的代码,并将所述代码存储至代码库;Acquiring code of a test case written by a user based on the case editing interface, and storing the code in a code base;
    当侦测到基于所述测试案例触发的调试指令时,根据所述调试指令建立调试任务并确定该调试任务的参数;When a debugging instruction triggered based on the test case is detected, a debugging task is established according to the debugging instruction and parameters of the debugging task are determined;
    将所述调试任务添加至任务队列中,由执行机集群中的当前处于空闲状态的执行机按照预设的任务调度机制从所述任务队列中调取并执行所述调试任务,以对被测系统进行测试,并由执行机将任务数据回写到预设数据库中;The debugging task is added to the task queue, and the currently executing machine in the cluster of executive machines retrieves and executes the debugging task from the task queue according to a preset task scheduling mechanism, so that The system tests and the execution machine writes the task data back to the preset database;
    若检测到所述调试任务完成,从所述预设数据库中读取所述任务数据并展示。If the completion of the debugging task is detected, the task data is read from the preset database and displayed.
  9. 如权利要求8所述的测试案例的在线调试方法,其特征在于,所述当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例的步骤包括:The online debugging method for a test case according to claim 8, wherein the step of displaying a case editing interface for the user to edit the test case when a case editing instruction sent by the user based on the user terminal is detected comprises:
    当侦测到用户基于用户终端发送的案例编辑指令时,确定所述编辑指令对应的测试案例;When a user is detected based on a case editing instruction sent by a user terminal, determining a test case corresponding to the editing instruction;
    从代码库中查找所述测试案例的代码,展示案例编辑界面,并将查找到的代码展示在所述案例编辑界面上,以供用户对所述测试案例的代码进行在线编辑。Find the code of the test case from the code base, display the case editing interface, and display the found code on the case editing interface for users to edit the code of the test case online.
  10. 如权利要求8所述的测试案例的在线调试方法,其特征在于,所述方法还包括如下步骤:The online debugging method of the test case according to claim 8, wherein the method further comprises the following steps:
    在将所述调试任务添加至任务队列之后,将所述调试任务的状态标记为待执行状态;After adding the debugging task to a task queue, marking the status of the debugging task as a pending state;
    每当检测到有执行机调取所述调试任务时,判断所述调试任务的状态任务是否为待执行状态;Whenever it is detected that an execution machine calls the debugging task, determine whether the status task of the debugging task is a pending state;
    若所述调试任务的任务状态为待执行状态,则为所述调试任务添加该调 试任务被该执行机调取的状态信息,并在调取所述调试任务并从所述代码库下载对应代码的执行机的数量达到所述预设数量后,将所述调试任务的状态修改为执行状态;If the task status of the debugging task is a pending status, add status information of the debugging task to be called by the execution machine for the debugging task, and call the debugging task and download the corresponding code from the code base. After the number of executing machines reaches the preset number, modifying the state of the debugging task to an execution state;
    若所述调试任务的状态任务为执行状态,则向该执行机发送调取任务失败的响应信息;If the state task of the debugging task is an execution state, sending a response message that the task fails to retrieve the task;
    在检测到所述调试任务的状态为执行状态时,控制所述预设数量的执行机执行所述调试任务,以对被测系统进行测试。When it is detected that the state of the debugging task is the execution state, controlling the preset number of execution machines to execute the debugging task to test the system under test.
  11. 如权利要求8所述的测试案例的在线调试方法,其特征在于,所述若检测到所述调试任务完成,从所述预设数据库中读取所述任务数据并展示的步骤之后,所述方法还包括如下步骤:The online debugging method for a test case according to claim 8, wherein after the step of reading the task data from the preset database and displaying it is detected, if the debugging task is detected to be completed, the method The method also includes the following steps:
    若接收到基于所述任务数据触发的案例修改指令时,从所述代码库中获取所述测试案例的代码并展示,以供用户根据所述任务数据对所述代码进行修改;If a case modification instruction triggered based on the task data is received, the code of the test case is obtained from the code base and displayed for the user to modify the code according to the task data;
    若检测到代码修改完成,则将修改后的代码更新存储到所述代码库中。If the completion of the code modification is detected, the modified code update is stored in the code base.
  12. 如权利要求8所述的测试案例的在线调试方法,其特征在于,所述方法还包括如下步骤:The online debugging method of the test case according to claim 8, wherein the method further comprises the following steps:
    在接收到用户基于用户终端发送的测试场景修改指令时,从所述测试场景修改指令中获取场景参数,并确定所述场景修改指令对应的测试场景;When receiving a test scenario modification instruction sent by a user based on a user terminal, obtaining scene parameters from the test scenario modification instruction, and determining a test scenario corresponding to the scenario modification instruction;
    从代码库中获取与测试场景匹配的测试代码,并所述场景参数修改所述测试代码,将修改后的所述测试代码更新存储至所述代码库。Obtain a test code that matches the test scenario from the code base, modify the test code with the scene parameters, and store the modified test code update in the code base.
  13. 如权利要求9所述的测试案例的在线调试方法,其特征在于,所述方法还包括如下步骤:The online debugging method of the test case according to claim 9, wherein the method further comprises the following steps:
    在接收到用户基于用户终端发送的测试场景修改指令时,从所述测试场景修改指令中获取场景参数,并确定所述场景修改指令对应的测试场景;When receiving a test scenario modification instruction sent by a user based on a user terminal, obtaining scene parameters from the test scenario modification instruction, and determining a test scenario corresponding to the scenario modification instruction;
    从代码库中获取与测试场景匹配的测试代码,并所述场景参数修改所述测试代码,将修改后的所述测试代码更新存储至所述代码库。Obtain a test code that matches the test scenario from the code base, modify the test code with the scene parameters, and store the modified test code update in the code base.
  14. 如权利要求10所述的测试案例的在线调试方法,其特征在于,所述方法还包括如下步骤:The online debugging method of the test case according to claim 10, wherein the method further comprises the following steps:
    在接收到用户基于用户终端发送的测试场景修改指令时,从所述测试场景修改指令中获取场景参数,并确定所述场景修改指令对应的测试场景;When receiving a test scenario modification instruction sent by a user based on a user terminal, obtaining scene parameters from the test scenario modification instruction, and determining a test scenario corresponding to the scenario modification instruction;
    从代码库中获取与测试场景匹配的测试代码,并所述场景参数修改所述测试代码,将修改后的所述测试代码更新存储至所述代码库。Obtain a test code that matches the test scenario from the code base, modify the test code with the scene parameters, and store the modified test code update in the code base.
  15. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有案例调试程序,所述案例调试程序可被一个或者多个处理器执行,以实现如下步骤:A computer-readable storage medium is characterized in that a case debug program is stored on the computer-readable storage medium, and the case debug program can be executed by one or more processors to implement the following steps:
    当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例;When a user is detected based on a case editing instruction sent by the user terminal, the case editing interface is displayed for the user to edit the test case;
    获取用户基于所述案例编辑界面编写的测试案例的代码,并将所述代码存储至代码库;Acquiring code of a test case written by a user based on the case editing interface, and storing the code in a code base;
    当侦测到基于所述测试案例触发的调试指令时,根据所述调试指令建立调试任务并确定该调试任务的参数;When a debugging instruction triggered based on the test case is detected, a debugging task is established according to the debugging instruction and parameters of the debugging task are determined;
    将所述调试任务添加至任务队列中,由执行机集群中的当前处于空闲状态的执行机按照预设的任务调度机制从所述任务队列中调取并执行所述调试任务,以对被测系统进行测试,并由执行机将任务数据回写到预设数据库中;The debugging task is added to the task queue, and the currently executing machine in the cluster of executive machines retrieves and executes the debugging task from the task queue according to a preset task scheduling mechanism, so that The system tests and the execution machine writes the task data back to the preset database;
    若检测到所述调试任务完成,从所述预设数据库中读取所述任务数据并展示。If the completion of the debugging task is detected, the task data is read from the preset database and displayed.
  16. 如权利要求15所述的计算机可读存储介质,其特征在于,,所述当侦测到用户基于用户终端发送的案例编辑指令时,展示案例编辑界面以供用户编辑测试案例的步骤包括:The computer-readable storage medium of claim 15, wherein the step of displaying a case editing interface for the user to edit a test case when detecting a case editing instruction sent by the user based on the user terminal comprises:
    当侦测到用户基于用户终端发送的案例编辑指令时,确定所述编辑指令对应的测试案例;When a user is detected based on a case editing instruction sent by a user terminal, determining a test case corresponding to the editing instruction;
    从代码库中查找所述测试案例的代码,展示案例编辑界面,并将查找到的代码展示在所述案例编辑界面上,以供用户对所述测试案例的代码进行在线编辑。Find the code of the test case from the code base, display the case editing interface, and display the found code on the case editing interface for users to edit the code of the test case online.
  17. 如权利要求15所述的计算机可读存储介质,其特征在于,所述任务参数包括执行机的预设数量,所述在线调试程序还可被处理器执行,以实现如下步骤:The computer-readable storage medium of claim 15, wherein the task parameters include a preset number of execution machines, and the online debugging program is further executable by a processor to implement the following steps:
    在将所述调试任务添加至任务队列之后,将所述调试任务的状态标记为待执行状态;After adding the debugging task to a task queue, marking the status of the debugging task as a pending state;
    每当检测到有执行机调取所述调试任务时,判断所述调试任务的状态任 务是否为待执行状态;Whenever it is detected that an execution machine calls the debugging task, determine whether a state task of the debugging task is a pending state;
    若所述调试任务的任务状态为待执行状态,则为所述调试任务添加该调试任务被该执行机调取的状态信息,并在调取所述调试任务并从所述代码库下载对应代码的执行机的数量达到所述预设数量后,将所述调试任务的状态修改为执行状态;If the task status of the debugging task is a pending status, add status information of the debugging task to be called by the execution machine for the debugging task, and call the debugging task and download the corresponding code from the code base. After the number of executing machines reaches the preset number, modifying the state of the debugging task to an execution state;
    若所述调试任务的状态任务为执行状态,则向该执行机发送调取任务失败的响应信息;If the state task of the debugging task is an execution state, sending a response message that the task fails to retrieve the task;
    在检测到所述调试任务的状态为执行状态时,控制所述预设数量的执行机执行所述调试任务,以对被测系统进行测试。When it is detected that the state of the debugging task is the execution state, controlling the preset number of execution machines to execute the debugging task to test the system under test.
  18. 如权利要求15所述的计算机可读存储介质,其特征在于,所述案例调试程序还可被处理器执行,以在所述若检测到所述调试任务完成,从所述预设数据库中读取所述任务数据并展示的步骤之后,还实现如下步骤:The computer-readable storage medium of claim 15, wherein the case debugging program is further executable by a processor to read from the preset database if the debugging task is detected to be completed. After taking the task data and displaying it, the following steps are also implemented:
    若接收到基于所述任务数据触发的案例修改指令时,从所述代码库中获取所述测试案例的代码并展示,以供用户根据所述任务数据对所述代码进行修改;If a case modification instruction triggered based on the task data is received, the code of the test case is obtained from the code base and displayed for the user to modify the code according to the task data;
    若检测到代码修改完成,则将修改后的代码更新存储到所述代码库中。If the completion of the code modification is detected, the modified code update is stored in the code base.
  19. 如权利要求15所述的计算机可读存储介质,其特征在于,所述案例调试程序还可被处理器执行,以实现如下步骤:The computer-readable storage medium of claim 15, wherein the case debugging program is further executable by a processor to implement the following steps:
    在接收到用户基于用户终端发送的测试场景修改指令时,从所述测试场景修改指令中获取场景参数,并确定所述场景修改指令对应的测试场景;When receiving a test scenario modification instruction sent by a user based on a user terminal, obtaining scene parameters from the test scenario modification instruction, and determining a test scenario corresponding to the scenario modification instruction;
    从代码库中获取与测试场景匹配的测试代码,并所述场景参数修改所述测试代码,将修改后的所述测试代码更新存储至所述代码库。Obtain a test code that matches the test scenario from the code base, modify the test code with the scene parameters, and store the modified test code update in the code base.
  20. 如权利要求16所述的计算机可读存储介质,其特征在于,所述案例调试程序还可被所述处理器执行,以实现如下步骤:The computer-readable storage medium of claim 16, wherein the case debug program is further executable by the processor to implement the following steps:
    在接收到用户基于用户终端发送的测试场景修改指令时,从所述测试场景修改指令中获取场景参数,并确定所述场景修改指令对应的测试场景;When receiving a test scenario modification instruction sent by a user based on a user terminal, obtaining scene parameters from the test scenario modification instruction, and determining a test scenario corresponding to the scenario modification instruction;
    从代码库中获取与测试场景匹配的测试代码,并所述场景参数修改所述测试代码,将修改后的所述测试代码更新存储至所述代码库。Obtain a test code that matches the test scenario from the code base, modify the test code with the scene parameters, and store the modified test code update in the code base.
PCT/CN2018/102104 2018-05-31 2018-08-24 Online debugging apparatus and method for test case, and computer-readable storage medium WO2019227708A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810544750.3A CN108763085A (en) 2018-05-31 2018-05-31 On-line debugging device, method and the computer readable storage medium of test cases
CN201810544750.3 2018-05-31

Publications (1)

Publication Number Publication Date
WO2019227708A1 true WO2019227708A1 (en) 2019-12-05

Family

ID=64000931

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/102104 WO2019227708A1 (en) 2018-05-31 2018-08-24 Online debugging apparatus and method for test case, and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN108763085A (en)
WO (1) WO2019227708A1 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110543429B (en) * 2019-09-10 2023-05-16 深圳前海微众银行股份有限公司 Test case debugging method, device and storage medium
CN110781074A (en) * 2019-09-18 2020-02-11 平安银行股份有限公司 Automatic testing method and device and storage medium
CN111078525A (en) * 2019-10-11 2020-04-28 中国平安财产保险股份有限公司 Method and device for adjusting system running time, computer equipment and storage medium
CN110908899A (en) * 2019-11-08 2020-03-24 北京奇艺世纪科技有限公司 Application program debugging method, mobile terminal and computer readable storage medium
CN111061630A (en) * 2019-11-26 2020-04-24 歌尔股份有限公司 Product debugging method, debugging device and readable storage medium
CN111427790A (en) * 2020-03-26 2020-07-17 中国建设银行股份有限公司 Test method, test device, terminal equipment and storage medium
CN112597030B (en) * 2020-12-26 2024-09-17 中国农业银行股份有限公司 Task release method and device, execution method and device and system
CN113626309A (en) * 2021-07-06 2021-11-09 深圳点猫科技有限公司 Method and device for simulating operation of mobile terminal, electronic equipment and storage medium
CN114996166B (en) * 2022-08-02 2022-10-21 杭州高达软件系统股份有限公司 Code online debugging method, system and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102722440A (en) * 2012-06-07 2012-10-10 中兴通讯股份有限公司 Debugging device of executive codes of embedded system, debugging method and embedded system
CN103984624A (en) * 2014-04-29 2014-08-13 北京京东尚科信息技术有限公司 Automatic testing method and system for webpage
CN106021257A (en) * 2015-12-31 2016-10-12 广州华多网络科技有限公司 Method, device, and system for crawler to capture data supporting online programming
CN107315678A (en) * 2016-04-27 2017-11-03 龙芯中科技术有限公司 The call method and device of debugging acid

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1326044C (en) * 2004-10-22 2007-07-11 中国工商银行股份有限公司 Automation software testing system based on script explanatory tool
CN101719097A (en) * 2009-12-24 2010-06-02 深圳市金蝶移动互联技术有限公司 Debug method and system of automation test script and automation application server
CN106452830A (en) * 2016-08-22 2017-02-22 平安科技(深圳)有限公司 Test task execution machine distribution method and device
US10169200B2 (en) * 2016-10-28 2019-01-01 International Business Machines Corporation Code component debugging in an application program

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102722440A (en) * 2012-06-07 2012-10-10 中兴通讯股份有限公司 Debugging device of executive codes of embedded system, debugging method and embedded system
CN103984624A (en) * 2014-04-29 2014-08-13 北京京东尚科信息技术有限公司 Automatic testing method and system for webpage
CN106021257A (en) * 2015-12-31 2016-10-12 广州华多网络科技有限公司 Method, device, and system for crawler to capture data supporting online programming
CN107315678A (en) * 2016-04-27 2017-11-03 龙芯中科技术有限公司 The call method and device of debugging acid

Also Published As

Publication number Publication date
CN108763085A (en) 2018-11-06

Similar Documents

Publication Publication Date Title
WO2019227708A1 (en) Online debugging apparatus and method for test case, and computer-readable storage medium
CN109302522B (en) Test method, test device, computer system, and computer medium
US9898396B2 (en) Automated software testing and validation via graphical user interface
US20160283353A1 (en) Automated software testing
US20130263090A1 (en) System and method for automated testing
US20160170867A1 (en) Exposing method related data calls during testing in an event driven, multichannel architecture
US20190227917A1 (en) Adaptive system for mobile device testing
CN105302722B (en) CTS automatic testing method and device
CN110825619A (en) Automatic generation method and device of interface test case and storage medium
WO2019214109A1 (en) Monitoring device and method for testing process, and computer readable storage medium
CN106126424A (en) A kind of visual automated testing method of script, device and mobile terminal
WO2018188380A1 (en) Method and device for adding control identification
CN112988605B (en) Method and device for realizing WEB application automatic test
CN111475390A (en) Log collection system deployment method, device, equipment and storage medium
CN112115051A (en) Page traversal detection method, device and equipment for application and readable storage medium
CN115658529A (en) Automatic testing method for user page and related equipment
CN114297056A (en) Automatic testing method and system
CN112231206A (en) Script editing method for application program test, computer readable storage medium and test platform
CN111414309A (en) Automatic test method of application program, computer equipment and storage medium
CN115934503A (en) Program testing method, device, equipment and storage medium
JP5460928B1 (en) Programmable controller, programmable controller system, and execution error information creation method
CN111176986B (en) Thread script debugging method and device, computer equipment and storage medium
CN113806209A (en) Interface testing method, frame, computer device and storage medium
CN114201382A (en) Test case generation method and device, storage medium and electronic equipment
CN111444109A (en) Mobile terminal UI automatic testing method and system

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: 18920231

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18920231

Country of ref document: EP

Kind code of ref document: A1