Method for realizing synchronization of attributes of objects to be tested through automatic testing virtual machine technology
Technical Field
The invention relates to the technical field of automatic testing, in particular to a method for realizing synchronization of attributes of objects to be tested by an automatic testing virtual machine technology.
Background
The automated testing is used as an important component of software testing, a solid guarantee is provided for the quality of software products, but in the face of complex software application, the automated testing is often difficult and serious, and one of the problems to be solved urgently is that the attributes of various objects to be tested are identified, and usually along with the change of space and time, the attributes of the objects to be tested can also be changed, and the change can possibly cause that a test script cannot be repeatedly executed.
Disclosure of Invention
Technical problem to be solved
Aiming at the defects of the prior art, the invention provides a method for realizing the synchronization of the attributes of the objects to be tested by an automatic test virtual machine technology, and provides a method for synchronizing the attributes of the objects to be tested based on the automatic test virtual machine technology, so that the method has the advantages of helping a test or development personnel to capture the change of the attributes of the objects to be tested, and the problem that the change of the attributes of the objects to be tested is not displayed in the current automatic test operation result is solved.
(II) technical scheme
In order to achieve the purpose, the invention provides the following technical scheme: a method for achieving synchronization of attributes of objects to be tested through an automatic testing virtual machine technology comprises an address book of the objects to be tested, an object detector to be tested, an object collector to be tested, an automatic testing virtual machine, an object synchronizer to be tested and an actuator, wherein the object detector to be tested is connected with an application to be tested in a one-way mode, the object detector to be tested is connected with the object collector to be tested in a two-way mode, the address book of the objects to be tested is connected with a compiler in a one-way mode, the compiler is connected with a symbol table and three address codes in a one-way mode, and the actuator is connected with an application driver 1 to be tested, an application driver 2 to be tested and a result collector in a one-way mode.
Preferably, the address book of the object to be tested defines the type, the attribute and the construction method of the object to be tested, the object to be tested and the upper application layer thereof are organized in a tree-shaped hierarchical structure to construct the address book of the object to be tested, and the object to be tested is separated from the test script through the address book of the object to be tested.
Preferably, the object detector to be detected may capture various objects to be detected in the software application, for example, in a web page test, the object detector to be detected is opened, an object capture operation is started, after a target element is selected by a mouse or a keyboard, the detector captures an attribute and a hierarchical relationship of the element, and meanwhile, the detector automatically generates a locator of the object to be detected by an addressing algorithm.
Preferably, the object collector to be tested can show the object captured by the detector for a test or developer to check and modify the attribute of the object to be tested, and simultaneously, a verification function of the object to be tested is provided, after the collector sends a verification instruction to the detector, the detector searches for a corresponding element from an application to be tested, highlights the element by modifying the appearance attribute of the element or drawing an appearance outline, and can perform screenshot operation on the object to be tested, and the collector can store the verified object to be tested in an address book of the object to be tested.
Preferably, the compiler of the automated testing virtual machine converts the keyword automated testing script and the address book of the object to be tested into a three-address code and a symbol table.
Preferably, the executor reads the three-address instruction and the symbol table, calls the to-be-detected application driver to complete the operation on the to-be-detected object, relocates the to-be-detected object through an image recognition technology when the to-be-detected object cannot be recognized, collects the attribute of the to-be-detected object again after the recognition is successful, and sends the attribute to the synchronizer.
Preferably, the result collector: and collecting the test result and the attribute change condition of the object to be tested, and persisting the data in a uniform format.
Preferably, the object synchronizer synchronizes the attribute of the object to be tested to the address book of the object to be tested based on the set rule.
Compared with the prior art, the invention provides a method for realizing the synchronization of the attributes of the objects to be tested by the automatic testing virtual machine technology, which has the following beneficial effects:
1. the method for realizing the synchronization of the attributes of the objects to be tested through the automatic test virtual machine technology solves the requirement of automatic test object identification, can monitor and synchronize the change of the attributes of the objects to be tested, and displays the change in the test report. The collection of the object to be tested can collect the attribute of the object to be tested and construct the locator of the object to be tested aiming at different types of applications to be tested, can search according to the locator, can capture and synchronize the change of the attribute of the object to be tested in the script execution process, and helps a test or development staff to capture the change of the attribute of the object to be tested.
2. The method for realizing the synchronization of the attributes of the objects to be tested through the automatic test virtual machine technology is based on the automatic test virtual machine technology, captures the change of the attributes of the objects to be tested in the script execution process, synchronizes the change into the address book of the objects to be tested, can help the test cases to realize the self-healing function, and improves the stability of the automatic test.
Drawings
FIG. 1 is a schematic diagram of a script execution process according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a method for synchronizing attributes of an object to be tested through an automated testing virtual machine technology includes an address book of the object to be tested, an object detector to be tested, an object collector to be tested, an automated testing virtual machine, an object synchronizer to be tested, and an actuator, where the object detector to be tested is unidirectionally connected with an application to be tested, the object detector to be tested is bidirectionally connected with the object collector to be tested, the address book of the object to be tested is unidirectionally connected with a compiler, the compiler is unidirectionally connected with a symbol table and three address codes, and the actuator is unidirectionally connected with an application driver 1 to be tested, an application driver 2 to be tested, and a result collector.
Specifically, the address book of the object to be tested defines the type, the attribute and the construction method of the object to be tested, the object to be tested and the upper application layer thereof are organized in a tree-shaped hierarchical structure, the address book of the object to be tested is constructed, and the object to be tested is separated from the test script through the address book of the object to be tested.
Specifically, the object detector to be detected may capture various objects to be detected in the software application, for example, in a web page test, the object detector to be detected is turned on, an object capture operation is started, after a target element is selected through a mouse or a keyboard, the detector captures an attribute and a hierarchical relationship of the element, and meanwhile, the detector automatically generates a locator of the object to be detected through an addressing algorithm.
Specifically, the object collector to be tested can display the object captured by the detector for the test or development personnel to check and modify the attribute of the object to be tested. Meanwhile, a verification function of the object to be detected is provided, after the collector sends the verification instruction to the detector, the detector searches for the corresponding element from the application to be detected, the element can be highlighted by modifying the appearance attribute of the element or drawing the appearance outline, screenshot operation can be performed on the object to be detected, and the collector can store the verified object to be detected in an address book of the object to be detected.
Specifically, the compiler of the automated testing virtual machine converts the keyword automated testing script and the address book of the object to be tested into a three-address code and a symbol table.
Specifically, the executor reads the three-address instruction and the symbol table, calls the to-be-detected application driver to complete the operation on the to-be-detected object, relocates the to-be-detected object through an image recognition technology when the to-be-detected object cannot be recognized, collects the attribute of the to-be-detected object again after the recognition is successful, and sends the attribute to the synchronizer.
Specifically, the result collector: and collecting the test result and the attribute change condition of the object to be tested, and persisting the data in a uniform format.
Specifically, the object synchronizer synchronizes the attribute of the object to be tested to the address book of the object to be tested based on the set rule.
The working principle is as follows: when the method for realizing synchronization of the attributes of the objects to be tested through the automatic test virtual machine technology is used, the address book of the objects to be tested defines the types, the attributes and the construction method of the objects to be tested, the objects to be tested and the upper application of the objects to be tested are organized in a tree-shaped hierarchical structure to construct the address book of the objects to be tested, and the objects to be tested and the test scripts are separated through the address book of the objects to be tested. And opening the detector of the object to be detected, starting object capturing operation, selecting a target element through a mouse or a keyboard, capturing the attribute and the hierarchical relation of the element by the detector, and automatically generating the locator of the object to be detected by the detector through an addressing algorithm. The object collector to be tested can show the object captured by the detector, so that a test or development worker can check and modify the attribute of the object to be tested, and meanwhile, the verification function of the object to be tested is provided;
after the collector sends the verification instruction to the detector, the detector searches for corresponding elements from the application to be tested, highlighting the elements by modifying the appearance attributes or drawing the appearance outlines of the elements, and can also perform screen capture operation on the object to be tested. And when the object to be detected cannot be identified, the object to be detected is repositioned through an image identification technology, and after the object to be detected is successfully identified, the attribute of the object to be detected is collected again and sent to the synchronizer. The object synchronizer to be tested synchronizes the attribute of the object to be tested to the address book of the object to be tested based on the set rule, thereby solving the requirement of automatically testing the identification of the object to be tested, monitoring and synchronizing the change of the attribute of the object to be tested, and displaying the change in the test report. The test method can be used for constructing the locator of the object to be tested aiming at different types of applications to be tested, verifying the object to be tested, searching according to the attribute of the object to be tested and the locator, synchronizing the attribute of the object to be tested, capturing in the script execution process and helping a test or development staff to capture the change of the attribute of the object to be tested.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.