CN109753435B - Software testing method and device - Google Patents

Software testing method and device Download PDF

Info

Publication number
CN109753435B
CN109753435B CN201811642778.7A CN201811642778A CN109753435B CN 109753435 B CN109753435 B CN 109753435B CN 201811642778 A CN201811642778 A CN 201811642778A CN 109753435 B CN109753435 B CN 109753435B
Authority
CN
China
Prior art keywords
area
color
target
determining
expected
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.)
Active
Application number
CN201811642778.7A
Other languages
Chinese (zh)
Other versions
CN109753435A (en
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.)
Beijing Testin Information Technology Co Ltd
Original Assignee
Beijing Testin Information Technology 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 Beijing Testin Information Technology Co Ltd filed Critical Beijing Testin Information Technology Co Ltd
Priority to CN201811642778.7A priority Critical patent/CN109753435B/en
Publication of CN109753435A publication Critical patent/CN109753435A/en
Application granted granted Critical
Publication of CN109753435B publication Critical patent/CN109753435B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application discloses a software testing method and device. The method comprises the following steps: determining a target area in a screenshot of a software interface to be tested, wherein the target area is an area expected to comprise a target control; determining a target sub-area in the target area, wherein the target sub-area is an area occupied by a preset characteristic color of the target control; and if the target sub-area is determined to be matched with the expected area range, executing the test operation on the target sub-area. Therefore, the control identification accuracy can be effectively improved by setting the characteristic color for the control and determining the area occupied by the characteristic color in the screenshot of the software interface to be tested so as to identify and test the control, and the test coverage rate and the test precision are further improved.

Description

Software testing method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a software testing method and apparatus.
Background
Software testing refers to a process used to facilitate the identification of the correctness, integrity, security, and quality of software.
The existing software testing scheme has the problem that some controls cannot be accurately identified, so that the software testing effect is poor. For example: for a control which appears randomly and disappears in a short time, due to the fact that the attribute information of the control is less or the capability of a test frame is insufficient, the control is difficult to identify accurately; for the control of the carousel image, although the image recognition can recognize the currently displayed image, due to the fast carousel speed, after a certain image is recognized, the test operation may proceed to the next image, resulting in test failure.
Therefore, there is a need to provide a more efficient software testing scheme.
Disclosure of Invention
The embodiment of the specification provides a software testing scheme, which is used for improving the identification accuracy of a control so as to improve the coverage rate and the testing precision of automatic testing.
An embodiment of the present specification further provides a software testing method, which is characterized by including:
determining a target area in a screenshot of a software interface to be tested, wherein the target area is an area expected to comprise a target control;
determining a target sub-area in the target area, wherein the target sub-area is an area occupied by a preset characteristic color of the target control;
and if the target sub-area is determined to be matched with the expected area range, executing the test operation on the target sub-area.
Optionally, the determining a target area in the screenshot of the software interface to be tested includes:
acquiring a test script corresponding to a software interface to be tested;
determining the target area based on an expected area recorded by the test script;
and the expected area is an area which is divided in the software interface to be tested in advance and contains the target control.
Optionally, before determining the target sub-region in the target region, the method further includes:
determining a selected target color, wherein the target color is a color in the expected area;
and if the target color meets a preset characteristic condition, setting the target color as the preset characteristic color.
Optionally, the method further includes:
determining a magnification area corresponding to the expected area, wherein the magnification area comprises the expected area;
determining a region between a boundary of the expected region and a boundary of the enlarged region as a surrounding region;
and if the ratio of the area of the target color in the surrounding area is determined not to be out of limit, determining that the target color meets the preset characteristic condition.
Optionally, the method further includes:
and if the target color meets a preset characteristic condition, determining the proportion of the region of the target color in the expected region as the expected proportion.
Optionally, the method further includes:
determining the actual occupation ratio of the target sub-region in the target region according to the areas of the target region and the target sub-region;
and if the actual proportion is matched with the expected proportion, determining that the target sub-area is matched with the expected area range.
Optionally, if it is determined that the actual proportion is not matched with the expected proportion, repeatedly capturing the screenshot of the software interface to be tested until a target area and a target sub-area are determined, or until timeout occurs, where the actual proportion is matched with the expected proportion.
Optionally, the determining a target sub-region in the target region includes:
and taking the area occupied by the color matched with the preset characteristic color in the target area as the target sub-area.
Optionally, the method further includes:
determining a color matched with the preset characteristic color based on a preset color tolerance;
determining the pixel grids of the color matched with the preset characteristic color based on the pixel data of the target area;
and determining the area occupied by the pixel grids as the area occupied by the color matched with the preset characteristic color.
An embodiment of the present specification further provides a software testing apparatus, which includes:
the first determination module is used for determining a target area in the screenshot of the software interface to be detected, wherein the target area is an area where the target control is expected to be located;
a second determining module, configured to determine a target sub-region in the target region, where the target sub-region is a region occupied by a preset feature color of the target control;
and the test module is used for executing the test operation on the target sub-area if the target sub-area is determined to be matched with the expected area range.
Optionally, the first determining module is specifically configured to:
acquiring a test script corresponding to a software interface to be tested; determining the target area based on an expected area recorded by the test script;
and the expected area is an area which is divided in the software interface to be tested in advance and contains the target control.
Optionally, the method further includes:
the color recording module is used for determining the selected target color, and the target color is the color in the expected area; and if the target color meets a preset characteristic condition, setting the target color as the preset characteristic color.
Optionally, the color recording module is further configured to:
determining a magnification area corresponding to the expected area, wherein the magnification area comprises the expected area; determining a region between a boundary of the expected region and a boundary of the enlarged region as a surrounding region; and if the ratio of the area of the target color in the surrounding area is determined not to be out of limit, determining that the target color meets the preset characteristic condition.
Optionally, the color recording module is further configured to:
and if the target color meets a preset characteristic condition, determining the proportion of the region of the target color in the expected region as the expected proportion.
Optionally, the method further includes:
the matching module is used for determining the actual occupation ratio of the target sub-region in the target region according to the areas of the target region and the target sub-region; and if the actual proportion is matched with the expected proportion, determining that the target sub-area is matched with the expected area range.
Optionally, the test module is further configured to:
and if the actual occupation ratio is determined not to be matched with the expected occupation ratio, repeatedly intercepting the screenshot of the software interface to be detected until a target area and a target sub-area, which are matched with the actual occupation ratio and the expected occupation ratio, are determined, or until overtime occurs.
Optionally, the second determining module is specifically configured to:
and taking the area occupied by the color matched with the preset characteristic color in the target area as the target sub-area.
Optionally, the second determining module is specifically configured to:
determining a color matched with the preset characteristic color based on a preset color tolerance; determining the pixel grids of the color matched with the preset characteristic color based on the pixel data of the target area; and determining the area occupied by the pixel grids as the area occupied by the color matched with the preset characteristic color.
The present specification further provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and when the computer program is executed by the processor, the steps of the software testing method are implemented.
The embodiment of the present specification further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when being executed by a processor, the computer program implements the steps of the software testing method.
The embodiment of the specification adopts at least one technical scheme which can achieve the following beneficial effects:
by judging the characteristic color of the control and detecting the area occupied by the characteristic color in the screenshot of the software interface to be tested, when the area occupied by the characteristic color is determined to be matched with the expected area range, the test operation on the area is executed, so that the test operation on the control is completed. Compared with the prior art, the area where the control is located is identified through the characteristic color of the control, so that the control identification accuracy can be effectively improved, and further, the automatic test coverage rate and the test precision are improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic diagram of an application scenario provided in the present specification;
fig. 2 is a schematic flowchart of a software testing method according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of a positional relationship between regions according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a software testing apparatus according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
For the problems in the prior art stated in the background section, the invention provides a software testing method, which comprises the steps of judging the characteristic color of a control, detecting the area occupied by the characteristic color in a screenshot of a software interface to be tested, and executing the testing operation on the area when the area occupied by the characteristic color is determined to be matched with an expected area range so as to finish the testing operation on the control. Compared with the prior art, the area where the control is located is identified through the characteristic color of the control, so that the control identification accuracy can be effectively improved, and further, the automatic test coverage rate and the test precision are improved.
Wherein, the control refers to the encapsulation of data and methods, for example: hyperlink controls common in pages; the characteristic color of the control is the color which can embody the color characteristic of the interface in the visible interface of the control; the test operation refers to the operation of the control in the automatic test based on the test script; automated testing generally refers to the automation of software testing.
The following exemplifies an application scenario of the present invention.
Referring to fig. 1, the application scenario includes: a test platform 110, a test tool 120, and software under test 130; wherein:
in the recording process of the test script, the test platform 110 obtains an interface screenshot of the software 130 to be tested, and a tester captures an area including a certain control from the interface screenshot, records the area as a target area, and records the target area in the test script; and then, selecting a representative color from the target area as the characteristic color of the control, further obtaining the target sub-area occupied by the characteristic color in the target area, and recording the target sub-area in the test script.
In the automatic testing process, the testing platform 110 reads the testing script and tests the interface screenshot of the software through the testing tool 120 to check whether the target sub-region in the interface screenshot is matched with the target sub-region obtained in the recording process, and if so, the testing operation on the target sub-region is executed.
The testing platform can be a platform provided by a software tester; the testing tool means that some simple problems of the software can be visually displayed in front of a reader through some tools, so that a tester can better find out the location of a software error.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 2 is a schematic flow chart of a software testing scheme provided in an embodiment of the present specification, and referring to fig. 2, the method may specifically include:
step 220, determining a target area in the screenshot of the software interface to be tested, wherein the target area is an area expected to include a target control; one implementation may be:
acquiring a test script corresponding to a software interface to be tested; determining the target area based on an expected area recorded by the test script; and the expected area is an area which is divided in the software interface to be tested in advance and contains the target control. Referring to fig. 3, the present implementation may specifically include the following two parts:
a recording part: projecting the software interface onto a mapping screen of a recording script tool to obtain an interface projection image 310; an expected area containing the target control, which is defined by the tester in the projected image, is determined 320, and the relative position of the expected area in the software interface is recorded in the test script.
Test part: and determining an area corresponding to the relative position in the screenshot of the software interface to be tested based on the relative position of the expected area recorded in the test script, and recording as a target area.
It can be seen that, in the implementation manner of step 220, the expected region 'theoretically' including the target control is recorded in the test script in the process of recording the test script, so that the target region corresponding to the expected region can be automatically and accurately found from the screenshot of the software interface to be tested by the test script in the automatic test process, and support is provided for subsequent control identification.
Step 240, determining a target sub-region in the target region, wherein the target sub-region is a region occupied by a preset characteristic color of the target control;
it is understood that step 240 further includes: recording the characteristic color and the area thereof, wherein the recording step can specifically comprise the following steps:
determining a selected target color, wherein the target color is the color in the expected area, and can be manually selected by a tester or automatically selected by a machine after the image analysis of the expected area is carried out; if the target color meets a preset characteristic condition, setting the target color as the preset characteristic color, determining the area proportion of the target color in an expected area to be recorded as an expected proportion, and recording the characteristic color and the expected proportion in a test script for an automatic test process; and if the target color does not meet the preset characteristic condition, indicating the tester to reselect the color. Therefore, a characteristic color can be set for the control or the carousel map based on different characteristics embodied on the interface UI, and the purpose of accurately identifying the control or the carousel map can be achieved.
The implementation manner of the step of judging whether the target color meets the preset characteristic condition may be:
determining a magnification area corresponding to the expected area, wherein the magnification area comprises the expected area; determining a region between a boundary of the expected region and a boundary of the enlarged region as a surrounding region; if the ratio of the area of the target color in the surrounding area is determined not to be out of limit, determining that the target color meets the preset characteristic condition; and if the proportion of the area of the target color in the surrounding area is determined to be out of limit, determining that the target color does not meet the preset characteristic condition. Referring to fig. 3, specific examples may be:
assuming that the target color selected from the expected area 320 is black, determining a magnified area 340 magnified twice with respect to the expected area 320 based on a preset magnification rule; checking a black area in an area (marked as a surrounding area) between the boundary of the enlarged area 340 and the boundary of the expected area 320, and calculating whether the occupation ratio of the black area in the surrounding area exceeds the limit (for example, whether the occupation ratio exceeds 10%), and if not, recording black as the preset characteristic color of the target control. Therefore, when the method is applied to terminal equipment of various models and the expected area changes, the concept of enlarging the area is introduced to avoid the influence of the characteristic color in the area around the expected area on the characteristic color area to be searched (namely the target sub-area), so as to improve the dividing precision of the characteristic color area and provide data support for the control identification precision.
Based on this, one implementation of step 240 may be:
and taking the area occupied by the color matched with the preset characteristic color in the target area as the target sub-area. Specific examples can be:
determining a color matched with the preset characteristic color based on a preset color tolerance; determining the pixel grids of the color matched with the preset characteristic color based on the pixel data of the target area; and determining the area occupied by the pixel grids as the area occupied by the color matched with the preset characteristic color.
The color tolerance refers to a selection range set during color selection, the larger the tolerance is, the larger the selection range is, and the numerical value is between 0 and 255; for example: the selected color is blue and if a color tolerance of 50 is set, both light blue and deep blue are within the range of the selected color.
Preferably, the selectable color tolerances include: approximately equal to, above, equal to options; wherein, approximately equal may be exemplified by: hexadecimal color #38A1FD, color tolerance 20.
And step 260, if the target sub-area is determined to be matched with the expected area range, executing a test operation on the target sub-area. One implementation may be:
determining the actual occupation ratio of the target sub-region in the target region according to the areas of the target region and the target sub-region; and if the actual proportion is matched with the expected proportion, determining that the target sub-area is matched with the expected area range. That is, comparing the expected occupancy of the area 330 recorded in the recording part in the expected area 320 with the actual occupancy of the target sub-area in the target area detected in the automated testing process to determine whether the two are the same or similar, if so, performing the testing operation on the target sub-area to complete the testing operation on the target control. Therefore, the realization method determines whether the target sub-region meets the expected region range by comparing the actual proportion with the expected proportion, so as to avoid the influence of the change of the sizes of the target region and the target sub-region on the control identification accuracy when the method is applied to various types of terminal equipment.
And if the actual occupation ratio is determined not to be matched with the expected occupation ratio, repeatedly intercepting the screenshot of the software interface to be detected until a target area and a target area which are matched with the actual occupation ratio and the expected occupation ratio are determined, or until overtime occurs. That is, repeatedly capturing the screenshot of the software interface to be tested every preset time period, and repeatedly performing the above steps 220 to 240 to check whether the target sub-region in the captured screenshot of the software interface to be tested matches with the expected region range or not until the target sub-region meeting the requirement is found, or until the time is out. Therefore, the steps can be carried out for multiple times in the process of initiating the software interface request by the terminal equipment, so that the problem of control identification failure caused by network delay and the like can be avoided.
As can be seen, in the embodiment, by judging the characteristic color of the control and detecting the area occupied by the characteristic color in the screenshot of the software interface to be tested, when it is determined that the area occupied by the characteristic color matches with the expected area range, the test operation on the area is executed, so as to complete the test operation on the control. Compared with the prior art, the area where the control is located is identified through the characteristic color of the control, so that the control identification accuracy can be effectively improved, and further, the automatic test coverage rate and the test precision are improved.
In addition, for simplicity of explanation, the above-described method embodiments are described as a series of acts or combinations, but it should be understood by those skilled in the art that the present invention is not limited by the order of acts or steps described, as some steps may be performed in other orders or simultaneously according to the present invention. Furthermore, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Fig. 4 is a schematic structural diagram of a software testing apparatus provided in an embodiment of the present specification, and referring to fig. 4, the apparatus may specifically include: a first determination module 41, a second determination module 42, and a test module 43, wherein:
the first determining module 41 is configured to determine a target area in the screenshot of the software interface to be tested, where the target area is an area where the target control is expected to be located;
a second determining module 42, configured to determine a target sub-region in the target region, where the target sub-region is a region occupied by a preset feature color of the target control;
and the testing module 43 is configured to perform a testing operation on the target sub-region if it is determined that the target sub-region matches the expected region range.
Optionally, the first determining module 41 is specifically configured to:
acquiring a test script corresponding to a software interface to be tested; determining the target area based on an expected area recorded by the test script;
and the expected area is an area which is divided in the software interface to be tested in advance and contains the target control.
Optionally, the method further includes:
the color recording module is used for determining the selected target color, and the target color is the color in the expected area; and if the target color meets a preset characteristic condition, setting the target color as the preset characteristic color.
Optionally, the color recording module is further configured to:
determining a magnification area corresponding to the expected area, wherein the magnification area comprises the expected area; determining a region between a boundary of the expected region and a boundary of the enlarged region as a surrounding region; and if the ratio of the area of the target color in the surrounding area is determined not to be out of limit, determining that the target color meets the preset characteristic condition.
Optionally, the color recording module is further configured to:
and if the target color meets a preset characteristic condition, determining the proportion of the region of the target color in the expected region as the expected proportion.
Optionally, the apparatus further comprises:
the matching module is used for determining the actual occupation ratio of the target sub-region in the target region according to the areas of the target region and the target sub-region; and if the actual proportion is matched with the expected proportion, determining that the target sub-area is matched with the expected area range.
Optionally, the test module is further configured to:
and if the actual occupation ratio is determined not to be matched with the expected occupation ratio, repeatedly intercepting the screenshot of the software interface to be detected until a target area and a target sub-area, which are matched with the actual occupation ratio and the expected occupation ratio, are determined, or until overtime occurs.
Optionally, the second determining module 42 is specifically configured to:
and taking the area occupied by the color matched with the preset characteristic color in the target area as the target sub-area.
Optionally, the second determining module 42 is specifically configured to:
determining a color matched with the preset characteristic color based on a preset color tolerance; determining the pixel grids of the color matched with the preset characteristic color based on the pixel data of the target area; and determining the area occupied by the pixel grids as the area occupied by the color matched with the preset characteristic color.
As can be seen, in the embodiment, by judging the characteristic color of the control and detecting the area occupied by the characteristic color in the screenshot of the software interface to be tested, when it is determined that the area occupied by the characteristic color matches with the expected area range, the test operation on the area is executed, so as to complete the test operation on the control. Compared with the prior art, the area where the control is located is identified through the characteristic color of the control, so that the control identification accuracy can be effectively improved, and further, the automatic test coverage rate and the test precision are improved. In addition, as for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to part of the description of the method embodiment. Further, it should be noted that, among the respective components of the apparatus of the present invention, the components thereof are logically divided according to the functions to be realized, but the present invention is not limited thereto, and the respective components may be newly divided or combined as necessary.
Fig. 5 is a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure, and referring to fig. 5, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include hardware required by other services. The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the software testing device on the logic level. Of course, besides the software implementation, the present application does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
The network interface, the processor and the memory may be interconnected by a bus system. The bus may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 5, but this does not indicate only one bus or one type of bus.
The memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both read-only memory and random access memory, and provides instructions and data to the processor. The Memory may include a Random-Access Memory (RAM) and may also include a non-volatile Memory (non-volatile Memory), such as at least 1 disk Memory.
The processor is used for executing the program stored in the memory and specifically executing:
determining a target area in a screenshot of a software interface to be tested, wherein the target area is an area expected to comprise a target control;
determining a target sub-area in the target area, wherein the target sub-area is an area occupied by a preset characteristic color of the target control;
and if the target sub-area is determined to be matched with the expected area range, executing the test operation on the target sub-area.
The method performed by the software testing device or manager (Master) node according to the embodiment shown in fig. 4 of the present application can be applied to or implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
The software testing apparatus may also perform the method of fig. 2 and implement the method performed by the administrator node.
Based on the same invention creation, the embodiment of the present application further provides a computer readable storage medium, which stores one or more programs, and when the one or more programs are executed by an electronic device including a plurality of application programs, the electronic device is caused to execute the software testing method provided by the corresponding embodiment of fig. 2.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (4)

1. A software testing method, comprising:
determining a target area in a screenshot of a software interface to be tested, wherein the target area is an area expected to comprise a target control;
determining a target sub-area in the target area, wherein the target sub-area is an area occupied by a preset characteristic color of the target control;
if the target sub-area is determined to be matched with the expected area range, executing test operation on the target sub-area;
the determining of the target area in the screenshot of the software interface to be tested comprises the following steps:
acquiring a test script corresponding to a software interface to be tested;
determining the target area based on an expected area recorded by the test script;
the expected area is an area which is divided in the software interface to be tested in advance and contains the target control;
before determining a target sub-region in the target region, further comprising:
determining a selected target color, wherein the target color is a color in the expected area;
if the target color meets a preset characteristic condition, setting the target color as the preset characteristic color;
further comprising:
determining a magnification area corresponding to the expected area, wherein the magnification area comprises the expected area;
determining a region between a boundary of the expected region and a boundary of the enlarged region as a surrounding region;
if the ratio of the area of the target color in the surrounding area is determined not to be out of limit, determining that the target color meets the preset characteristic condition;
if the ratio of the area of the target color in the surrounding area is determined to be out of limit, determining that the target color does not meet the preset characteristic condition;
by introducing the concept of enlarging the area, the influence of the characteristic color in the area around the expected area on the characteristic color area to be searched is avoided;
further comprising:
if the target color meets a preset characteristic condition, determining the area proportion of the target color in the expected area as the expected proportion, and recording the characteristic color and the expected proportion in a test script for the use of an automatic test process; if the target color does not meet the preset characteristic condition, indicating the tester to reselect the color;
the determining a target sub-region in the target region includes:
taking the area occupied by the color matched with the preset characteristic color in the target area as the target sub-area;
further comprising:
determining a color matched with the preset characteristic color based on a preset color tolerance;
determining the pixel grids of the color matched with the preset characteristic color based on the pixel data of the target area;
determining the area occupied by the pixel grids as the area occupied by the color matched with the preset characteristic color;
the color tolerance refers to a selection range set during color selection, the larger the tolerance is, the larger the selection range is, and the numerical value is between 0 and 255; the selectable color tolerances include: approximately equal to, above, equal to the option.
2. The method of claim 1, further comprising:
determining the actual occupation ratio of the target sub-region in the target region according to the areas of the target region and the target sub-region;
and if the actual proportion is matched with the expected proportion, determining that the target sub-area is matched with the expected area range.
3. The method of claim 2,
and if the actual occupation ratio is determined not to be matched with the expected occupation ratio, repeatedly intercepting the screenshot of the software interface to be detected until a target area and a target sub-area, which are matched with the actual occupation ratio and the expected occupation ratio, are determined, or until overtime occurs.
4. A software testing apparatus, comprising:
the first determination module is used for determining a target area in the screenshot of the software interface to be detected, wherein the target area is an area where the target control is expected to be located;
a second determining module, configured to determine a target sub-region in the target region, where the target sub-region is a region occupied by a preset feature color of the target control;
the test module is used for executing the test operation on the target sub-area if the target sub-area is determined to be matched with the expected area range;
the first determining module is specifically configured to:
acquiring a test script corresponding to a software interface to be tested; determining the target area based on an expected area recorded by the test script;
the expected area is an area which is divided in the software interface to be tested in advance and contains the target control;
further comprising:
the color recording module is used for determining the selected target color, and the target color is the color in the expected area; if the target color meets a preset characteristic condition, setting the target color as the preset characteristic color;
a color recording module further configured to:
determining a magnification area corresponding to the expected area, wherein the magnification area comprises the expected area; determining a region between a boundary of the expected region and a boundary of the enlarged region as a surrounding region; if the ratio of the area of the target color in the surrounding area is determined not to be out of limit, determining that the target color meets the preset characteristic condition; if the ratio of the area of the target color in the surrounding area is determined to be out of limit, determining that the target color does not meet the preset characteristic condition; by introducing the concept of enlarging the area, the influence of the characteristic color in the area around the expected area on the characteristic color area to be searched is avoided;
a color recording module further configured to:
if the target color meets a preset characteristic condition, determining the area proportion of the target color in the expected area as the expected proportion, and recording the characteristic color and the expected proportion in a test script for the use of an automatic test process; if the target color does not meet the preset characteristic condition, indicating the tester to reselect the color;
a second determining module, specifically configured to:
taking the area occupied by the color matched with the preset characteristic color in the target area as the target sub-area;
determining a color matched with the preset characteristic color based on a preset color tolerance; determining the pixel grids of the color matched with the preset characteristic color based on the pixel data of the target area; determining the area occupied by the pixel grids as the area occupied by the color matched with the preset characteristic color;
the color tolerance refers to a selection range set during color selection, the larger the tolerance is, the larger the selection range is, and the numerical value is between 0 and 255; the selectable color tolerances include: approximately equal to, above, equal to the option.
CN201811642778.7A 2018-12-29 2018-12-29 Software testing method and device Active CN109753435B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811642778.7A CN109753435B (en) 2018-12-29 2018-12-29 Software testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811642778.7A CN109753435B (en) 2018-12-29 2018-12-29 Software testing method and device

Publications (2)

Publication Number Publication Date
CN109753435A CN109753435A (en) 2019-05-14
CN109753435B true CN109753435B (en) 2022-02-01

Family

ID=66404526

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811642778.7A Active CN109753435B (en) 2018-12-29 2018-12-29 Software testing method and device

Country Status (1)

Country Link
CN (1) CN109753435B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111079730B (en) * 2019-11-20 2023-12-22 北京云聚智慧科技有限公司 Method for determining area of sample graph in interface graph and electronic equipment
CN111949263B (en) * 2020-07-08 2024-05-14 中核武汉核电运行技术股份有限公司 Man-factor engineering design verification method based on image recognition technology
CN115048309B (en) * 2022-06-27 2023-03-07 广州掌动智能科技有限公司 Non-intrusive APP software performance test method and system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107205120A (en) * 2017-06-30 2017-09-26 维沃移动通信有限公司 The processing method and mobile terminal of a kind of image
CN107734325A (en) * 2017-10-31 2018-02-23 武汉华星光电技术有限公司 A kind of image processing method and its equipment

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102033764B1 (en) * 2010-10-06 2019-10-17 삼성전자주식회사 User interface display method and remote controller using the same
CN102830958B (en) * 2011-06-16 2017-11-24 奇智软件(北京)有限公司 A kind of method and system for obtaining interface control information
US9078565B2 (en) * 2012-10-04 2015-07-14 General Electric Company Dual display CT scanner user interface
CN105868100A (en) * 2015-12-22 2016-08-17 乐视网信息技术(北京)股份有限公司 Android system-based automatic test method and device
CN106445816B (en) * 2016-09-07 2019-01-25 美的智慧家居科技有限公司 Control executes method and apparatus
CN106445359A (en) * 2016-10-28 2017-02-22 合网络技术(北京)有限公司 Control controlling method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107205120A (en) * 2017-06-30 2017-09-26 维沃移动通信有限公司 The processing method and mobile terminal of a kind of image
CN107734325A (en) * 2017-10-31 2018-02-23 武汉华星光电技术有限公司 A kind of image processing method and its equipment

Also Published As

Publication number Publication date
CN109753435A (en) 2019-05-14

Similar Documents

Publication Publication Date Title
CN109753435B (en) Software testing method and device
CN109871316A (en) A kind of control recognition methods and device
CN107193750B (en) Script recording method and device
CN109871326B (en) Script recording method and device
CN111078908A (en) Data annotation detection method and device
CN107193733A (en) Simulate the methods, devices and systems of Monkey tests
CN109086734B (en) Method and device for positioning pupil image in human eye image
CN109614324A (en) A kind of method for generating test case and device
CN109102026B (en) Vehicle image detection method, device and system
CN109308263A (en) A kind of small routine test method, device and equipment
CN110554962A (en) Regression testing process covering method, server and computer readable storage medium
CN111080092A (en) Data annotation management method and device, electronic equipment and readable storage medium
CN111124871A (en) Interface test method and device
CN109388564B (en) Test method and device and electronic equipment
CN115118627B (en) Temporary speed limiting server testing method and device
CN115952757A (en) Register testing method and device
CN109684225A (en) A kind of method for testing software and device
CN113781414B (en) Lens resolution testing method and device and electronic equipment
CN109740336B (en) Method and device for identifying verification information in picture and electronic equipment
CN116756037A (en) Abnormal code positioning system, method, equipment and computer readable storage medium
CN107153601B (en) Unit performance test method and device
CN109542775B (en) Test script generation and execution method and device
CN110428156B (en) Method and device for checking service data and electronic equipment
CN116738091A (en) Page monitoring method and device, electronic equipment and storage medium
CN112559313A (en) Test case setting method and device, storage medium and electronic equipment

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20210719

Address after: 100016 no.4301, No.52 Jiuxianqiao hospital, Chaoyang District, Beijing

Applicant after: BEIJING TESTIN INFORMATION TECHNOLOGY Co.,Ltd.

Address before: Room 2016, building 2, No.8, Fenghuang Third Road, Zhongxin Guangzhou Knowledge City, Guangzhou 510260, Guangdong Province

Applicant before: GUANGZHOU TESTIN INFORMATION TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant