CN114817078A - Automatic testing method and device and storage medium - Google Patents

Automatic testing method and device and storage medium Download PDF

Info

Publication number
CN114817078A
CN114817078A CN202210751563.9A CN202210751563A CN114817078A CN 114817078 A CN114817078 A CN 114817078A CN 202210751563 A CN202210751563 A CN 202210751563A CN 114817078 A CN114817078 A CN 114817078A
Authority
CN
China
Prior art keywords
attribute values
constant
production
tool
user interface
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
CN202210751563.9A
Other languages
Chinese (zh)
Other versions
CN114817078B (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.)
Honor Device Co Ltd
Original Assignee
Honor Device 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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202210751563.9A priority Critical patent/CN114817078B/en
Publication of CN114817078A publication Critical patent/CN114817078A/en
Application granted granted Critical
Publication of CN114817078B publication Critical patent/CN114817078B/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
    • 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
    • G06F11/3692Test management for test results analysis

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

An automatic testing method, an automatic testing device and a storage medium relate to the technical field of automatic testing, the technical field of automation and the field of computers. The method comprises the following steps: identifying each user interface element of the production test tool and the production management system by using the constant attribute value of each interface in the preset interface set, wherein the preset interface set comprises at least one of the interfaces with constant attribute values or part of the interfaces with constant attribute values; the production test tool is used for testing the device to be tested under the control of the production management system and the PRA tool and feeding back a test result to the PRA tool; the production management system is used for controlling the production test tool; and operating each user interface element of the production test tool and the production management system according to a preset test strategy so as to carry out automatic test. By using the method, the program window can still be identified when the application is restarted, the re-adaptation is not needed, and the efficiency of the automatic test is improved.

Description

Automatic testing method and device and storage medium
Technical Field
The present disclosure relates to the field of automated testing technologies, and in particular, to a method, an apparatus, and a storage medium for automated testing.
Background
With the increasing expansion of production scale and the complication of production flow, the testing of production line bodies becomes more difficult and complicated, and the limitation of the traditional manual testing is more and more obvious. Automated testing techniques may overcome many of the problems of conventional testing techniques.
The automated testing generally refers to a Process of writing a script to control a production testing tool and a production management system by using a Robot Process Automation (RPA) tool to automatically execute a test, and comparing an actual result with an expected result to obtain a test conclusion. Automated testing is based on a rigorous set of test rules and evaluation criteria with a complete automated testing process. Therefore, the automatic test can automatically execute some repeated but necessary test works, and can also complete tests which are difficult to complete by manual tests, thereby avoiding test omission caused by inertial thinking of testers and reducing human errors caused by complicated repeated work in the manual tests.
However, for the current RPA tool, when the production test tool and/or the production management system is restarted, since the positioning element may not be effectively identified, the automated test may not be performed smoothly, and the script of the RPA tool needs to be adapted and adjusted again, thereby reducing the efficiency of the automated test.
Disclosure of Invention
In order to solve the above problems, the present application provides an automated testing method, an automated testing device, and a storage medium, which improve the efficiency of automated testing.
In a first aspect, the present application provides a method for automated testing, which is applied to a Robot Process Automation (RPA) tool, and includes the following steps: identifying each user interface element of a production test tool and a production management system by using a constant attribute value of each interface in a preset interface set, wherein the preset interface set comprises at least one of interfaces with constant attribute values or part of interfaces with constant attribute values; the production test tool is used for testing the device under test under the control of the production management system and the PRA tool and feeding back a test result to the PRA tool; the production management system is used for controlling the production test tool; and operating the production test tool and each user interface element of the production management system according to a preset test strategy so as to carry out automatic test.
The method utilizes the constant attribute values of all interfaces in the preset interface set to identify all user interface elements of a production test tool and a production management system. Specifically, when the preset interface set includes an interface with a constant attribute value, the full value of the attribute value of the interface may be applied; when the preset interface set comprises a part of interfaces with constant attribute values, namely other part of attribute values of the interfaces can change, the technical scheme of the application only utilizes the constant attribute values of the part to identify, and the changed part of attribute values cannot be utilized. Therefore, when the production test tool and the production management system are restarted, even if the attribute values of the interface elements change, the scheme of the application can still position all the user interface elements, automatic detection is realized, re-adaptation is not needed, and the efficiency of automatic testing is improved.
In addition, when the method is applied, even if the production test tool and the production management system are located in the background to run, the scheme of the application can also normally locate each user interface element to realize automatic detection, so that the scheme of the application has higher practicability.
In a possible implementation manner, the preset interface set includes interfaces with constant attribute values and some interfaces with constant attribute values, and the identifying, by using the constant attribute values of the interfaces in the preset interface set, each user interface element of the production test tool and the production management system specifically includes:
acquiring attribute values of user interface elements of each running program window;
and performing regular matching from the attribute values of the user interface elements of each running program window by taking the partial constant attribute values of the interfaces with constant attribute values as first attribute values to be matched and taking the constant attribute values of the interfaces with constant attribute values as second attribute values to be matched so as to identify the production test tool and the user interface elements of the production management system.
For an interface with a constant part of attribute values, the rest of the attribute values of the interface can change, so that the global matching often fails to achieve the matching result, and the adaptation needs to be performed again. And then, combining the matching result of the second attribute value to be matched, and positioning the unique user interface element.
In a possible implementation manner, the preset interface set includes interfaces with constant attribute values and some interfaces with constant attribute values, and the identifying, by using the constant attribute values of the interfaces in the preset interface set, each user interface element of the production test tool and the production management system specifically includes:
acquiring attribute values of user interface elements of each running program window;
taking the partial constant attribute value of the interface with the partial constant attribute value as a first attribute value to be matched, and performing regular matching from the attribute values of the user interface elements of the running program window; and performing full-value matching from the attribute values of the user interface elements of each running program window by taking the constant attribute value of the interface with the constant attribute value as a second attribute value to be matched so as to identify the production test tool and the user interface elements of the production management system.
For an interface with a constant part of attribute values, the rest of the attribute values of the interface can change, so that the global matching often fails to achieve the matching result, and the adaptation needs to be performed again. And then, combining the matching result of the second attribute value to be matched, and positioning the unique user interface element.
And because the second attribute value to be matched does not change, the full-value matching is carried out on the second attribute value to be matched, so that the matching result can be obtained more directly, the number of results is reduced, and the calculation amount is reduced.
In one possible implementation, the interface in which the attribute value is constant comprises at least one of:
an element ID, a button name, a window title, or an application name.
In one possible implementation, the interface where the partial attribute values are constant includes a window class name.
In a second aspect, the present application further provides an apparatus for automated testing, the apparatus comprising: the system comprises a robot process automation PRA tool, a production test tool and a production management system. Namely the PRA tool, production test tool and production management system above which the device operates. The PRA tool is used for identifying a production test tool and user interface elements of a production management system by using constant attribute values of each interface in a preset interface set, and operating the production test tool and the user interface elements of the production management system according to a preset test strategy so as to perform automatic test; the preset interface set comprises at least one of interfaces with constant attribute values or interfaces with constant part of attribute values. The production test tool is used for testing the device under test under the control of the production management system and the PRA tool and feeding back a test result to the PRA tool; the production management system is used for controlling the production test tool.
The PRA tool of the device utilizes the constant and unchangeable attribute values of all interfaces in the preset interface set to identify the production test tool and all user interface elements of the production management system. Specifically, when the preset interface set includes an interface with a constant attribute value, the full value of the attribute value of the interface may be applied; when the preset interface set comprises a part of interfaces with constant attribute values, namely other part of attribute values of the interfaces can change, the technical scheme of the application only utilizes the constant attribute values of the part to identify, and the changed part of attribute values cannot be utilized. Therefore, when the production test tool and the production management system are restarted, even if the attribute values of the interface elements change, the device can still position the user interface elements, automatic detection is realized, re-adaptation is not needed, and therefore the efficiency of automatic testing is improved.
In addition, when the device is applied, even if the production test tool and the production management system are located in the background to run, the scheme of the application can also be used for normally positioning each user interface element, and automatic detection is realized, so that the scheme of the application has higher practicability.
In a possible implementation manner, the PRA tool is specifically configured to obtain attribute values of user interface elements of each running program form; and performing regular matching from the attribute values of the user interface elements of each running program window by taking the partial constant attribute values of the interfaces with constant attribute values as first attribute values to be matched and taking the constant attribute values of the interfaces with constant attribute values as second attribute values to be matched so as to identify the production test tool and the user interface elements of the production management system, wherein the preset interface set comprises the interfaces with constant attribute values and the interfaces with constant attribute values.
For an interface with constant and unchangeable part of attribute values, because the attribute values of the rest part of the interface are changed, the global matching often fails to achieve the matching result, and the adaptation needs to be carried out again, so that the PRA tool adopts a regular matching mode to carry out matching on the basis of the first attribute value to be matched, and the matching result is ensured to be obtained. And then, combining the matching result of the second attribute value to be matched, and positioning the unique user interface element.
In a possible implementation manner, the PRA tool is specifically configured to obtain attribute values of user interface elements of each running program form; taking the partial constant attribute value of the interface with the partial constant attribute value as a first attribute value to be matched, and performing regular matching from the attribute values of the user interface elements of the running program window; and performing full-value matching from the attribute values of the user interface elements of each running program window by taking the constant attribute value of the interface with the constant attribute value as a second attribute value to be matched so as to identify the production test tool and the user interface elements of the production management system, wherein the preset interface set comprises the interface with the constant attribute value and part of the interfaces with the constant attribute value.
For an interface with a constant part of attribute values, the rest of the attribute values of the interface can change, so that the global matching often fails to achieve the matching result, and the adaptation needs to be performed again. And then, combining the matching result of the second attribute value to be matched, and positioning the unique user interface element. And because the second attribute value to be matched does not change, the PRA tool performs full-value matching on the second attribute value to be matched, so that the matching result can be obtained more directly, and the number of results is reduced, thereby reducing the calculation amount.
In one possible implementation, the interface in which the attribute value is constant comprises at least one of:
an element ID, a button name, a window title, or an application name.
In one possible implementation, the interface where the partial attribute values are constant includes a window class name.
In a possible implementation manner, the PRA tool is specifically configured to operate the production test tool and each user interface element of the production management system according to a predetermined test policy, so as to implement testing of the device under test; and receiving a test result fed back by the production test tool, and executing a response strategy according to the test result.
In a third aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor, implements the method for automated testing described in any of the above implementations.
In a fourth aspect, the present application further provides an electronic device, which includes a processor and a memory, wherein the processor is configured to call the program instructions of the memory, and the program instructions are executed to perform the method for automated testing provided by the above embodiment. The electronic device may be a server, a Personal Computer (PC), a tablet computer (pad), a mobile phone, a notebook computer, or the like.
Drawings
FIG. 1 is a diagram of a system architecture for automated testing;
FIG. 2 is a flow chart of a method for automated testing according to an embodiment of the present disclosure;
FIG. 3 is a flow chart of another method for automated testing provided by embodiments of the present application;
FIG. 4 is a flow chart of yet another method for automated testing provided by an embodiment of the present application;
FIG. 5 is a schematic diagram of an apparatus for automated testing according to an embodiment of the present disclosure;
fig. 6 is a schematic view of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the technical solution of the present application more clearly understood, an application scenario of the technical solution of the present application is first described below.
With the increasing expansion of production scale and the complication of production flow, the testing of production line bodies becomes more difficult and complicated, and the limitation of the traditional manual testing is more and more obvious. Automated testing techniques may overcome many of the problems of conventional testing techniques.
The specific implementation manner of the production line body is not limited in the embodiment of the application, the method provided by the application can be applied to different test scenes, and the following description takes an automatic test for performing a pressure test on a production station as an example, and the automatic test of the item tests a tested Device (DUT) prototype to find out a small probability problem in the production process of the line body so as to ensure that the produced product meets the specification requirement.
The electronic device to which the automated testing method is applied is not particularly limited in the embodiment of the present application, and may be, for example, a mobile phone, a tablet computer, a notebook computer, a professional detection device, a desktop computer, or the like.
Referring to fig. 1, a schematic diagram of a system architecture for automated testing is shown.
The automated testing system 10 includes: RPA tool 11, production test tool 12, and production management system 13.
The RPA tool 11 is used for controlling the production test tool 12 and the production management system 13 according to the written script, and receiving the test result of the DUT prototype 20 fed back by the production test tool 12. RPA utility 11 is typically a desktop version of a software application. The desktop version refers to an application program which can be downloaded and installed on the electronic equipment.
The DUT prototype 20 may be a mobile phone, a notebook computer, a wearable electronic device (e.g., a smart watch), a tablet computer, an Augmented Reality (AR) device, a Virtual Reality (VR) device, an in-vehicle device, and the like, which is not limited in this embodiment.
The production testing tool 12 is used for realizing automatic detection of the DUT prototype 20 under the control of the RPA tool 11, feeding back the detection result to the RPA tool 11, and communicating with the production management system 12 to receive production flow control.
Production test tool 12 is typically a desktop version of a software application.
The production management system 13 ensures that the production flow is controlled as required by communicating with the production test tool 12. The production management system 13 may be a software application or a web page version, i.e. accessed via a web site on a browser.
The automated testing system 10 may also be connected to a local area network 30 and to a server 40 via the local area network 30.
However, with the current RPA tool 11, when the production test tool 12 and/or the production management system 13 is restarted, since the positioning element may not be effectively recognized, the automation test may not be performed smoothly, and the script of the RPA tool 11 needs to be adapted and adjusted again, which reduces the efficiency of the automation test. Wherein, for the restart of the software application program, the software application program is generally opened again after being closed; for the restart of the web page version of the production management system, generally, after the web page of the production management system is closed, the web page is skipped to the page of the production management system again by inputting or selecting the corresponding website on the browser.
In order to solve the technical problems, the application provides an automatic testing method, an automatic testing device and a storage medium, wherein an element identification function is integrated in an RPA tool, when a production testing tool and/or a production management system are restarted, a program window can be directly identified, positioning elements can be effectively identified, a script of the RPA tool does not need to be adapted and adjusted again, and the positioning elements can be idled even if the production testing tool and the production management system are opened at a desktop background, so that the automatic testing efficiency is improved.
In order to make the technical solutions more clearly understood by those skilled in the art, the technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
The terms "first", "second", and the like in the description of the present application are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated
The embodiment of the application provides an automatic testing method, which is specifically described below with reference to the accompanying drawings.
Referring to fig. 2, the figure is a flowchart of a method for automated testing according to an embodiment of the present disclosure.
The method is used for realizing automatic detection of a DUT prototype so as to find defects which occur with small probability in the production process. The detection of the DUT prototype may include, but is not limited to, whether the installation of the detection system is completed, whether the function of the detection system is normal, whether other functions of the DUT prototype are normal, and the like, which is not specifically limited in this embodiment of the present application.
The method comprises the following steps:
s101: and identifying each user interface element of the production test tool and the production management system by using the constant attribute value of each interface in the preset interface set.
The RPA tool is used for controlling the production test tool and the production management system according to the written script and receiving the test result of the DUT prototype 20 fed back by the production test tool. The RPA utility is typically a desktop version of a software application. The desktop version refers to an application program which can be downloaded and installed on the electronic equipment.
The production testing tool is used for realizing automatic detection of the DUT prototype machine under the control of the RPA tool, feeding back a detection result to the RPA tool, communicating with a production management system and receiving production flow control.
The production test tool is typically a desktop version of a software application.
The production management system ensures that the production flow is controlled as required by communicating with the production test tool.
The preset interface set comprises at least one of interfaces with constant attribute values or interfaces with constant part of attribute values.
The Interface is used for identifying and positioning User Interface (UI) elements, and for the RPA tool, the calling of the Interface is generally realized by calling an Interface function, so that the subsequent positioning of the UI elements is carried out.
The following exemplifies an interface function, an interface name, and an attribute value of an interface.
Table 1: interface illustration
Figure DEST_PATH_IMAGE001
The preset interface set in the application includes interfaces with constant attribute values and/or some interfaces with constant attribute values.
See table 1, where the attribute values of the interfaces, such as the element ID, the button name, the window title, and the application name, do not change with the program restart or the adjustment of the program window, and belong to interfaces with constant attribute values.
And for the window class name, the attribute value is longer, and the window class name comprises a class name format, a module handle, a window class style, a cursor handle, a background brush handle and an icon handle. The handle is an identifier for identifying an object or an item, and may be used to describe a form, a file, or the like, and it should be noted that the handle may not be a constant. The handle is set up, which basically results from the problem of the memory management mechanism, i.e. the virtual address. In short, the address of the data needs to be changed, and the change needs to be recorded and managed after the change, so that the change of the data address is recorded by the handle, namely the change of the data address, the handle is changed, and the handle is maintained when the data address is not changed. For the interface of the window class name, the part of the 'class name format, the module handle, the window class style and the cursor handle' is generally unchanged, namely the attribute value of the part is constant, and the part of the 'background brush handle, the cursor handle' is transformed along with the program restart.
By utilizing the constant attribute values of the interfaces in the preset interface set, the user interface elements of the production test tool and the production management system can be identified and uniquely positioned, and the influence of whether the program is restarted or not can be avoided.
S102: and operating each user interface element of the production test tool and the production management system according to a preset test strategy so as to carry out automatic test.
The RPA tool controls the production test tool and the production management system according to the pre-programmed script.
It can be understood that, in the method provided in the embodiment of the present application, the RPA tool integrates the above functions of identifying the user interface element, that is, the preset interface set in S101 needs to be predetermined in the process of writing the script, and is to be run when the RPA tool is started. The interface specifically included in the preset interface set is not limited in the embodiment of the present application, and a person skilled in the art may select the interface according to actual test requirements, and in the actual application, the interface generally includes a window class name, an element ID, a button name, a window title, an application program, and the like.
In summary, the method provided in the embodiment of the present application identifies each user interface element of the production test tool and the production management system by using the constant attribute value of each interface in the preset interface set. Specifically, when the preset interface set includes an interface with a constant attribute value, the full value of the attribute value of the interface may be applied; when the preset interface set comprises a part of interfaces with constant attribute values, namely other part of attribute values of the interfaces can change, the technical scheme of the application only utilizes the constant attribute values of the part to identify, and the changed part of attribute values cannot be utilized. Therefore, when the production test tool and the production management system are restarted, even if the attribute values of the interface elements change, the scheme of the application can still position the user interface elements, automatic detection is realized, re-adaptation is not needed, and therefore the efficiency of automatic testing is improved. In addition, even production test tool and production management system are located the backstage and move, each user interface element also can normally be positioned to the scheme of this application, realizes automated inspection, therefore this application scheme has higher practicality.
The following description is made with reference to specific implementations.
Referring to fig. 3, a flowchart of another method for automated testing according to an embodiment of the present application is shown.
In the embodiment of the present application, an example in which the preset interface set includes an interface with a constant attribute value and a part of interfaces with a constant attribute value is described.
The method comprises the following steps:
s201: and acquiring the attribute value of each user interface element of each running program form.
In one possible implementation, the attribute values of the interface elements may be obtained by aspect.
Exe is a windows operating system based tool that allows selection of UI elements and viewing of accessibility data of the elements, e.g., UI automation properties and control patterns.
S202: and performing regular matching from the attribute values of the user interface elements of each running program window by taking the partial constant attribute values of the interfaces with constant attribute values as first attribute values to be matched and taking the constant attribute values of the interfaces with constant attribute values as second attribute values to be matched so as to identify the user interface elements of the production test tool and the production management system.
For an interface with a constant part of attribute values, because the attribute values of the rest of the interface are changed, global matching often fails to match results, and adaptation needs to be performed again. And then, combining the matching result of the second attribute value to be matched, and positioning the unique user interface element.
Regular matching generally uses Regular expressions (often abbreviated as regex or RE), also called Regular expressions, Regular representations, Regular expressions, Regular representations. Regular expressions use a single string to describe, match a series of strings that match a certain syntactic rule.
For example, for the interface of window class name in table one, the format of the attribute value is "class name format: module handle: window class style: cursor handle: background brush handle: icon handle".
Wherein, the background brush handle, the icon handle and the like are changed. And the attribute values of the class name format, module handle, cursor handle, window class style part are constant. All or part of the class name format, the module handle, the cursor handle and the window class style part can be selected as the first attribute value to be matched. The following description takes the class name format as the first attribute value to be matched as an example.
And when the regular matching is carried out, the class name format is used as a first attribute value to be matched, and the regular matching is carried out from the attribute values of each user interface element of each running program window. Assuming that the class name format is Afx, there may be multiple attribute values obtained by matching, such as "Afx: 400000: b:10011:6: e605 af" or "Afx: 400000: b:10011:0:7175 d".
And then, taking the constant attribute value of the interface with the constant attribute value as a second attribute value to be matched, and performing regular matching from the attribute values of the user interface elements of the running program window.
And solving the intersection of the result of the regular matching by using the first attribute value to be matched and the result of the regular matching by using the second attribute value to be matched, namely obtaining the element which is matched with the first attribute value to be matched and the element which is matched with the second attribute value to be matched, and identifying and positioning the unique element.
S203: and operating each user interface element of the production test tool and the production management system according to a preset test strategy to realize the test of the tested device.
The operation on the interface elements includes, but is not limited to, a click operation (for opening or closing some interfaces or functions), an input operation of a specific character or character string, a configuration operation, and the like, and the specific operation is related to the purpose of the test and related elements, which is not described herein again in this embodiment of the present application.
S204: and receiving a test result fed back by the production test tool, and executing a response strategy according to the test result.
In practical applications, the production test tool may perform the test on the DUT prototype repeatedly for multiple times, and then feed back the test result to the RPA tool together, or feed back the test result after each test on the DUT prototype, which is not specifically limited in this embodiment of the present application.
The response policy implemented by the RPA utility may include, but is not limited to, any of the following:
generating a report or log according to the test result;
when the test result is failure, requesting a production test tool to feed back a problem report;
when the test result is failure, the test is carried out again;
and when the test result is failure, stopping the test.
The above response policies are only illustrative examples, and in practical applications, the RPA tool may also execute other response policies, which are not described herein again.
Referring to fig. 4, it is a flowchart of another method for automated testing provided in the embodiments of the present application.
S301: and acquiring the attribute value of each user interface element of each running program form.
In one possible implementation, the attribute values of the interface elements may be obtained by aspect.
S302: taking the partial constant attribute value of the interface with the partial constant attribute value as a first attribute value to be matched, and performing regular matching from the attribute values of user interface elements of each running program window; and taking the constant attribute value of the interface with constant and unchangeable attribute value as a second attribute value to be matched, and performing full-value matching from the attribute values of the user interface elements of the running program window to identify the user interface elements of the production test tool and the production management system.
The method shown in fig. 4 is different from the method shown in fig. 3 in S302.
For an interface with a constant part of attribute values, because the attribute values of the rest of the interface are changed, global matching often fails to match results, and adaptation needs to be performed again. And then, combining the matching result of the second attribute value to be matched, and positioning the unique user interface element.
For a specific implementation of the regular matching, reference may be made to the description in the above embodiments, and details of the embodiments of the present application are not described herein again.
And because the second attribute value to be matched does not change, the matching result can be more directly obtained by performing full-value matching on the second attribute value to be matched, and compared with regular matching, the number of results is reduced, so that the calculation amount in the subsequent positioning of the unique user interface element is reduced.
S303: and operating each user interface element of the production test tool and the production management system according to a preset test strategy to realize the test of the device under test.
The operation on the interface elements includes, but is not limited to, a click operation (for opening or closing some interfaces or functions), an input operation of a specific character or character string, a configuration operation, and the like, and the specific operation is related to the purpose of the test and related elements, which is not described herein again in this embodiment of the present application.
S304: and receiving a test result fed back by the production test tool, and executing a response strategy according to the test result.
In practical applications, the production test tool may perform the test on the DUT prototype repeatedly for multiple times, and then feed back the test result to the RPA tool together, or feed back the test result after each test on the DUT prototype, which is not specifically limited in this embodiment of the present application.
The response policy implemented by the RPA utility may include, but is not limited to, any of the following:
generating a report or log according to the test result;
when the test result is failure, requesting a production test tool to feed back a problem report;
when the test result is failure, the test is carried out again;
and when the test result is failure, stopping the test.
The above response policies are only illustrative examples, and in practical applications, the RPA tool may also execute other response policies, which are not described herein again.
The division of the above steps in the embodiments of the present application is only for convenience of description, and does not limit the technical solution of the present application, and a person skilled in the art may appropriately adjust the above steps according to actual situations.
The production test tool and the production management system in the embodiment of the present application may be an application program or a web page, which is not particularly limited in the embodiment of the present application.
In a possible application scenario, the automatic testing method can be used for performing pressure testing on a production station, and by detecting a DUT prototype, a small probability problem of a production line body in the production process is found, so that the requirements of whether the current state of the production station is normal and whether the production capacity of the production station can be improved are evaluated.
In one possible implementation, the RPA tool and the production test tool are typically desktop version software applications. The production management system can be a desktop version of a software application program, and can also be a webpage version, namely, the production management system is accessed on a browser through a website.
In summary, with the method provided in the embodiment of the present application, when the production test tool and the production management system are restarted, even if the attribute value of the interface element changes, the scheme of the present application can still locate each user interface element, so as to implement automatic detection without re-adaptation, thereby improving the efficiency of automatic testing. In addition, even production test tool and production management system are located the backstage and move, or the position on the desktop has taken place the adjustment, each user interface element also can normally be positioned to the scheme of this application, realizes automated inspection, therefore this application scheme has higher practicality.
Based on the method for automatic testing provided by the above embodiment, the embodiment of the present application further provides an automatic testing device, which is specifically described below with reference to the accompanying drawings.
Referring to fig. 5, the figure is a schematic view of an apparatus for automated testing according to an embodiment of the present application.
The automated testing apparatus 50 includes: PRA tool 11, production test tool 12, and production management system 13.
The PRA tool 11 is configured to identify a production test tool and user interface elements of a production management system by using a constant attribute value of each interface in a preset interface set, and operate the production test tool and the user interface elements of the production management system according to a predetermined test policy to perform an automated test.
The preset interface set comprises at least one of interfaces with constant attribute values or interfaces with constant part of attribute values.
In a possible implementation manner, the PRA tool is specifically configured to obtain attribute values of user interface elements of each running program form; and performing regular matching from the attribute values of the user interface elements of each running program window by taking the partial constant attribute values of the interfaces with constant attribute values as first attribute values to be matched and taking the constant attribute values of the interfaces with constant attribute values as second attribute values to be matched so as to identify the production test tool and the user interface elements of the production management system. At this time, the preset interface set includes interfaces with constant attribute values and some interfaces with constant attribute values.
For an interface with a constant part of attribute values, because the attribute values of the rest of the interface are changed, global matching often fails to match results, and adaptation needs to be performed again. And then, combining the matching result of the second attribute value to be matched, and positioning the unique user interface element.
In a possible implementation manner, the PRA tool is specifically configured to obtain attribute values of user interface elements of each running program form; taking the partial constant attribute value of the interface with the partial constant attribute value as a first attribute value to be matched, and performing regular matching from the attribute values of the user interface elements of the running program window; and performing full-value matching from the attribute values of the user interface elements of each running program window by taking the constant attribute value of the interface with the constant attribute value as a second attribute value to be matched so as to identify the production test tool and the user interface elements of the production management system. At this time, the preset interface set includes interfaces with constant attribute values and some interfaces with constant attribute values.
For an interface with a constant part of attribute values, because the attribute values of the rest of the interface are changed, global matching often fails to match results, and adaptation needs to be performed again. And then, combining the matching result of the second attribute value to be matched, and positioning the unique user interface element.
And because the second attribute value to be matched does not change, the matching result can be more directly obtained by performing full-value matching on the second attribute value to be matched, and compared with regular matching, the number of results is reduced, so that the calculation amount in the subsequent positioning of the unique user interface element is reduced.
Wherein the interface with constant attribute values comprises at least one of:
an element ID, a button name, a window title, or an application name.
Part of the interface where the attribute values are constant includes the window class name.
And the production test tool 12 is used for testing the device under test under the control of the production management system and the PRA tool and feeding back a test result to the PRA tool.
A production management system 13 for controlling the production test tool.
For specific working principles of the production test tool 12 and the production management system 13, reference may be made to the relevant descriptions in the above embodiments, which are not described herein in detail.
In a possible implementation manner, the PRA tool 11 is specifically configured to operate the production test tool and various user interface elements of the production management system according to a predetermined test policy, so as to implement the test on the device under test; and receiving a test result fed back by the production test tool, and executing a response strategy according to the test result.
The device provided by the embodiment of the application can be used for detecting defects with small probability in the production process. For example, the detection is performed on the electronic device such as a mobile phone, and the detection items include, but are not limited to, whether system installation is completed, whether system functions are normal, and whether other functions are normal.
In summary, the PRA tool of the apparatus identifies the production test tool and each user interface element of the production management system by using the constant attribute value of each interface in the preset interface set. Specifically, when the preset interface set includes an interface with a constant attribute value, the full value of the attribute value of the interface may be applied; when the preset interface set comprises a part of interfaces with constant attribute values, namely other part of attribute values of the interfaces can change, the technical scheme of the application only utilizes the constant attribute values of the part to identify, and the changed part of attribute values cannot be utilized. Therefore, when the production test tool and the production management system are restarted, even if the attribute values of the interface elements change, the device can still position the user interface elements, automatic detection is realized, re-adaptation is not needed, and therefore the efficiency of automatic testing is improved. In addition, even production test tool and production management system are located the backstage and move, each user interface element also can normally be positioned to the scheme of this application, realizes automated inspection, therefore this application scheme has higher practicality.
The automatic test device comprises a processor and a memory, the PRA tool, the production test tool, the production management system and the like can be stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more, and automatic testing is realized by adjusting kernel parameters.
The embodiment of the application provides a storage medium, wherein a program is stored on the storage medium, and the program realizes the automatic testing method when being executed by a processor.
The embodiment of the application provides a processor, wherein the processor is used for running a program, and the method for the automatic test is executed when the program runs.
Referring to fig. 6, the figure is a schematic view of an electronic device provided in an embodiment of the present application.
The electronic device 60 comprises at least one processor 601, and at least one memory 602 coupled to the processor, and further comprises a bus 603.
The processor 601 and the memory 602 are in communication with each other via a bus 603.
Processor 601 is configured to call program instructions in memory 602 to perform the automated testing methods described above. The electronic device in the present application may be a server, a Personal Computer (PC), a tablet computer (pad), a mobile phone, a notebook computer, or the like.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A method of automated testing, applied to a robotic process automation PRA tool, the method comprising:
identifying each user interface element of a production test tool and a production management system by using a constant attribute value of each interface in a preset interface set, wherein the preset interface set comprises at least one of interfaces with constant attribute values or part of interfaces with constant attribute values; the production test tool is used for testing the device under test under the control of the production management system and the PRA tool and feeding back a test result to the PRA tool; the production management system is used for controlling the production test tool;
and operating the production test tool and each user interface element of the production management system according to a preset test strategy so as to carry out automatic test.
2. The method according to claim 1, wherein the preset interface set includes interfaces with constant attribute values and some interfaces with constant attribute values, and the identifying, by using the constant attribute values of the interfaces in the preset interface set, each user interface element of the production test tool and the production management system specifically includes:
acquiring attribute values of user interface elements of each running program window;
and performing regular matching from the attribute values of the user interface elements of each running program window by taking the partial constant attribute values of the interfaces with constant attribute values as first attribute values to be matched and taking the constant attribute values of the interfaces with constant attribute values as second attribute values to be matched so as to identify the production test tool and the user interface elements of the production management system.
3. The method according to claim 1, wherein the preset interface set includes interfaces with constant attribute values and some interfaces with constant attribute values, and the identifying, by using the constant attribute values of the interfaces in the preset interface set, each user interface element of the production test tool and the production management system specifically includes:
acquiring attribute values of user interface elements of each running program window;
taking the partial constant attribute value of the interface with the partial constant attribute value as a first attribute value to be matched, and performing regular matching from the attribute values of the user interface elements of the running program window; and performing full-value matching from the attribute values of the user interface elements of each running program window by taking the constant attribute value of the interface with the constant attribute value as a second attribute value to be matched so as to identify the production test tool and the user interface elements of the production management system.
4. The method of automated testing according to any of claims 1 to 3, wherein the interface with constant attribute values comprises at least one of:
an element ID, a button name, a window title, or an application name.
5. The method for automated testing according to any of claims 1 to 3, wherein the interface where the partial attribute values are constant comprises a window class name.
6. The method according to claim 1, wherein the operating the production test tool and the user interface elements of the production management system according to the predetermined test policy for performing the automated test specifically comprises:
operating the production test tool and each user interface element of the production management system according to a preset test strategy so as to realize the test of the device to be tested;
and receiving a test result fed back by the production test tool, and executing a response strategy according to the test result.
7. An apparatus for automated testing, the apparatus comprising: a robot process automation PRA tool, a production test tool and a production management system;
the PRA tool is used for identifying a production test tool and user interface elements of a production management system by using constant attribute values of each interface in a preset interface set, and operating the production test tool and the user interface elements of the production management system according to a preset test strategy so as to carry out automatic test; the preset interface set comprises at least one of interfaces with constant attribute values or interfaces with constant part of attribute values;
the production test tool is used for testing the device under test under the control of the production management system and the PRA tool and feeding back a test result to the PRA tool;
the production management system is used for controlling the production test tool.
8. The automated testing apparatus of claim 7, wherein the PRA tool is specifically configured to obtain attribute values of user interface elements of running program forms; and performing regular matching from the attribute values of the user interface elements of each running program window by taking the partial constant attribute values of the interfaces with constant attribute values as first attribute values to be matched and taking the constant attribute values of the interfaces with constant attribute values as second attribute values to be matched so as to identify the production test tool and the user interface elements of the production management system, wherein the preset interface set comprises the interfaces with constant attribute values and the interfaces with constant attribute values.
9. The automated testing apparatus of claim 7, wherein the PRA tool is specifically configured to obtain attribute values of user interface elements of running program forms; taking the partial constant attribute value of the interface with the partial constant attribute value as a first attribute value to be matched, and performing regular matching from the attribute values of the user interface elements of the running program window; and performing full-value matching from the attribute values of the user interface elements of each running program window by taking the constant attribute value of the interface with the constant attribute value as a second attribute value to be matched so as to identify the production test tool and the user interface elements of the production management system, wherein the preset interface set comprises the interface with the constant attribute value and part of the interfaces with the constant attribute value.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method of automated testing of any one of claims 1 to 5.
CN202210751563.9A 2022-06-29 2022-06-29 Automatic testing method and device and storage medium Active CN114817078B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210751563.9A CN114817078B (en) 2022-06-29 2022-06-29 Automatic testing method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210751563.9A CN114817078B (en) 2022-06-29 2022-06-29 Automatic testing method and device and storage medium

Publications (2)

Publication Number Publication Date
CN114817078A true CN114817078A (en) 2022-07-29
CN114817078B CN114817078B (en) 2022-11-29

Family

ID=82523092

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210751563.9A Active CN114817078B (en) 2022-06-29 2022-06-29 Automatic testing method and device and storage medium

Country Status (1)

Country Link
CN (1) CN114817078B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040229200A1 (en) * 2003-05-16 2004-11-18 Mckeon Brendan User interface automation framework classes and interfaces
CN102521121A (en) * 2011-11-18 2012-06-27 华为技术有限公司 Page testing method and page testing device
CN102799520A (en) * 2012-06-27 2012-11-28 清华大学 Static checking method and device for source code pairing
CN104516633A (en) * 2014-11-19 2015-04-15 微梦创科网络科技(中国)有限公司 User interface element management method and device
CN107025172A (en) * 2017-03-22 2017-08-08 厦门大学 A kind of method for testing software based on probabilistic risk assessment
CN111159023A (en) * 2019-12-20 2020-05-15 中国建设银行股份有限公司 Test method, test device, electronic equipment and computer readable storage medium
CN112416762A (en) * 2020-11-16 2021-02-26 中信银行股份有限公司 API test method and device, equipment and computer readable storage medium
CN113334371A (en) * 2020-02-18 2021-09-03 尤帕斯公司 Automated window for robot process automation
EP3937015A1 (en) * 2020-07-09 2022-01-12 UiPath, Inc. Automation of a process running in a first session via a robotic process automation robot running in a second session

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040229200A1 (en) * 2003-05-16 2004-11-18 Mckeon Brendan User interface automation framework classes and interfaces
CN102521121A (en) * 2011-11-18 2012-06-27 华为技术有限公司 Page testing method and page testing device
CN102799520A (en) * 2012-06-27 2012-11-28 清华大学 Static checking method and device for source code pairing
CN104516633A (en) * 2014-11-19 2015-04-15 微梦创科网络科技(中国)有限公司 User interface element management method and device
CN107025172A (en) * 2017-03-22 2017-08-08 厦门大学 A kind of method for testing software based on probabilistic risk assessment
CN111159023A (en) * 2019-12-20 2020-05-15 中国建设银行股份有限公司 Test method, test device, electronic equipment and computer readable storage medium
CN113334371A (en) * 2020-02-18 2021-09-03 尤帕斯公司 Automated window for robot process automation
EP3937015A1 (en) * 2020-07-09 2022-01-12 UiPath, Inc. Automation of a process running in a first session via a robotic process automation robot running in a second session
CN112416762A (en) * 2020-11-16 2021-02-26 中信银行股份有限公司 API test method and device, equipment and computer readable storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MATS HOLMBERG等: "An Industrial Case-Study on GUI Testing With RPA", 《2022 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE TESTING, VERIFICATION AND VALIDATION WORKSHOPS (ICSTW)》 *
戚龙雨: "基于Appium的APP并行自动化测试平台及测试用例设计与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》 *

Also Published As

Publication number Publication date
CN114817078B (en) 2022-11-29

Similar Documents

Publication Publication Date Title
CN110058856B (en) Page configuration method and device
US9207973B2 (en) Meta-application management in a multitasking environment
CN106874174B (en) Method and device for realizing interface test and function test
KR20090122953A (en) Techniques to share information between application programs
CN111797312B (en) Model training method and device
EP2951680B1 (en) Acquiring identification of an application lifecycle management entity associated with similar code
CN109144871B (en) Automatic test element identification method and device
JP6542887B2 (en) Category directory determination method and apparatus, and automatic classification method and apparatus
CN110716804A (en) Method and device for automatically deleting useless resources, storage medium and electronic equipment
CN108228611B (en) Document information copying method and device
CN111124872A (en) Branch detection method and device based on difference code analysis and storage medium
CN114817078B (en) Automatic testing method and device and storage medium
CN109977317B (en) Data query method and device
US9959196B2 (en) Unification of descriptive programming and object repository
US20220137125A1 (en) Method and device for testing system-on-chip, electronic device using method, and computer readable storage medium
CN115061928A (en) Micro-service automatic testing method and device, electronic equipment and storage medium
US8775936B2 (en) Displaying dynamic and shareable help data for images a distance from a pointed-to location
CN112559346A (en) Service testing method and device
CN110955813A (en) Data crawling method and device
CN112182507A (en) Data quality measuring method, device and equipment
CN117130946B (en) Test scene generation method and device, electronic equipment and readable storage medium
CN113760696A (en) Program problem positioning method and device, electronic equipment and storage medium
CN113407454B (en) Method, device and equipment for comprehensive test
CN108415814A (en) Automatically record field changing method, application server and computer readable storage medium
CN111897774B (en) File uploading 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
GR01 Patent grant
GR01 Patent grant