CN110704321A - Program debugging method and device - Google Patents

Program debugging method and device Download PDF

Info

Publication number
CN110704321A
CN110704321A CN201910931236.XA CN201910931236A CN110704321A CN 110704321 A CN110704321 A CN 110704321A CN 201910931236 A CN201910931236 A CN 201910931236A CN 110704321 A CN110704321 A CN 110704321A
Authority
CN
China
Prior art keywords
target program
electronic device
control instruction
screenshot
code
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.)
Pending
Application number
CN201910931236.XA
Other languages
Chinese (zh)
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.)
JD Digital Technology Holdings Co Ltd
Original Assignee
JD Digital Technology Holdings Co 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 JD Digital Technology Holdings Co Ltd filed Critical JD Digital Technology Holdings Co Ltd
Priority to CN201910931236.XA priority Critical patent/CN110704321A/en
Publication of CN110704321A publication Critical patent/CN110704321A/en
Pending legal-status Critical Current

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

Abstract

The present disclosure provides a program debugging method, including: determining at least one electronic device for code debugging of a target program; causing at least one electronic device to run a target program; controlling a target program running on at least one electronic device to execute a control instruction; controlling at least one electronic device to capture the interface display effect of the target program executing the control instruction; and acquiring screenshots from at least one electronic device so as to debug the target program based on the acquired screenshots. The present disclosure provides a program debugging apparatus, a computer system, and a computer-readable storage medium.

Description

Program debugging method and device
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for debugging a program.
Background
At present, a WebAPP is generally directly operated on a real machine to check the coded effect. What is seen is the operational effect of WebAPP on one device. In the process of implementing the invention, the inventor finds that due to fragmentation of the android system, the operation effect of the same code on different devices is different. This is an unavoidable pain point and difficulty for WebAPP.
Disclosure of Invention
In view of this, the embodiments of the present disclosure provide a group control type program debugging method and apparatus.
One aspect of the embodiments of the present disclosure provides a program debugging method, including: determining at least one electronic device for code debugging of a target program; enabling the at least one electronic device to run the target program; controlling the target program running on the at least one electronic device to execute a control instruction; controlling the at least one electronic device to capture the interface display effect of the target program which executes the control instruction; and acquiring a screenshot from the at least one electronic device so as to debug the target program based on the acquired screenshot.
According to an embodiment of the present disclosure, the method further includes: configuring one device of the at least one electronic device as a master device and configuring the rest devices of the at least one electronic device as slave devices; and the target program execution control instruction after the control code is updated comprises: generating a first control instruction for controlling a first application, wherein the first application is a target program running in the main device, and the first control instruction corresponds to a first user operation; sending the first control instruction to the main device so that the first application executes the first control instruction; and controlling the slave device to generate and execute a second control instruction for controlling a second application, wherein the second application is a target program running in the slave device, and the second control instruction is generated by simulating a user to execute the first user operation on the second application.
According to an embodiment of the present disclosure, controlling the slave device to generate a second manipulation instruction for manipulating a second application includes: aiming at the main equipment, determining a first minimum control aimed at by the first user operation; determining a second minimum control based on the first minimum control for the slave device; and controlling the slave device to generate a second control instruction by simulating a user to execute the first user operation on the second minimum control.
According to an embodiment of the present disclosure, the method further includes: and debugging the code of the target program according to the acquired screenshot, wherein the operation comprises the following steps: comparing the difference between a second screenshot and a first screenshot, wherein the first screenshot is from the master device, and the second screenshot is from the slave device; determining whether the difference exceeds a fault tolerance threshold; and if the difference is determined to exceed the fault tolerance threshold, feeding back corresponding prompt information aiming at the slave equipment.
According to an embodiment of the present disclosure, the method further includes: and after feeding back corresponding prompt information aiming at the slave equipment, displaying the second screenshot.
According to an embodiment of the present disclosure, the method further includes: after feeding back corresponding prompt information aiming at the slave equipment, reconfiguring the slave equipment into new master equipment; acquiring a third control instruction for controlling the target program running in the new main device; sending the third control instruction to the new master device so that the target program executes the third control instruction; controlling the new main equipment to capture the interface display effect of the target program which executes the third control instruction; acquiring a screenshot from the new main equipment; and debugging the code of the target program according to the acquired screenshot.
According to an embodiment of the present disclosure, the causing the at least one electronic device to run the object program includes: a first code for causing the at least one electronic device to execute the object program; the method further comprises the following steps: and sending a second code of the target program to the at least one electronic device, so that the at least one electronic device updates the first code to the second code.
Another aspect of the embodiments of the present disclosure provides a program debugging apparatus, including: the system comprises a determining module, a debugging module and a debugging module, wherein the determining module is used for determining at least one electronic device for performing code debugging on a target program; a first control module, configured to enable the at least one electronic device to run the target program; the second control module is used for controlling the target program running on the at least one piece of electronic equipment to execute the control instruction; the third control module is used for controlling the at least one electronic device to capture the interface display effect of the target program which executes the control instruction; and the acquisition module is used for acquiring the screenshot from the at least one piece of electronic equipment so as to debug the target program based on the acquired screenshot.
According to an embodiment of the present disclosure, the apparatus further includes: a first configuration module, configured to configure one device of the at least one electronic device as a master device and configure the remaining devices of the at least one electronic device as slave devices; and the second control module comprises: the device comprises a generating unit, a processing unit and a processing unit, wherein the generating unit is used for generating a first control instruction for controlling a first application, the first application is a target program running in the main equipment, and the first control instruction corresponds to a first user operation; a sending unit, configured to send the first manipulation instruction to the master device, so that the first application executes the first manipulation instruction; and a control unit, configured to control the slave device to generate and execute a second manipulation instruction that is manipulated with respect to a second application, where the second application is a target program running in the slave device, and the second manipulation instruction is generated by simulating a user to perform the first user operation on the second application.
According to an embodiment of the present disclosure, the control unit includes: a first determining subunit, configured to determine, for the master device, a first minimum control for which the first user operation is directed; a second determining subunit, configured to determine, for the slave device, a second minimum control based on the first minimum control; and the control subunit is used for controlling the slave device to generate a second control instruction by simulating a user to execute the first user operation on the second minimum control.
According to an embodiment of the present disclosure, the first debugging module includes: a comparison unit, configured to compare a difference between a second screenshot and a first screenshot, where the first screenshot is from the master device, and the second screenshot is from the slave device; a determining unit for determining whether the difference exceeds a fault tolerance threshold; and the error reporting unit is used for feeding back corresponding prompt information aiming at the slave equipment under the condition that the difference is determined to exceed the fault tolerance threshold.
According to an embodiment of the present disclosure, the apparatus further includes: and the display module is used for displaying the second screenshot after feeding back corresponding prompt information aiming at the slave equipment.
According to an embodiment of the present disclosure, the apparatus further includes: a second configuration module, configured to reconfigure the slave device to a new master device after feeding back corresponding prompt information for the slave device; a second obtaining module, configured to obtain a third control instruction for controlling the target program running in the new master device; a second sending module, configured to send the third control instruction to the new master device, so that the target program executes the third control instruction; a fourth control module, configured to control the new master device to perform screenshot on an interface display effect of the target program that has executed the third manipulation instruction; a third obtaining module, configured to obtain a screenshot from the new master device; and the second debugging module is used for debugging the codes of the target program according to the acquired screenshot.
Another aspect of an embodiment of the present disclosure provides a computer system, including: one or more processors; and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the methods of embodiments of the present disclosure.
Another aspect of the disclosed embodiments provides a computer-readable storage medium storing computer-executable instructions that, when executed, implement a method of the disclosed embodiments.
Another aspect of the disclosed embodiments provides a computer program comprising computer executable instructions that when executed perform the method of the disclosed embodiments.
According to the embodiment of the disclosure, because a group control type code debugging means is adopted, the technical problem that in the related technology, only one real machine is used for debugging codes, so that the WebAPP cannot be better compatible with other equipment, or the codes are debugged one by one on a plurality of real machines, so that the coding efficiency is low is at least partially solved, and the technical effects of improving the compatibility of the WebAPP and improving the coding efficiency are further achieved.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an exemplary system architecture to which the program debugging method and apparatus of embodiments of the present disclosure may be applied;
FIG. 2 schematically shows a flow chart of a program debugging method according to an embodiment of the present disclosure;
FIG. 3 schematically illustrates a schematic diagram of a remote control master, slave device according to an embodiment of the disclosure;
fig. 4 schematically illustrates a slave device simulating a master device to execute an execution manipulation instruction according to an embodiment of the present disclosure;
FIG. 5 schematically shows a block diagram of a program debugging apparatus according to an embodiment of the present disclosure; and
FIG. 6 schematically illustrates a block diagram of a computer system suitable for implementing the program debugging method and apparatus according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). It will be further understood by those within the art that virtually any disjunctive word and/or phrase presenting two or more alternative terms, whether in the description, claims, or drawings, should be understood to contemplate the possibilities of including one of the terms, either of the terms, or both terms. For example, the phrase "a or B" should be understood to include the possibility of "a" or "B", or "a and B".
The embodiment of the disclosure provides a group control type program debugging method and a program debugging device capable of applying the method. The method comprises the steps of determining at least one electronic device for code debugging of a target program; enabling the at least one electronic device to run the target program; controlling the target program running on the at least one electronic device to execute a control instruction; controlling the at least one electronic device to capture the interface display effect of the target program which executes the control instruction; and acquiring a screenshot from the at least one electronic device so as to debug the target program based on the acquired screenshot.
Fig. 1 schematically illustrates an exemplary system architecture to which the program debugging method and apparatus of the present disclosure may be applied. It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 1, the system architecture according to this embodiment may include mobile terminals 101, 102, 103, a personal computer PC 104, a server 105, and a WEB presentation side 106. Mobile terminals (e.g., mobile terminals 101, 102) can establish a wired communication connection with the server 105 through the personal computer PC 104, thereby achieving the purpose of device sharing. The mobile terminal (such as the mobile terminal 103) may also establish a wireless communication connection with the server 105 through a WIFI network or a cellular network, so as to achieve the purpose of device sharing.
The user can use the WEB display 106 to interact with the server 105, so as to achieve the purpose of renting the specific equipment which accords with the current debugging task, and further remotely control the rented specific equipment. The mobile terminals 101, 102, 103 can automatically detect whether there is a code update, so that the developer can complete the code debugging task.
The mobile terminals 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and the like.
The server 105 may be a server providing various services, such as device information collection for mobile terminals 101, 102, 103 accessing the server 105 wirelessly or by wire (for example only). The server 105 may analyze and process the received data such as the user request, and forward a processing result (for example, a webpage, information, or data obtained or generated according to the user request) to the mobile terminal, forward the control instruction to the WEB display, forward the screenshot to the WEB display, and the like.
It should be noted that the program debugging method provided by the embodiment of the present disclosure may be generally executed by the WEB display 106. The program debugging method provided by the embodiment of the disclosure may also be executed by other terminal devices that are different from the WEB display 106 and that are capable of communicating with the terminal devices 101, 102, and 103 and/or the server 105.
It should be understood that the number of mobile terminals, personal computers PC, servers and WEB presentation ends in fig. 1 is merely illustrative. There may be any number of mobile terminals, personal computers PC, servers and WEB presentation ends, as desired for implementation.
The present disclosure will be described in detail below with reference to specific embodiments with reference to the attached drawings.
Fig. 2 schematically shows a flow chart of a program debugging method according to an embodiment of the present disclosure.
As shown in fig. 2, the method may include operations S201 to S205, for example.
In operation S201, at least one electronic device for code debugging of a target program is determined.
It should be noted that, in the related art, a developer usually adopts a mode of writing code and debugging the code when developing an application. And debugging code also consistently adopts a code verification mode of one device or one browser for one application. Obviously, such code verification approach easily causes that the application cannot be better compatible with more devices, or in order to be better compatible with more devices, a developer needs to verify the same piece of code on multiple genuine machines one by one, resulting in low coding efficiency.
In this regard, embodiments of the present disclosure provide a system architecture, as shown in fig. 1, to facilitate a company or individual to share their electronic devices. In short, a company or an individual may connect their mobile terminals to a server or a server cluster serving as a sharing platform through a PC or directly, thereby achieving the purpose of sharing the mobile terminals. In this way, a developer can rent one or more mobile terminals capable of satisfying the current debugging task through the shared platform. Under the condition that a plurality of mobile terminals are rented, the mobile terminals can be remotely controlled in a group control mode to simultaneously carry out code verification on the same code, so that the technical effects of improving application compatibility and improving coding efficiency are achieved.
Specifically, referring back to fig. 1, when a mobile terminal is connected to a server through a PC, the mobile terminal may upload its device information to the PC connected thereto, and then upload its device information to the server by the PC. When one mobile terminal is directly connected to the server through the WIFI or the cellular network, the mobile terminal can also directly upload the device information of the mobile terminal to the server. The server can provide the equipment information of all the mobile terminals accessing the sharing platform to the WEB display end. In this way, based on the device information provided by the server 105, the user may search and select one or more mobile terminals that satisfy the current debugging task through the search interface provided by the WEB display 106. In response to the selection operation of the user, the WEB display side (such as the development side) can determine at least one mobile terminal for debugging the code of the target program. It should be noted that the device information may include, but is not limited to: brand information of the device, system version information of the device, serial number of the device, and the like.
Next, in operation S202, the at least one electronic device is caused to run the target program.
Specifically, operation S202 may include, for example, first code that causes the at least one electronic device to run the object program.
It should be noted that, in the embodiment of the present disclosure, the first code may be, for example, a code of a first version of an application, or may also be a code of an nth version of an application, where N is greater than 1 and N is an integer. For example, when an application is debugged for the first time, the code of the first version of the application may be sent to all electronic devices participating in code verification of the application, so that the electronic devices can install and run the application, and further, a developer may perform remote group control on the electronic devices through an initiation terminal (which may be a WEB display terminal as shown in fig. 1), thereby achieving the purpose of verifying the application with respect to the code of the first version.
Further, the following operations may also be performed after operation S202. And sending the second code of the target program to the at least one electronic device, so that the at least one electronic device updates the first code into the second code.
It should be noted that, in the embodiment of the present disclosure, all electronic devices participating in code verification of a target program may detect in real time whether a code update exists at an development end (e.g., a WEB display end shown in fig. 1). And if the development end is found to have code updating by the detection, requesting the updated code from the development end. The development terminal responds to the code requests of the electronic devices and sends the updated codes to the electronic devices, so that the electronic devices can also update the codes aiming at the target program in time, such as updating the previous first codes to the current second codes. In this way, each time a developer modifies the code, the developer can update the code at the development end and each debugging end (i.e. all electronic devices participating in code verification of the target program).
It should be noted that, in the embodiment of the present disclosure, if an electronic device (i.e., a mobile terminal) accesses the shared platform through a PC, its code request may be delivered to an initiating terminal (e.g., a WEB display terminal) through the following procedures: the electronic equipment is more than the PC end, more than the server and more than the starting end. The updated code of the development end can be transferred to the electronic device (i.e. each mobile terminal) through the following procedures: the development terminal is more than the server, more than the PC terminal and more than the electronic equipment. If an electronic device accesses the sharing platform in a wireless manner such as WIFI, the code request may be transmitted to the development end through the following procedures: the electronic equipment is more than the server and more than the starting end. The updated code of the development end can be transferred to the electronic device through the following processes: the development terminal is more than the server and more than the electronic equipment.
Next, in operation S203, the object program running on the at least one electronic device is controlled to execute the manipulation instruction.
Specifically, operation S203 may include, for example, controlling the target program after the code is updated to execute the manipulation instruction.
Referring back to fig. 1, in operation S203, one electronic device a of all electronic devices participating in code verification of the target program may be directly remotely controlled through the development end, and other electronic devices performing code verification of the target program may be controlled to perform an interlocking operation to perform the same operation as the electronic device a.
Next, in operation S204, the at least one electronic device is controlled to capture an interface display effect of the target program that has executed the control instruction.
Next, in operation S205, a screenshot from the at least one electronic device is obtained, so that the target application target program can be code debugged based on the obtained screenshot.
Specifically, in the embodiment of the present disclosure, after each operation is performed by all electronic devices participating in code verification of a target program, a picture can be cut off for a currently displayed interface, and the cut-off is returned to an initiating terminal. Through the screenshot, whether the interface changes of the target programs running on the electronic equipment participating in code verification of the target programs occur or not after each operation is executed or not, whether the interface changes occurring each time are accurate or not can be determined.
It should be noted that, for an electronic device accessing a shared platform through a PC, a remote control instruction may be transmitted to the electronic device through the following flow, for example: the development terminal is more than the server, more than the PC terminal and more than the electronic equipment. The screenshot of the electronic device may be transferred to the development end, for example, through the following process: the electronic equipment is more than the PC end, more than the server and more than the starting end. For an electronic device accessing a sharing platform in a wireless manner such as WIFI, a remote control instruction may be transmitted to the electronic device through the following procedures: the development terminal is more than the server and more than the electronic equipment. The screenshot of the electronic device may be transferred to the development end, for example, through the following process: the electronic equipment is more than the server and more than the starting end.
It should be noted that, in the embodiment of the present disclosure, for an electronic device that is directly remotely controlled by a user through a development end, a screenshot of the electronic device may be directly displayed at the development end, so that the user may determine an operation condition of a target program on the electronic device by observing the screenshot, and further determine whether a function and an interface display of the target program after a code is modified are correct. Therefore, each time an operation is executed, the screenshot from the electronic device can be used as a reference screenshot, the screenshots from other electronic devices are compared with the reference screenshot, and the running effect of the target program on other electronic devices participating in debugging the target program is determined according to the comparison result.
By the aid of the method and the device, for any application, the running effect of the modified code on tens of or even hundreds of electronic equipment related to multiple brands, multiple system versions and multiple sizes can be verified simultaneously through one-time debugging after the code is modified, and a developer is not required to hold each electronic equipment to operate independently after the code is modified every time like the related art. Therefore, when the same debugging task is faced, through the embodiment of the disclosure, a developer can solve the compatibility problem applied to a plurality of electronic devices at one time, so that the debugging time is shortened, and the coding efficiency is improved. Furthermore, because the developer can develop and debug at the same time, higher-quality codes can be provided for the tester, the workload of the tester is reduced, the labor cost is reduced, and meanwhile, the communication frequency between the developer and the tester can be reduced, so that the communication cost is reduced.
The method shown in fig. 2 is further described with reference to fig. 3-4 in conjunction with specific embodiments.
As an alternative embodiment, the method may further include the following operations, for example. Configuring one device of the at least one electronic device as a master device and configuring the remaining devices of the at least one electronic device as slave devices.
Correspondingly, the target program execution manipulation instruction after the control code is updated in operation S203 may include the following operations, for example. And generating a first control instruction for performing remote control on a first application, wherein the first application is a target program running in the main device, and the first control instruction corresponds to a first user operation. And sending the first control instruction to the main device so that the first application executes the first control instruction. And controlling the slave device to generate and execute a second control instruction for remotely controlling a second application, wherein the second application is a target program running in the slave device, and the second control instruction is generated by simulating a user to execute the first user operation on the second application.
It should be noted that, in the embodiment of the present disclosure, the second control instruction may also be generated at the development end and then sent to the slave device for execution. The method for generating the second control instruction at the issuable end is similar to the method for generating the second control instruction at the slave end, and is not described herein again.
As shown in fig. 3, it is assumed that the electronic devices participating in the present debugging include an electronic device 1 and an electronic device 2. At this time, the electronic device 1 may be configured as a master device, and the electronic device 2 may be configured as a slave device. As a main device, the interface related to the target program running on the electronic device 1 may be displayed on the display screen of the development end in addition to the display screen of the electronic device 1. As a slave device, the relevant interface of the target program running on the electronic device 2 is only displayed on the display screen of the electronic device 2, and is not simultaneously displayed on the display screen of the development end. Based on this, in the embodiment of the present disclosure, the user can directly remotely operate the electronic device 1, and the electronic device 2 can simulate the electronic device 1 to perform the same operation in an interlocking manner. For example, a developer performs a one-click operation on the electronic device 1 at a development end, and at this time, a virtual-click operation may be performed on the electronic device 2, so that the electronic device 2 can perform the same operation as the electronic device 1, thereby achieving the purpose of group-controlling the electronic devices 1 and 2.
Through the embodiment of the disclosure, for all the electronic devices participating in code verification of the target program, one electronic device can be directly and remotely controlled at the development end, and the other electronic devices can execute the same operation in a linkage manner, so that the compatibility problem of the electronic devices related to multiple brands, multiple system versions and multiple sizes in continuous code updating can be realized by simultaneously verifying the electronic devices at one time through debugging.
As an alternative embodiment, controlling the slave device to generate the second manipulation instruction for manipulating the second application may include, for example, the following operations. And determining a first minimum control for the first user operation aiming at the main equipment. For the slave device, a second minimum control is determined based on the first minimum control. And controlling the slave equipment to generate a second control instruction by simulating the user to execute the first user operation on the second minimum control.
Specifically, in the embodiment of the present disclosure, as shown in fig. 4, first, a developer may select, through a development end, all electronic devices participating in debugging a target program, for example, tens of electronic devices of multiple brands. The developer can then remotely control a host device, such as by clicking on the host device (e.g., clicking a login button) through the developer. The master device may then automatically capture and transmit back to the originating terminal as a reference image for comparison with the capture provided by the slave device. The tens of slave devices may perform the same operation in conjunction with the click operation performed by the user on the master device. Specifically, the minimum control including all click coordinate points in the master device is searched, control information (such as xpath, id, text and the like) of the minimum control is continuously collected after the minimum control is found, a corresponding minimum control is searched in the slave device based on the control information, and after the minimum control is found, a virtual click operation is executed on the control, namely the control is simulated to be triggered by the click operation. The slave device may also then automatically capture and transmit back to the originating terminal for comparison with the capture provided by the master device.
It should be noted that, in the embodiment of the present disclosure, the master device and the slave device may also transmit the screenshot to the server, so that the screenshot comparison operation is implemented at the server.
In addition, in the embodiment of the present disclosure, the slave device may execute the same operation in a coordinated manner according to the click operation performed by the user on the master device, in addition to the control manner. Specifically, a coordinate point in the master device a to which the click operation is directed is searched first, then a corresponding coordinate point is searched in the slave device based on the coordinate point, and after the coordinate point is found, a virtual click operation is executed on the coordinate point, that is, the coordinate point is simulated to be triggered by the click operation.
Compared with the control method, the coordinate method causes coordinate deviation because the width and height ratios of different devices are different. Because the aspect ratios of many devices are different, accurate results may not be obtained even by scaling up all coordinates. It is therefore preferable to use a more accurate approach, i.e. a control approach.
As an alternative embodiment, the method may further include, for example: and debugging the code of the target program according to the acquired screenshot. This operation may include, for example, the following operations. And comparing the difference between a second screenshot and the first screenshot, wherein the first screenshot comes from the master device, and the second screenshot comes from the slave device. It is determined whether the difference has exceeded a fault tolerance threshold. If it is determined that the difference has exceeded the fault tolerance threshold, an error is reported for the slave device.
Specifically, in the embodiment of the present disclosure, for example, the server may start a corresponding thread, and compare screenshots transmitted to the server. After each screenshot, the host device may compress the screenshot and then upload the compressed screenshot to the server, such as a 400 × 800 image. After each screenshot of the slave device, the same compression can be performed firstly and then the screenshot is uploaded to the server, so that the screenshot of the slave device is compressed into a picture with the same size as the screenshot of the master device. In this regard, the server may use the opencv provided template to match the screenshots provided by the master device with the screenshots provided by the slave devices. For each slave device, if the screenshot provided by the slave device and the screenshot provided by the master device can be successfully matched within the fault tolerance threshold range, the interface displayed by the slave device is considered to be the same as the interface displayed by the master device. If the comparison difference between the screenshots of the two devices is larger, namely if the screenshot provided by one slave device fails to be matched with the screenshot provided by the master device within the fault tolerance threshold range, an error report can be given, and the interfaces of all the devices are listed. It should be noted that, for the electronic device participating in debugging, if an error is reported, it indicates that the current code version may have compatibility problems, and a developer may be required to further modify the code.
As an alternative embodiment, the method may further include the following operations, for example. And displaying the second screenshot after feeding back corresponding prompt information aiming at the slave equipment.
In the embodiment of the disclosure, for the slave devices listed in the error list, the screenshots of the slave devices can be displayed at the development end, so that whether the interfaces displayed by the slave devices really have problems can be determined in a manual viewing manner. If the interface display problem of a certain slave device is determined to exist through the checking, the device information of the slave device and the problem existing in the interface display can be recorded, so that the developer can continuously modify the code of the target program until the application with stronger compatibility is debugged.
As an alternative embodiment, the method may further include the following operations, for example. And after feeding back corresponding prompt information aiming at the slave equipment, reconfiguring the slave equipment into new master equipment. And acquiring a third control instruction for controlling the target program running in the new main device. And sending the third control instruction to the new main device so that the target program executes the third control instruction. And controlling the new main equipment to capture the interface display effect of the target program which executes the third control instruction. A screenshot from the new master device is obtained. And debugging the code of the target program according to the acquired screenshot.
Specifically, in the embodiment of the present disclosure, for a slave device listed in an error list, a screenshot of the slave device may be presented at a development end, so that whether an interface displayed by the slave device really has a problem may be determined in a manner of manual viewing. If the fact that whether the interface is really problematic is uncertain through inspection, the slave equipment can be temporarily set as the master equipment, the slave equipment is directly remotely controlled through the development end, and then whether the displayed interface is really problematic is determined through a manual inspection mode.
It should be noted that, in the embodiment of the present disclosure, for the slave device listed in the error list, an operation of displaying a screenshot of the slave device at the development end may also be omitted, the slave device is directly and temporarily set as the master device, the slave device is directly and remotely controlled through the development end, and then whether the displayed interface is really problematic is determined in a manual viewing manner.
Fig. 5 schematically shows a block diagram of a program debugging apparatus according to an embodiment of the present disclosure.
As shown in fig. 5, the program debugging apparatus 500 may include, for example, a determination module 501, a first control module 502, a second control module 503, a third control module 504, and an acquisition module 505.
Specifically, the determining module 501 is configured to determine at least one electronic device for code debugging of a target program.
A first control module 502, configured to enable the at least one electronic device to run the target program.
A second control module 503, configured to control the object program running on the at least one electronic device to execute the control instruction.
A third control module 504, configured to control the at least one electronic device to capture an interface display effect of the target program that has executed the control instruction.
An obtaining module 505 (i.e. a first obtaining module) is configured to obtain a screenshot from the at least one electronic device, so as to enable code debugging on the target program based on the obtained screenshot.
As an alternative embodiment, the apparatus may further comprise, for example, a first configuration module. The first configuration module is used for configuring one device in the at least one electronic device as a master device and configuring the rest devices in the at least one electronic device as slave devices. Correspondingly, the second control module may include, for example: the device comprises a generating unit, a sending unit and a control unit. The generating unit is used for generating a first control instruction for controlling a first application, the first application is a target program running in the main device, and the first control instruction corresponds to a first user operation. The sending unit is used for sending the first control instruction to the main device so that the first application can execute the first control instruction. The control unit is used for controlling the slave device to generate and execute a second control instruction for controlling a second application, wherein the second application is a target program running in the slave device, and the second control instruction is generated by simulating a user to execute the first user operation on the second application.
As an alternative embodiment, the control unit may for example comprise: the device comprises a first determining subunit, a second determining subunit and a control subunit. The first determining subunit is configured to determine, for the master device, a first minimum control for which the first user operation is directed. The second determining subunit is configured to determine, for the slave device, a second minimum control based on the first minimum control. The control subunit is configured to control the slave device to generate a second control instruction by simulating a user to perform the first user operation on the second minimum control.
As an alternative embodiment, the apparatus may further comprise, for example, a first debugging module. The first debugging module may include, for example: the device comprises a comparison unit, a determination unit and an error reporting unit. The comparison unit is used for comparing the difference between a second screenshot and a first screenshot, wherein the first screenshot comes from the master device, and the second screenshot comes from the slave device. The determination unit is used to determine whether the difference has exceeded a fault tolerance threshold. An error reporting unit is configured to report an error to the slave device if it is determined that the difference has exceeded the fault tolerance threshold.
As an alternative embodiment, the device may also comprise a display module, for example. And the display module is used for displaying the second screenshot after an error is reported for the slave equipment.
As an alternative embodiment, the apparatus may further comprise: the device comprises a second configuration module, a second acquisition module, a second sending module, a fourth control module, a third acquisition module and a second debugging module. The second configuration module is used for reconfiguring the slave device into a new master device after an error is reported for the slave device. The second obtaining module is used for obtaining a third control instruction for controlling the target program running in the new main device. The second sending module is used for sending the third control instruction to the new main device so that the target program can execute the third control instruction. And the fourth control module is used for controlling the new main equipment to capture the screen of the interface display effect of the target program which executes the third control instruction. And the third acquisition module is used for acquiring the screenshot from the new main equipment. And the second debugging module is used for debugging the code of the target program according to the acquired screenshot.
Any of the modules, units, sub-units, or at least part of the functionality of any of them according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, units and sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, units, sub-units according to the embodiments of the present disclosure may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in any other reasonable manner of hardware or firmware by integrating or packaging a circuit, or in any one of three implementations of software, hardware, and firmware, or in any suitable combination of any of them. Alternatively, one or more of the modules, units, sub-units according to embodiments of the disclosure may be at least partially implemented as computer program modules, which, when executed, may perform the corresponding functions.
For example, any plurality of the determining module 501, the first control module 502, the second control module 503, the third control module 504 and the obtaining module 505 may be combined and implemented in one module/unit/sub-unit, or any one of the modules/units/sub-units may be split into a plurality of modules/units/sub-units. Alternatively, at least part of the functionality of one or more of these modules/units/sub-units may be combined with at least part of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to an embodiment of the present disclosure, at least one of the determining module 501, the first controlling module 502, the second controlling module 503, the third controlling module 504 and the obtaining module 505 may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented by hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or implemented by any one of three implementations of software, hardware and firmware, or implemented by a suitable combination of any several of them. Alternatively, at least one of the determining module 501, the first control module 502, the second control module 503, the third control module 504 and the obtaining module 505 may be at least partially implemented as a computer program module, which when executed, may perform a corresponding function.
It should be noted that, the apparatus part embodiment of the present disclosure corresponds to the same or similar method part embodiment of the present disclosure, and the description of the apparatus part specifically refers to the description of the method part, and is not repeated herein.
Fig. 6 schematically shows a block diagram of a computer system suitable for implementing the above described method according to an embodiment of the present disclosure. The computer system illustrated in FIG. 6 is only one example and should not impose any limitations on the scope of use or functionality of embodiments of the disclosure.
As shown in fig. 6, a computer system 600 according to an embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. Processor 601 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 601 may also include onboard memory for caching purposes. Processor 601 may include a single processing unit or multiple processing units for performing different actions of a method flow according to embodiments of the disclosure.
In the RAM 603, various programs and data necessary for the operation of the system 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 602 and/or RAM 603. It is to be noted that the programs may also be stored in one or more memories other than the ROM 602 and RAM 603. The processor 601 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, system 600 may also include an input/output (I/O) interface 605, input/output (I/O) interface 605 also connected to bus 604. The system 600 may also include one or more of the following components connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program, when executed by the processor 601, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 602 and/or RAM 603 described above and/or one or more memories other than the ROM 602 and RAM 603.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (10)

1. A method of program debugging, comprising:
determining at least one electronic device for code debugging of a target program;
causing the at least one electronic device to run the target program;
controlling the target program running on the at least one electronic device to execute a control instruction;
controlling the at least one electronic device to capture the interface display effect of the target program which executes the control instruction; and
acquiring screenshots from the at least one electronic device so as to debug the target program based on the acquired screenshots.
2. The method of claim 1, wherein,
the method further comprises the following steps: configuring one device of the at least one electronic device as a master device and configuring the remaining devices of the at least one electronic device as slave devices; and
the target program after the control code is updated executes a control instruction, including:
generating a first control instruction for controlling a first application, wherein the first application is a target program running in the main device, and the first control instruction corresponds to a first user operation;
sending the first control instruction to the main device so that the first application can execute the first control instruction; and
and controlling the slave device to generate and execute a second control instruction for controlling a second application, wherein the second application is a target program running in the slave device, and the second control instruction is generated by simulating a user to execute the first user operation on the second application.
3. The method of claim 2, wherein controlling the slave device to generate a second manipulation instruction to manipulate for a second application comprises:
determining, for the primary device, a first minimum control for which the first user operation is directed;
determining, for the slave device, a second minimum control based on the first minimum control; and
and controlling the slave equipment to generate a second control instruction by simulating the user to execute the first user operation on the second minimum control.
4. The method of claim 1, wherein the method further comprises: and debugging the code of the target program according to the acquired screenshot, wherein the operation comprises the following steps:
comparing the difference between a second screenshot and a first screenshot, wherein the first screenshot comes from the master device, and the second screenshot comes from the slave device;
determining whether the difference has exceeded a fault tolerance threshold;
and feeding back corresponding prompt information for the slave equipment if the difference is determined to exceed the fault tolerance threshold.
5. The method of claim 4, wherein the method further comprises:
and displaying the second screenshot after feeding back corresponding prompt information aiming at the slave equipment.
6. The method of claim 4, wherein the method further comprises:
after feeding back corresponding prompt information aiming at the slave equipment, reconfiguring the slave equipment into new master equipment;
acquiring a third control instruction for controlling the target program running in the new main device;
sending the third control instruction to the new main device so that the target program can execute the third control instruction;
controlling the new main equipment to capture the interface display effect of the target program which executes the third control instruction;
acquiring a screenshot from the new master device; and
and debugging the code of the target program according to the acquired screenshot.
7. The method of claim 1, wherein:
the causing the at least one electronic device to run the object program includes: first code that causes the at least one electronic device to run the target program;
the method further comprises the following steps: and sending the second code of the target program to the at least one electronic device, so that the at least one electronic device updates the first code to the second code.
8. A program debugging apparatus comprising:
the system comprises a determining module, a debugging module and a debugging module, wherein the determining module is used for determining at least one electronic device for performing code debugging on a target program;
the first control module is used for enabling the at least one electronic device to run the target program;
the second control module is used for controlling the target program running on the at least one electronic device to execute the control instruction;
the third control module is used for controlling the at least one electronic device to capture the interface display effect of the target program which executes the control instruction; and
and the acquisition module is used for acquiring the screenshot from the at least one electronic device so as to debug the target program based on the acquired screenshot.
9. A computer system, comprising:
one or more processors;
a memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-7.
10. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the method of any one of claims 1 to 7.
CN201910931236.XA 2019-09-27 2019-09-27 Program debugging method and device Pending CN110704321A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910931236.XA CN110704321A (en) 2019-09-27 2019-09-27 Program debugging method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910931236.XA CN110704321A (en) 2019-09-27 2019-09-27 Program debugging method and device

Publications (1)

Publication Number Publication Date
CN110704321A true CN110704321A (en) 2020-01-17

Family

ID=69196349

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910931236.XA Pending CN110704321A (en) 2019-09-27 2019-09-27 Program debugging method and device

Country Status (1)

Country Link
CN (1) CN110704321A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782530A (en) * 2020-06-30 2020-10-16 北京奇艺世纪科技有限公司 Remote debugging method, device and system, electronic equipment and storage medium
WO2022100033A1 (en) * 2020-11-16 2022-05-19 百度在线网络技术(北京)有限公司 Method and apparatus for debugging applet, electronic device and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104050076A (en) * 2013-03-12 2014-09-17 阿里巴巴集团控股有限公司 Testing method, device and system of application software on mobile terminal
CN104765678A (en) * 2014-01-08 2015-07-08 阿里巴巴集团控股有限公司 Method and device for testing applications on mobile terminal
CN105117337A (en) * 2015-08-26 2015-12-02 小米科技有限责任公司 Application debugging method, client and debugging platform
CN107861860A (en) * 2016-09-21 2018-03-30 Fmr有限责任公司 The automatic checking of the mobile applications of synchronizing moving equipment
US20180121319A1 (en) * 2016-10-28 2018-05-03 International Business Machines Corporation Code component debugging in an application program
CN109408362A (en) * 2018-08-21 2019-03-01 中国平安人寿保险股份有限公司 Application compatibility test method, device, system and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104050076A (en) * 2013-03-12 2014-09-17 阿里巴巴集团控股有限公司 Testing method, device and system of application software on mobile terminal
CN104765678A (en) * 2014-01-08 2015-07-08 阿里巴巴集团控股有限公司 Method and device for testing applications on mobile terminal
CN105117337A (en) * 2015-08-26 2015-12-02 小米科技有限责任公司 Application debugging method, client and debugging platform
CN107861860A (en) * 2016-09-21 2018-03-30 Fmr有限责任公司 The automatic checking of the mobile applications of synchronizing moving equipment
US20180121319A1 (en) * 2016-10-28 2018-05-03 International Business Machines Corporation Code component debugging in an application program
CN109408362A (en) * 2018-08-21 2019-03-01 中国平安人寿保险股份有限公司 Application compatibility test method, device, system and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李少杰: "面向移动智能终端应用性能测试平台的研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782530A (en) * 2020-06-30 2020-10-16 北京奇艺世纪科技有限公司 Remote debugging method, device and system, electronic equipment and storage medium
CN111782530B (en) * 2020-06-30 2023-10-10 北京奇艺世纪科技有限公司 Remote debugging method, device, system, electronic equipment and storage medium
WO2022100033A1 (en) * 2020-11-16 2022-05-19 百度在线网络技术(北京)有限公司 Method and apparatus for debugging applet, electronic device and storage medium

Similar Documents

Publication Publication Date Title
CN109302522B (en) Test method, test device, computer system, and computer medium
US9274935B1 (en) Application testing system with application programming interface
US9021443B1 (en) Test automation API for host devices
US10462029B2 (en) Device cloud monitoring and stability
CN102195970B (en) Based on the debugging of client session
US20140331209A1 (en) Program Testing Service
US9679090B1 (en) Systematically exploring programs during testing
US9292423B1 (en) Monitoring applications for compatibility issues
CN110347085B (en) Automated test system, method, vehicle, and computer-readable medium
US20150212930A1 (en) Application test system, application test method and storage medium
US11237948B2 (en) Rendering engine component abstraction system
JP2013545172A (en) Device and method for providing a software program adapted to a computer system downloaded by a user
US20160077955A1 (en) Regression testing of responsive user interfaces
CN110704321A (en) Program debugging method and device
CN108304209B (en) Firmware upgrading method and firmware upgrading system
US9699247B2 (en) User experience monitoring for application remoting
KR20170073750A (en) test equipment of Display Module
US20140331205A1 (en) Program Testing Service
CA2910977A1 (en) Program testing service
CN111240947B (en) Page thermodynamic diagram generation method and system
CN110688318A (en) Program testing method and device
US10169216B2 (en) Simulating sensors
EP3321808B1 (en) Verification system and verification method
US20190227909A1 (en) Application testing on multiple device types
KR20180076020A (en) Apparatus and method for application test automation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200117

RJ01 Rejection of invention patent application after publication