CN116185812A - Automatic testing method, device and medium for software system functions - Google Patents
Automatic testing method, device and medium for software system functions Download PDFInfo
- Publication number
- CN116185812A CN116185812A CN202211183444.4A CN202211183444A CN116185812A CN 116185812 A CN116185812 A CN 116185812A CN 202211183444 A CN202211183444 A CN 202211183444A CN 116185812 A CN116185812 A CN 116185812A
- Authority
- CN
- China
- Prior art keywords
- page
- software system
- information
- traversing
- software
- 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
Links
- 230000006870 function Effects 0.000 title claims abstract description 75
- 238000012360 testing method Methods 0.000 title claims abstract description 43
- 238000000034 method Methods 0.000 claims abstract description 56
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 35
- 238000001514 detection method Methods 0.000 claims description 30
- 238000004891 communication Methods 0.000 claims description 11
- 238000004590 computer program Methods 0.000 claims description 9
- 238000012545 processing Methods 0.000 claims description 9
- 238000010845 search algorithm Methods 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 6
- 238000011990 functional testing Methods 0.000 description 5
- 230000008901 benefit Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 230000000694 effects Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 238000010998 test method Methods 0.000 description 3
- 238000012549 training Methods 0.000 description 3
- 230000001351 cycling effect Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 238000007792 addition Methods 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000000354 decomposition reaction Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 238000005065 mining Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000005215 recombination Methods 0.000 description 1
- 230000006798 recombination Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Human Computer Interaction (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a method, a device and a medium for automatically testing functions of a software system. The method comprises the following steps: the software system to be tested is subjected to full-screen display, and all page element information of the pages of the software system is traversed; generating a functional map of the software system according to the page element information; traversing the functional map according to a preset path navigation algorithm, and judging whether the software function to be tested is realized or not.
Description
Technical Field
The present invention relates to the field of automated testing technology, and more particularly, to a method, an apparatus, and a medium for automatically testing functions of a software system.
Background
The traditional software function automatic test is based on script recording and playback technology and comprises the following three steps: 1. and (3) script recording: firstly, a tester runs all steps requiring automatic testing on a tested system once, and a testing tool finishes recording by recording corresponding page element IDs and input data; 2. script editing: the tester checks the corresponding script flow by playing back the script, reading the code and the like, parameterizes the input data, namely reads the corresponding data from the database as input; 3. testing: essentially, the automatic test is completed through the playback script, and if the output data accords with the preset data, the test is judged to pass. There are the following disadvantages: 1. the test and the recording result are required to be manually executed; 2. the personal experience of the tested person is greatly affected.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a method, a device and a medium for automatically testing the functions of a software system.
According to one aspect of the present invention, there is provided a software system function automation test method, comprising:
the software system to be tested is subjected to full-screen display, and all page element information of the pages of the software system is traversed;
generating a functional map of the software system according to the page element information;
traversing the functional map according to a preset path navigation algorithm, and judging whether the software function to be tested is realized or not.
Optionally, the software system to be tested is displayed in a full screen, and the operation of traversing all page element information of the page of the software system comprises the following steps:
screen capturing is carried out on the software system page, and a software system page image is determined;
binarizing the page image of the software system;
calibrating a non-page background color pixel point set in an image, and taking the pixel point set range and coordinates as a basis for determining the page element range and coordinate positioning in the page;
capturing a screen of each page element range according to the page element coordinate positioning;
identifying information in each page element range screen shot by using a character identification algorithm, and storing the information, each page element range screen shot and the position thereof into a triplet in a database;
Identifying and positioning coordinates of the screen capturing of the software system to be tested by using a character identification algorithm;
traversing page element data by using a hollow rectangular frame detection method, and acquiring a hollow rectangular frame range and coordinates thereof as a hollow frame type candidate input area;
traversing page element data by using a line segment detection method, and acquiring a line segment range and coordinates thereof as an underline type candidate input area;
traversing page element data based on a hollow rectangular frame detection method and a line segment detection method, and acquiring an input area range and coordinates by using an input area detection method;
traversing page elements to obtain effective click areas and coordinates thereof in the page;
and traversing page elements, and generating a functional map of software according to the jump relation between the effective click area and the page input area, wherein the effective click jump area is used as a 'place' of the map, and the content input by the page input area is used as a road name between the two 'places'.
Optionally, traversing the page element to obtain the effective click region and the coordinates thereof in the page, including:
the similarity comparison is carried out on the two page screen capturing pictures before and after clicking,
traversing the subset of the page information hot spot data information, simulating mouse clicking, comparing the difference between screen shots before clicking and after clicking by the screenshot, and judging the subset of the page information hot spot data information as a clickable area if the difference is concentrated in the pixel connected subset with the pixel value larger than a set threshold value. The system page drop-down box and the pop-up box are treated as new pages.
And carrying out character recognition on the effective clicking region of the page by using the character recognition algorithm, determining the label of the clickable region of the page, and adopting screenshot of the effective clicking region as the label under the condition that the character recognition fails.
Optionally, traversing based on a hollow rectangular frame detection method and a line segment detection method to generate page element data, and acquiring an input area range and coordinates by using an input area detection method, wherein the operation comprises the following steps:
traversing a subset of the page information hot spot data information, simulating a mouse click, then sending a fixed character string, and screenshot again to compare differences between front and rear screen shots of the software system page, if the differences are concentrated in the corresponding subset of the page information hot spot data information, and recognizing that the similarity degree of a difference part and the sent fixed character string exceeds a threshold value by using a character recognition algorithm, judging that the subset of the page information hot spot data information is a page input area;
optionally, the operation of generating the functional map of the software system according to the element information includes:
taking the information of each page element in the home page of the software system as a starting point set of the functional map, and taking the labels of each page element in the home page as starting point names;
According to page element information of all pages of the software system, taking the clicking times as the road communication distance of elements among the pages;
generating a functional map according to the starting point, the starting point name and the road communication distance of elements between pages of the functional map;
and according to the input information attached to the effective clicking area of the page, the effective clicking area is used as the road name between page elements between two different pages.
And processing the part of the non-click area and the input area in the page character recognition result as output information of the page.
Optionally, traversing the functional map according to a preset path navigation algorithm, and judging whether the software function to be tested is implemented or not, including:
traversing the path corpus of the functional map by using a depth-limited search algorithm, and determining that the function of the software to be tested is realized under the condition that the path between two functional points of the software to be tested is contained in the path corpus.
According to another aspect of the present invention, there is provided a software system function automation test device, comprising:
the software function traversing module is used for displaying the software system to be tested in a full screen mode and traversing all page element information of the software system page;
The software map generation module is used for generating a functional map of the software system according to the page element information;
and the software function judging module is used for traversing the functional map according to a preset path navigation algorithm and judging whether the software function to be tested is realized or not.
According to a further aspect of the present invention there is provided a computer readable storage medium storing a computer program for performing the method according to any one of the above aspects of the present invention.
According to still another aspect of the present invention, there is provided an electronic device including: a processor; a memory for storing the processor-executable instructions; the processor is configured to read the executable instructions from the memory and execute the instructions to implement the method according to any of the above aspects of the present invention.
Therefore, the method and the device for automatically testing the functions of the software system realize the self-cognition of the software system by automatically establishing the software function map. The comparison of the functional test cases and the software functional map can judge whether the functions are realized or not, and the whole process only needs few manual participation. The test quality is strongly related to the algorithm and is not affected by manpower. The processes of marking data, training a model and the like are not needed, and a great deal of labor and hardware cost is saved.
Drawings
Exemplary embodiments of the present invention may be more completely understood in consideration of the following drawings:
FIG. 1 is a flow chart of a method for automatically testing functions of a software system according to an exemplary embodiment of the present invention;
FIG. 2a is a schematic view of a 4-connected binary image provided by an exemplary embodiment of the present invention;
FIG. 2b is another flow chart of a method for automated testing of software system functionality provided by an exemplary embodiment of the present invention;
FIG. 3 is a schematic diagram of a functional map provided by an exemplary embodiment of the present invention;
FIG. 4 is a schematic diagram of an automated testing apparatus for software system functionality according to an exemplary embodiment of the present invention;
fig. 5 is a structure of an electronic device provided in an exemplary embodiment of the present invention.
Detailed Description
Hereinafter, exemplary embodiments according to the present invention will be described in detail with reference to the accompanying drawings. It should be apparent that the described embodiments are only some embodiments of the present invention and not all embodiments of the present invention, and it should be understood that the present invention is not limited by the example embodiments described herein.
It should be noted that: the relative arrangement of the components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless it is specifically stated otherwise.
It will be appreciated by those of skill in the art that the terms "first," "second," etc. in embodiments of the present invention are used merely to distinguish between different steps, devices or modules, etc., and do not represent any particular technical meaning nor necessarily logical order between them.
It should also be understood that in embodiments of the present invention, "plurality" may refer to two or more, and "at least one" may refer to one, two or more.
It should also be appreciated that any component, data, or structure referred to in an embodiment of the invention may be generally understood as one or more without explicit limitation or the contrary in the context.
In addition, the term "and/or" in the present invention is merely an association relationship describing the association object, and indicates that three relationships may exist, for example, a and/or B may indicate: a exists alone, A and B exist together, and B exists alone. In the present invention, the character "/" generally indicates that the front and rear related objects are an or relationship.
It should also be understood that the description of the embodiments of the present invention emphasizes the differences between the embodiments, and that the same or similar features may be referred to each other, and for brevity, will not be described in detail.
Meanwhile, it should be understood that the sizes of the respective parts shown in the drawings are not generated in actual scale for convenience of description.
The following description of at least one exemplary embodiment is merely exemplary in nature and is in no way intended to limit the invention, its application, or uses.
Techniques, methods, and apparatus known to one of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, the techniques, methods, and apparatus should be considered part of the specification.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further discussion thereof is necessary in subsequent figures.
Embodiments of the invention are operational with numerous other general purpose or special purpose computing system environments or configurations with electronic devices, such as terminal devices, computer systems, servers, etc. Examples of well known terminal devices, computing systems, environments, and/or configurations that may be suitable for use with the terminal device, computer system, server, or other electronic device include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, hand-held or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, small computer systems, mainframe computer systems, and distributed cloud computing technology environments that include any of the foregoing, and the like.
Electronic devices such as terminal devices, computer systems, servers, etc. may be described in the general context of computer system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, etc., that perform particular tasks or implement particular abstract data types. The computer system/server may be implemented in a distributed cloud computing environment in which tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules may be located in both local and remote computing system storage media including memory storage devices.
Exemplary method
FIG. 1 is a flow chart of a method for automatically testing functions of a software system according to an exemplary embodiment of the present invention. The embodiment can be applied to an electronic device, as shown in fig. 1, the software system function automation test method 100 includes the following steps:
And step 103, traversing the functional map according to a preset path navigation algorithm, and judging whether the software function to be tested is realized or not.
Optionally, the software system to be tested is displayed in a full screen, and the operation of traversing all page element information of the page of the software system comprises the following steps:
screen capturing is carried out on the software system page, and a software system page image is determined;
binarizing the page image of the software system;
calibrating a non-page background color pixel point set in an image, and taking the pixel point set range and coordinates as a basis for determining the page element range and coordinate positioning in the page;
capturing a screen of each page element range according to the page element coordinate positioning;
identifying information in each page element range screen shot by using a character identification algorithm, and storing the information, each page element range screen shot and the position thereof into a triplet in a database;
identifying and positioning coordinates of the screen capturing of the software system to be tested by using a character identification algorithm;
traversing page element data by using a hollow rectangular frame detection method, and acquiring a hollow rectangular frame range and coordinates thereof as a hollow frame type candidate input area;
traversing page element data by using a line segment detection method, and acquiring a line segment range and coordinates thereof as an underline type candidate input area;
Traversing page element data based on a hollow rectangular frame detection method and a line segment detection method, and acquiring an input area range and coordinates by using an input area detection method;
traversing page elements to obtain effective click areas and coordinates thereof in the page;
and traversing page elements, and generating a functional map of software according to the jump relation between the effective click area and the page input area, wherein the effective click jump area is used as a 'place' of the map, and the content input by the page input area is used as a road name between the two 'places'.
Optionally, traversing the page element to obtain the effective click region and the coordinates thereof in the page, including:
traversing the subset of the page information hot spot data information, simulating mouse clicking, comparing the difference between screen shots before clicking and after clicking by the screenshot, and judging the subset of the page information hot spot data information as a clickable area if the difference is concentrated in the pixel connected subset with the pixel value larger than a set threshold value. The system page drop-down box and the pop-up box are treated as new pages.
And carrying out character recognition on the effective clicking region of the page by using the character recognition algorithm, determining the label of the clickable region of the page, and adopting screenshot of the effective clicking region as the label under the condition that the character recognition fails.
Optionally, traversing the page element data based on a hollow rectangular frame detection method and a line segment detection method, and obtaining the input area range and coordinates by using an input area detection method, including:
traversing a subset of the page information hot spot data information, simulating a mouse click, then sending a fixed character string, and screenshot again to compare differences between front and rear screen shots of the software system page, if the differences are concentrated in the corresponding subset of the page information hot spot data information, and recognizing that the similarity degree of a difference part and the sent fixed character string exceeds a threshold value by using a character recognition algorithm, judging that the subset of the page information hot spot data information is a page input area;
optionally, the operation of generating the functional map of the software system according to the element information includes:
taking the information of each page element in the home page of the software system as a starting point set of the functional map, and taking the labels of each page element in the home page as starting point names;
according to page element information of all pages of the software system, taking the clicking times as the road communication distance of elements among the pages;
generating a functional map according to the starting point, the starting point name and the road communication distance of elements between pages of the functional map;
And according to the input information attached to the effective clicking area of the page, the effective clicking area is used as the road name between page elements between two different pages.
And processing the part of the non-click area and the input area in the page character recognition result as output information of the page.
Optionally, traversing the functional map according to a preset path navigation algorithm, and judging whether the software function to be tested is implemented or not, including:
traversing the path corpus of the functional map by using a depth-limited search algorithm, and determining that the function of the software to be tested is realized under the condition that the path between two functional points of the software to be tested is contained in the path corpus.
Specifically, first, a test procedure element is defined:
definition 1 (page input): information provided for the next operation of the software system, including: button clicking and clicking after inputting.
Definition 2 (page input element): after clicking, page elements such as buttons, input boxes and the like can be input into the page.
Definition 2 (page output): the software system provides information for the next operation of the person, and the information comprises: and the initial page display and the information output after page input are two types.
Definition 3 (page info hotspot): a space on a software system page, which is made up of a set of points that differ from the background color, can be represented as a direct sum of its subsets. Wherein the Hausdorff distance between each point within the subset is less than the points outside the subset.
Definition 4 (software system function map): a collection of software system function points and their relationships. Wherein the function point appears as a page input element for any page within the software system. If after a limited step operation, the page in which one page input element is located can reach the page in which the other page input element is located, the two page input elements are said to be in road communication. Otherwise, the connection is not established. The number of operation steps required for a page in which one page input element is located to reach a page in which another page input element is located becomes the length of the road between the two page input elements. The page input on each road segment becomes the name of the road, and there may be one or more page inputs per road segment, but not null.
Definition 5 (rectangular hollow frame): in a 4-connected binary image (as in fig. 2 a):
(1) Firstly, searching a starting point of an outer boundary;
(2) If the starting point is only a boundary pixel point coded as 0;
(3) After a limited number of recursions n1, only boundary pixels encoded as 3;
(4) After a limited number of recursions n2, only boundary pixels encoded as 2;
(5) After a limited number of recursions n3, only boundary pixels encoded as 1;
(6) After a limited number of recursions n4, returning to the initial outer boundary starting point, and n1=n3, n2=n4, the outer boundary B1 being connected and closed;
(7) Secondly, searching a starting point of a hole boundary;
(8) After a limited number of recursions m1, only boundary pixels encoded as 3;
(9) After a limited number of recursions m2, only boundary pixels encoded as 2;
(10) After a limited number of recursions m3, only boundary pixels encoded as 1;
(11) After a limited number of recursions m4, returning to the initial outer boundary starting point, and m1=m3, m2=m4, the hole boundary B2 is connected and closed;
(12) B1 forms the parent boundary of B2.
Definition 6 (line segment): in a 4-connected binary image:
(1) Firstly, searching a starting point of an outer boundary;
(2) If the starting point is only a boundary pixel point coded as 0;
(3) After a limited number of recursions n1, only boundary pixels encoded as 3;
(4) The pattern is connected but not closed.
Definition 6 (functional chain): a certain function n of the software system can be realized after operation [1, …, n-1] is operated, and then the function is a function chain n;
property 1: after each page input operation, the system should give a page output different from the input page for a defined time.
Property 2: the input boxes on the same page must have an association relationship, belonging to the same input or inquiry condition combination.
Specifically, referring to fig. 2b, a schematic diagram of a function test based on a software system structure self-cognition and path navigation algorithm is shown below, wherein the first step to the eighth step are software system structure self-cognition, and the ninth step is to determine whether a certain function in a test case is implemented based on the path navigation algorithm, and please see the following detailed description.
(1) Binarizing the screen capturing image;
(2) Traversing non-page ground color pixel points in the image by adopting Findcontours () function in OpenCV, and dividing the non-page ground color pixel points into subsets according to a topological structure;
(3) Generating a rectangular box outside each subset;
(4) And outputting the coordinates of the four points of the upper left, the lower left, the upper right and the lower right of each rectangular frame.
(5) The coordinate vector is used as the unique identification of each subset.
And identifying the coordinates of all characters and the four points of the upper left, the lower left, the upper right and the lower right of the corresponding rectangular frame for the screenshot of the page by using a hundred-degree parallel character identification algorithm, and taking the coordinate vector as the unique identification of each group of characters.
The open rectangle is an existing form with higher probability of the input frame, so that the traversing of the open rectangle greatly reduces the traversing space of the input frame.
According to the method, a rectangular hollow frame traversing method based on OpenCV is provided according to the existing method for detecting the rectangle based on OpenCV and the detection capability of the OpenCV on the inner contour, and the method comprises the following steps of;
(1) Filtering the enhancement edges;
(2) Separating the image channels and detecting the outer edges with the cv_retr_extnal () function of OpenCV;
(3) Extracting an outer contour;
(4) Calculating 4 vertexes of the rectangle;
(5) In the case of successful extraction of the rectangle, detecting all contours in the coordinate range of (4) by using the CV_RETR_TREE () function of OpenCV, and forming a hierarchical TREE structure;
(6) If there are only two-level contours in (5), the graph is determined to be a hollow rectangular box and is treated as an input box.
Step 4 traversal of line segments
The line segment is in a form with higher probability of the input frame, so that traversing of the rectangular hollow frame greatly reduces traversing space of the input frame.
Step 5 traversal of Page input (buttons)
According to definition 1, a button is a button that can provide necessary input information for the next operation of the software system and can be operated in a click mode. Again by nature 1, the system page will differ to some extent from the original page within a limited time after clicking the button. Thus, the method traverses the buttons of the current page using the following steps:
(1) Completing the first step to the second step in fig. 2;
(2) According to the current page information hotspot subset coordinates obtained in the second step, a mouse_click () operation is sent to the software system;
(3) Traversing the subset of the page information hot spot data information, simulating mouse clicking, comparing the difference between screen shots before clicking and after clicking by the screenshot, and judging the subset of the page information hot spot data information as a clickable area if the difference is concentrated in the pixel connected subset with the pixel value larger than a set threshold value. The system page drop-down box and the pop-up box are treated as new pages.
(4) Performing character recognition on the information hotspot subset by adopting a pallet character recognition algorithm in the step 2, and taking a recognition result as a label of the clickable area;
(5) If the character recognition fails, the button is considered to be a picture-form button, and the image in the range is intercepted as a label of the button according to the coordinates of the hot spot subset of the page information;
(6) And (5) cycling the steps (1) to (5) to finish the traversing result of all buttons in the current page.
Step 6 traversal of Page inputs (various types of input boxes)
(1) Let the result corpus of the second step of traversing page information hotspot in FIG. 1 be U, which is each subset { U } 1 ,…,U n Finite non-intersection of };
(2) Let the result corpus of the third step of traversing page text in FIG. 1 be W, which is each subset { W 1 ,…,W n Finite non-intersection of };
(3) Let the result corpus of all rectangular open boxes of the fourth step traversal page in FIG. 1 be R, which is each subset { R } 1 ,…,R n Finite non-intersection of };
(4) Let the result corpus of all segments of the fifth step traversal page in FIG. 1 be S, which is each subset { S } 1 ,…,S n Finite non-intersection of };
(5) For non-drop down or pop up input boxes:
a. a mouse_click () operation is sent inside the rectangular hollow frame of R, and a keybord_input () is sent, wherein the content is test;
b. re-screenshot, wherein if the character recognition result in the rectangular hollow frame is test or the similarity between the recognition result and the test exceeds a preset threshold value, the difference part of the front page and the rear page is treated as a button or a button combination;
(6) For drop down or pop up input boxes:
a. a mouse_click () operation is sent inside the rectangular hollow frame of R, and a keybord_input () is sent, wherein the content is test;
b. re-screenshot, if the text recognition result not in the rectangular hollow frame is test, or the similarity between the recognition result and test exceeds a preset threshold value, executing the second step in fig. 1 in the difference part of the front page and the rear page;
c. Send a mouse_click () operation into each subset of information hotspots:
1) And comparing pages before and after the mouse_click () operation, and if the difference is concentrated in a pixel connected subset with a pixel value larger than a set threshold value, judging the subset of the hot spot data information of the page information as a clickable area. The page is considered to jump, and the subset of the page information hot spots is a button; and (3) carrying out character recognition on the information hotspot subset by adopting a pad character recognition algorithm in the step (2), and taking a recognition result as a label of the button.
2) Comparing the pages before and after the mouse_click () operation, if the difference proportion is smaller than the threshold sigma, the page is considered not to jump, and the option in the drop-down or pop-up box is a single-select or multiple-select operation. And (3) performing character recognition on the option coordinate area by adopting a pad character recognition algorithm in the step (2), and taking a recognition result as a label of the button.
d. And (5) circulating the steps until all the information hot spots of the drop-down or pop-up boxes are traversed.
Step 7 Page output
Outputting the software system after each step of input operation, and simultaneously saving the system sectionThe result of character recognition by the panel and the pad character recognition algorithm in step 2 is referred to O in step 8 jk 。
Step 8 generation of a software System function map
The software system function map is a two-dimensional directed graph, and the specific generation steps are as follows:
(1) Starting from the first page of the software system, traversing all page input elements by the methods of steps 1 to 6, and taking the page input elements as map starting points. Inputting an element label as a starting point name;
(2) Let the whole set of input elements of each page be I jk Limited non-cross { I } for a subset thereof 1k ,I 2k ,…,I jk },(j∈[0,n]) Wherein j is a page sequence number, and k is an input element sequence number on each page; clicking the page corpus after each page input element as O jk Limited non-cross { O for a subset thereof 1k ,O 2k ,…,O jk },(j∈[0,n]) I.e. make up the page output corpus, in O jk Outputting a number for each item;
(3) Cycling through steps (1) and (2) and recording as quadruples [ I ] jk ,I (j+1)k ,INFO jk ,O jk ]Wherein I (j+1)k Is via I jk The two input elements are connected by a road, and the distance is 1;
(4) The above steps are iterated to generate a functional map of the software system, as shown with reference to fig. 3.
Step 9, judging whether the function is realized according to the depth-first search algorithm
The function test case can be regarded as verification of a function chain set of a software system, so that the method adopts a Depth-First-Search algorithm (Depth-First-Search) to carry out all path set P between two function points, and records path nodes, and if the function chain of the test case belongs to P, the function is considered to be realized, and the specific steps are as follows:
(1) Assume that a test case is a verification function x= { S [1] ,…,S [n] (n.epsilon.Z), where S [n] N operation steps to be verified;
(2) Assuming that the software system has generated a functional map, wherein the functional map is M, and the total set of paths among all functional points is U-P;
(3) Searching X in the U-P, and if the same path exists, considering that the system function is realized.
(4) If there is a further requirement for input and output, the input information and the expected output information of the relevant steps can be preset, and the fifth step and the sixth step in the step 6 of "traversal of page input (various input boxes)" are re-executed.
(5) Such as at O jk The text recognition result of the execution result of the step contains expected output information, and the function containing input and output is judged to be realized.
Step 10 modification of functional test cases
Test cases using this method need to be listed:
(1) A functional chain of the function, refer to step 9 (1);
(2) Input information and desired output information of the function.
Step 11 identification of non-text input information
In the step 5 (5), a mode of intercepting the picture is adopted as a unique label for the picture form button, and text labels can be input to the label in a unified way by manpower.
The method for automatically testing the functions of the software system provided by the method comprises the following effects:
(1) The method can automatically generate a function map according to the software function, and if a function chain described by a related function test case is contained in a path set of related functions in the function map, the function is judged to be realized;
(2) The method can specify input information and expected input and output information to assist in judging the function realization condition;
(3) The method does not need to manually execute test cases, train an artificial intelligent model and annotate data.
(4) On the premise that the functional test case meets the requirement of the step 10, the near-zero manual software system functional automation test (except for a small amount of manual identification work mentioned in the step 11) can be realized.
Therefore, the application 1 solves the problem of high labor cost in the traditional function test: the self-cognition of the software system is realized by automatically establishing a software function map; the comparison of the functional test cases and the software functional map can judge whether the functions are realized or not, and the whole process only needs little manual participation;
2. the problem of unstable test quality in traditional function test is solved: the test quality is strongly related to the algorithm and is not affected by manpower;
3. the problem of training with high costs in the AI-based functional test is solved: the processes of marking data, training a model and the like are not needed, and a great deal of labor and hardware cost is saved.
Exemplary apparatus
Fig. 4 is a schematic structural diagram of an automatic testing device for software system functions according to an exemplary embodiment of the present invention. As shown in fig. 4, the apparatus 400 includes:
the software traversing module 410 is configured to perform full-screen display on the software system to be tested, and traverse all page element information of the software system page;
a software map generating module 420, configured to generate a functional map of the software system according to the page element information;
the software function judging module 430 is configured to traverse the functional map according to a preset path navigation algorithm, and judge whether the software function to be tested is implemented.
Optionally, the traversing module 410 includes:
the first determining submodule is used for capturing a screen of the software system page and determining a software system page image;
the binarization processing sub-module is used for binarizing the page image of the software system;
the second determining submodule is used for calibrating a non-page ground color pixel point set in the image, and taking the pixel point set range and coordinates as the basis for determining the page element range and coordinate positioning in the page;
the screen capturing sub-module is used for capturing a screen of each page element range according to the page element coordinate positioning;
The first recognition sub-module is used for recognizing information in each page element range screen shot by using a character recognition algorithm, and forming a triplet with each page element range screen shot and the position thereof to be stored in a database;
the second recognition sub-module is used for recognizing and positioning coordinates of the screen shot of the software system to be tested by utilizing a character recognition algorithm;
the first acquisition submodule is used for traversing page element data by using a hollow rectangular frame detection method to acquire a hollow rectangular frame range and coordinates thereof as a hollow frame type candidate input area;
the second acquisition submodule is used for traversing the page element data by utilizing a line segment detection method, acquiring a line segment range and coordinates thereof and taking the line segment range and coordinates thereof as an underline type candidate input area;
the third acquisition submodule is used for traversing page element data based on a hollow rectangular frame detection method and a line segment detection method and acquiring an input area range and coordinates by using an input area detection method;
the first traversal sub-module is used for traversing page elements and acquiring effective click areas and coordinates thereof in the page;
the second traversing sub-module is used for traversing the page elements, generating a functional map of the software according to the jump relation between the effective clicking area and the page input area, wherein the effective clicking jump area is used as a 'place' of the map, and the content input by the page input area is used as a road name between the two 'places'.
Optionally, the first traversal submodule includes:
and the unit is used for comparing the similarity of the two page screen capturing pictures before and after clicking, and if the difference is concentrated in the pixel connected subsets with pixel values larger than the set threshold value, the subset of the page information hot spot data information is judged to be a clickable area. The page is considered to jump and the page information hotspot can be treated as an active click zone. The system page drop-down box and the pop-up box are treated as new pages.
The determining unit is used for carrying out character recognition on the effective clicking area of the page by utilizing a character recognition algorithm, determining the label of the clickable area of the page, and adopting screenshot of the effective clicking area as the label under the condition that the character recognition fails.
Optionally, the third acquisition sub-module includes:
the comparison unit is used for traversing a subset of the page information hot spot data information and comparing the difference proportion of the pixel quantity between the front page and the back page of the software system;
and the judging unit is used for judging that the page information hot spot subset is a page input area when the difference is concentrated in the corresponding page information hot spot data information subset and the similarity degree between the difference part and the sent fixed character string exceeds a threshold value by using a character recognition algorithm.
Optionally, the software map generation module 420 includes:
the first sub-module is used for taking the information of each page element in the first page of the software system as a starting point set of the functional map, and taking the labels of each page element in the first page as starting point names;
secondly, the sub-module is used for taking the clicking times as the road communication distance of elements among the pages according to the page element information of all the pages of the software system;
the generation sub-module is used for generating the functional map according to the starting point of the functional map, the names of the starting point and the road communication distance of the elements between pages;
and thirdly, a sub-module, which is used for serving as a road name between page elements between two different pages according to the input information attached to the page effective clicking area.
And processing the part of the non-click area and the input area in the page character recognition result as output information of the page.
Optionally, the software function determining module 430 includes:
and the third determining submodule is used for traversing the path corpus of the functional map by utilizing a depth-limited search algorithm, and determining that the function of the software to be tested is realized under the condition that the path between two functional points of the software to be tested is contained in the path corpus.
Exemplary electronic device
Fig. 5 is a structure of an electronic device provided in an exemplary embodiment of the present invention. As shown in fig. 5, the electronic device 50 includes one or more processors 51 and memory 52.
The processor 51 may be a Central Processing Unit (CPU) or other form of processing unit having data processing and/or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.
In addition, the input device 53 may also include, for example, a keyboard, a mouse, and the like.
The output device 54 can output various information to the outside. The output device 54 may include, for example, a display, speakers, a printer, and a communication network and remote output devices connected thereto, etc.
Of course, only some of the components of the electronic device that are relevant to the present invention are shown in fig. 5 for simplicity, components such as buses, input/output interfaces, etc. being omitted. In addition, the electronic device may include any other suitable components depending on the particular application.
Exemplary computer program product and computer readable storage Medium
In addition to the methods and apparatus described above, embodiments of the invention may also be a computer program product comprising computer program instructions which, when executed by a processor, cause the processor to perform steps in a method according to various embodiments of the invention described in the "exemplary methods" section of this specification.
The computer program product may write program code for performing operations of embodiments of the present invention in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present invention may also be a computer-readable storage medium, having stored thereon computer program instructions which, when executed by a processor, cause the processor to perform the steps in a method of mining history change records according to various embodiments of the present invention described in the "exemplary methods" section above in this specification.
The computer readable storage medium may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The basic principles of the present invention have been described above in connection with specific embodiments, however, it should be noted that the advantages, benefits, effects, etc. mentioned in the present invention are merely examples and not intended to be limiting, and these advantages, benefits, effects, etc. are not to be considered as essential to the various embodiments of the present invention. Furthermore, the specific details disclosed herein are for purposes of illustration and understanding only, and are not intended to be limiting, as the invention is not necessarily limited to practice with the above described specific details.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different manner from other embodiments, so that the same or similar parts between the embodiments are mutually referred to. For system embodiments, the description is relatively simple as it essentially corresponds to method embodiments, and reference should be made to the description of method embodiments for relevant points.
The block diagrams of the devices, systems, apparatuses, systems according to the present invention are merely illustrative examples and are not intended to require or imply that the connections, arrangements, configurations must be made in the manner shown in the block diagrams. As will be appreciated by one of skill in the art, the devices, systems, apparatuses, systems may be connected, arranged, configured in any manner. Words such as "including," "comprising," "having," and the like are words of openness and mean "including but not limited to," and are used interchangeably therewith. The terms "or" and "as used herein refer to and are used interchangeably with the term" and/or "unless the context clearly indicates otherwise. The term "such as" as used herein refers to, and is used interchangeably with, the phrase "such as, but not limited to.
The method and system of the present invention may be implemented in a number of ways. For example, the methods and systems of the present invention may be implemented by software, hardware, firmware, or any combination of software, hardware, firmware. The above-described sequence of steps for the method is for illustration only, and the steps of the method of the present invention are not limited to the sequence specifically described above unless specifically stated otherwise. Furthermore, in some embodiments, the present invention may also be embodied as programs recorded in a recording medium, the programs including machine-readable instructions for implementing the methods according to the present invention. Thus, the present invention also covers a recording medium storing a program for executing the method according to the present invention.
It is also noted that in the systems, devices and methods of the present invention, components or steps may be disassembled and/or assembled. Such decomposition and/or recombination should be considered as equivalent aspects of the present invention. The previous description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the invention. Thus, the present invention is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, this description is not intended to limit embodiments of the invention to the form disclosed herein. Although a number of example aspects and embodiments have been discussed above, a person of ordinary skill in the art will recognize certain variations, modifications, alterations, additions, and subcombinations thereof.
Claims (9)
1. A method for automatically testing functions of a software system, comprising:
the method comprises the steps of carrying out full-screen display on a software system to be tested, and traversing all page element information of a page of the software system;
generating a functional map of the software system according to the page element information;
traversing the functional map according to a preset path navigation algorithm, and judging whether the software function to be tested is realized or not.
2. The method of claim 1, wherein the operation of displaying the software system to be tested in full screen and traversing all page element information of the software system page comprises:
the software system page is subjected to screen capturing, and a software system page image is determined;
binarizing the page image of the software system;
calibrating a non-page background color pixel point set in an image, and taking the pixel point set range and coordinates as a basis for determining the page element range and coordinate positioning in the page;
Capturing a screen of each page element range according to the page element coordinate positioning;
identifying information in each page element range screen shot by using a character identification algorithm, and storing the information, each page element range screen shot and the position thereof into a triplet in a database;
identifying and positioning coordinates of the screen capturing of the software system to be tested by using a character identification algorithm;
traversing the page element data by using a hollow rectangular frame detection method, and acquiring a hollow rectangular frame range and coordinates thereof as a hollow frame type candidate input area;
traversing the page element data by using a line segment detection method, and obtaining a line segment range and coordinates thereof as an underline type candidate input area;
traversing the page element data based on a hollow rectangular frame detection method and a line segment detection method, and acquiring an input area range and coordinates by using an input area detection method;
traversing the page element to obtain an effective clicking area and coordinates thereof in the page;
and traversing the page elements, and generating a functional map of the software according to the jump relation between the effective click region and the page input region, wherein the effective click jump region is used as a 'place' of the map, and the content input by the page input region is used as a road name between the two 'places'.
3. The method of claim 2, wherein traversing the page element to obtain the valid click region and its coordinates within the page comprises:
traversing the subset of the page information hot spot data information, simulating mouse clicking, comparing the difference between screen shots before clicking and after clicking by the screenshot, and judging the subset of the page information hot spot data information as a clickable area if the difference is concentrated in the pixel connected subset with the pixel value larger than a set threshold value. The system page drop-down box and the pop-up box are treated as new pages.
And carrying out character recognition on the effective clicking region of the page by using the character recognition algorithm, determining the label of the clickable region of the page, and adopting screenshot of the effective clicking region as the label under the condition that the character recognition fails.
4. The method of claim 2, wherein traversing the page element data based on a open rectangular box detection method and a line segment detection method, and obtaining the input region range and coordinates using an input region detection method, comprises:
traversing the subset of the page information hot spot data information, simulating a mouse click, then sending a fixed character string, and screenshot again to compare the difference between the front screenshot and the rear screenshot of the software system page, if the difference is concentrated in the corresponding subset of the page information hot spot data information, and recognizing that the similarity degree of the difference part and the sent fixed character string exceeds a threshold value by using a character recognition algorithm, judging that the subset of the page information hot spot data information is a page input area.
5. The method of claim 1, wherein generating a functional map of the software system from the element information comprises:
taking the information of each page element in the home page of the software system as a starting point set of the functional map, and taking the labels of each page element in the home page as starting point names;
according to the page element information of all the pages of the software system, taking the clicking times as the road communication distance of elements among the pages;
generating the functional map according to the starting point of the functional map, the starting point name and the road communication distance of the elements between the pages;
and according to the input information attached to the effective clicking area of the page, the effective clicking area is used as the road name between page elements between two different pages.
And processing the part of the non-click area and the input area in the page character recognition result as output information of the page.
6. The method of claim 1, wherein the operation of traversing the functional map according to a preset path navigation algorithm to determine whether the software function to be tested is implemented comprises:
traversing the path corpus of the functional map by using a depth-limited search algorithm, and determining that the software function to be tested is realized when the path between two functional points of the software to be tested is contained in the path corpus.
7. An automated testing device for software system functions, comprising:
the software traversing module is used for displaying the software system to be tested in a full screen mode and traversing all page element information of the software system page;
the software map generation module is used for generating a functional map of the software system according to the page element information;
and the software function judging module is used for traversing the functional map according to a preset path navigation algorithm and judging whether the software function to be tested is realized or not.
8. A computer readable storage medium, characterized in that the storage medium stores a computer program for executing the method of any of the preceding claims 1-6.
9. An electronic device, the electronic device comprising:
a processor;
a memory for storing the processor-executable instructions;
the processor is configured to read the executable instructions from the memory and execute the instructions to implement the method of any of the preceding claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211183444.4A CN116185812A (en) | 2022-09-27 | 2022-09-27 | Automatic testing method, device and medium for software system functions |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211183444.4A CN116185812A (en) | 2022-09-27 | 2022-09-27 | Automatic testing method, device and medium for software system functions |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116185812A true CN116185812A (en) | 2023-05-30 |
Family
ID=86439025
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211183444.4A Pending CN116185812A (en) | 2022-09-27 | 2022-09-27 | Automatic testing method, device and medium for software system functions |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116185812A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116594916A (en) * | 2023-07-17 | 2023-08-15 | 腾讯科技(深圳)有限公司 | Page control positioning method, device and storage medium |
-
2022
- 2022-09-27 CN CN202211183444.4A patent/CN116185812A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116594916A (en) * | 2023-07-17 | 2023-08-15 | 腾讯科技(深圳)有限公司 | Page control positioning method, device and storage medium |
CN116594916B (en) * | 2023-07-17 | 2023-11-14 | 腾讯科技(深圳)有限公司 | Page control positioning method, device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110275834B (en) | User interface automatic test system and method | |
Shen et al. | A large dataset of historical japanese documents with complex layouts | |
CN109684803B (en) | Man-machine verification method based on gesture sliding | |
CN110175609B (en) | Interface element detection method, device and equipment | |
CN108062377A (en) | The foundation of label picture collection, definite method, apparatus, equipment and the medium of label | |
CN111931859B (en) | Multi-label image recognition method and device | |
CN111753120B (en) | Question searching method and device, electronic equipment and storage medium | |
CN111460355B (en) | Page analysis method and device | |
CN110909768B (en) | Method and device for acquiring marked data | |
CN117036271A (en) | Production line quality monitoring method and system thereof | |
CN112101346A (en) | Verification code identification method and device based on target detection | |
CN113205046A (en) | Method, system, device and medium for identifying question book | |
US20200364034A1 (en) | System and Method for Automated Code Development and Construction | |
CN116185812A (en) | Automatic testing method, device and medium for software system functions | |
Schlagenhauf et al. | Text detection on technical drawings for the digitization of brown-field processes | |
CN117951009A (en) | Test script generation method and device, computing equipment and storage medium | |
Li et al. | Comic image understanding based on polygon detection | |
CN111476090A (en) | Watermark identification method and device | |
CN114359912B (en) | Software page key information extraction method and system based on graph neural network | |
CN116980646A (en) | Video data processing method, device, equipment and readable storage medium | |
CN115631374A (en) | Control operation method, control detection model training method, device and equipment | |
CN110472121A (en) | Card information searching method, device, electronic equipment and computer readable storage medium | |
CN113705559B (en) | Character recognition method and device based on artificial intelligence and electronic equipment | |
CN114387600A (en) | Text feature recognition method and device, computer equipment and storage medium | |
CN113742559A (en) | Keyword detection method and device, electronic equipment and storage medium |
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 |