CN110737573A - Method and device for automatically testing user interface UI - Google Patents

Method and device for automatically testing user interface UI Download PDF

Info

Publication number
CN110737573A
CN110737573A CN201810789737.4A CN201810789737A CN110737573A CN 110737573 A CN110737573 A CN 110737573A CN 201810789737 A CN201810789737 A CN 201810789737A CN 110737573 A CN110737573 A CN 110737573A
Authority
CN
China
Prior art keywords
test
picture
instruction
pictures
sequence
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.)
Granted
Application number
CN201810789737.4A
Other languages
Chinese (zh)
Other versions
CN110737573B (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 Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo 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 Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201810789737.4A priority Critical patent/CN110737573B/en
Publication of CN110737573A publication Critical patent/CN110737573A/en
Application granted granted Critical
Publication of CN110737573B publication Critical patent/CN110737573B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method and a device for automatically testing a user interface UI. The method comprises the following steps: reading the test case from the storage path of the test case; generating a test instruction corresponding to each test picture according to the file name of each test picture in the test case; and finishing the UI automatic test according to the test instruction and the corresponding test picture. The technical scheme realizes tight coupling of the test case and the test picture based on modification of the file name of the test picture, is convenient for management and test result investigation, and simultaneously codes of automatic test can be automatically generated according to rules and are convenient to use.

Description

Method and device for automatically testing user interface UI
Technical Field
The invention relates to the field of automatic testing, in particular to a method and a device for automatically testing a User Interface (UI).
Background
In the past, the UI (User Interface) test usually adopts manual test, which is time-consuming and labor-consuming. Currently, UI automation tests are well developed, but there are many disadvantages, for example, when a test picture is needed, a test case needs to be written for the test picture, the test case is separated from the test picture, which is not convenient for storage management and examination of test results, and is also inconvenient for generation of automation test codes.
Disclosure of Invention
In view of the above, the present invention has been developed to provide methods and apparatus for user interface UI automation testing that overcome, or at least partially address, the above-mentioned problems.
According to aspects of the present invention, there is provided a method for automated testing of a user interface UI, comprising:
reading the test case from the storage path of the test case;
generating a test instruction corresponding to each test picture according to the file name of each test picture in the test case;
and finishing the UI automatic test according to the test instruction and the corresponding test picture.
Optionally, the test case is a folder containing a plurality of test pictures.
Optionally, the file name of the test picture includes a sequence identifier of a test sequence;
the reading of the test case from the storage path of the test case comprises:
reading test pictures from the folder according to the sequence identifications, wherein test pictures are read each time, and after corresponding tests are finished according to the test pictures, the test pictures corresponding to the next sequence identifications in the test sequence are read, or new sequence identifications are determined according to the test results, and the test pictures corresponding to the new sequence identifications are read;
and ending the UI automation test when the test pictures corresponding to the last sequence identifications in the test sequence in the folder are read completely, or ending the UI automation test when the test ending condition is determined to be met according to the test results of test pictures.
Optionally, the file name of the test picture includes a plurality of pieces of test information and an identifier corresponding to each piece of test information;
the test information includes a dummy of the test instruction and/or test data.
Optionally, the generating a test instruction corresponding to each test picture according to the file name of each test picture in the test case includes:
reading the file name of the test picture as a character string, and traversing the character string in sequence to obtain each identifier and test information corresponding to each identifier;
and searching a test instruction mapping table according to the pseudo instructions in the test information, and searching out corresponding test instructions.
Optionally, the test instructions include or more of:
triggering a user event instruction, judging the instruction, jumping the instruction, and testing the time setting instruction.
Optionally, the completing the UI automation test according to the test instruction and the corresponding test picture includes:
screenshot is conducted on the UI of the application, and identification of a test picture is conducted in the screenshot;
and finishing the UI automatic test according to the image recognition result and the test instruction.
Optionally, the method further comprises:
and storing the test result of the UI automation test and the corresponding test case into the same directory.
According to another aspect of the invention, there is provided an apparatus for automated testing of user interface UIs, comprising:
the test case reading unit is suitable for reading the test case from the storage path of the test case;
the test instruction generating unit is suitable for generating test instructions corresponding to the test pictures according to the file names of the test pictures in the test cases;
and the test unit is suitable for completing the UI automatic test according to the test instruction and the corresponding test picture.
Optionally, the test case is a folder containing a plurality of test pictures.
Optionally, the file name of the test picture includes a sequence identifier of a test sequence;
the test case reading unit is suitable for reading test pictures from the folder according to the sequence identification, wherein test pictures are read each time, after the corresponding test is finished according to the test pictures, the test pictures corresponding to the next sequence identifications in the test sequence are read, or a new sequence identification is determined according to the test results, the test pictures corresponding to the new sequence identification are read, and the UI automatic test is finished when the test pictures corresponding to the last sequence identifications in the test sequence in the folder are read, or the UI automatic test is finished when the test end condition is met according to the test results of test pictures.
Optionally, the file name of the test picture includes a plurality of pieces of test information and an identifier corresponding to each piece of test information;
the test information includes a dummy of the test instruction and/or test data.
Optionally, the test instruction generating unit is adapted to read a file name of the test picture as a character string, sequentially traverse the character string, and obtain each identifier and test information corresponding to each identifier; and searching a test instruction mapping table according to the pseudo instructions in the test information, and searching out corresponding test instructions.
Optionally, the test instructions include or more of:
triggering a user event instruction, judging the instruction, jumping the instruction, and testing the time setting instruction.
Optionally, the test unit is adapted to perform screenshot on the UI of the application, and identify a test picture in the screenshot; and finishing the UI automatic test according to the image recognition result and the test instruction.
Optionally, the test unit is further adapted to store the test result of the UI automation test and the corresponding test case into the same directory.
According to a further aspect of the invention, there is provided electronic device comprising a processor and a memory arranged to store computer executable instructions which, when executed, cause the processor to perform the method of any of as described above.
According to yet another aspect of the invention there is provided computer readable storage medium storing or more programs which, when executed by a processor, perform the method as any of above, or more programs.
According to the technical scheme, the test cases are read from the storage paths of the test cases, the test instructions corresponding to the test pictures are generated according to the file names of the test pictures in the test cases, and the UI automatic test is completed according to the test instructions and the corresponding test pictures. The technical scheme realizes tight coupling of the test case and the test picture based on modification of the file name of the test picture, is convenient for management and test result investigation, and simultaneously codes of automatic test can be automatically generated according to rules and are convenient to use.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 shows a flowchart of a method for automated testing of user interface UIs, according to embodiments of the invention;
FIG. 2 is a schematic diagram of a user interface UI automation test device according to embodiments of the invention;
FIG. 3 shows a schematic structural diagram of an electronic device according to embodiments of the invention;
fig. 4 shows a schematic structural diagram of embodiments of the computer-readable storage medium according to the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
FIG. 1 shows a flow diagram of a method for automated testing of user interface UIs according to embodiments of the invention, as shown in FIG. 1, the method includes:
step S110, reading the test case from the storage path of the test case.
The meaning of the test case is generally analyzed in combination with the usage scenario, and in the embodiment of the present invention, the automated test code is separated from the test case, but the test case also contains test logic. That is, the test case contains data used for testing and description information of the test logic, but does not contain specific execution instructions.
Therefore, in step S120, a test command corresponding to each test picture is generated based on the file name of each test picture in the test case.
It can be seen that the file name contains description information of the test logic, for example, the picture content of test pictures describes controls in the application, and the file name describes that the click operation is to be performed on the control, so that the test instruction is generated according to these controls.
And step S130, finishing UI automatic test according to the test instruction and the corresponding test picture.
It can be seen that, in the method shown in fig. 1, the test case is read from the storage path of the test case, the test instruction corresponding to each test picture is generated according to the file name of each test picture in the test case, and the UI automation test is completed according to the test instruction and the corresponding test picture. The technical scheme realizes tight coupling of the test case and the test picture based on modification of the file name of the test picture, is convenient for management and test result investigation, and simultaneously codes of automatic test can be automatically generated according to rules and are convenient to use.
In embodiments of the present invention, in the above method, the test case is a folder containing a plurality of test pictures.
It can be seen that folders containing a plurality of test pictures are test cases, in the prior art, UI automation tests are realized by storing the test pictures in a centralized manner, and writing the test pictures and corresponding test logics in another files (for example, Excel documents). in this case, generally refers to the files as test cases, and the test pictures are only used as test data used in the test, so that loose coupling is formed.
In embodiments of the present invention, in the method, the filename of the test picture includes a sequence identifier of a test sequence, and reading the test case from the storage path of the test case includes reading the test pictures from the folder according to the sequence identifier, wherein, test pictures are read each time, and after completing a corresponding test according to the test pictures, the test pictures corresponding to the lower sequence identifiers in the test sequence are read, or a new sequence identifier is determined according to the test result, the test pictures corresponding to the new sequence identifier are read, and when the test pictures in the folder corresponding to the last sequence identifiers in the test sequence are read, the UI automated test is ended, or when it is determined according to the test result of test pictures that a test end condition is satisfied, the UI automated test is ended.
For example, ten test pictures with 01 and 02 … … 10 beginning are arranged under the folder and used as sequence marks of a test sequence, when in test, the picture with 01 beginning is read first, test logic is known according to the rest part of the file name, a corresponding test instruction is generated, the test is completed according to the picture, and then the picture with 02 beginning is read … … until the test of the picture with 10 beginning is completed, so that the test for test cases is completed.
In , it is possible to execute different test logic according to different test results of some test pictures, for example, clicking controls to jump, and then another test is needed when the control does not exist, and it is possible to jump to the test of test picture 08 instead of continuing the test of test picture 04 when test picture 03 fails.
The test instructions generated according to the test picture file name may further include an instruction for directly determining to end the test according to the test result, for example, if a certain picture is not identified, the test is directly ended, and the test process also supports an interference scene picture appearing in the UI automation test process, for example, the test picture 08 may be hidden by floating windows (for example, a system floating window, but not a floating window of an application to be tested), so that the test picture 07 corresponding to the floating window may be added before the test picture 08, and thus, although the floating window 08 does not need to be tested actually, the floating window 08 may be operated due to interferences, for example, the floating window is clicked, and a control corresponding to the test picture 08 is exposed after the floating window disappears, so that the UI automation test may be continued.
In embodiments of the present invention, in the method, the filename of the test picture includes a plurality of pieces of test information and an identifier corresponding to each piece of test information, and the test information includes a dummy instruction of the test instruction and/or test data.
Based on test pictures, there may be multiple operations or only operations, the operations themselves may be only to determine whether a control corresponding to a certain test picture exists, or may need to be clicked, or the controls may be input boxes, and test data needs to be input.
01_click_key_Enter.png;02_exist.png;03_type_value.png。
The first test picture 01 needs to click (click) the control first, judge the feature item (key) and then execute the operation (Enter) of pressing the Enter key, the first test picture 02 only needs to judge whether the corresponding picture content exists, and the first test picture 03 needs to input (type) the value (value) of the corresponding test data in the control, that is, test pictures support a plurality of test instructions.
It can be seen that there is a plurality of test information in the file name, separated by "_" i.e. an underline. Of course, other identification symbols may be used to identify the test information in other embodiments.
In embodiments of the present invention, the method for generating a test instruction corresponding to each test picture according to the filename of each test picture in the test case includes reading the filename of the test picture as a string, traversing the string in sequence to obtain each identifier and test information corresponding to each identifier, and searching for a test instruction mapping table according to a pseudo instruction in the test information to find out the corresponding test instruction.
It is obvious that click is pseudo commands that can be understood by a tester, not actual test commands, in this embodiment, test command mapping tables can be preset, and the mapping relationship between the pseudo commands and the test commands is set, so that the test pictures need to be set by relying on the test command mapping tables during naming.
Specifically, in embodiments of the present invention, the test instructions in the method include or more of an instruction triggering a user event, a judgment instruction, a jump instruction, and a test time setting instruction.
For example, click corresponds to the operation of clicking a screen, Enter corresponds to the operation of pressing an Enter key, and all of the operations trigger corresponding user events, and corresponding test instructions belong to judgment instructions; exist belongs to judging whether the picture exists or not, and a corresponding test instruction belongs to a judging instruction; when the test picture does not exist, other test pictures are jumped and tested without the original sequence, the corresponding test instruction belongs to the jump instruction, and the logic corresponding to the if else statement in the code is easy to think in practice; the pictures are searched in the UI interface for different reasons, the response time is different, so that the test time can be set to meet the requirement that the response is slow to wait partially due to the reasons of test environment and the like, and the corresponding test instruction is a test time setting instruction.
In embodiments of the present invention, the method for completing the UI automated test according to the test instruction and the corresponding test picture includes capturing a screenshot of the UI to be applied, recognizing the test picture in the screenshot, and completing the UI automated test according to the image recognition result and the test instruction.
In this embodiment, based on an image recognition technology, the screenshot of the UI is recognized, and whether the screenshot includes the picture content of the test picture is determined, and the subsequent test may refer to several examples of test logic given in the foregoing embodiments, such as clicking a control or inputting test data.
Based on test pictures, it is possible to identify multiple identical parts from the screenshot, for example, there are two pictures corresponding to "confirmation" in the UI interface, and it is that all such identical pictures can be identified and corresponding operations, for example, clicking, are supported in the embodiment of the present invention, and only pictures need to be placed in the test case, and only the corresponding test information in the file name needs to be modified, for example, two identical pictures that may be identified are marked and both the pictures are clicked.
In embodiments of the present invention, the method further comprises saving the test results and the corresponding test cases of the UI automation test in the same directory.
Therefore, the test result can be quickly checked, the test case can be found immediately after the test result is seen, the corresponding test picture can be found, the checking of testers is greatly facilitated, and the test efficiency is improved.
FIG. 2 is a schematic diagram illustrating an apparatus for automated testing of types of User Interfaces (UIs) according to embodiments of the present invention, and as shown in FIG. 2, the apparatus 200 for automated testing of UIs comprises:
the test case reading unit 210 is adapted to read a test case from a storage path of the test case.
The meaning of the test case is generally analyzed in combination with the usage scenario, and in the embodiment of the present invention, the automated test code is separated from the test case, but the test case also contains test logic. That is, the test case contains data used for testing and description information of the test logic, but does not contain specific execution instructions.
The test instruction generating unit 220 is adapted to generate a test instruction corresponding to each test picture according to the file name of each test picture in the test case.
It can be seen that the file name contains description information of the test logic, for example, the picture content of test pictures describes controls in the application, and the file name describes that the click operation is to be performed on the control, so that the test instruction is generated according to these controls.
And the test unit 230 is adapted to complete the UI automation test according to the test instruction and the corresponding test picture.
It can be seen that, in the apparatus shown in fig. 2, through the mutual cooperation of the units, the test case is read from the storage path of the test case, the test instruction corresponding to each test picture is generated according to the file name of each test picture in the test case, and the UI automation test is completed according to the test instruction and the corresponding test picture. The technical scheme realizes tight coupling of the test case and the test picture based on modification of the file name of the test picture, is convenient for management and test result investigation, and simultaneously codes of automatic test can be automatically generated according to rules and are convenient to use.
In embodiments of the present invention, in the above-mentioned apparatus, the test case is a folder containing a plurality of test pictures.
It can be seen that folders containing a plurality of test pictures are test cases, in the prior art, UI automation tests are realized by storing the test pictures in a centralized manner, and writing the test pictures and corresponding test logics in another files (for example, Excel documents). in this case, generally refers to the files as test cases, and the test pictures are only used as test data used in the test, so that loose coupling is formed.
In embodiments of the present invention, in the above apparatus, the filename of the test picture includes a sequence identifier of a test sequence, the test case reading unit 210 is adapted to read the test pictures from the folder according to the sequence identifier, where test pictures are read each time, and after completing a corresponding test according to the test pictures, the test pictures corresponding to the next sequence identifiers in the test sequence are read, or a new sequence identifier is determined according to the test result, the test pictures corresponding to the new sequence identifier are read, and when the test pictures in the folder corresponding to the last sequence identifiers in the test sequence are read, the UI automation test is ended, or when it is determined according to the test result of test pictures that a test end condition is satisfied, the UI automation test is ended.
For example, ten test pictures with 01 and 02 … … 10 beginning are arranged under the folder and used as sequence marks of a test sequence, when in test, the picture with 01 beginning is read first, test logic is known according to the rest part of the file name, a corresponding test instruction is generated, the test is completed according to the picture, and then the picture with 02 beginning is read … … until the test of the picture with 10 beginning is completed, so that the test for test cases is completed.
In , it is possible to execute different test logic according to different test results of some test pictures, for example, clicking controls to jump, and then another test is needed when the control does not exist, and it is possible to jump to the test of test picture 08 instead of continuing the test of test picture 04 when test picture 03 fails.
The test instructions generated according to the test picture file name may further include an instruction for directly determining to end the test according to the test result, for example, if a certain picture is not identified, the test is directly ended, and the test process also supports an interference scene picture appearing in the UI automation test process, for example, the test picture 08 may be hidden by floating windows (for example, a system floating window, but not a floating window of an application to be tested), so that the test picture 07 corresponding to the floating window may be added before the test picture 08, and thus, although the floating window 08 does not need to be tested actually, the floating window 08 may be operated due to interferences, for example, the floating window is clicked, and a control corresponding to the test picture 08 is exposed after the floating window disappears, so that the UI automation test may be continued.
In embodiments of the present invention, in the apparatus, the filename of the test picture includes a plurality of pieces of test information and a flag corresponding to each piece of test information, and the test information includes a dummy instruction of the test instruction and/or test data.
Based on test pictures, there may be multiple operations or only operations, the operations themselves may be only to determine whether a control corresponding to a certain test picture exists, or may need to be clicked, or the controls may be input boxes, and test data needs to be input.
01_click_key_Enter.png;02_exist.png;03_type_value.png。
The first test picture 01 needs to click (click) the control first, judge the feature item (key) and then execute the operation (Enter) of pressing the Enter key, the first test picture 02 only needs to judge whether the corresponding picture content exists, and the first test picture 03 needs to input (type) the value (value) of the corresponding test data in the control, that is, test pictures support a plurality of test instructions.
It can be seen that there is a plurality of test information in the file name, separated by "_" i.e. an underline. Of course, other identification symbols may be used to identify the test information in other embodiments.
In embodiments of the present invention, the test instruction generating unit 220 is adapted to read the filename of the test picture as a string, sequentially traverse the string to obtain each identifier and test information corresponding to each identifier, and search the test instruction mapping table according to the pseudo instructions in the test information to find out the corresponding test instructions.
It is obvious that click is pseudo commands that can be understood by a tester, not actual test commands, in this embodiment, test command mapping tables can be preset, and the mapping relationship between the pseudo commands and the test commands is set, so that the test pictures need to be set by relying on the test command mapping tables during naming.
Specifically, in embodiments of the present invention, the test instructions in the above-mentioned apparatus include or more of an instruction triggering a user event, a judgment instruction, a jump instruction, and a test time setting instruction.
For example, click corresponds to the operation of clicking a screen, Enter corresponds to the operation of pressing an Enter key, and all of the operations trigger corresponding user events, and corresponding test instructions belong to judgment instructions; exist belongs to judging whether the picture exists or not, and a corresponding test instruction belongs to a judging instruction; when the test picture does not exist, other test pictures are jumped and tested without the original sequence, the corresponding test instruction belongs to the jump instruction, and the logic corresponding to the if else statement in the code is easy to think in practice; the pictures are searched in the UI interface for different reasons, the response time is different, so that the test time can be set to meet the requirement that the response is slow to wait partially due to the reasons of test environment and the like, and the corresponding test instruction is a test time setting instruction.
In embodiments of the present invention, in the apparatus described above, the test unit 230 is adapted to perform screenshot on the UI of the application, perform recognition of the test picture in the screenshot, and complete an automated UI test according to the image recognition result and the test instruction.
In this embodiment, based on an image recognition technology, the screenshot of the UI is recognized, and whether the screenshot includes the picture content of the test picture is determined, and the subsequent test may refer to several examples of test logic given in the foregoing embodiments, such as clicking a control or inputting test data.
Based on test pictures, it is possible to identify multiple identical parts from the screenshot, for example, there are two pictures corresponding to "confirmation" in the UI interface, and it is that all such identical pictures can be identified and corresponding operations, for example, clicking, are supported in the embodiment of the present invention, and only pictures need to be placed in the test case, and only the corresponding test information in the file name needs to be modified, for example, two identical pictures that may be identified are marked and both the pictures are clicked.
In embodiments of the present invention, in the apparatus, the test unit 230 is further adapted to save the test result of the UI automation test and the corresponding test case into the same directory.
Therefore, the test result can be quickly checked, the test case can be found immediately after the test result is seen, the corresponding test picture can be found, the checking of testers is greatly facilitated, and the test efficiency is improved.
In summary, according to the technical solution of the present invention, the test case is read from the storage path of the test case, the test instruction corresponding to each test picture is generated according to the file name of each test picture in the test case, and the UI automation test is completed according to the test instruction and the corresponding test picture. The technical scheme realizes tight coupling of the test case and the test picture based on modification of the file name of the test picture, is convenient for management and test result investigation, and simultaneously codes of automatic test can be automatically generated according to rules and are convenient to use.
It should be noted that:
the algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus, various general purpose devices may also be used with the teachings based thereon, the required structure for constructing such devices is readily apparent from the above description.
However, it is understood that embodiments of the invention may be practiced without these specific details, and that examples well-known methods, structures, and techniques have not been shown in detail in order not to obscure the understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together by in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of the various inventive aspects, however, the disclosed method is not intended to be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim.
It will be understood by those skilled in the art that modules in the apparatus of the embodiments may be adaptively changed and arranged in or more apparatuses different from the embodiments, that modules or units or components in the embodiments may be combined into modules or units or components, and further, that they may be divided into sub-modules or sub-units or sub-components, that all features disclosed in this specification (including the accompanying claims, abstract and drawings), and all processes or units of any method or apparatus so disclosed, may be combined in any combination, except at least of such features and/or processes or units are mutually exclusive, unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose.
Furthermore, those of skill in the art will appreciate that while the embodiments described herein include some features included in other embodiments, not others, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments.
It should be understood by those skilled in the art that micro-processors or Digital Signal Processors (DSPs) may be used in practice to implement some or all of the functions of some or all of the components in an apparatus for automated testing of user interfaces UI according to embodiments of the present invention the invention may also be implemented as a device or apparatus program (e.g., computer program and computer program product) for performing part or all of the methods described herein, such programs embodying the invention may be stored on a computer readable medium or may be in the form of 2 or more signals 539.
For example, fig. 3 shows a schematic structural diagram of an electronic device according to embodiments of the invention, the electronic device comprising a processor 310 and a memory 320 arranged to store computer executable instructions (computer readable program code), the memory 320 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk or a ROM, the memory 320 having a storage space 330 storing computer readable program code 331 for performing any of the method steps in the above method, for example, the storage space 330 for storing the computer readable program code may comprise respective computer readable program code 331 for implementing the various steps in the above method, the computer readable program code 331 may be read from or written to one or more computer program products or more computer program products, the computer readable program code 331 comprises program code carriers such as a hard disk, a Compact Disk (CD), a memory card or a floppy disk, such computer program products are generally computer readable storage media such as depicted in fig. 4 shows that the computer readable program code 331 implemented according to the implementation of the embodiments of the invention may be read by the computer readable program code 300 when the computer readable storage medium 331 is run, the computer readable program code 331, the computer readable program code 300, the execution of the above method steps in the above method steps may be performed by the computer readable storage medium , the computer readable program 300, the computer readable storage medium shown in an embodiment of the electronic device.
The invention may be embodied by means of hardware comprising several distinct elements, and by means of a suitably programmed computer, in a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware, the use of the words , second, third, etc. may indicate any sequence.
The invention provides a method for automatically testing A1 and User Interfaces (UIs), which comprises the following steps:
reading the test case from the storage path of the test case;
generating a test instruction corresponding to each test picture according to the file name of each test picture in the test case;
and finishing the UI automatic test according to the test instruction and the corresponding test picture.
A2, the method as in A1, wherein the test case is a folder containing a number of test pictures.
A3, the method as in A2, wherein the file name of the test picture includes the sequence identification of the test sequence;
the reading of the test case from the storage path of the test case comprises:
reading test pictures from the folder according to the sequence identifications, wherein test pictures are read each time, and after corresponding tests are finished according to the test pictures, the test pictures corresponding to the next sequence identifications in the test sequence are read, or new sequence identifications are determined according to the test results, and the test pictures corresponding to the new sequence identifications are read;
and ending the UI automation test when the test pictures corresponding to the last sequence identifications in the test sequence in the folder are read completely, or ending the UI automation test when the test ending condition is determined to be met according to the test results of test pictures.
A4, the method as A1, wherein the filename of the test picture includes a plurality of pieces of test information and an identifier corresponding to each piece of test information;
the test information includes a dummy of the test instruction and/or test data.
The method A5, as in A4, wherein the generating the test instruction corresponding to each test picture according to the file name of each test picture in the test case includes:
reading the file name of the test picture as a character string, and traversing the character string in sequence to obtain each identifier and test information corresponding to each identifier;
and searching a test instruction mapping table according to the pseudo instructions in the test information, and searching out corresponding test instructions.
A6, the method of a1, wherein the test instructions include or more of:
triggering a user event instruction, judging the instruction, jumping the instruction, and testing the time setting instruction.
A7, the method of A1, wherein the completing UI automation test according to the test instructions and corresponding test pictures comprises:
screenshot is conducted on the UI of the application, and identification of a test picture is conducted in the screenshot;
and finishing the UI automatic test according to the image recognition result and the test instruction.
A8, the method of a1, wherein the method further comprises:
and storing the test result of the UI automation test and the corresponding test case into the same directory.
The invention also provides a device for automatically testing the UI of the B9 and user interfaces, which comprises:
the test case reading unit is suitable for reading the test case from the storage path of the test case;
the test instruction generating unit is suitable for generating test instructions corresponding to the test pictures according to the file names of the test pictures in the test cases;
and the test unit is suitable for completing the UI automatic test according to the test instruction and the corresponding test picture.
B10, the device as B9, wherein the test case is a folder containing a plurality of test pictures.
B11, the device as B10, wherein the file name of the test picture includes the sequence identification of the test sequence;
the test case reading unit is suitable for reading test pictures from the folder according to the sequence identification, wherein test pictures are read each time, after the corresponding test is finished according to the test pictures, the test pictures corresponding to the next sequence identifications in the test sequence are read, or a new sequence identification is determined according to the test results, the test pictures corresponding to the new sequence identification are read, and the UI automatic test is finished when the test pictures corresponding to the last sequence identifications in the test sequence in the folder are read, or the UI automatic test is finished when the test end condition is met according to the test results of test pictures.
B12, the device as B9, wherein the filename of the test picture includes a plurality of pieces of test information and an identifier corresponding to each piece of test information;
the test information includes a dummy of the test instruction and/or test data.
B13, the device of B12, wherein,
the test instruction generating unit is suitable for reading the file name of the test picture as a character string, sequentially traversing the character string and obtaining each identifier and test information corresponding to each identifier; and searching a test instruction mapping table according to the pseudo instructions in the test information, and searching out corresponding test instructions.
B14, the device as B9, wherein the test command includes or more of:
triggering a user event instruction, judging the instruction, jumping the instruction, and testing the time setting instruction.
B15, the device of B9, wherein,
the test unit is suitable for screenshot of the UI of the application and identification of a test picture in the screenshot; and finishing the UI automatic test according to the image recognition result and the test instruction.
B16, the device of B15, wherein,
the test unit is also suitable for storing the test result of the UI automation test and the corresponding test case into the same directory.
The invention also provides C17, electronic devices, wherein the electronic devices comprise a processor and a memory arranged to store computer executable instructions that, when executed, cause the processor to perform the method of any of a1-a 8.
The invention also provides D18, computer readable storage media, wherein the computer readable storage media stores or more programs, the or more programs, when executed by a processor, implement the method as described in any of a1-a 8.

Claims (10)

1, method for automatically testing UI (user interface), comprising:
reading the test case from the storage path of the test case;
generating a test instruction corresponding to each test picture according to the file name of each test picture in the test case;
and finishing the UI automatic test according to the test instruction and the corresponding test picture.
2. The method of claim 1, wherein the test case is a folder containing a number of test pictures.
3. The method according to claim 2, wherein the file name of the test picture comprises a sequence identification of a test sequence;
the reading of the test case from the storage path of the test case comprises:
reading test pictures from the folder according to the sequence identifications, wherein test pictures are read each time, and after corresponding tests are finished according to the test pictures, the test pictures corresponding to the next sequence identifications in the test sequence are read, or new sequence identifications are determined according to the test results, and the test pictures corresponding to the new sequence identifications are read;
and ending the UI automation test when the test pictures corresponding to the last sequence identifications in the test sequence in the folder are read completely, or ending the UI automation test when the test ending condition is determined to be met according to the test results of test pictures.
4. The method as claimed in claim 1, wherein the file name of the test picture includes a plurality of pieces of test information and a mark corresponding to each piece of test information;
the test information includes a dummy of the test instruction and/or test data.
5. The method of claim 4, wherein the generating of the test instruction corresponding to each test picture according to the file name of each test picture in the test case comprises:
reading the file name of the test picture as a character string, and traversing the character string in sequence to obtain each identifier and test information corresponding to each identifier;
and searching a test instruction mapping table according to the pseudo instructions in the test information, and searching out corresponding test instructions.
6. The method of claim 1, wherein the test instructions include or more of:
triggering a user event instruction, judging the instruction, jumping the instruction, and testing the time setting instruction.
7. The method of claim 1, wherein the completing the UI automation test according to the test instructions and the corresponding test pictures comprises:
screenshot is conducted on the UI of the application, and identification of a test picture is conducted in the screenshot;
and finishing the UI automatic test according to the image recognition result and the test instruction.
8, apparatus for automated testing of UI, comprising:
the test case reading unit is suitable for reading the test case from the storage path of the test case;
the test instruction generating unit is suitable for generating test instructions corresponding to the test pictures according to the file names of the test pictures in the test cases;
and the test unit is suitable for completing the UI automatic test according to the test instruction and the corresponding test picture.
An electronic device of 9, , wherein the electronic device comprises a processor and a memory arranged to store computer-executable instructions that, when executed, cause the processor to perform the method of any of claims 1-7, .
10, computer-readable storage media, wherein the computer-readable storage media stores one or more programs, the one or more programs, when executed by a processor, implement the method of any of claims 1-7.
CN201810789737.4A 2018-07-18 2018-07-18 Method and device for automatically testing user interface UI Active CN110737573B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810789737.4A CN110737573B (en) 2018-07-18 2018-07-18 Method and device for automatically testing user interface UI

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810789737.4A CN110737573B (en) 2018-07-18 2018-07-18 Method and device for automatically testing user interface UI

Publications (2)

Publication Number Publication Date
CN110737573A true CN110737573A (en) 2020-01-31
CN110737573B CN110737573B (en) 2023-02-17

Family

ID=69235246

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810789737.4A Active CN110737573B (en) 2018-07-18 2018-07-18 Method and device for automatically testing user interface UI

Country Status (1)

Country Link
CN (1) CN110737573B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112150431A (en) * 2020-09-21 2020-12-29 京东数字科技控股股份有限公司 UI visual walkthrough method and device, storage medium and electronic device
CN114323585A (en) * 2021-12-28 2022-04-12 梅卡曼德(北京)机器人科技有限公司 Method for calculating modulation transfer function in batch, electronic device and storage medium
WO2022141745A1 (en) * 2020-12-29 2022-07-07 福州富昌维控电子科技有限公司 Ladder diagram-based plc instruction quality detection method, and terminal

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103309797A (en) * 2012-03-09 2013-09-18 阿里巴巴集团控股有限公司 Automatic testing method and device of user interface
US9075918B1 (en) * 2014-02-25 2015-07-07 International Business Machines Corporation System and method for creating change-resilient scripts
CN107861862A (en) * 2017-06-27 2018-03-30 陆金所(上海)科技服务有限公司 UI automated testing methods, device and computer-readable recording medium
CN107885665A (en) * 2017-12-28 2018-04-06 努比亚技术有限公司 With case script method of testing, mobile terminal and computer-readable recording medium
CN107957948A (en) * 2017-12-07 2018-04-24 郑州云海信息技术有限公司 A kind of user interface automatic test device and method
CN108268373A (en) * 2017-09-21 2018-07-10 平安科技(深圳)有限公司 Automatic test cases management method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103309797A (en) * 2012-03-09 2013-09-18 阿里巴巴集团控股有限公司 Automatic testing method and device of user interface
US9075918B1 (en) * 2014-02-25 2015-07-07 International Business Machines Corporation System and method for creating change-resilient scripts
CN107861862A (en) * 2017-06-27 2018-03-30 陆金所(上海)科技服务有限公司 UI automated testing methods, device and computer-readable recording medium
CN108268373A (en) * 2017-09-21 2018-07-10 平安科技(深圳)有限公司 Automatic test cases management method, device, equipment and storage medium
CN107957948A (en) * 2017-12-07 2018-04-24 郑州云海信息技术有限公司 A kind of user interface automatic test device and method
CN107885665A (en) * 2017-12-28 2018-04-06 努比亚技术有限公司 With case script method of testing, mobile terminal and computer-readable recording medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112150431A (en) * 2020-09-21 2020-12-29 京东数字科技控股股份有限公司 UI visual walkthrough method and device, storage medium and electronic device
WO2022141745A1 (en) * 2020-12-29 2022-07-07 福州富昌维控电子科技有限公司 Ladder diagram-based plc instruction quality detection method, and terminal
CN114323585A (en) * 2021-12-28 2022-04-12 梅卡曼德(北京)机器人科技有限公司 Method for calculating modulation transfer function in batch, electronic device and storage medium
CN114323585B (en) * 2021-12-28 2024-04-12 梅卡曼德(北京)机器人科技有限公司 Method for batch calculation of modulation transfer function, electronic device and storage medium

Also Published As

Publication number Publication date
CN110737573B (en) 2023-02-17

Similar Documents

Publication Publication Date Title
US8645919B2 (en) Generic validation test framework for graphical user interfaces
US9619373B2 (en) Method and apparatus to semantically connect independent build and test processes
CN105743736B (en) Automated testing method and system
CN110737573B (en) Method and device for automatically testing user interface UI
JP2015507303A (en) Code coverage rate determination method and system
CN110287696A (en) A kind of detection method, device and the equipment of the shell process that rebounds
US20130339798A1 (en) Methods for automated software testing and devices thereof
EP2951680B1 (en) Acquiring identification of an application lifecycle management entity associated with similar code
CN108829389A (en) Android application automation triggering execution method based on Appium
CN105512276B (en) Method and device for constructing junk file and electronic equipment
CN109426496B (en) Method for writing program log into file, storage medium, electronic device and system
CN106528429A (en) UI testing method and device
US20140229923A1 (en) Commit sensitive tests
CN109189688A (en) A kind of generation method, generating means and the electronic equipment of test case script
CN112667502A (en) Page testing method, device and medium
CN110737577B (en) Test defect data storage method and device
CN109086173B (en) Equipment test method and device of operating system and storage medium
CN112597040B (en) Interface automatic testing method and device and electronic equipment
CN110378566A (en) Information checking method, equipment, storage medium and device
CN113326193A (en) Applet testing method and device
JP6217440B2 (en) Symbolic execution program, symbolic execution method, and symbolic execution device
WO2012066635A1 (en) Test method, test device, and test execution program
CN113268412B (en) Control analysis method, device, equipment and medium for Web system test case recording
CN108763087A (en) A kind of script testing method, apparatus and system
CN111124548B (en) Rule analysis method and system based on YAML file

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
GR01 Patent grant
GR01 Patent grant