WO2016173332A1 - 一种js调试页面方法和装置 - Google Patents

一种js调试页面方法和装置 Download PDF

Info

Publication number
WO2016173332A1
WO2016173332A1 PCT/CN2016/076619 CN2016076619W WO2016173332A1 WO 2016173332 A1 WO2016173332 A1 WO 2016173332A1 CN 2016076619 W CN2016076619 W CN 2016076619W WO 2016173332 A1 WO2016173332 A1 WO 2016173332A1
Authority
WO
WIPO (PCT)
Prior art keywords
interface
debugging
read
configuration file
debug
Prior art date
Application number
PCT/CN2016/076619
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 WO2016173332A1 publication Critical patent/WO2016173332A1/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

Definitions

  • This paper relates to the field of JS debugging page technology, and in particular relates to a JS debugging page method and device.
  • a web page also known as a web page, is a page that uses the HTML language to format and display content in the form of tags.
  • web pages support the use of JavaScript scripts (JS) to manipulate content on the page. It is one of the widely used methods of displaying Internet content. It can display rich content through browsers on PCs, mobile phones, tablets, set-top boxes, TV sets and other devices.
  • JS JavaScript scripts
  • the technical problem to be solved by the present invention is to provide a JS debug page method and apparatus for solving the problem that the test work caused by the input of a large number of parameters is very heavy when the test environment changes during the web page development process.
  • a JavaScript script JS debug page method includes:
  • the read and write operations corresponding to the interface are completed through the debug configuration file.
  • the step of completing the read/write operation corresponding to the interface by using the debug configuration file includes: calling the debug read/write function by using the debug configuration file, or calling other read by using the debug configuration file The write function completes the reading and writing of the corresponding interface;
  • the step of calling the debugging read/write function by using the debugging configuration file, or calling the other configuration function to complete the reading and writing of the corresponding interface by using the debugging configuration file includes: reading the state of the debugging switch; if the debugging switch is When the state is turned on, the debugging configuration file is used to call the debugging read/write function or other read/write function to complete the reading and writing of the corresponding interface; if the debugging switch is in the off state, the other debugging is called through the debugging configuration file. The function completes the reading and writing of the corresponding interface.
  • the debugging read/write function includes a read function for debugging
  • the step of calling the debugging read/write function or other read/write function to complete the reading and writing of the corresponding interface by using the debugging configuration file includes: searching whether the debugging configuration file includes the interface content corresponding to the interface; And returning the value of the interface content corresponding to the interface saved in the debugging configuration file to the debugging read function, and reading the interface content corresponding to the interface as the debugging read function. The result is read; if not, the reading of the corresponding interface is completed by another reading function, and the reading result is stored in the debugging configuration file as the interface content corresponding to the interface.
  • the debugging read/write function further includes a write function for debugging
  • the step of calling the debugging read/write function or other read/write function to complete the reading and writing of the corresponding interface by using the debugging configuration file includes: calling the debugging writing function, and writing the content as the interface corresponding to The interface content is written to the debug configuration file.
  • the method before the step of performing the read/write operation corresponding to the interface by using the debugging configuration file, the method further includes:
  • the debug is defined in the debug JS file by using a read/write function
  • the state of the debug switch is saved in the debug configuration file.
  • a JavaScript script JS debug page device including a creation unit and a read-write unit, wherein:
  • the creating unit is configured to: create a debugging configuration file; wherein the debugging configuration file is used to save the interface content corresponding to the interface;
  • the read/write unit is configured to: when the read/write operation of the interface is performed, complete the read and write operations corresponding to the interface by using the debug configuration file.
  • the read/write unit is configured to complete the read and write operations of the interface by using the debug configuration file as follows:
  • the reading and writing unit includes:
  • the debugging switch reads the module, and is set to: read the state of the debugging switch; if the debugging switch is in an open state, the debugging configuration file is used to call the debugging read/write function or other reading and writing functions to complete the reading and writing of the corresponding interface; If the debugging switch is in the off state, the debugging configuration file is used to call other reading and writing functions to complete the reading and writing of the corresponding interface.
  • the debugging read/write function includes a read function for debugging
  • the reading and writing unit includes:
  • the reading module is configured to: search whether the interface content corresponding to the interface is included in the debugging configuration file; if yes, return the value of the interface content corresponding to the interface saved in the debugging configuration file to the debugging Reading a function, and using the interface content corresponding to the interface as the read result of the read function of the debugging read function; if not, reading the corresponding interface through other read functions, and reading The result of the interface is stored in the debug configuration file as the interface content corresponding to the interface.
  • the debugging read/write function further includes a write function for debugging
  • the reading and writing unit further includes:
  • the write module is configured to: call the debug write function, and write the write content as the interface content corresponding to the interface into the debug configuration file.
  • the device further includes:
  • the creating unit is further configured to: create a debug JS file; the debug read and write function is defined in the debug JS file.
  • the interface and the interface content corresponding to the interface are saved in the debugging configuration file.
  • the interface can be read and written directly through the debugging configuration file, and various combinations of different conditions are tested.
  • the debug read/write function can directly address the required interface content from the debug configuration file.
  • you can directly write or update the interface content corresponding to each interface in the debugging configuration file, thereby reducing the tedious work of repetitive operations in the test work, especially in the case of a set-top box interface, etc.
  • the fast reading and writing mode of the interface content during the reading process greatly reduces the workload required for the test and improves the work efficiency of the page test.
  • FIG. 1 is a schematic flowchart of a JS debugging page method according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of a JS debugging page device according to an embodiment of the present invention.
  • An embodiment of the present invention provides a JS debug page method, where the JS debug page method includes:
  • the read and write operations corresponding to the interface are completed through the debug configuration file.
  • the performing the read and write operations corresponding to the interface by using the debugging configuration file specifically includes: performing read and write operations on the corresponding interface by using a read/write function through debugging;
  • the reading and writing of the corresponding interface by using the read/write function through debugging includes:
  • the debugging read/write function includes a read function for debugging, and the reading and writing of the corresponding interface by debugging the configuration file includes:
  • the interface content corresponding to the interface is used as the read result of the current reading; if not, the corresponding interface is read by the existing read function, and the read result is used as the interface corresponding
  • the interface content is stored in the debug configuration file.
  • the debugging read/write process further includes a write function for debugging, and the reading and writing of the corresponding interface by debugging the configuration file includes:
  • the method before the performing the read and write operations corresponding to the interface by using the debugging configuration file, the method further includes:
  • the debug is defined in the debug JS file by using a read/write function
  • the state of the debug switch is saved in the debug configuration file.
  • an embodiment of the present invention provides a JavaScript script JS debugging page device, and the device includes:
  • the read/write unit is configured to complete the read/write operation corresponding to the interface by using the debug configuration file when performing the read/write operation of the interface.
  • the read/write unit completes reading and writing of the corresponding interface by using a read/write function for debugging
  • the reading and writing unit includes:
  • the debugging switch reading module is used to read the state of the debugging switch; if the debugging switch is in an open state, the corresponding interface is read and written by debugging the configuration file; if the debugging switch is in the off state, the existing reading and writing function is completed. Read and write of the corresponding interface.
  • the debugging read/write function includes a read function for debugging
  • the read/write unit includes:
  • a reading module configured to search whether the interface content corresponding to the interface is included in the debugging configuration file; if yes, the interface content corresponding to the interface is used as a reading result of the current reading; if not, the The existing read function completes the reading of the corresponding interface, and stores the read result as the interface content corresponding to the interface in the debug configuration file.
  • the debugging read/write process further includes a write function for debugging
  • the read/write unit further includes:
  • a write module configured to write the write content as the interface content corresponding to the interface into the debug configuration file.
  • it also includes:
  • the creation unit is further configured to create a debug JS file; the debug read and write function is defined in the debug JS file.
  • FIG. 1 is a schematic flowchart of a JS debugging page method according to an embodiment of the present invention.
  • the JS debugging page method provided by the embodiment of the present invention includes:
  • Step S110 Create a debug configuration file, where the debug configuration file is used to save the interface content corresponding to the interface;
  • step S120 when the read/write operation of the interface is performed, the read/write operation corresponding to the interface is completed by using the debug configuration file.
  • the interface content is usually a numeric value, or it can be a text or a string.
  • the performing the read and write operations corresponding to the interface by using the debugging configuration file specifically includes: reading and writing the corresponding interface by using a read/write function through debugging. That is to say, the read and write operations corresponding to the interface are completed by using the debug configuration file by using a read/write function for debugging.
  • the method before completing the read/write operation corresponding to the interface by using the debugging configuration file, the method further includes: creating a debugging JS file; the debugging read/write function is defined in the debugging JS file; The state of the switch is saved in the debug configuration file. The state of the debug switch is saved in the debug configuration file.
  • the debug read/write function defined in the debug JS file is called to complete the read and write operations of the interface.
  • the interface and the interface content corresponding to the interface are saved in the debugging configuration file.
  • the interface can be read and written directly through the debugging configuration file, and various combinations of different conditions are tested.
  • the debug read/write function can directly address the required interface content from the debug configuration file.
  • you can directly write or update the interface content corresponding to each interface in the debugging configuration file, thereby reducing the tedious work of repetitive operations in the test work, especially in the case of a set-top box interface, etc.
  • the fast reading and writing mode of the interface content during the reading process greatly reduces the workload required for the test and improves the work efficiency of the page test.
  • the debugging switch In the processing flow of the debugging read/write function, first, read the value of the debugging switch in the debugging configuration file.
  • the value of the debugging switch defined in the debugging configuration file is 0 or 1. If the value is 1, it means the debugging switch. If it is on, if the value is 0, it means the debug switch is off.
  • the reading and writing of the corresponding interface by using the read/write function includes: reading the state of the debugging switch; if the debugging switch is in the open state, completing the reading and writing of the corresponding interface by debugging the configuration file; if the debugging switch is in the off state Then, the existing interface is read and written by the existing read/write function.
  • the debugging read/write function includes a read function for debugging, and the reading and writing of the corresponding interface by debugging the configuration file includes:
  • the interface content corresponding to the interface is used as the read result of the current reading; if not, the corresponding interface is read by the existing read function, and the read result is used as the interface corresponding
  • the interface content is stored in the debug configuration file.
  • the debugging read/write process further includes a write function for debugging, and the reading and writing of the corresponding interface by debugging the configuration file includes:
  • the JS debugging page method provided by the present invention is described in detail below in conjunction with a specific implementation scenario.
  • Step S210 creating a debugging JS file and a debugging configuration file
  • the debugging configuration file is used to include the interface content corresponding to the interface, and the value of the debugging switch.
  • the debugging JS file defines a debugging read/write function, wherein the debugging read/write function includes a debugging read function and a debug write function.
  • debugging read/write function different read/write processes are executed according to the state of the debug switch. If the debug switch is in the open state, the corresponding interface is read and written by debugging the configuration file; if the debug switch is off, the existing The read and write functions complete the reading and writing of the corresponding interface.
  • Step S220 during the page debugging process, a certain JS file calls a debugging read function
  • Step S221 the state of the debug switch is read, if the debug switch is in the open state, step S223 is performed; if the debug switch is in the closed state, step S222 is performed;
  • Step S222 the reading of the corresponding interface is completed by the existing reading function.
  • Step S223 it is found in the debug configuration file whether there is an interface corresponding to the current read; if yes, step S224 is performed; if not, step S225 is performed;
  • step S224 if there is an interface corresponding to the current reading, the interface content corresponding to the interface in the debugging configuration file is used as the reading result of the current reading.
  • the value of the interface content corresponding to the interface saved in the debug configuration file is returned to the debug read function, and the read result of the interface is read this time as a debug read function.
  • step S225 if the corresponding interface is not read this time, the reading of the corresponding interface is completed by the existing reading function, and the reading result is stored in the debugging configuration file as the interface content corresponding to the interface.
  • step S230 during the page debugging process, a certain JS file calls the debugging write function.
  • step S230 there is no specific sequence between step S230 and step S220, but is determined according to the requirements of the read operation and the write operation in the JS file debugging page process.
  • Step S231 the state of the debug switch is read, if the debug switch is in the open state, step S233 is performed; if the debug switch is in the closed state, step S232 is performed;
  • Step S232 completing the writing of the corresponding interface by using an existing write function.
  • Step S233 writing the content as the interface content corresponding to the interface into the debugging configuration file. If the content of the interface corresponding to the interface is already saved in the debugging configuration file, the content of the interface corresponding to the interface is updated to the current content. If the interface content corresponding to the interface is not saved in the debugging configuration file, create The interface stores the content and saves the interface content corresponding to the interface.
  • FIG. 2 is a schematic structural diagram of a JS debugging page device according to an embodiment of the present invention. As shown in FIG. 2, the device includes:
  • the creating unit 10 is configured to: create a debugging configuration file, where the debugging configuration file is used to save the interface content corresponding to the interface;
  • the reading and writing unit 20 is configured to: when the read/write operation of the interface is performed, complete the read and write operations corresponding to the interface by using the debug configuration file.
  • the read/write unit 20 completes reading and writing of the corresponding interface by using a read/write function for debugging
  • the read/write unit 20 includes:
  • the debugging switch reading module 21 is configured to: read the state of the debugging switch; if the debugging switch is in an open state, complete the reading and writing of the corresponding interface by debugging the configuration file; if the debugging switch is in the off state, the existing reading and writing is performed. The function completes the reading and writing of the corresponding interface.
  • the read/write function for debugging includes a read function for debugging
  • the read/write unit 20 includes:
  • the reading module 22 is configured to: find whether the interface content corresponding to the interface is included in the debugging configuration file; if yes, the interface content corresponding to the interface is used as a reading result of the current reading; if not, Then, the reading of the corresponding interface is completed by the existing reading function, and the reading result is stored in the debugging configuration file as the interface content corresponding to the interface.
  • the debugging read/write process further includes a write function for debugging
  • the read/write unit 20 further includes:
  • the writing module 23 is configured to write the written content as the interface content corresponding to the interface into the debug configuration file.
  • the creating unit 10 is further configured to: create a debugging JS file; and the debugging read/write function is defined in the debugging JS file.
  • the embodiment of the invention also discloses a computer program, comprising program instructions, which when executed by a computer, enable the computer to execute any of the above-mentioned JavaScript script JS debug page methods.
  • the embodiment of the invention also discloses a carrier carrying the computer program.
  • all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve. Thus, the invention is not limited to any specific combination of hardware and software.
  • the devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
  • each device/function module/functional unit in the above embodiment When each device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium.
  • the above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
  • the interface and the interface content corresponding to the interface are saved in the debugging configuration file.
  • the interface can be directly read and written through the debugging configuration file.
  • the debugging read/write function can be directly Read the required interface content from the debug configuration file.

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

一种JS调试页面方法和装置,所述JS调试页面方法包括:创建调试配置文件;其中,所述调试配置文件用于保存接口对应的接口内容;在执行接口的读写操作时,通过所述调试配置文件完成所述接口对应的读写操作。通过调试配置文件完成接口的读写操作,在测试各种不同条件组合的情况下,调试用读写函数可以直接从调试配置文件中针对需要的接口内容进行读取,从而减少了测试工作中重复性操作的繁琐劳动,尤其是在例如机顶盒界面等需要使用遥控器方向键顺序操作的页面的测试过程中,通过读取过程中接口内容的快捷的读写方式,大量减少了测试所需的工作量,提高了页面测试的工作效率。

Description

一种JS调试页面方法和装置 技术领域
本文涉及JS调试页面技术领域,特别涉及一种JS调试页面方法和装置。
背景技术
Web页面,也称网页,是一种使用HTML语言,通过标签的形式对内容进行格式化并显示的页面。在多数浏览器上,Web页面支持使用JavaScript脚本(JS)对页面上的内容做操作。它是目前广泛应用的互联网内容展示方式之一,可以在PC、手机、平板电脑、机顶盒、电视机等多种设备上通过浏览器展示出丰富的内容。
在开发Web页面的过程中,如果需要测试不同场景和条件时,通常需要通过改变使用环境情况、输入不同的参数、经过不同的步骤来操作以实现。在多数情况下,为了测试各种不同条件组合的情况,需要付出很多重复性劳动,在机顶盒界面等需要使用遥控器方向键顺序操作的界面中,由于每次测试都需要输入不同的参数,且参数的输入操作较为困难,因此重复性测试工作尤其繁琐。
发明内容
本发明要解决的技术问题是提供一种JS调试页面方法和装置,用于解决Web页面开发过程中在测试环境改变时由于大量参数的输入所造成的测试工作非常繁重的问题。
为了解决上述技术问题,采用如下技术方案:
一种JavaScript脚本JS调试页面方法,所述JS调试页面方法包括:
创建调试配置文件;其中,所述调试配置文件用于保存接口对应的接口内容;
在执行接口的读写操作时,通过所述调试配置文件完成所述接口对应的读写操作。
可选地,所述通过所述调试配置文件完成所述接口对应的读写操作的步骤包括:通过所述调试配置文件,调用调试用读写函数,或通过所述调试配置文件,调用其他读写函数完成对应接口的读写;
所述通过所述调试配置文件,调用调试用读写函数,或通过所述调试配置文件,调用其他读写函数完成对应接口的读写的步骤包括:读取调试开关的状态;如果调试开关为打开状态,则通过所述调试配置文件,调用调试用读写函数或其他的读写函数完成对应接口的读写;如果调试开关为关闭状态,则通过所述调试配置文件,调用其他的读写函数完成对应接口的读写。
可选地,所述调试用读写函数包括调试用读取函数;
所述通过所述调试配置文件,调用调试用读写函数或其他的读写函数完成对应接口的读写的步骤包括:查找所述调试配置文件中是否包括所述接口对应的接口内容;如果是,则将所述调试配置文件中保存的接口对应的接口内容的值返回给所述调试用读取函数,并将所述接口对应的接口内容作为所述调试用读取函数本次读取的读取结果;如果否,则通过其他的读取函数完成对应接口的读取,并将读取结果作为所述接口对应的接口内容存储在所述调试配置文件中。
可选地,所述调试用读写函数还包括调试用写入函数;
所述通过所述调试配置文件,调用调试用读写函数或其他的读写函数完成对应接口的读写的步骤包括:调用所述调试用写入函数,将写入内容作为所述接口对应的接口内容写入到所述调试配置文件中。
可选地,在所述通过所述调试配置文件完成所述接口对应的读写操作的步骤之前,该方法还包括:
创建调试JS文件;所述调试用读写函数定义在所述调试JS文件中;
所述调试开关的状态保存在所述调试配置文件中。
一种JavaScript脚本JS调试页面装置,包括创建单元和读写单元,其中:
所述创建单元设置成:创建调试配置文件;其中,所述调试配置文件用于保存接口对应的接口内容;
所述读写单元设置成:在执行接口的读写操作时,通过所述调试配置文件完成所述接口对应的读写操作。
可选地,所述读写单元设置成按照如下方式通过所述调试配置文件完成所述接口对应的读写操作:
通过所述调试配置文件,调用调试用读写函数,或通过所述调试配置文件,调用其他读写函数完成对应接口的读写;
所述读写单元包括:
调试开关读取模块,设置成:读取调试开关的状态;如果调试开关为打开状态,则通过所述调试配置文件,调用调试用读写函数或其他的读写函数完成对应接口的读写;如果调试开关为关闭状态,则通过所述调试配置文件,调用其他的读写函数完成对应接口的读写。
可选地,所述调试用读写函数包括调试用读取函数,
所述读写单元包括:
读取模块,设置成:查找所述调试配置文件中是否包括所述接口对应的接口内容;如果是,则将所述调试配置文件中保存的接口对应的接口内容的值返回给所述调试用读取函数,并将所述接口对应的接口内容作为所述调试用读取函数本次读取的读取结果;如果否,则通过其他的读取函数完成对应接口的读取,并将读取结果作为所述接口对应的接口内容存储在所述调试配置文件中。
可选地,所述调试用读写函数还包括调试用写入函数;
所述读写单元还包括:
写入模块,设置成:调用所述调试用写入函数,将写入内容作为所述接口对应的接口内容写入到所述调试配置文件中。
可选地,该装置还包括:
所述创建单元还设置成:创建调试JS文件;所述调试用读写函数定义在所述调试JS文件中。
本发明技术方案的有益效果包括:
本发明实施例中,将接口以及接口对应的接口内容保存在调试配置文件中,当需要进行读写操作时,可以直接通过调试配置文件完成接口的读写操作,在测试各种不同条件组合的情况下,不需要在每次测试中针对每次测试的接口进行对应的接口内容的输入,而是在每次测试过程中,调试用读写函数可以直接从调试配置文件中针对需要的接口内容进行读取,此外,还可以直接在调试配置文件中写入或者更新各个接口对应的接口内容,从而减少了测试工作中重复性操作的繁琐劳动,尤其是在例如机顶盒界面等需要使用遥控器方向键顺序操作的页面的测试过程中,通过读取过程中接口内容的快捷的读写方式,大量减少了测试所需的工作量,提高了页面测试的工作效率。
附图概述
图1为本发明实施例提供的一种JS调试页面方法的流程示意图;
图2为本发明实施例提供的一种JS调试页面装置的结构示意图。
本发明的较佳实施方式
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。
下面结合附图对本发明实施例提供的一种JS调试页面方法和装置进行详细描述。
本发明实施例提供了一种JS调试页面方法,所述JS调试页面方法包括:
创建调试配置文件;其中,所述调试配置文件用于保存接口对应的接口内容;
在执行接口的读写操作时,通过所述调试配置文件完成所述接口对应的读写操作。
可选地,所述通过所述调试配置文件完成所述接口对应的读写操作具体包括:通过调试用读写函数完成对应接口的读写;
所述通过调试用读写函数完成对应接口的读写包括:
读取调试开关的状态;如果调试开关为打开状态,则通过调试配置文件完成对应接口的读写;如果调试开关为关闭状态,则通过现有的读写函数完成对应接口的读写。
可选地,所述调试用读写函数包括调试用读取函数,所述通过调试配置文件完成对应接口的读写包括:
查找所述调试配置文件中是否包括所述接口对应的接口内容;
如果是,则将所述接口对应的接口内容作为本次读取的读取结果;如果否,则通过现有的读取函数完成对应接口的读取,并将读取结果作为所述接口对应的接口内容存储在所述调试配置文件中。
可选地,所述调试用读写流程还包括调试用写入函数,所述通过调试配置文件完成对应接口的读写包括:
将写入内容作为所述接口对应的接口内容写入到所述调试配置文件中。
可选地,在所述通过所述调试配置文件完成所述接口对应的读写操作之前还包括:
创建调试JS文件;所述调试用读写函数定义在所述调试JS文件中;
所述调试开关的状态保存在所述调试配置文件中。
为了解决上述技术问题,本发明实施例提供了一种JavaScript脚本JS调试页面装置,所述装置包括:
创建单元,用于创建调试配置文件;其中,所述调试配置文件用于保存接口对应的接口内容;
读写单元,用于在执行接口的读写操作时,通过所述调试配置文件完成所述接口对应的读写操作。
可选地,所述读写单元通过调试用读写函数完成对应接口的读写;
所述读写单元包括:
调试开关读取模块,用于读取调试开关的状态;如果调试开关为打开状态,则通过调试配置文件完成对应接口的读写;如果调试开关为关闭状态,则通过现有的读写函数完成对应接口的读写。
可选地,所述调试用读写函数包括调试用读取函数,所述读写单元包括:
读取模块,用于查找所述调试配置文件中是否包括所述接口对应的接口内容;如果是,则将所述接口对应的接口内容作为本次读取的读取结果;如果否,则通过现有的读取函数完成对应接口的读取,并将读取结果作为所述接口对应的接口内容存储在所述调试配置文件中。
可选地,所述调试用读写流程还包括调试用写入函数,所述读写单元还包括:
写入模块,用于将写入内容作为所述接口对应的接口内容写入到所述调试配置文件中。
可选地,还包括:
所述创建单元还用于创建调试JS文件;所述调试用读写函数定义在所述调试JS文件中。
请参阅图1,为本发明实施例提供的一种JS调试页面方法的流程示意图,如图1所示,本发明实施例提供的JS调试页面方法包括:
步骤S110,创建调试配置文件;其中,所述调试配置文件用于保存接口对应的接口内容;
步骤S120,在执行接口的读写操作时,通过所述调试配置文件完成所述接口对应的读写操作。
其中,接口内容通常为数值,也可以是文字或字符串等内容。
本发明实施例中,所述通过所述调试配置文件完成所述接口对应的读写操作具体包括:通过调试用读写函数完成对应接口的读写。也就是说通过所述调试配置文件完成所述接口对应的读写操作是通过调试用读写函数完成的。
本发明实施例中,在通过所述调试配置文件完成所述接口对应的读写操作之前还包括:创建调试JS文件;所述调试用读写函数定义在所述调试JS文件中;所述调试开关的状态保存在所述调试配置文件中。所述调试开关的状态保存在所述调试配置文件中。在需要执行接口的读写操作时,将调用调试JS文件中定义的调试用读写函数来完成接口的读写操作。
本发明实施例中,将接口以及接口对应的接口内容保存在调试配置文件中,当需要进行读写操作时,可以直接通过调试配置文件完成接口的读写操作,在测试各种不同条件组合的情况下,不需要在每次测试中针对每次测试的接口进行对应的接口内容的输入,而是在每次测试过程中,调试用读写函数可以直接从调试配置文件中针对需要的接口内容进行读取,此外,还可以直接在调试配置文件中写入或者更新各个接口对应的接口内容,从而减少了测试工作中重复性操作的繁琐劳动,尤其是在例如机顶盒界面等需要使用遥控器方向键顺序操作的页面的测试过程中,通过读取过程中接口内容的快捷的读写方式,大量减少了测试所需的工作量,提高了页面测试的工作效率。
在调试用读写函数的处理流程中,首先,读取调试配置文件中的调试开关的值,例如,在调试配置文件中定义调试开关的值为0或者1,如果值为1则代表调试开关为打开状态,如果值为0则代表调试开关为关闭状态。
其中,所述通过调试用读写函数完成对应接口的读写包括:读取调试开关的状态;如果调试开关为打开状态,则通过调试配置文件完成对应接口的读写;如果调试开关为关闭状态,则通过现有的读写函数完成对应接口的读写。
本发明实施例中,所述调试用读写函数包括调试用读取函数,所述通过调试配置文件完成对应接口的读写包括:
查找所述调试配置文件中是否包括所述接口对应的接口内容;
如果是,则将所述接口对应的接口内容作为本次读取的读取结果;如果否,则通过现有的读取函数完成对应接口的读取,并将读取结果作为所述接口对应的接口内容存储在所述调试配置文件中。
本发明实施例中,所述调试用读写流程还包括调试用写入函数,所述通过调试配置文件完成对应接口的读写包括:
将写入内容作为所述接口对应的接口内容写入到所述调试配置文件中。
下面结合具体的实施场景对本发明提供的JS调试页面方法进行详细说明。
本发明实施例提供的一种JS调试页面方法的流程示意图,包括:
步骤S210,创建调试JS文件和调试配置文件;
其中,调试配置文件中用于包括接口对应的接口内容,以及调试开关的值。
所述调试JS文件中定义了调试用读写函数,其中,所述调试用读写函数包括调试用读取函数和调试用写入函数。
在调试用读写函数中,根据调试开关的状态执行不同的读写流程,如果调试开关为打开状态,则通过调试配置文件完成对应接口的读写;如果调试开关为关闭状态,则通过现有的读写函数完成对应接口的读写。
步骤S220,页面调试过程中,某个JS文件调用调试用读取函数;
步骤S221,读取调试开关的状态,如果调试开关为打开状态,则执行步骤S223;如果调试开关为关闭状态,则执行步骤S222;
步骤S222,通过现有的读取函数完成对应接口的读取。
步骤S223,查找所述调试配置文件中是否存在本次读取对应的接口;如果存在,则执行步骤S224;如果不存在,则执行步骤S225;
步骤S224,如果存在本次读取对应的接口,则将调试配置文件中所述接口对应的接口内容作为本次读取的读取结果。也就是说,将调试配置文件中保存的接口对应的接口内容的值返回给调试用读取函数,并作为调试用读取函数本次读取所述接口的读取结果。
步骤S225,如果没有本次读取对应的接口,则通过现有的读取函数完成对应接口的读取,并将读取结果作为所述接口对应的接口内容存储在所述调试配置文件中。
步骤S230,页面调试过程中,某个JS文件调用调试用写入函数。
需要说明的是,步骤S230和步骤S220之间没有特定的先后顺序,而是根据JS文件调试页面过程中的读取操作和写入操作的需求所决定的。
步骤S231,读取调试开关的状态,如果调试开关为打开状态,则执行步骤S233;如果调试开关为关闭状态,则执行步骤S232;
步骤S232,通过现有的写入函数完成对应接口的写入。
步骤S233,将写入内容作为所述接口对应的接口内容写入到所述调试配置文件中。其中,如果调试配置文件中已经保存有接口对应的接口内容,则将接口对应的接口内容更新为本次的写入内容,如果调试配置文件中还没有保存有接口对应的接口内容,则创建关于该接口的存储内容,并保存接口对应的接口内容。
基于与上述方法实施例相同或相似的构思,本发明实施例还提供一种JavaScript脚本JS调试页面装置。请参阅图2,为本发明实施例提供的一种JS调试页面装置的结构示意图,如图2所示,所述装置包括:
创建单元10,设置成:创建调试配置文件;其中,所述调试配置文件用于保存接口对应的接口内容;
读写单元20,设置成:在执行接口的读写操作时,通过所述调试配置文件完成所述接口对应的读写操作。
其中,所述读写单元20通过调试用读写函数完成对应接口的读写;
所述读写单元20包括:
调试开关读取模块21,设置成:读取调试开关的状态;如果调试开关为打开状态,则通过调试配置文件完成对应接口的读写;如果调试开关为关闭状态,则通过现有的读写函数完成对应接口的读写。
本发明实施例中,所述调试用读写函数包括调试用读取函数,所述读写单元20包括:
读取模块22,设置成:查找所述调试配置文件中是否包括所述接口对应的接口内容;如果是,则将所述接口对应的接口内容作为本次读取的读取结果;如果否,则通过现有的读取函数完成对应接口的读取,并将读取结果作为所述接口对应的接口内容存储在所述调试配置文件中。
本发明实施例中,所述调试用读写流程还包括调试用写入函数,所述读写单元20还包括:
写入模块23,设置成:将写入内容作为所述接口对应的接口内容写入到所述调试配置文件中。
本发明实施例中,所述创建单元10还设置成:创建调试JS文件;所述调试用读写函数定义在所述调试JS文件中。
本发明实施例还公开了一种计算机程序,包括程序指令,当该程序指令被计算机执行时,使得该计算机可执行上述任意的JavaScript脚本JS调试页面方法。
本发明实施例还公开了一种载有所述的计算机程序的载体。
在阅读并理解了附图和详细描述后,可以明白其他方面。
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中,所述计算机程序在相应的硬件平台上(如系统、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。
上述实施例中的各装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。
上述实施例中的各装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。
任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求所述的保护范围为准。
工业实用性
本发明实施例中,将接口以及接口对应的接口内容保存在调试配置文件中,当需要进行读写操作时,可以直接通过调试配置文件完成接口的读写操 作,在测试各种不同条件组合的情况下,不需要在每次测试中针对每次测试的接口进行对应的接口内容的输入,而是在每次测试过程中,调试用读写函数可以直接从调试配置文件中针对需要的接口内容进行读取,此外,还可以直接在调试配置文件中写入或者更新各个接口对应的接口内容,从而减少了测试工作中重复性操作的繁琐劳动,尤其是在例如机顶盒界面等需要使用遥控器方向键顺序操作的页面的测试过程中,通过读取过程中接口内容的快捷的读写方式,大量减少了测试所需的工作量,提高了页面测试的工作效率。因此本发明具有很强的工业实用性。

Claims (10)

  1. 一种JavaScript脚本JS调试页面方法,所述JS调试页面方法包括:
    创建调试配置文件;其中,所述调试配置文件用于保存接口对应的接口内容;
    在执行接口的读写操作时,通过所述调试配置文件完成所述接口对应的读写操作。
  2. 如权利要求1所述的JS调试页面方法,其中
    所述通过所述调试配置文件完成所述接口对应的读写操作的步骤包括:通过所述调试配置文件,调用调试用读写函数,或通过所述调试配置文件,调用其他读写函数完成对应接口的读写;
    所述通过所述调试配置文件,调用调试用读写函数,或通过所述调试配置文件,调用其他读写函数完成对应接口的读写的步骤包括:读取调试开关的状态;如果调试开关为打开状态,则通过所述调试配置文件,调用调试用读写函数或其他的读写函数完成对应接口的读写;如果调试开关为关闭状态,则通过所述调试配置文件,调用其他的读写函数完成对应接口的读写。
  3. 如权利要求2所述的JS调试页面方法,其中
    所述调试用读写函数包括调试用读取函数;
    所述通过所述调试配置文件,调用调试用读写函数或其他的读写函数完成对应接口的读写的步骤包括:查找所述调试配置文件中是否包括所述接口对应的接口内容;如果是,则将所述调试配置文件中保存的接口对应的接口内容的值返回给所述调试用读取函数,并将所述接口对应的接口内容作为所述调试用读取函数本次读取的读取结果;如果否,则通过其他的读取函数完成对应接口的读取,并将读取结果作为所述接口对应的接口内容存储在所述调试配置文件中。
  4. 如权利要求2或3所述的JS调试页面方法,其中
    所述调试用读写函数还包括调试用写入函数;
    所述通过所述调试配置文件,调用调试用读写函数或其他的读写函数完成对应接口的读写的步骤包括:调用所述调试用写入函数,将写入内容作为所述接口对应的接口内容写入到所述调试配置文件中。
  5. 如权利要求2所述的JS调试页面方法,其中,在所述通过所述调试配置文件完成所述接口对应的读写操作的步骤之前,该方法还包括:
    创建调试JS文件;所述调试用读写函数定义在所述调试JS文件中;
    所述调试开关的状态保存在所述调试配置文件中。
  6. 一种JavaScript脚本JS调试页面装置,包括创建单元和读写单元,其中:
    所述创建单元设置成:创建调试配置文件;其中,所述调试配置文件用于保存接口对应的接口内容;
    所述读写单元设置成:在执行接口的读写操作时,通过所述调试配置文件完成所述接口对应的读写操作。
  7. 如权利要求1所述的JS调试页面装置,其中,所述读写单元设置成按照如下方式通过所述调试配置文件完成所述接口对应的读写操作:
    通过所述调试配置文件,调用调试用读写函数,或通过所述调试配置文件,调用其他读写函数完成对应接口的读写;
    所述读写单元包括:
    调试开关读取模块,设置成:读取调试开关的状态;如果调试开关为打开状态,则通过所述调试配置文件,调用调试用读写函数或其他的读写函数完成对应接口的读写;如果调试开关为关闭状态,则通过所述调试配置文件,调用其他的读写函数完成对应接口的读写。
  8. 如权利要求2所述的JS调试页面装置,其中
    所述调试用读写函数包括调试用读取函数,
    所述读写单元包括:
    读取模块,设置成:查找所述调试配置文件中是否包括所述接口对应的接口内容;如果是,则将所述调试配置文件中保存的接口对应的接口内容的值返回给所述调试用读取函数,并将所述接口对应的接口内容作为所述调试用读取函数本次读取的读取结果;如果否,则通过其他的读取函数完成对应接口的读取,并将读取结果作为所述接口对应的接口内容存储在所述调试配置文件中。
  9. 如权利要求2所述的JS调试页面装置,其中
    所述调试用读写函数还包括调试用写入函数;
    所述读写单元还包括:
    写入模块,设置成:调用所述调试用写入函数,将写入内容作为所述接口对应的接口内容写入到所述调试配置文件中。
  10. 如权利要求2所述的JS调试页面装置,该装置还包括:
    所述创建单元还设置成:创建调试JS文件;所述调试用读写函数定义在所述调试JS文件中。
PCT/CN2016/076619 2015-04-28 2016-03-17 一种js调试页面方法和装置 WO2016173332A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510208909.0 2015-04-28
CN201510208909.0A CN106155902A (zh) 2015-04-28 2015-04-28 一种js调试页面方法和装置

Publications (1)

Publication Number Publication Date
WO2016173332A1 true WO2016173332A1 (zh) 2016-11-03

Family

ID=57198103

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/076619 WO2016173332A1 (zh) 2015-04-28 2016-03-17 一种js调试页面方法和装置

Country Status (2)

Country Link
CN (1) CN106155902A (zh)
WO (1) WO2016173332A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107835459A (zh) * 2017-11-20 2018-03-23 深圳市亿联智能有限公司 一种基于融合型机顶盒的tuner性能自动测试方法

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108628729B (zh) * 2017-03-15 2021-11-30 北京嘀嘀无限科技发展有限公司 一种软件测试方法和软件测试客户端

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101977230A (zh) * 2010-10-21 2011-02-16 中兴通讯股份有限公司 一种widget应用安全保护方法和系统
CN102622211A (zh) * 2011-01-27 2012-08-01 腾讯科技(深圳)有限公司 一种应用程序开发的方法和装置
CN102830959A (zh) * 2011-06-16 2012-12-19 中国科学院声学研究所 一种嵌入式浏览器接口动态扩展方法及系统
US20140365828A1 (en) * 2013-06-07 2014-12-11 Successfactors, Inc. Analysis engine for automatically analyzing and linking error logs

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070169015A1 (en) * 2005-12-07 2007-07-19 Sbc Knowledge Ventures, L.P. Web services development automation toolkit with test case driver and customized configuration file
US8245200B2 (en) * 2008-07-11 2012-08-14 International Business Machines Corporation Method, system, and apparatus for dynamically injecting logging statements into web 2.0 javascript applications
CN101833498B (zh) * 2009-07-31 2012-06-06 北京伟晨豪嘉科技有限责任公司 一种基于测试脚本技术的嵌入式系统自动化检测系统
CN103186459B (zh) * 2011-12-30 2016-05-11 迈普通信技术股份有限公司 基于脚本的java图形用户界面自动测试方法
CN104281518B (zh) * 2013-07-02 2018-05-15 腾讯科技(深圳)有限公司 终端应用测试方法、装置、系统、平台及移动终端
CN103440151A (zh) * 2013-09-05 2013-12-11 北京京东尚科信息技术有限公司 一种动态加载Web页面的方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101977230A (zh) * 2010-10-21 2011-02-16 中兴通讯股份有限公司 一种widget应用安全保护方法和系统
CN102622211A (zh) * 2011-01-27 2012-08-01 腾讯科技(深圳)有限公司 一种应用程序开发的方法和装置
CN102830959A (zh) * 2011-06-16 2012-12-19 中国科学院声学研究所 一种嵌入式浏览器接口动态扩展方法及系统
US20140365828A1 (en) * 2013-06-07 2014-12-11 Successfactors, Inc. Analysis engine for automatically analyzing and linking error logs

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107835459A (zh) * 2017-11-20 2018-03-23 深圳市亿联智能有限公司 一种基于融合型机顶盒的tuner性能自动测试方法

Also Published As

Publication number Publication date
CN106155902A (zh) 2016-11-23

Similar Documents

Publication Publication Date Title
US20210216700A1 (en) Information Processing Method and System
CN109325195A (zh) 浏览器的渲染方法和系统、计算机设备、计算机存储介质
KR20200043467A (ko) 웹페이지 콘텐츠를 추출하기 위한 방법 및 단말 장치
US9069432B2 (en) Copy and paste buffer
CN105307030A (zh) 弹幕显示方法及装置
US20180095604A1 (en) Rendering components based on screen size
CN106020823A (zh) 一种前端Web表现与数据分离以及页面快速响应的方式
CN111078221B (zh) 页面颜色主题的切换方法、装置、存储介质及电子设备
CN107657024B (zh) 一种搜索结果展示方法、装置、设备以及存储介质
US9430808B2 (en) Synchronization points for state information
US9880924B2 (en) Source code unit testing using an indexing tool
CN111459501A (zh) 基于SVG的Web组态画面存储与展示系统和方法及介质
WO2018001041A1 (zh) 接口实现方法、装置、机顶盒及存储介质
WO2016173332A1 (zh) 一种js调试页面方法和装置
CN112306594A (zh) 一种基于移动端的渲染方法、装置及存储介质
US8117625B2 (en) Module interrogation
US11055209B2 (en) Application analysis with flexible post-processing
CN112346761B (zh) 前端资源上线方法、设备、系统及存储介质
CN117707982A (zh) 测试方法、装置、设备、介质和程序产品
CN112799670A (zh) 一种统一多端逻辑开发的方法及系统
KR100938992B1 (ko) 애니메이션 폰트파일 구조 및 휴대용 단말기의 텍스트 출력방법
US8442980B2 (en) Attribute change coalescing in order to deal with component moves on a page
CN110955813A (zh) 一种数据爬取方法及装置
US10296566B2 (en) Apparatus and method for outputting web content that is rendered based on device information
US20180090174A1 (en) Video generation of project revision history

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

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

Country of ref document: EP

Kind code of ref document: A1