WO2020177519A1 - 在智能终端上执行的调试方法以及软件调试器 - Google Patents

在智能终端上执行的调试方法以及软件调试器 Download PDF

Info

Publication number
WO2020177519A1
WO2020177519A1 PCT/CN2020/075524 CN2020075524W WO2020177519A1 WO 2020177519 A1 WO2020177519 A1 WO 2020177519A1 CN 2020075524 W CN2020075524 W CN 2020075524W WO 2020177519 A1 WO2020177519 A1 WO 2020177519A1
Authority
WO
WIPO (PCT)
Prior art keywords
debugging
information
page
tested
interface call
Prior art date
Application number
PCT/CN2020/075524
Other languages
English (en)
French (fr)
Inventor
解楠
张聪萍
Original Assignee
中国银联股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中国银联股份有限公司 filed Critical 中国银联股份有限公司
Publication of WO2020177519A1 publication Critical patent/WO2020177519A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3628Software debugging of optimised code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • 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
    • 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
    • G06F11/3644Software debugging by instrumenting at runtime

Definitions

  • the present invention relates to the field of software debugging, and in particular, to a debugging method executed on an intelligent terminal (ie, real machine development and debugging), a software debugger, a computer storage medium, and an intelligent terminal.
  • H5 ie HTML 5
  • program developers write pure H5 code, and finally load and render through the native Webview component.
  • This hybrid development model is very conducive to front-end access and is suitable for rapid business iteration, but because the pages in the APP run in the client Webview framework, there will be various compatibility issues due to different platforms and vendors.
  • the existing debugging methods only rely on testing, code inspection, and user feedback, and cannot fully discover and locate these compatibility issues.
  • the existing debugging methods also have certain requirements on the development environment, such as the need to download some configuration files on the Google server, and the need to package a special debug version on the client side, which further exacerbates the problems of difficulty in positioning and development and debugging.
  • the invention provides a solution for the development and debugging of a real machine, which solves the problems of difficulty in positioning and development and debugging by performing page debugging in the real machine.
  • a debugging method executed on a smart terminal comprising: when an interface call initiated by a page to be tested is called, intercepting the interface call and obtaining a first debugging method Information; after obtaining the first information, execute the interface call; intercept the response to the interface call, and obtain the second information for debugging; and after obtaining the second information, send to the waiting The test page executes the response.
  • the aforementioned debugging method further includes: classifying and converting the first information and the second information into a standard json data format.
  • the page to be tested is an H5 page.
  • the interface call includes a client plug-in function and a background interface message request.
  • the above-mentioned debugging method further includes: injecting a self-executable debugging file after loading the page to be tested, so that the entrance of the debugging panel appears in the page to be tested.
  • the foregoing debugging method further includes: dynamically introducing a debugging file by configuring a debugging identifier in the code provided for third-party access.
  • the debugging file is a js file.
  • the interception of the request or response of the interface call is implemented by intercepting and rewriting the native method of the client plug-in.
  • the intercepting and rewriting includes: deep copying the original core function of the client plug-in; periodically polling whether the original core function is in a state that can be rewritten; if so, rewriting the original core function; The core function is rewritten to generate a second core function that can not only collect information for debugging but also perform the function of the original core function.
  • a software debugger comprising: a first interception device, used to intercept the interface call initiated by the page to be tested and obtain the user The first information for debugging; the first execution device is used to execute the interface call after obtaining the first information; the second interception device is used to intercept the response to the interface call and obtain the information used for debugging And a second execution device for executing the response to the page to be tested after obtaining the second information.
  • the above-mentioned software debugger further includes: a conversion device for classifying and converting the first information and the second information into a standard json data format.
  • the page to be tested is an H5 page.
  • the interface call includes a client plug-in function and a background interface message request.
  • the above-mentioned software debugger further includes: an injection device for injecting a self-executable debugging file after loading the page to be tested, so that an entrance of the debugging panel appears in the page to be tested.
  • the above-mentioned software debugger further includes: an import device, which is used to dynamically import a debugging file by configuring a debugging identifier in the code provided for third-party access.
  • an import device which is used to dynamically import a debugging file by configuring a debugging identifier in the code provided for third-party access.
  • the debugging file is a js file.
  • the first interception device and the second interception device are implemented based on intercepting and rewriting the native method of the client plug-in.
  • the intercepting and rewriting includes: deep copying the original core function of the client plug-in; periodically polling whether the original core function is in a state that can be rewritten; if so, yes
  • the original core function is rewritten to generate a second core function that can not only collect information for debugging, but also perform the functions of the original core function.
  • a computer storage medium including instructions, which execute the aforementioned debugging method at runtime.
  • an intelligent terminal is provided, and the intelligent terminal includes the software debugger as described above.
  • the technical scheme of the present invention intercepts and obtains the interface call and the response of the client plug-in to the interface call, so that the developer can see the system information, the content of the page message and the execution of the client plug-in call in real time in a real machine environment, which is helpful Locate the problem for the developer and debug the code accordingly.
  • FIG. 1 is a flowchart showing a debugging method executed on a smart terminal according to an embodiment of the present invention
  • Figure 2 is a structural diagram showing a software debugger of an embodiment of the present invention.
  • Fig. 3 is a schematic diagram showing the interaction of a debugging method according to an embodiment of the present invention.
  • Hybrid APP “Hybrid APP Development” or “Hybrid Application Development” refer to hybrid mobile application development that combines Web network technologies (such as HTML, CSS, and Javascript) with Native.
  • Cordova refers to a mobile development framework that provides a set of device-related APIs. Through this set of APIs, mobile applications can use JavaScript to access native device functions, such as cameras and microphones. Cordova supports a variety of mobile operating systems, including IOS, Android, Blackberry, etc.
  • Webview refers to a client-side browsing control/component that uses a rendering engine to display page content. Webview can load and display web pages, pictures, etc., and can be regarded as a browser.
  • FIG. 1 shows a flowchart 1000 of a debugging method executed on a smart terminal according to an embodiment of the present invention.
  • the term "smart terminal” includes mobile devices, such as mobile phones.
  • the debugging method 1000 executed on the smart terminal includes: step A1, when an interface call initiated by a page to be tested is invoked, intercept the interface call and obtain first information for debugging; step A2, After obtaining the first information, execute the interface call; step A3, intercept (for example, a client plug-in) response to the interface call, and obtain the second information for debugging; and step A4, after obtaining the After the second information is described, the response is executed to the page to be tested.
  • the first information and the second information used for debugging may include: url (uniform resource locator), method (request mode), pluginName (Cordova plugin name), actionName (Cordova plugin behavior function name), params (request parameters), status (response status), responseType (response type), responseHeaders (response header information), response (response data), startTime (call start time), endTime (response end time), costTime (call start time) The time elapsed between the end of the response).
  • the above-mentioned debugging method 1000 may further include: step A5, classifying and converting the first information and the second information into a standard json data format for display, for example.
  • the page to be tested is an H5 page.
  • the interface call includes a client plug-in function and a background interface message request.
  • the above-mentioned debugging method 1000 further includes: step B1, before step A1, injecting a self-executable debugging file when or after, for example, Webview loads the page to be tested.
  • the aforementioned debugging file may be a js file.
  • a self-executing local js file is provided. After the webview loads the page and triggers the finish event, the js file is injected, so that the debug panel entry can be seen on the H5 page.
  • the above-mentioned debugging method 1000 further includes: Step B2: Before step A1, a debugging file is dynamically imported by configuring a debugging identifier in the code provided for third-party access.
  • the aforementioned debugging file may be a js file.
  • the debug panel js file is dynamically introduced through the debug identification configuration.
  • the developer can see the system information, the content of the page message and the call execution status of the client plug-in in real time in the real machine environment when the Hrybrid+H5 hybrid development mode is adopted. This makes it easy for developers to locate problems and debug code.
  • the storage medium may include: flash disk, read-only memory, random access memory, magnetic disk or optical disk, etc.
  • Fig. 2 is a structural diagram showing a software debugger according to an embodiment of the present invention.
  • the software debugger 2000 includes: a first interception device 210, a first execution device 220, a second interception device 230, and a second execution device 240.
  • the first intercepting device 210 is configured to intercept the interface call and obtain the first information for debugging when the interface call is initiated by the page to be tested.
  • the first execution device 220 is configured to execute the interface call after acquiring the first information.
  • the second intercepting device 230 is used for intercepting the response to the interface call and acquiring the second information for debugging.
  • the second execution device 240 is configured to execute the response to the page to be tested after acquiring the second information.
  • the above-mentioned software debugger 2000 may further include a conversion device.
  • the conversion device is used to convert the first information and the second information into a standard json data format, for example, for display.
  • the page to be tested is an H5 page
  • the interface call includes a client plug-in function and a background interface message request.
  • the above-mentioned software debugger further includes: an injection device for injecting a debugging file (such as a js file) when the Webview loads the page to be tested, for example.
  • the above-mentioned software debugger includes: an introduction device for dynamically introducing a debugging file (such as a js file) in the code provided for third-party access by configuring a debugging identifier.
  • the software debugger described above is only illustrative.
  • the division of the devices is only a logical function division, and there may be other divisions in actual implementation, for example, multiple devices can be combined or integrated into another System.
  • Fig. 3 is a schematic diagram showing the interaction of a debugging method according to an embodiment of the present invention. This embodiment rewrites the underlying functions of Cordova's native code, intercepts and obtains Cordova execution information, converts the execution information into a standard json data format, and displays it in different tab pages of the debugging panel.
  • Webview injects debugging js after the H5 page is loaded (loadFinish event is triggered).
  • the main function of debugging js implemented in this embodiment is to intercept the corresponding API (application program interface) method when initiating interface calls (including client plug-in functions and background interface message requests) through cordova/ajax in the H5 page. Interception is divided into the following two steps:
  • the information that can be used for debugging collected in steps 1) 2) is classified and converted into a standard json data format, and then displayed in different tab pages of the debugging panel.
  • the function/request call includes: Cordova's exec (execution function), ajax's open (open function), and ajax's send (send function).
  • the function/request response includes: Cordova's success/failure callback function, and ajax's onreadystatechange (state change monitoring function).
  • the information that can be used for debugging includes: url (uniform resource locator), method (request method), pluginName (Cordova plugin name), actionName (Cordova plugin behavior function name), params (request parameters), status (Response status), responseType (response type), responseHeaders (response header information), response (response data), startTime (call start time), endTime (response end time), costTime (the time spent between the start of the call and the end of the response) time).
  • the embodiment of the present invention is different from the existing proxy mode using protocols such as http or websocket, and adopts a form of rewriting core methods or functions.
  • the specific implementation form can be as follows:
  • oldFunc coreFunc//Object deep copy, so that it does not affect the normal execution of subsequent requests
  • the role of newFunc includes (a) collecting debugging information and (b) executing the original core method or function oldFunc.
  • the embodiments of the present invention can also debug messages sent through client plug-ins or rely on clients under the H5 hybrid APP development mode.
  • the computer software product is stored in a storage medium and includes a number of instructions to enable one or more computer devices (which can be A personal computer, a server or a network device, etc.) execute all or part of the steps of the method.

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

一种在智能终端上执行的调试方法、软件调试器、计算机存储介质以及智能终端,所述方法包括在待测试页面发起的接口调用时,对所述接口调用进行拦截并获取用于调试的第一信息(A1);在获取所述第一信息后,执行所述接口调用(A2);拦截对所述接口调用的响应,并获取用于调试的第二信息(A3);以及在获取所述第二信息后,向所述待测试页面执行所述响应(A4)。

Description

在智能终端上执行的调试方法以及软件调试器 技术领域
本发明涉及软件调试领域,特别地,涉及在智能终端上执行的调试方法(即真机开发调试)、软件调试器、计算机存储介质以及智能终端。
背景技术
随着移动浪潮的兴起,各种APP应用层出不穷,极速的业务扩展提升了团队对开发效率的要求。H5(即HTML 5)作为一种高级网页技术,由于其低成本、高效率、跨平台等特性,被利用起来而形成一种混合APP开发模式。在这种混合开发模式下,程序开发人员写的是纯粹的H5代码,最后通过原生端的Webview组件来加载渲染。
这种混合开发模式非常有利于前端接入,适合业务快速迭代,但由于APP中页面运行在客户端Webview框架内,会因为平台、厂商不同而有种种兼容性问题。然而,现有的调试方法仅靠测试、代码检查以及用户反馈等手段,不能全面地发现和定位这些兼容性问题。而且,现有的调试方法还对开发环境有一定的要求,例如需要上google服务器下载一些配置文件,需要客户端打包特殊debug版本等,这进一步加剧了定位难和开发调试难的问题。
以上公开于本发明背景部分的信息仅仅旨在增加对本发明的总体背景的理解,而不应当被视为承认或以任何形式暗示该信息构成已为本领域一般技术人员所公知的现有技术。
发明内容
本发明提供了一种真机开发调试的解决方案,通过在真机中进行页面调试,来解决问题定位难和开发调试难的问题。
根据本发明的一个方面,提供了一种在智能终端上执行的调试方法,所述方法包括:在待测试页面发起的接口调用时,对所 述接口调用进行拦截并获取用于调试的第一信息;在获取所述第一信息后,执行所述接口调用;拦截对所述接口调用的响应,并获取用于调试的第二信息;以及在获取所述第二信息后,向所述待测试页面执行所述响应。
可选地,上述调试方法还包括:将所述第一信息和所述第二信息分类转换成标准json数据格式。
可选地,在上述调试方法中,所述待测试页面为H5页面。
可选地,在上述调试方法中,所述接口调用包括客户端插件功能和后台接口报文请求。
可选地,上述调试方法还包括:在加载所述待测试页面完成后注入可自执行的调试文件,使得在所述待测试页面中出现调试面板的入口。
可选地,上述调试方法还包括:在提供给第三方接入的代码中通过配置调试标识来动态引入调试文件。
可选地,在上述调试方法中,所述调试文件为js文件。
可选地,在上述调试方法中,对所述接口调用的请求或响应的拦截通过对所述客户端插件原生方法进行拦截重写来实现。
可选地,在上述调试方法中,所述拦截重写包括:深拷贝所述客户端插件的原核心函数;定时轮询所述原核心函数是否处于可被重写的状态;若是,对原核心函数进行重写,以便产生既能够收集用于调试的信息又能够执行该原核心函数的功能的第二核心函数。
根据本发明的另一个方面,提供了一种软件调试器,所述软件调试器包括:第一拦截装置,用于在待测试页面发起的接口调用时,对所述接口调用进行拦截并获取用于调试的第一信息;第一执行装置,用于在获取所述第一信息后,执行所述接口调用;第二拦截装置,用于拦截对所述接口调用的响应,并获取用于调试的第二信息;以及第二执行装置,用于在获取所述第二信息后,向所述待测试页面执行所述响应。
可选地,上述软件调试器还包括:转换装置,用于将所述第 一信息和所述第二信息分类转换成标准json数据格式。
可选地,在上述软件调试器中,所述待测试页面为H5页面。
可选地,在上述软件调试器中,所述接口调用包括客户端插件功能和后台接口报文请求。
可选地,上述软件调试器还包括:注入装置,用于在加载所述待测试页面完成后注入可自执行的调试文件,使得在所述待测试页面中出现调试面板的入口。
可选地,上述软件调试器还包括:引入装置,用于在提供给第三方接入的代码中通过配置调试标识来动态引入调试文件。
可选地,在上述软件调试器中,所述调试文件为js文件。
可选地,在上述软件调试器中,所述第一拦截装置和所述第二拦截装置基于对所述客户端插件原生方法进行拦截重写来实现。
可选地,在上述软件调试器中,所述拦截重写包括:深拷贝所述客户端插件的原核心函数;定时轮询所述原核心函数是否处于可被重写的状态;若是,对原核心函数进行重写,以便产生既能够收集用于调试的信息又能够执行该原核心函数的功能的第二核心函数。
根据本发明的又一个方面,提供了一种计算机存储介质,包括指令,所述指令在运行时执行如前所述的调试方法。
根据本发明的又一个方面,提供了一种智能终端,所述智能终端包括如前所述的软件调试器。
本发明的技术方案通过拦截获取接口调用以及客户端插件针对该接口调用的响应,使得开发者在真机环境下可以实时看到系统信息,页面报文内容以及客户端插件调用执行情况,有助于开发者定位问题并相应地进行代码调试。
通过纳入本文的附图以及随后与附图一起用于说明本发明的某些原理的具体实施方式,本发明的方法和装置所具有的其它特征和优点将更为具体地变得清楚或得以阐明。
附图说明
图1是表示本发明的一个实施例的在智能终端上执行的调试方法的流程图;
图2是表示本发明的一个实施例的软件调试器的结构图;以及
图3是表示本发明的一个实施例的调试方法的交互示意图。
具体实施方式
以下说明描述了本发明的特定实施方式以教导本领域技术人员如何制造和使用本发明的最佳模式。为了教导发明原理,已简化或省略了一些常规方面。本领域技术人员应该理解源自这些实施方式的变型将落在本发明的范围内。本领域技术人员应该理解下述特征能够以各种方式接合以形成本发明的多个变型。由此,本发明并不局限于下述特定实施方式,而仅由权利要求和它们的等同物限定。
在本发明的上下文中,术语“Hybrid APP”、“混合APP开发”或“混合应用开发”表示通过Web网络技术(如HTML、CSS和Javascript)与Native相结合的混合移动应用程序开发。
术语“Cordova”表示一种移动开发框架,其提供了一组设备相关的API,通过这组API,移动应用能够以JavaScript访问原生的设备功能,如摄像头、麦克风等。Cordova支持多种移动操作系统,包括IOS、Android、Blackberry等。
术语“Webview”表示一种客户端的浏览控件/组件,其内部采用渲染引擎来显示页面内容。Webview能加载显示网页、图片等,可以将其视为一个浏览器。
参考图1,它示出了根据本发明的一个实施例的在智能终端上执行的调试方法的流程图1000。在本发明的上下文中,术语“智能终端”包括移动设备,例如手机。
如图1所示,在智能终端上执行的调试方法1000包括:步骤A1,在待测试页面发起的接口调用时,对所述接口调用进行 拦截并获取用于调试的第一信息;步骤A2,在获取所述第一信息后,执行所述接口调用;步骤A3,拦截(例如客户端插件)对所述接口调用的响应,并获取用于调试的第二信息;以及步骤A4,在获取所述第二信息后,向所述待测试页面执行所述响应。
在一个实施例中,用于调试的第一信息和第二信息可以包括:url(统一资源定位符)、method(请求方式)、pluginName(Cordova插件名)、actionName(Cordova插件行为函数名)、params(请求参数)、status(响应状态)、responseType(响应类型)、responseHeaders(响应头信息)、response(响应数据)、startTime(调用开始时间)、endTime(响应结束时间)、costTime(调用开始到响应结束之间所耗费的时间)。
优选地,上述调试方法1000还可包括:步骤A5,将所述第一信息和所述第二信息分类转换成标准json数据格式,以便例如进行展示。
在一个实施例中,所述待测试页面为H5页面。在一个实施例中,所述接口调用包括客户端插件功能和后台接口报文请求。
尽管图1中未示出,在一个实施例中,上述调试方法1000还包括:步骤B1,在步骤A1之前,在例如Webview加载所述待测试页面完成时或之后注入可自执行的调试文件。在一个实施例中,前述调试文件可以为js文件。例如,在客户端debug版本中,提供可自执行的本地js文件,在webview加载页面触发finish事件后,注入该js文件,使得H5页面中可以看到调试面板入口。
在另一个实施例中,上述调试方法1000还包括:步骤B2:在步骤A1之前,在提供给第三方接入的代码中通过配置调试标识来动态引入调试文件。在一个实施例中,前述调试文件可以为js文件。例如,在提供给第三方接入的upsdk.js代码中,通过debug标识配置来动态引入调试面板js文件。
通过本发明的智能终端侧的调试方法,可以使开发者在采用Hrybrid+H5的混合开发模式时在真机环境下实时看到系统信息,页面报文内容以及客户端插件的调用执行情况。这方便了开发者 定位问题,从而进行代码调试。
本领域普通技术人员可以理解,上述一个或多个实施例的方法中的全部或部分步骤时可以通过程序来指令终端设备相关的硬件来完成的,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器、随机存储器、磁盘或光盘等。
图2是表示本发明的一个实施例的软件调试器的结构图。如图2所示,软件调试器2000包括:第一拦截装置210、第一执行装置220、第二拦截装置230以及第二执行装置240。其中,第一拦截装置210用于在待测试页面发起的接口调用时,对所述接口调用进行拦截并获取用于调试的第一信息。第一执行装置220用于在获取所述第一信息后,执行所述接口调用。第二拦截装置230用于拦截对所述接口调用的响应,并获取用于调试的第二信息。第二执行装置240用于在获取所述第二信息后,向所述待测试页面执行所述响应。
尽管图2中未示出,在一个实施例中,上述软件调试器2000还可包括转换装置。该转换装置用于将所述第一信息和所述第二信息分类转换成标准json数据格式,以便例如进行展示。
在一个实施例中,在上述软件调试器中,所述待测试页面为H5页面,所述接口调用包括客户端插件功能和后台接口报文请求。
在一个实施例中,上述软件调试器还包括:注入装置,用于在例如Webview加载所述待测试页面完成时注入调试文件(例如js文件)。可选地,上述软件调试器包括:引入装置,用于在提供给第三方接入的代码中通过配置调试标识来动态引入调试文件(例如js文件)。
以上所描述的软件调试器仅仅是示意性的,例如所述装置的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个装置可以结合或者可以集成到另一个系统中。
图3是表示本发明的一个实施例的调试方法的交互示意图。 该实施例通过对Cordova原生代码的底层功能进行重写,拦截获取Cordova执行信息,将执行信息分类转换成标准json数据格式后,在调试面板的不同tab页面中进行展示。
具体来说,如图3所示,Webview在H5页面加载完成后(loadFinish事件被触发)注入调试js。该实施例实现的调试js的主要作用是在H5页面中通过cordova/ajax发起接口调用(包括客户端插件功能和后台接口报文请求)时,对相应的API(应用程序接口)方法进行拦截,拦截分为以下两步:
1)在H5页面发起功能/请求调用时进行拦截,获取调试所需信息后再执行原功能/请求调用;
2)在H5页面中对获取功能/请求响应的API方法进行拦截,获取调试所需信息后再执行原功能/请求响应。
拦截完成后将步骤1)2)中收集的可用于调试的信息分类转换成标准json数据格式后,在调试面板的不同tab页面中进行展示。
在一个实施例中,功能/请求调用包含:Cordova的exec(执行函数)、ajax的open(打开函数)、ajax的send(发送函数)。
在一个实施例中,功能/请求响应包含:Cordova的成功/失败回调函数、ajax的onreadystatechange(状态变化监听函数)。
在一个实施例中,可用于调试的信息包含:url(统一资源定位符)、method(请求方式)、pluginName(Cordova插件名)、actionName(Cordova插件行为函数名)、params(请求参数)、status(响应状态)、responseType(响应类型)、responseHeaders(响应头信息)、response(响应数据)、startTime(调用开始时间)、endTime(响应结束时间)、costTime(调用开始到响应结束之间所耗费的时间)。
本发明的实施例区别于现有利用http或websocket等协议进行代理的模式,采用了对核心方法或函数进行重写的形式。尤其是对于Cordova插件原生方法的拦截重写,具体实现形式例如可以如下所示:
1.存储核心方法或函数coreFunc
oldFunc=coreFunc//对象深拷贝,使之不影响后续请求的正常执行
2.定时轮询判断原核心方法oldFunc是否处于可被重写的状态,上下文是否准备妥当。
3.重写核心方法或函数
coreFunc=newFunc
其中,newFunc作用包括(a)收集调试信息以及(b)执行原核心方法或函数oldFunc。
相较于现有技术仅能调试一些网页页面技术(例如H5技术)相关的内容,本发明的实施例在利用H5的混合APP开发模式下同样能够调试通过客户端插件发送的报文或依赖客户端功能实现的内容。
本领域普通技术人员可以理解,上述一个或多个实施例可以以软件产品的形式体现出来,该计算机软件产品存储在存储介质中,包括若干指令用以使得一台或多台计算机设备(可为个人计算机、服务器或网络设备等)执行所述方法的全部或部分步骤。
以上例子主要说明了本发明的在智能终端上执行的调试方法、软件调试器、计算机存储介质以及智能终端。尽管只对其中一些本发明的具体实施方式进行了描述,但是本领域普通技术人员应当了解,本发明可以在不偏离其主旨与范围内以许多其他的形式实施。因此,所展示的例子与实施方式被视为示意性的而非限制性的,在不脱离如所附各权利要求所定义的本发明精神及范围的情况下,本发明可能涵盖各种的修改与替换。

Claims (20)

  1. 一种在智能终端上执行的调试方法,其特征在于,所述方法包括:
    步骤A1:在待测试页面发起的接口调用时,对所述接口调用进行拦截并获取用于调试的第一信息;
    步骤A2:在获取所述第一信息后,执行所述接口调用;
    步骤A3:拦截对所述接口调用的响应,并获取用于调试的第二信息;以及
    步骤A4:在获取所述第二信息后,向所述待测试页面执行所述响应。
  2. 如权利要求1所述的调试方法,还包括:
    步骤A5:将所述第一信息和所述第二信息分类转换成标准json数据格式。
  3. 如权利要求1所述的方法,其中,所述待测试页面为H5页面。
  4. 如权利要求1所述的方法,其中,所述接口调用包括客户端插件功能和后台接口报文请求。
  5. 如权利要求1所述的方法,还包括:
    步骤B1:在步骤A1之前,在加载所述待测试页面完成后注入可自执行的调试文件,使得在所述待测试页面中出现调试面板的入口。
  6. 如权利要求1所述的方法,还包括:
    步骤B2:在步骤A1之前,在提供给第三方接入的代码中通过配置调试标识来动态引入调试文件。
  7. 如权利要求5或6所述的方法,其中,所述调试文件为js文件。
  8. 如权利要求1所述的方法,其中,对所述接口调用的请求或响应的拦截通过对所述客户端插件原生方法进行拦截重写来实现。
  9. 如权利要求8所述的方法,其中,所述拦截重写包括:
    深拷贝所述客户端插件的原核心函数;
    定时轮询所述原核心函数是否处于可被重写的状态;
    若是,对原核心函数进行重写,以便产生既能够收集用于调试的信息又能够执行该原核心函数的功能的第二核心函数。
  10. 一种软件调试器,其特征在于,所述软件调试器包括:
    第一拦截装置,用于在待测试页面发起的接口调用时,对所述接口调用进行拦截并获取用于调试的第一信息;
    第一执行装置,用于在获取所述第一信息后,执行所述接口调用;
    第二拦截装置,用于拦截对所述接口调用的响应,并获取用于调试的第二信息;以及
    第二执行装置,用于在获取所述第二信息后,向所述待测试页面执行所述响应。
  11. 如权利要求10所述的软件调试器,还包括:
    转换装置,用于将所述第一信息和所述第二信息分类转换成标准json数据格式。
  12. 如权利要求10所述的软件调试器,其中,所述待测试页面为H5页面。
  13. 如权利要求10所述的软件调试器,其中,所述接口调用包括客户端插件功能和后台接口报文请求。
  14. 如权利要求10所述的软件调试器,还包括:
    注入装置,用于在加载所述待测试页面完成后注入可自执行的调试文件,使得在所述待测试页面中出现调试面板的入口。
  15. 如权利要求10所述的软件调试器,还包括:
    引入装置,用于在提供给第三方接入的代码中通过配置调试标识来动态引入调试文件。
  16. 如权利要求14或15所述的软件调试器,其中,所述调试文件为js文件。
  17. 如权利要求10所述的软件调试器,其中,所述第一拦截 装置和所述第二拦截装置基于对所述客户端插件原生方法进行拦截重写来实现。
  18. 如权利要求17所述的软件调试器,其中,所述拦截重写包括:
    深拷贝所述客户端插件的原核心函数;
    定时轮询所述原核心函数是否处于可被重写的状态;
    若是,对原核心函数进行重写,以便产生既能够收集用于调试的信息又能够执行该原核心函数的功能的第二核心函数。
  19. 一种计算机存储介质,包括指令,所述指令在运行时执行如权利要求1至9中任一项所述的方法。
  20. 一种智能终端,所述智能终端包括如权利要求10至18中任一项所述的软件调试器。
PCT/CN2020/075524 2019-03-05 2020-02-17 在智能终端上执行的调试方法以及软件调试器 WO2020177519A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910163934.XA CN111666199B (zh) 2019-03-05 2019-03-05 在智能终端上执行的调试方法以及软件调试器
CN201910163934.X 2019-03-05

Publications (1)

Publication Number Publication Date
WO2020177519A1 true WO2020177519A1 (zh) 2020-09-10

Family

ID=72336884

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/075524 WO2020177519A1 (zh) 2019-03-05 2020-02-17 在智能终端上执行的调试方法以及软件调试器

Country Status (2)

Country Link
CN (1) CN111666199B (zh)
WO (1) WO2020177519A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113641581A (zh) * 2021-08-11 2021-11-12 上海哔哩哔哩科技有限公司 混合模式移动应用调试方法及系统
CN113641580A (zh) * 2021-08-11 2021-11-12 上海哔哩哔哩科技有限公司 混合模式移动应用调试方法及系统
CN113836460A (zh) * 2021-08-13 2021-12-24 深圳市明源云空间电子商务有限公司 mock数据控制方法、设备终端及计算机可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102981947A (zh) * 2011-09-07 2013-03-20 阿里巴巴集团控股有限公司 一种测试中准备数据的方法及系统
US20140211021A1 (en) * 2013-01-25 2014-07-31 Samsung Electronics Co., Ltd. Test system for evaluating mobile device and driving method thereof
CN105354143A (zh) * 2015-12-02 2016-02-24 北京奇虎科技有限公司 一种用于应用程序的测试方法及装置
CN108345535A (zh) * 2017-12-26 2018-07-31 阿里巴巴集团控股有限公司 mock测试方法、装置及设备

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106598830B (zh) * 2015-10-16 2019-06-07 阿里巴巴集团控股有限公司 移动终端的网页脚本调试方法及系统
CN106055480B (zh) * 2016-06-02 2021-03-16 腾讯科技(深圳)有限公司 一种调试网页的方法及终端
US20180165177A1 (en) * 2016-12-08 2018-06-14 Nutanix, Inc. Debugging distributed web service requests

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102981947A (zh) * 2011-09-07 2013-03-20 阿里巴巴集团控股有限公司 一种测试中准备数据的方法及系统
US20140211021A1 (en) * 2013-01-25 2014-07-31 Samsung Electronics Co., Ltd. Test system for evaluating mobile device and driving method thereof
CN105354143A (zh) * 2015-12-02 2016-02-24 北京奇虎科技有限公司 一种用于应用程序的测试方法及装置
CN108345535A (zh) * 2017-12-26 2018-07-31 阿里巴巴集团控股有限公司 mock测试方法、装置及设备

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113641581A (zh) * 2021-08-11 2021-11-12 上海哔哩哔哩科技有限公司 混合模式移动应用调试方法及系统
CN113641580A (zh) * 2021-08-11 2021-11-12 上海哔哩哔哩科技有限公司 混合模式移动应用调试方法及系统
CN113641580B (zh) * 2021-08-11 2023-10-20 上海哔哩哔哩科技有限公司 混合模式移动应用调试方法及系统
CN113641581B (zh) * 2021-08-11 2023-10-20 上海哔哩哔哩科技有限公司 混合模式移动应用调试方法及系统
CN113836460A (zh) * 2021-08-13 2021-12-24 深圳市明源云空间电子商务有限公司 mock数据控制方法、设备终端及计算机可读存储介质

Also Published As

Publication number Publication date
CN111666199A (zh) 2020-09-15
CN111666199B (zh) 2022-01-11

Similar Documents

Publication Publication Date Title
US8875098B2 (en) Workflow engine for execution of web mashups
WO2020177519A1 (zh) 在智能终端上执行的调试方法以及软件调试器
US11010283B2 (en) Mock-based unit test(s) for an end-to-end test of a code snippet
CN111124906B (zh) 基于动态埋点的跟踪方法、编译方法、装置和电子设备
US8806437B2 (en) Automated testing process
US20150089299A1 (en) Online application testing across browser environments
US10073761B2 (en) Legacy system
US20130046878A1 (en) Asynchronous request interception for testing a request life-cycle
CN110955409B (zh) 在云平台上创建资源的方法和装置
CN109344066B (zh) 一种浏览器页面的测试方法、系统及终端
CN112799940B (zh) 回归测试方法、装置、计算机系统和计算机可读存储介质
CN107644075B (zh) 收集页面信息的方法和装置
KR20150022849A (ko) 핸드세이크를 이용한 클라이언트 인터페이스 실행 중의 자동 업데이트 기법
WO2018171195A1 (zh) 一种基于依赖注入的安卓应用半自动化测试方法
WO2019029451A1 (zh) 发布移动应用的方法和电子设备
CN111338829B (zh) 远程过程调用服务的调用方法及装置
US8904346B1 (en) Method and system for automated load testing of web applications
CN112631590A (zh) 组件库生成方法、装置、电子设备和计算机可读介质
CN113778897B (zh) 接口的自动测试方法、装置、设备及存储介质
US11789726B2 (en) Semantic functional wrappers of services
WO2020077681A1 (zh) 一种延迟加载js脚本的方法和装置
CN111694744B (zh) 一种基于monkey源码的测试开发方法
CN109634758A (zh) 基于json文件控制事件和行为的方法及中间件平台
CN113485927A (zh) 一种测试数据生成方法、装置、设备及存储介质
US9069897B2 (en) Capturing telemetry data by dynamic language engine

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

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

Country of ref document: EP

Kind code of ref document: A1