WO2017162058A1 - 软件测试方法和装置 - Google Patents

软件测试方法和装置 Download PDF

Info

Publication number
WO2017162058A1
WO2017162058A1 PCT/CN2017/076399 CN2017076399W WO2017162058A1 WO 2017162058 A1 WO2017162058 A1 WO 2017162058A1 CN 2017076399 W CN2017076399 W CN 2017076399W WO 2017162058 A1 WO2017162058 A1 WO 2017162058A1
Authority
WO
WIPO (PCT)
Prior art keywords
test
program
target program
test point
software testing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2017/076399
Other languages
English (en)
French (fr)
Inventor
刘俊峰
姚文辉
张海勇
朱家稷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Publication of WO2017162058A1 publication Critical patent/WO2017162058A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Definitions

  • the present invention relates to computer technology, and in particular, to a software testing method and apparatus.
  • Software testing is a necessary link before the software runs online. Different software application environments can be tested by different software testing methods to ensure the running stability of the software running online.
  • the Failover test is a test method for testing software for processing and recovering. At present, when the software fails the recovery test, the test code is pre-written in the program code of the tested software, so that the test is compiled.
  • the test software needs to perform simulated abnormal exit scenarios under various paths, which is commonly referred to as simulated abnormal paths, and therefore, existing Every time an error path is tested in the technology, the programmer needs to update the code and recompile, which is less efficient.
  • the present invention provides a software testing method and apparatus for solving the technical problem of low efficiency of failure recovery testing in the prior art.
  • a software testing method comprising:
  • test program corresponding to the test point is called to test the target program.
  • a software testing apparatus comprising:
  • the software testing method and device provided by the embodiment of the present invention, by setting a test point in the target program in advance, in the process of executing the target program, executing the test program corresponding to the test point to the target after setting the position of the test point The program is tested.
  • the process of recompilation improves the efficiency of the test.
  • FIG. 1 is a schematic flowchart of a software testing method according to Embodiment 1 of the present invention.
  • FIG. 2 is a schematic flowchart of a software testing method according to Embodiment 2 of the present invention.
  • FIG. 3 is a schematic structural diagram of a software testing apparatus according to Embodiment 3 of the present invention.
  • FIG. 4 is a schematic structural diagram of a software testing apparatus according to Embodiment 4 of the present invention.
  • FIG. 1 is a schematic flowchart of a software testing method according to Embodiment 1 of the present invention. As shown in FIG. 1, the method includes:
  • Step 101 Execute a target program.
  • test points When writing the target program code, test points have been preset in the target program.
  • the content of the test point includes the test point identifier, such as the test point name, and the test point may also include a macro and a custom code, wherein the macro is used to indicate the execution order of the custom code and the calling test program.
  • test procedures usually use execution methods, events
  • the fixed format of content and event types is described, so in order to increase the flexibility of testing, the user can write a piece of custom code for testing in the test point before writing the target program code.
  • each test point in the target program can be set to the closed state, and then the target program is compiled, so that the target program is not affected by the test point, and the integrity and relative of the target program are guaranteed.
  • the client sends a Remote Procedure Call Protocol (RCP) request as a request for setting the open/close state, and the server sets the test point in the target program to be turned on or off according to the RCP request.
  • RCP Remote Procedure Call Protocol
  • Step 102 When executing a test point preset in the target program, calling the test program corresponding to the test point to test the target program.
  • test program is invoked to perform a failure recovery test on the target program.
  • test program is called to test the execution time of the target program.
  • the test program marked by the test point identifier may be queried in the container for recording the test program according to the test point identifier in the test point, according to the execution manner indicated by the test program, The content of the event and/or the type of event, the failure recovery test of the target program.
  • the execution mode may be a single execution, multiple executions, random execution, and the like;
  • the event type may be a delay, a return error code, an exception thrown, and a termination process, and the event content may be a specific time of the delay.
  • test points and when executing to the test point, the test program corresponding to the test point is called to test the target program to simulate various scenarios.
  • the target program and the test program are independent of each other, when the test program needs to be modified, there is no need to recompile the target program, which improves the efficiency of the test and the convenience of the test.
  • the solution in this embodiment is applied to a distributed system, since the distributed system is deployed with a high degree of complexity, the advantage of modifying the code and compiling the target program running in the distributed system is reflected. More fully.
  • Embodiment 2 is a schematic flowchart of a software testing method according to Embodiment 2 of the present invention. To clear the execution flow when the client performs a modification to the server-side test program, this embodiment provides a specific Schematic diagram of the process.
  • the method provided in this embodiment is executed by a server and a client, wherein the server is used to run the target program, and a server (Map) storing the test program is set on the server.
  • the client can update the test program in the Map through the RCP request.
  • test points are inserted in the required test locations within the target program, for example, to eliminate the bug point.
  • the debug point can be designed in a singleton mode.
  • the location of the debug point needs to be added, and the name of a debug point is declared, for example: DECLARE_DBG_POINT(New_DebugPiontName), where New_DebugPiontName is the name of the debug point. .
  • DECLARE_DBG_POINT New_DebugPiontName
  • New_DebugPiontName is the name of the debug point.
  • DBG_POINT_PRE_EXEC New_DebugPiontName, code
  • DBG_POINT_PRE_EXEC is a macro, this macro indicates that the custom code is executed before executing the test program corresponding to the debug point.
  • Different macros can specify a custom code to be executed before execution or after executing the test program at the debug point. Since this part of the custom code is located in the target program and therefore cannot be modified by the client, it needs to be determined when writing the code of the target program.
  • the test program corresponding to each test point is stored in the Map, and the test program includes the execution mode (Point Type), the event content (Action), and the event type (Action Type) of each debug point.
  • the execution mode may be a single execution, multiple executions, random execution, and the like;
  • the event type may be a delay, a return error code, an exception thrown, and a termination process, and the event content may be a specific time of the delay.
  • the software testing methods include:
  • Step 201 The client sends an RCP request.
  • the RPC request carries the name of the debug point, and the execution mode, event content, and event type of the test program corresponding to the debug point.
  • Step 202 The server end updates the test program according to the RCP request.
  • the server side modifies the execution mode, the event content, and the event type in the test program corresponding to the debug point in the Map container to the execution mode, the event content, and the event type in the RCP request.
  • Step 203 When the server runs the target program to the test point location, query the test program corresponding to the test point.
  • the server side executes the test point to DBG_POINT_PRE_EXEC(New_DebugPiontName, code)
  • the server first executes the custom code code, and then calls the singleton method of the debug point to query the Map container for events that need to be executed. Including event content and event type, as well as event execution Line mode.
  • Step 204 Determine whether the event type in the test program is a delay. If yes, execute step 205; otherwise, perform step 206.
  • Step 205 Determine an execution time according to a delay time remaining in the test program whose delay time has not ended and a delay time indicated in the current test program, and perform delay according to the determined execution time.
  • the delay type event Before executing the delay type event, it is necessary to query the debug point that has been executed before the debug point, whether there is a debug point whose event type is delayed, and the delay time does not end. If it does not exist, execute the event. If it exists, The difference between the delay time of the unfinished debug point and the delay time of the current event is used as the delay time for the event to be executed. When the delay time for the event to be executed is a positive number, the calculated delay is performed according to the calculated delay. Time to execute the delay event.
  • the actual delay time is the delay time of the previous debug point.
  • Step 206 Perform a test procedure corresponding to the test point.
  • the test is performed directly according to the contents of the test program, that is, the execution mode, event content, and event type indicated by the test program are executed.
  • the test program corresponding to the test point is called after the position where the test point is set, and the target program is tested.
  • FIG. 3 is a schematic structural diagram of a software testing apparatus according to Embodiment 3 of the present invention. As shown in FIG. 3, the method includes: an executing module 31 and a calling module 32.
  • the execution module 31 is configured to execute a target program.
  • the calling module 32 is configured to, when executing a test point preset to the target program, invoke a test program corresponding to the test point to test the target program.
  • test points can include: test point identification, macros and custom code.
  • the calling module 32 is specifically configured to invoke the test program to perform a failure recovery test on the target program.
  • the test program corresponding to the test point is called after the position where the test point is set, and the target program is tested.
  • the calling module 32 further includes: a query unit 321 and a testing unit. 322.
  • the query unit 321 is configured to query the test program marked by the test point identifier in a container for recording a test program according to the test point identifier in the test point.
  • the testing unit 322 is configured to perform a failure recovery test on the target program according to the execution manner, the event content, and/or the event type indicated by the test program.
  • testing unit 322 includes a query sub-unit 3221, a computing sub-unit 3222, and an executing sub-unit 3223.
  • the query subunit 3221 is configured to query, in the test program that has been executed, whether the test program has a delay time that is not completed when the event type of the test program is delayed.
  • the calculation sub-unit 3222 is configured to determine, if present, an actual delay time of the test program based on a remaining delay time of the test program whose delay time has not ended, and a delay time indicated by an event content of the test program.
  • the executing subunit 3223 is configured to delay the target program according to the actual delay time of the test program.
  • the software testing device further includes: a customization module 33, a receiving module 34, an updating module 35, a compiling module 36, a status receiving module 37, a setting module 38, and a confirming module 39.
  • a custom module 33 configured to execute the custom code and the test program according to the macro in the test point In order, execute the custom code.
  • the receiving module 34 is configured to receive an update request.
  • the update request includes a test point identifier, and an execution manner, event content, and/or event type.
  • the updating module 35 is configured to update the test program indicated by the update request according to the update request.
  • the update module 35 is specifically configured to update the execution mode, the event content, and/or the event type in the test program corresponding to the test point identifier in the update request, and update the execution manner, the event content, and the event content in the update request. / or event type.
  • the compiling module 36 is configured to compile the target program after setting each test point in the target program to a closed state.
  • the status receiving module 37 is configured to receive a request for setting an open/close state.
  • the setting module 38 is configured to set the test point in the target program to an open state or a closed state according to the request for setting an open/close state.
  • the confirmation module 39 is configured to confirm that the test point is in an open state before calling the test program corresponding to the test point to test the target program.
  • the device provided in this embodiment is specifically used to perform the method shown in FIG. 1 and FIG. 2 .
  • the specific implementation method of each function module refer to the related description in the corresponding embodiment, which is not repeatedly described in this embodiment.
  • the aforementioned program can be stored in a computer readable storage medium.
  • the program when executed, performs the steps including the foregoing method embodiments; and the foregoing storage medium includes various media that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.

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

一种软件测试方法和装置,通过预先在目标程序中设置测试点,从而在执行目标程序的过程中(101),当执行到目标程序中所预先设置的测试点时,调用测试点所对应的测试程序对目标程序进行测试(102)。当需要模拟不同异常路径时,不需要对目标程序的代码进行修改,仅需要更新测试程序即可,因而也就省去了由于修改了目标程序代码所带来的对目标程序进行重新编译的过程,提高了测试的效率。

Description

软件测试方法和装置
本申请要求2016年03月23日递交的申请号为201610168942.X、发明名称为“软件测试方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及计算机技术,尤其涉及一种软件测试方法和装置。
背景技术
软件测试是在软件上线运行之前所必须的一个环节,针对软件的不同应用环境可以采用不同的软件测试方法对其进行测试,从而保证软件上线运行过程中的运行稳定性。
在各类软件测试方法中,失败恢复(Failover)测试是一种用于测试软件针对处理故障并恢复的过程的测试方法。目前对软件进行失败恢复测试时,往往采用在被测软件的程序代码中预先写入测试代码,从而编译后进行测试。
由于失败恢复测试中往往需要对多种执行失败的场景进行测试,从而需要被测软件进行各种不同的路径下模拟异常退出的场景,也就是通常所说的模拟异常路径,因此,在现有技术中每测试一种异常路径,便需要程序员更新代码并重新编译,测试效率较低。
发明内容
本发明提供一种软件测试方法和装置,用于解决现有技术中失败恢复测试效率较低的技术问题。
为达到上述目的,本发明的实施例采用如下技术方案:
第一方面,提供了一种软件测试方法,包括:
执行目标程序;
当执行到所述目标程序中所预先设置的测试点时,调用所述测试点对应的测试程序对所述目标程序进行测试。
第二方面,提供了一种软件测试装置,包括:
执行模块,用于执行目标程序;
调用模块,用于当执行到所述目标程序中所预先设置的测试点时,调用所述测试点对应的测试程序对所述目标程序进行测试。
本发明实施例提供的软件测试方法和装置,通过预先在目标程序中设置测试点,从而在执行目标程序的过程中,执行到设置了测试点的位置之后调用测试点所对应的测试程序对目标程序进行测试。当需要模拟不同异常路径时,不需要对目标程序的代码进行修改,仅需要更新测试程序既可,因而也就省去了现有技术中由于修改了目标程序代码所带来的对目标程序进行重新编译的过程,提高了测试的效率。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。
附图说明
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:
图1为本发明实施例一提供的一种软件测试方法的流程示意图;
图2为本发明实施例二提供的一种软件测试方法的流程示意图;
图3为本发明实施例三提供的一种软件测试装置的结构示意图;
图4为本发明实施例四提供的一种软件测试装置的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。
下面结合附图对本发明实施例提供的软件测试方法和装置进行详细描述。
实施例一
图1为本发明实施例一提供的一种软件测试方法的流程示意图,如图1所示,包括:
步骤101、执行目标程序。
在编写目标程序代码时,已在目标程序中预先设置了测试点。该测试点的内容包括了测试点标识,例如测试点名称,另外测试点还可以包括宏和自定义代码,其中,宏用于指示自定义代码和调用测试程序的执行顺序。由于测试程序通常采用执行方式、事件 内容和事件类型这种固定格式进行描述,因而为了提高测试的灵活性,用户可以在编写目标程序代码时,预先在测试点中写入一段用于测试的自定义代码。
进一步,在执行目标程序之前,可以将目标程序中的各测试点设置为关闭状态,然后对目标程序进行编译,从而使得目标程序不会受到测试点的影响,保证了目标程序的完整性和相对测试程序而言的独立性。可以在编译完成之后,由客户端发送远程过程调用协议(Remote Procedure Call Protocol,RCP)请求作为用于设置开闭状态的请求,服务器端根据RCP请求设置目标程序中的测试点为开启状态或关闭状态,进而服务器端在运行目标程序的过程中,确认测试点处于开启状态时,再调用相应的测试程序。
步骤102、当执行到目标程序中所预先设置的测试点时,调用测试点对应的测试程序对目标程序进行测试。
具体的,作为一种可能的应用场景,调用测试程序对所述目标程序进行失败恢复测试。作为另一种可能的应用场景,调用测试程序对目标程序进行执行时间的测试。
对于进行失败恢复测试的应用场景,具体可以根据测试点中的测试点标识,在用于记录测试程序的容器中查询所述测试点标识所标记的测试程序,根据测试程序所指示的执行方式、事件内容和/或事件类型,对目标程序进行失败恢复测试。
其中,执行方式具体可以为执行单次、执行多次、随机执行等;事件类型具体可以为延迟、返回错码、抛出异常和终止进程等,事件内容可以为延迟的具体时间等。
可见,基于执行方式、事件类型和事件内容的组合,可以获得多种测试程序,同时,根据测试点设置的位置不同又可以模拟出不同的测试路径,因此,采用在目标程序中所预先设置的测试点,并在执行到测试点时,调用测试点对应的测试程序对目标程序进行测试的方式可以实现对多种场景的模拟。
另外,由于目标程序和测试程序相互独立,因而,当测试程序需要进行修改时,无需对目标程序进行重新编译,提高了测试的效率和测试的便捷性。尤其是将本实施例中的方案应用于分布式系统中时,由于分布式系统运行部署复杂程度较高,这种无需对分布式系统中所运行的目标程序修改代码和编译的优点就体现的更加充分。
实施例二
图2为本发明实施例二提供的一种软件测试方法的流程示意图,为了清除说明当客户端对服务器端的测试程序进行修改时的执行流程,本实施例提供了如图2所示的具体的流程示意图。
本实施例所提供的方法由服务器端和客户端执行,其中,服务器端用于运行目标程序,并且在服务器端设置有存储有测试程序的容器(Map)。客户端可以通过RCP请求更新Map内的测试程序。
针对服务器端来说,一方面,在目标程序内所需测试位置插入有测试点,例如消除漏洞(debug)点。
具体的,该debug点可以采用单例模式进行设计,在目标程序的代码中需要添加debug点的位置,声明一个debug点的名称,例如:DECLARE_DBG_POINT(New_DebugPiontName),其中,New_DebugPiontName是这个debug点的名称。在声明这个debug点后就可以在目标程序的代码中需要添加测试点的位置插入这个debug点,例如:DBG_POINT_PRE_EXEC(New_DebugPiontName,code)。其中,code为一段自定义代码,DBG_POINT_PRE_EXEC是宏,这个宏指示了在执行debug点对应的测试程序之前执行自定义代码。
不同的宏可以指定在执行之前或者是执行debug点的测试程序后执行一段自定义代码。由于这部分的自定义代码位于目标程序中,因而是不能够由客户端修改的,需要在写目标程序的代码时进行确定。
另一方面,在Map内存储有各个测试点所对应的测试程序,测试程序包括各debug点的执行方式(Point Type)、事件内容(Action)和事件类型(Action Type)。其中,执行方式具体可以为执行单次、执行多次、随机执行等;事件类型具体可以为延迟、返回错码、抛出异常和终止进程等,事件内容可以为延迟的具体时间等。
如图2所示,软件测试方法包括:
步骤201、客户端发送RCP请求。
其中,RPC请求携带有debug点的名称,以及该debug点对应的测试程序更新后的执行方式、事件内容和事件类型。
步骤202、服务器端根据RCP请求更新测试程序。
服务器端接收到该RCP请求之后,将Map容器中该debug点对应的测试程序中执行方式、事件内容和事件类型对应修改为RCP请求中的执行方式、事件内容和事件类型。
步骤203、当服务器端运行目标程序到测试点位置时,查询测试点对应的测试程序。
例如:当服务器端执行到DBG_POINT_PRE_EXEC(New_DebugPiontName,code)这一测试点时,服务器端首先执行自定义代码code,然后调用debug点的单例方法,从而在Map容器中查询是否有需要执行的事件,包括事件内容和事件类型,以及事件的执 行方式。
若存在需要执行的事件,进行执行。由于事件中包含的事件类型和事件的执行方式均存在多种不同的取值,根据不同的组合可以模拟出各种所希望的逻辑。
步骤204、判断测试程序中事件类型是否为延迟,若是,则执行步骤205,否则执行步骤206。
步骤205、根据延迟时间未结束的测试程序所剩余的延迟时间和当前测试程序中所指示的延迟时间,确定执行时间,并按照所确定出的执行时间进行延迟。
具体的,在执行延迟类型的事件之前,需要查询这个debug点之前已执行的debug点中是否存在事件类型为延迟,且延迟时间未结束的debug点,若不存在则执行该事件,若存在,则将未结束的debug点所剩余的延迟时间与当前事件的延迟时间之差,作为事件需执行的延迟时间,当事件需执行的延迟时间为正数时,按照所计算出的需执行的延迟时间执行该延迟事件。
这是由于前面的debug点没有执行完成,则处于延迟状态,若当前debug点同样为延迟,则在前面debug点的延迟基础上继续进行延迟,因而,实际延迟时间为前面的debug点的延迟时间与当前debug点的延迟时间之和。为了使得实际延迟时间符合测试程序所指示的延迟时间,需要延迟时间未结束的测试程序所剩余的延迟时间和当前测试程序中所指示的延迟时间,确定实际延迟时间。
步骤206、执行测试点对应的测试程序。
若测试程序中事件类型不为延迟,则直接按照测试程序中的内容进行测试,也就是说执行测试程序所指示的事件执行方式、事件内容和事件类型。
本实施例中,通过预先在目标程序中设置测试点,从而在执行目标程序的过程中,执行到设置了测试点的位置之后调用测试点所对应的测试程序对目标程序进行测试。当需要模拟不同异常路径时,不需要对目标程序的代码进行修改,仅需要更新测试程序既可,因而也就省去了现有技术中由于修改了目标程序代码所带来的对目标程序进行重新编译的过程,提高了测试的效率。
实施例三
图3为本发明实施例三提供的一种软件测试装置的结构示意图,如图3所示,包括:执行模块31和调用模块32。
执行模块31,用于执行目标程序。
调用模块32,用于当执行到所述目标程序中所预先设置的测试点时,调用所述测试点对应的测试程序对所述目标程序进行测试。
其中,测试点可以包括:测试点标识、宏和自定义代码。
具体的,调用模块32具体用于调用所述测试程序对所述目标程序进行失败恢复测试。
本实施例中,通过预先在目标程序中设置测试点,从而在执行目标程序的过程中,执行到设置了测试点的位置之后调用测试点所对应的测试程序对目标程序进行测试。当需要模拟不同异常路径时,不需要对目标程序的代码进行修改,仅需要更新测试程序既可,因而也就省去了现有技术中由于修改了目标程序代码所带来的对目标程序进行重新编译的过程,提高了测试的效率。
实施例四
图4为本发明实施例四提供的一种软件测试装置的结构示意图,如图4所示,在图3所提供的软件测试装置的基础上,调用模块32进一步包括:查询单元321和测试单元322。
查询单元321,用于根据所述测试点中的测试点标识,在用于记录测试程序的容器中查询所述测试点标识所标记的测试程序。
测试单元322,用于根据所述测试程序所指示的执行方式、事件内容和/或事件类型,对所述目标程序进行失败恢复测试。
进一步,测试单元322包括:查询子单元3221、计算子单元3222和执行子单元3223。
查询子单元3221,用于当所述测试程序的事件类型为延迟时,查询已执行的测试程序中是否存在延迟时间未结束的测试程序。
计算子单元3222,用于若存在,则根据所述延迟时间未结束的测试程序的剩余延迟时间,以及所述测试程序的事件内容所指示的延迟时间,确定所述测试程序的实际延迟时间。
执行子单元3223,用于依据所述测试程序的实际延迟时间,对所述目标程序进行延迟。
进一步,软件测试装置还包括:自定义模块33、接收模块34、更新模块35、编译模块36、状态接收模块37、设置模块38和确认模块39。
自定义模块33,用于根据所述测试点中的宏所指示的自定义代码与测试程序的执行 顺序,执行所述自定义代码。
接收模块34,用于接收更新请求。
其中,更新请求包括测试点标识,以及执行方式、事件内容和/或事件类型。
更新模块35,用于根据所述更新请求,对所述更新请求所指示的测试程序进行更新。
具体的,更新模块35具体用于将所述更新请求中测试点标识对应的测试程序中的执行方式、事件内容和/或事件类型,对应更新为所述更新请求中的执行方式、事件内容和/或事件类型。
编译模块36,用于将所述目标程序中的各测试点设置为关闭状态之后,对所述目标程序进行编译。
状态接收模块37,用于接收用于设置开闭状态的请求。
设置模块38,用于根据所述用于设置开闭状态的请求,设置所述目标程序中的测试点为开启状态或关闭状态。
确认模块39,用于调用所述测试点对应的测试程序对所述目标程序进行测试之前,确认所述测试点处于开启状态。
本实施例所提供的装置具体用于执行图1和图2所示的方法,各功能模块的具体实现方法参见对应实施例中的相关描述,本实施例中对此不再赘述。
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims (18)

  1. 一种软件测试方法,其特征在于,包括:
    执行目标程序;
    当执行到所述目标程序中所预先设置的测试点时,调用所述测试点对应的测试程序对所述目标程序进行测试。
  2. 根据权利要求1所述的软件测试方法,其特征在于,所述调用所述测试点对应的测试程序对所述目标程序进行测试,包括:
    调用所述测试程序对所述目标程序进行失败恢复测试。
  3. 根据权利要求2所述的软件测试方法,其特征在于,所述调用所述测试程序对所述目标程序进行失败恢复测试,包括:
    根据所述测试点中的测试点标识,在用于记录测试程序的容器中查询所述测试点标识所标记的测试程序;
    根据所述测试程序所指示的执行方式、事件内容和/或事件类型,对所述目标程序进行失败恢复测试。
  4. 根据权利要求3所述的软件测试方法,其特征在于,所述根据所述测试程序所指示的执行方式、事件内容和/或事件类型,对所述目标程序进行失败恢复测试,包括:
    当所述测试程序的事件类型为延迟时,查询已执行的测试程序中是否存在延迟时间未结束的测试程序;
    若存在,则根据所述延迟时间未结束的测试程序的剩余延迟时间,以及所述测试程序的事件内容所指示的延迟时间,确定所述测试程序的实际延迟时间;
    依据所述测试程序的实际延迟时间,对所述目标程序进行延迟。
  5. 根据权利要求2所述的软件测试方法,其特征在于,所述测试点包括:测试点标识、宏和自定义代码;所述执行到所述目标程序中所预先设置的测试点之后,还包括:
    根据所述测试点中的宏所指示的自定义代码与测试程序的执行顺序,执行所述自定义代码。
  6. 根据权利要求1-5任一项所述的软件测试方法,其特征在于,所述调用所述测试点对应的测试程序对所述目标程序进行测试之前,还包括:
    接收更新请求;
    根据所述更新请求,对所述更新请求所指示的测试程序进行更新。
  7. 根据权利要求6所述的软件测试方法,其特征在于,所述更新请求包括测试点标 识,以及执行方式、事件内容和/或事件类型;
    所述根据所述更新请求,对所述更新请求所指示的测试程序进行更新,包括:
    将所述更新请求中测试点标识对应的测试程序中的执行方式、事件内容和/或事件类型,对应更新为所述更新请求中的执行方式、事件内容和/或事件类型。
  8. 根据权利要求1-5任一项所述的软件测试方法,其特征在于,所述执行目标程序之前,还包括:
    将所述目标程序中的各测试点设置为关闭状态;
    对所述目标程序进行编译。
  9. 根据权利要求8所述的软件测试方法,其特征在于,在所述对所述目标程序进行编译之后,还包括:
    接收用于设置开闭状态的请求;
    根据所述用于设置开闭状态的请求,设置所述目标程序中的测试点为开启状态或关闭状态;
    所述调用所述测试点对应的测试程序对所述目标程序进行测试之前,还包括:
    确认所述测试点处于开启状态。
  10. 一种软件测试装置,其特征在于,包括:
    执行模块,用于执行目标程序;
    调用模块,用于当执行到所述目标程序中所预先设置的测试点时,调用所述测试点对应的测试程序对所述目标程序进行测试。
  11. 根据权利要求10所述的软件测试装置,其特征在于,
    所述调用模块,具体用于调用所述测试程序对所述目标程序进行失败恢复测试。
  12. 根据权利要求11所述的软件测试装置,其特征在于,所述调用模块,包括:
    查询单元,用于根据所述测试点中的测试点标识,在用于记录测试程序的容器中查询所述测试点标识所标记的测试程序;
    测试单元,用于根据所述测试程序所指示的执行方式、事件内容和/或事件类型,对所述目标程序进行失败恢复测试。
  13. 根据权利要求12所述的软件测试装置,其特征在于,所述测试单元,包括:
    查询子单元,用于当所述测试程序的事件类型为延迟时,查询已执行的测试程序中是否存在延迟时间未结束的测试程序;
    计算子单元,用于若存在,则根据所述延迟时间未结束的测试程序的剩余延迟时间, 以及所述测试程序的事件内容所指示的延迟时间,确定所述测试程序的实际延迟时间;
    执行子单元,用于依据所述测试程序的实际延迟时间,对所述目标程序进行延迟。
  14. 根据权利要求10所述的软件测试装置,其特征在于,所述测试点包括:测试点标识、宏和自定义代码;所述装置,还包括:
    自定义模块,用于根据所述测试点中的宏所指示的自定义代码与测试程序的执行顺序,执行所述自定义代码。
  15. 根据权利要求10-14任一项所述的软件测试装置,其特征在于,所述装置,还包括:
    接收模块,用于接收更新请求;
    更新模块,用于根据所述更新请求,对所述更新请求所指示的测试程序进行更新。
  16. 根据权利要求15所述的软件测试装置,其特征在于,所述更新请求包括测试点标识,以及执行方式、事件内容和/或事件类型;
    所述更新模块,具体用于将所述更新请求中测试点标识对应的测试程序中的执行方式、事件内容和/或事件类型,对应更新为所述更新请求中的执行方式、事件内容和/或事件类型。
  17. 根据权利要求10-14任一项所述的软件测试装置,其特征在于,所述装置,还包括:
    编译模块,用于将所述目标程序中的各测试点设置为关闭状态之后,对所述目标程序进行编译。
  18. 根据权利要求17所述的软件测试装置,其特征在于,所述装置,还包括:
    状态接收模块,用于接收用于设置开闭状态的请求;
    设置模块,用于根据所述用于设置开闭状态的请求,设置所述目标程序中的测试点为开启状态或关闭状态;
    确认模块,用于调用所述测试点对应的测试程序对所述目标程序进行测试之前,确认所述测试点处于开启状态。
PCT/CN2017/076399 2016-03-23 2017-03-13 软件测试方法和装置 Ceased WO2017162058A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610168942.XA CN107229558B (zh) 2016-03-23 2016-03-23 软件测试方法和装置
CN201610168942.X 2016-03-23

Publications (1)

Publication Number Publication Date
WO2017162058A1 true WO2017162058A1 (zh) 2017-09-28

Family

ID=59899200

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/076399 Ceased WO2017162058A1 (zh) 2016-03-23 2017-03-13 软件测试方法和装置

Country Status (3)

Country Link
CN (1) CN107229558B (zh)
TW (1) TW201734791A (zh)
WO (1) WO2017162058A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108256331A (zh) * 2018-01-04 2018-07-06 郑州云海信息技术有限公司 一种服务器bmc安全方案的测试方法
US10248554B2 (en) 2016-11-14 2019-04-02 International Business Machines Corporation Embedding profile tests into profile driven feedback generated binaries
CN112069083A (zh) * 2020-11-12 2020-12-11 深圳开源互联网安全技术有限公司 一种测试用例的设计方法、装置及存储介质
US10929117B2 (en) 2018-02-08 2021-02-23 Red Hat, Inc. Container image building using shared resources

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI682295B (zh) 2018-11-05 2020-01-11 財團法人資訊工業策進會 測試資料產生裝置及測試資料產生方法
CN111143229A (zh) * 2019-12-31 2020-05-12 中国银行股份有限公司 软件测试方法及装置、计算机设备及计算机可读存储介质
CN113568796B (zh) * 2021-08-04 2024-09-10 上海肇观电子科技有限公司 模块测试方法和装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101183335A (zh) * 2007-12-25 2008-05-21 中兴通讯股份有限公司 一种实现嵌入式软件异常测试的方法及系统
CN103761184A (zh) * 2013-12-31 2014-04-30 华为技术有限公司 程序的代码段测试方法、装置和系统
CN104834590A (zh) * 2014-02-11 2015-08-12 腾讯科技(深圳)有限公司 软件测试方法和系统
CN105224466A (zh) * 2015-11-17 2016-01-06 广州亦云信息技术有限公司 一种基于Docker的集成测试方法及系统
WO2016001982A1 (ja) * 2014-06-30 2016-01-07 株式会社 日立製作所 テストデータ生成支援装置、及びテストデータ生成支援方法

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105095087A (zh) * 2015-08-31 2015-11-25 武汉启明联创信息科技有限公司 一种基于权限操作的软件测试系统和方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101183335A (zh) * 2007-12-25 2008-05-21 中兴通讯股份有限公司 一种实现嵌入式软件异常测试的方法及系统
CN103761184A (zh) * 2013-12-31 2014-04-30 华为技术有限公司 程序的代码段测试方法、装置和系统
CN104834590A (zh) * 2014-02-11 2015-08-12 腾讯科技(深圳)有限公司 软件测试方法和系统
WO2016001982A1 (ja) * 2014-06-30 2016-01-07 株式会社 日立製作所 テストデータ生成支援装置、及びテストデータ生成支援方法
CN105224466A (zh) * 2015-11-17 2016-01-06 广州亦云信息技术有限公司 一种基于Docker的集成测试方法及系统

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10248554B2 (en) 2016-11-14 2019-04-02 International Business Machines Corporation Embedding profile tests into profile driven feedback generated binaries
CN108256331A (zh) * 2018-01-04 2018-07-06 郑州云海信息技术有限公司 一种服务器bmc安全方案的测试方法
US10929117B2 (en) 2018-02-08 2021-02-23 Red Hat, Inc. Container image building using shared resources
US11599348B2 (en) 2018-02-08 2023-03-07 Red Hat, Inc. Container image building using shared resources
CN112069083A (zh) * 2020-11-12 2020-12-11 深圳开源互联网安全技术有限公司 一种测试用例的设计方法、装置及存储介质

Also Published As

Publication number Publication date
CN107229558A (zh) 2017-10-03
TW201734791A (zh) 2017-10-01
CN107229558B (zh) 2020-10-16

Similar Documents

Publication Publication Date Title
WO2017162058A1 (zh) 软件测试方法和装置
CN109960643B (zh) 一种代码测试方法和装置
US11748245B2 (en) Object-oriented regression-candidate filter
CN109669873B (zh) 用户界面自动测试方法及装置、电子设备及存储介质
Liao et al. Toward a service platform for developing smart contracts on blockchain in bdd and tdd styles
CN109977008B (zh) 一种应用程序依赖的js代码与原生库兼容的方法及终端
US20190073292A1 (en) State machine software tester
JP6726140B2 (ja) 技術的システムのオペレーティングソフトウェアの変更およびシミュレーション
US20060036910A1 (en) Automated testing framework for event-driven systems
CN109885337A (zh) 一种系统版本升级方法、装置、设备及可读存储介质
CN108701057B (zh) 用于供应部署管道的计算机可读存储介质、系统和方法
WO2016127566A1 (zh) 补丁处理方法及装置
CN117827669A (zh) 接口自动化测试装置
CN113742215A (zh) 一种自动配置和调用测试工具进行测试分析的方法及系统
WO2025246269A1 (zh) 一种测试代码修复方法及相关设备
CN113721948A (zh) 一种数据库升级方法、系统及存储介质
CN109766125B (zh) 批次间追平冲突的识别方法及装置
CN104679648B (zh) 跨应用的自动化测试方法
JP7015625B2 (ja) プロセスアプリケーションを開発及び診断するためのステップバック機構
CN109947645A (zh) 自动化配置工具方法及系统
TWI773939B (zh) 版本管理系統、版本管理方法及非揮發性電腦可讀取記錄媒體
CN112631650A (zh) 插件版本信息校验方法、计算设备及存储介质
CN119127213B (zh) 一种嵌入式软件开发方法及系统
TWI905825B (zh) 用以管理與測試用例之執行相關之測試資料之裝置、方法及記錄媒體
CN111427762A (zh) 自动调用工具分析技术

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

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

Ref document number: 17769335

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17769335

Country of ref document: EP

Kind code of ref document: A1