Processing Method, Device and Electronic Device for Control Label

By obtaining and processing the tree structure of control names and labels, and automatically updating the control tags, the test code adaptation problems caused by different control names in the existing technology are solved, and software testing efficiency and operation efficiency are improved.

CN114398404BActive Publication Date: 2025-06-10YEALINK (XIAMEN) NETWORK TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210042667.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-14
Publication Date
2025-06-10
Estimated Expiration
2042-01-14

AI Technical Summary

Technical Problem

The existing software automation testing solution has different control names for the same function on different devices, so it is necessary to write multiple sets of test codes for adaptation. The process of setting control labels is cumbersome, time and inefficient, which increases the space occupied by the source code.

Method used

By obtaining the control name tree structure, control label tree structure, control name and control label mapping data, traversing the control name tree structure, judging and updating the control label, automatically setting the corresponding control label for each control name of the page control.

Benefits of technology

There is no need for tedious manual operations, which reduces the cost and time of manual operation and improves the operation efficiency of setting control labels. Automatically set control labels can meet testing needs and improves software testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114398404B_ABST
    Figure CN114398404B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a method, apparatus, and electronic device for processing control labels. The method includes: obtaining a control name tree structure, a control label tree structure, and mapping data between control names and control labels; traversing the control name nodes of the control name tree structure. If a corresponding control label node can be obtained from the control label tree structure based on the current control name of the current control name node, the obtained control label node is used as the current control label node. If the current control name matches the control name in the mapping data, a first control label corresponding to the current control name is determined according to the mapping data, and the label of the current control label node is updated to the first control label. In this way, corresponding control labels are automatically set for each control name of the page controls, eliminating the need for cumbersome manual operations, reducing the manual operation cost, reducing the operation time for setting control labels, and improving the operation efficiency of setting control labels.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software testing, and particularly to a method, apparatus, and electronic device for processing control labels. Background Art

[0002] Existing software automated testing solutions identify controls based on control names. However, since the control names for the same function on different devices are different, it is necessary to write multiple sets of test codes for adaptation respectively. In existing software automated testing solutions, software developers for each device set additional control labels according to the control functions. For each newly added function, software developers for each device need to modify the source code and set control labels to meet the testing requirements. This way of setting control labels one by one has problems such as cumbersome operation steps, long operation time, low operation efficiency, and increases the space occupied by the source code. Summary of the Invention

[0003] To solve the above technical problems, embodiments of this application provide a method, apparatus, and electronic device for processing control labels.

[0004] In a first aspect, embodiments of this application provide a method for processing control labels, the method including:

[0005] Obtain a control name tree structure, a control label tree structure, and mapping data between a control name and a control label;

[0006] Traverse the control name nodes of the control name tree structure, and determine whether a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node;

[0007] If a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node, use the obtained control label node as the current control label node;

[0008] Determine whether the current control name matches the control name in the mapping data;

[0009] If the current control name matches the control name in the mapping data, determine a first control label corresponding to the current control name according to the mapping data, and update the label of the current control label node to the first control label.

[0010] In a second aspect, embodiments of this application provide a device for processing control labels, the device including:

[0011] An obtaining module, configured to obtain a control name tree structure, a control label tree structure, and mapping data between a control name and a control label;

[0012] The first judgment module is used to traverse the control name nodes of the control name tree structure and judge whether a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node;

[0013] The processing module is used to, if a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node, use the obtained control label node as the current control label node;

[0014] The second judgment module is used to judge whether the current control name matches the control name in the mapping data;

[0015] The setting module is used to, if the current control name matches the control name in the mapping data, determine the first control label corresponding to the current control name according to the mapping data, and update the label of the current control label node to the first control label.

[0016] In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor. The memory is used to store a computer program, and the computer program executes the control label processing method provided in the first aspect when running on the processor.

[0017] For the control label processing method, device, and electronic device provided in the present application above, a control name tree structure, a control label tree structure, and mapping data of control names and control labels are obtained; the control name nodes of the control name tree structure are traversed to judge whether a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node; if a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node, use the obtained control label node as the current control label node; judge whether the current control name matches the control name in the mapping data; if the current control name matches the control name in the mapping data, determine the first control label corresponding to the current control name according to the mapping data, and update the label of the current control label node to the first control label. In this way, the corresponding control labels are automatically set for each control name of the page controls, eliminating the need for cumbersome manual operations, reducing the manual operation cost, reducing the operation time for setting control labels, improving the operation efficiency of setting control labels, and the automatically set control labels can meet the test requirements and improve the software test efficiency. Description of the Drawings

[0018] To more clearly illustrate the technical solutions of the present application, the accompanying drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following accompanying drawings only show certain embodiments of the present application and should not be regarded as limiting the protection scope of the present application. In each of the accompanying drawings, similar components are numbered similarly.

[0019] Figure 1 Fig. shows a schematic flowchart of a method for processing control labels provided by an embodiment of the present application;

[0020] Figure 2 Fig.

[0019] shows a schematic diagram of a tree structure of control names provided by an embodiment of the present application;

[0021] Figure 3 Fig. Figure 1 shows a schematic diagram of a tree structure of control labels provided by an embodiment of the present application;

[0022] Figure 4 Fig. shows another schematic flowchart of a method for processing control labels provided by an embodiment of the present application;

[0023] Figure 5 Fig.

[0020] shows another schematic flowchart of a method for processing control labels provided by an embodiment of the present application;

[0024] Figure 6 Fig. Figure 2 shows a schematic structural diagram of a device for processing control labels provided by an embodiment of the present application. Detailed Embodiments

[0025] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments.

[0026] Generally, the components of the embodiments of the present application described and shown in the accompanying drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application to be protected, but only represents the selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative efforts belong to the scope of protection of the present application.

[0027] Hereinafter, the terms "including", "having" and their cognates that can be used in various embodiments of the present application are only intended to indicate a specific feature, number, step, operation, element, component or combination of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or increasing the possibility of one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.

[0028] In addition, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and should not be construed as indicating or implying relative importance.

[0029] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. The terms (such as those defined in a general use dictionary) will be interpreted as having the same meaning as the contextual meaning in the relevant technical field and will not be interpreted as having an idealized meaning or an overly formal meaning, unless clearly defined in the various embodiments of this application.

[0030] Embodiment 1

[0031] The embodiments of the present disclosure provide a method for processing control labels.

[0032] Specifically, refer to Figure 1 , the method for processing control labels includes:

[0033] Step S101, obtain the control name tree structure, the control label tree structure, and the mapping data between the control name and the control label.

[0034] In this embodiment, each software to be tested may include multiple controls, and there is a hierarchical association relationship between the controls. In a specific application scenario, corresponding control names (IDs) and control labels (Tags) can be set for the controls of the software, and the corresponding control name tree structure and control label tree structure can be extracted from the software. Specifically, each step of the method for processing control labels provided in this embodiment can be implemented through a specific automated testing tool. The automated testing tool communicates with the software to be tested, obtains the control name tree structure through the automated testing tool, and maps to obtain the control attribute tree structure, where the attributes include the control name and the control label, and the control attribute tree structure is the mapping data between the control name and the control label. In addition, the automated testing tool can also obtain the control name tree structure for a web page, which is not limited herein.

[0035] Please refer to Figure 2 , Figure 2The shown tree structure of control names includes multiple control names. Among them, control name A is the top-level control name, and control names B, C, and D are the sub-control names of control name A. Control names E and F are the sub-control names of control name B. Control names G and N are the sub-control names of control name C. Controls I and J are the sub-controls of control name D. Control K is the sub-control of control name E. Control L is the sub-control of control name F. Controls M and control name N are the sub-controls of control name G. The positions of each control name are control name nodes, and the hierarchical relationships between each control name can be determined by the control logic relationship of the page.

[0036] Please refer to Figure 3 , Figure 3 The shown tree structure of control tags includes multiple control tags. Among them, control tag A is the top-level control tag, and control names B and G are the sub-control tags of control tag A. Control tags K and F are the sub-control tags of control tag B. Control tag M is the sub-control tag of control tag G. The hierarchical relationships between each control tag can be determined by the control logic relationship of the page.

[0037] It should be noted that in combination with Figure 2 and Figure 3 , control tags do not support all controls on the current page, and the tree structure of control names is also different from the tree structure of control tags. However, the hierarchical order relationship of the tree structure of control tags needs to be consistent with the hierarchical order relationship of the tree structure of control names.

[0038] In this embodiment, the mapping data between control names and control tags can be obtained in the following way: Configure a tag file. The format of the tag file is XML format. The tag file includes the mapping data between control names and control tags. By parsing the tag file, the mapping data between control names and control tags can be obtained. Among them, the mapping data between control names and control tags can be a one-to-one correspondence between a control name and a control tag. For example, the correspondence between control name A and control tag W.

[0039] In addition, processing operations such as deleting, updating, and adding mapping data to the mapping data between control names and control tags can also be performed. Specifically, an interface can be provided for users to directly perform processing operations of deleting, updating, and adding mapping data to the mapping data between control names and control tags in the software code, which can dynamically change the mapping data and can also delete the mapping data. There is no limit here.

[0040] Step S102: Traverse the control name nodes of the control name tree structure, and determine whether a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node;

[0041] In this embodiment, the traversal can be performed in sequence from the top layer to the lower layer of the control name according to the hierarchical relationship of the control name tree structure. For example, for Figure 2 the shown control name tree structure, the traversal can start from the top-level control name A, and determine whether a control label node A can be matched in the Figure 3 control label tree structure.

[0042] Step S103: If a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node, then use the obtained control label node as the current control label node.

[0043] Please refer to Figure 2 and Figure 3 , if the traversal starts from the top-level control name A of Figure 2 and it is determined that a control label node A can be matched in the Figure 3 control label tree structure, then use the control label node A as the current control label node.

[0044] Step S104: Determine whether the current control name matches the control name in the mapping data.

[0045] For example, if the control name A is used as the current control name, then determine whether there is a control name A among all the control names in the mapping data. If there is a control name A among all the control names in the mapping data, it means that the control label of the control name A has been set in a one-to-one correspondence in the mapping data. The control label found can be set as the label of the control name A by searching for the control label corresponding to the control name A.

[0046] Step S105: If the current control name matches the control name in the mapping data, then determine the first control label corresponding to the current control name according to the mapping data, and update the label of the current control label node to the first control label.

[0047] For example, if the mapping data includes the control name A and its corresponding first control label in a one-to-one correspondence, the control name B and its corresponding second control label in a one-to-one correspondence. If the control name A is used as the current control name, then according to the mapping data, the label corresponding to the control name A can be determined as the first control label. Since the control name A corresponds to the control label node A, the label of the control label node A is set as the first control label.

[0048] It should be noted that if the name of the traversed control is not the name of the top-level control but any other control name, the corresponding label setting can also be performed according to the label processing procedure similar to that of the top-level control name, which will not be elaborated here.

[0049] In this way, the corresponding control labels can be automatically set for the names of each control on the page according to the mapping data between the control names and the control labels, without the need for cumbersome manual operations, reducing the manual operation cost, reducing the operation time for setting control labels, improving the operation efficiency of setting control labels, and the automatically set control labels can meet the test requirements and improve the software test efficiency.

[0050] In this embodiment, the method for processing the control label includes:

[0051] If the current control name does not match the control name in the mapping data, it is determined whether the current control name is the name of the parent control;

[0052] If the current control name is the name of the parent control, the corresponding parent control label of the parent control name is set;

[0053] The label of the current control label node is updated to the parent control label.

[0054] In this embodiment, if the current control name does not match the control name in the mapping data, it means that the pre-obtained mapping data does not include the current control name, and the corresponding control label for the current control name has not been set in advance, and the control label of the current control name needs to be reset.

[0055] For example, Figure 2 for the sub-control names E and F at the next level of the control name B, if the current control name is the control name B, and if the mapping data includes the control name A and its corresponding first control label, the control name B does not match the control name A in the mapping data, and the control name B is the parent control name of the sub-control names E and F, the corresponding parent control label of the control name B is set, and the label of the control label node B is updated to the parent control label.

[0056] In this embodiment, the method for processing the control label includes:

[0057] If the current control name is not the name of the parent control, it is determined whether the current control name has a sibling control name;

[0058] If the current control name has a sibling control name, it is determined whether the sibling control name has a corresponding sibling control label node;

[0059] If there is a corresponding sibling control label node for the sibling control name, obtain the sibling control label of the sibling control label node, and update the label of the sibling control label node to the sibling control label.

[0060] For example, if the current control name is Figure 2 the control name E shown, and it is determined that there is a sibling control name F for the control name E, then determine whether there is a corresponding sibling control label node F for the sibling control name F. According to Figure 3 the control label tree structure shown, it is known that there is a sibling control label node F, and obtain the sibling control label of the sibling control label node F.

[0061] Specifically, obtaining the sibling control label of the sibling control label node F may include: if the sibling control name F matches the control name in the mapping data, then search the mapping data for the sibling control label corresponding to the sibling control name F; or, if the sibling control name F does not match the control name in the mapping data, then set the sibling control label corresponding to the sibling control name F.

[0062] After obtaining the sibling control label of the sibling control label node F, update the control label F of the sibling control label node F to the sibling control label.

[0063] In this embodiment, the method for processing the control label includes:

[0064] If there is no corresponding sibling control label node for the sibling control name, create a first control label node corresponding to the sibling control name, and set a control label for the first control label node according to the sibling control name.

[0065] For example, Figure 2 the control name N in is the sibling control name, and there is no corresponding control label node in Figure 3 , and it is necessary to create a control label node N corresponding to the control name N, and set a control label for the control label node N according to the control name N.

[0066] Specifically, setting a control label for the control label node N according to the control name N may include:

[0067] If the sibling control name N matches the control name in the mapping data, then search the mapping data for the control label corresponding to the sibling control name N, and set the label of the control label node N to the control label corresponding to the sibling control name N found in the mapping data. Or, if the sibling control name N does not match the control name in the mapping data, then the user sets the target control label corresponding to the sibling control name N, and sets the label of the control label node N to the target control label.

[0068] In this embodiment, the method for processing the control label includes:

[0069] If the corresponding control label node cannot be obtained from the control label tree structure according to the current control name, a second control label node corresponding to the current control name is created;

[0070] A second control label corresponding to the current control name is set, and the label of the second control label node is set to the second control label.

[0071] In this way, by creating a second control label node corresponding to the current control name, the user sets a second control label corresponding to the current control name, and sets the label of the second control label node to the second control label, so that each control name can establish a corresponding control label node. By setting a corresponding second control label for the created control label node, the purpose of setting a control label for each current control name one by one is achieved.

[0072] In this embodiment, the method for processing the control label includes:

[0073] Judge whether the control name to be removed is the same as the control name in the mapping data;

[0074] If the control name to be removed is the same as the control name in the mapping data, the control name to be removed and its corresponding control label are deleted from the mapping data.

[0075] Specifically, please refer to Figure 4 , the deletion process of the mapping data may include the following steps:

[0076] Step S401, judge whether the first mapping data is obtained;

[0077] In this embodiment, if the first mapping data is obtained, step S402 is executed; if the first mapping data is not obtained, step S405 is executed.

[0078] Step S402, judge whether the control name to be removed is consistent with the control name in the mapping data.

[0079] In this embodiment, if the control name to be removed is consistent with the control name in the mapping data, step S403 is executed; if the control name to be removed is not consistent with the control name in the mapping data, step S404 is executed.

[0080] Step S403, remove the mapping data.

[0081] Specifically, the removed mapping data is the control name and its control label that are the same as the control name to be removed.

[0082] Step S404: Determine whether to obtain the next mapping data.

[0083] In this embodiment, if the next mapping data is obtained, step S402 is executed; if the next mapping data is not obtained, step S405 is executed.

[0084] Step S405: The removal of the mapping data fails.

[0085] In this embodiment, obtaining the control label tree structure includes:

[0086] Traverse the controls on the page, and obtain the control labels to be exported according to the names of the traversed controls;

[0087] Record the label paths of each control label to be exported;

[0088] Generate the control label tree structure according to each of the label paths.

[0089] In this embodiment, obtaining the control label to be exported according to the name of the traversed control includes:

[0090] Determine whether the name of the traversed control matches the label of the traversed control, and use the control label that matches the control name as the control label to be exported; or,

[0091] If a specified mapping type exists in the name of the traversed control, obtain the corresponding label mapping method according to the specified mapping type, and obtain the control label to be exported from the name of the traversed control according to the label mapping method.

[0092] For example, the control ID needs to conform to the format of "TTT$WID", where "TTT" is the definition of the specified mapping type (such as Btn representing a button, Icon representing an icon, Text representing text, etc.), "$" is used as a separator, and "WID" is the actual control name (ID) of the control. For example: There are 3 mapping data of the icon type supported in the mapping data, with the ID of "icn / logo.png" and the tag attribute of icon_logo; the ID of "icn / head.png" and the tag attribute of icon_head; the ID of "icn / ok.png" and the tag attribute of icon_ok. The ID of the externally used control is "icon$icn / logo.png". After parsing, the obtained specified type is icon, and the tag attribute in the corresponding tag mapping data is found to be icon_logo according to "icon$icn / logo.png".

[0093] Specifically, please refer to Figure 5, the process of exporting control labels may include the following steps:

[0094] Step S501: Determine whether the current control name is the same as the control name in the current label node.

[0095] In this embodiment, if the current control name is the same as the control name in the current label node, export the control label of the current label node. If so, execute Step S502; if not, execute Step S503.

[0096] Step S502: Pass in the data of the first sub-label node of the current label node.

[0097] Step S503: Determine whether the data of the sub-control label node is successfully exported.

[0098] In this embodiment, if the data of the sub-control label node is successfully exported, execute Step S504; if the data of the sub-control label node is exported fails, execute Step S505.

[0099] Step S504: Pass in the data of the next sub-control label node.

[0100] Step S505: Determine whether the next sub-control label node is obtained.

[0101] In this embodiment, if the next sub-control label node is not obtained, execute Step S506; if the next sub-control label node is obtained, return to execute Step S503.

[0102] Step S506: End the export of the control label.

[0103] Please refer to again Figure 2 and Figure 3 , for example, after finding the control label B in Figure 3 through the ID of control name B, use the control label B as the current label path to reduce the need to start from the beginning each time when traversing to obtain the label. After finding the control label K through the ID of control name K and finding that there are no other sub-controls, the current control label K will be rolled back layer by layer to the control label B, and then use the control label B as the current label path to facilitate finding the label data of control name F. When searching for the data of control name G, the current path will change to the path of control label A.

[0104] The method for processing control labels provided in this embodiment obtains a control name tree structure, a control label tree structure, and mapping data between control names and control labels; traverses the control name nodes of the control name tree structure to determine whether a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node; if a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node, the obtained control label node is used as the current control label node; determines whether the current control name matches the control name in the mapping data; if the current control name matches the control name in the mapping data, determines a first control label corresponding to the current control name according to the mapping data, and updates the label of the current control label node to the first control label. In this way, corresponding control labels are automatically set for each control name of the page controls, eliminating the need for cumbersome manual operations, reducing manual operation costs, reducing the operation time for setting control labels, improving the operation efficiency of setting control labels, and the automatically set control labels can meet the test requirements and improve software testing efficiency.

[0105] Embodiment 2

[0106] In addition, an embodiment of the present disclosure provides a device for processing control labels.

[0107] Specifically, please refer to Figure 6 , the device 600 for processing control labels includes:

[0108] An obtaining module 601, configured to obtain a control name tree structure, a control label tree structure, and mapping data between control names and control labels;

[0109] A first judgment module 602, configured to traverse the control name nodes of the control name tree structure to determine whether a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node;

[0110] A processing module 603, configured to, if a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node, use the obtained control label node as the current control label node;

[0111] A second judgment module 604, configured to determine whether the current control name matches the control name in the mapping data;

[0112] A setting module 605, configured to, if the current control name matches the control name in the mapping data, determine a first control label corresponding to the current control name according to the mapping data, and update the label of the current control label node to the first control label.

[0113] In this embodiment, the processing device 600 for control labels further includes:

[0114] A third determination module, configured to determine whether the current control name is a parent control name if the current control name does not match the control name in the mapping data;

[0115] If the current control name is a parent control name, set the parent control label corresponding to the parent control name;

[0116] Update the label of the current control label node to the parent control label.

[0117] In this embodiment, the processing device 600 for control labels further includes:

[0118] A fourth determination module, configured to determine whether there is a sibling control name for the current control name if the current control name is not a parent control name;

[0119] If there is a sibling control name for the current control name, determine whether there is a corresponding sibling control label node for the sibling control name;

[0120] If there is a corresponding sibling control label node for the sibling control name, obtain the sibling control label of the sibling control label node, and update the label of the sibling control label node to the sibling control label.

[0121] In this embodiment, the processing device 600 for control labels further includes:

[0122] A first creation module, configured to create a first control label node corresponding to the sibling control name and set a control label for the first control label node according to the sibling control name if there is no corresponding sibling control label node for the sibling control name.

[0123] In this embodiment, the processing device 600 for control labels further includes:

[0124] A second creation module, configured to create a second control label node corresponding to the current control name if the corresponding control label node cannot be obtained from the control label tree structure according to the current control name;

[0125] Set a second control label corresponding to the current control name, and set the label of the second control label node to the second control label.

[0126] In this embodiment, the processing device 600 for control labels further includes:

[0127] A fifth judgment module, configured to judge whether the name of the control to be removed is the same as the name of the control in the mapping data;

[0128] If the name of the control to be removed is the same as the name of the control in the mapping data, delete the name of the control to be removed and its corresponding control label from the mapping data.

[0129] In this embodiment, the obtaining module 601 is further configured to traverse the controls on the page, and obtain the control label to be exported according to the name of the traversed control;

[0130] Record the label paths of the control labels to be exported;

[0131] Generate the control label tree structure according to the label paths.

[0132] In this embodiment, the obtaining module 601 is further configured to judge whether the name of the traversed control matches the label of the traversed control, and use the control label that matches the name of the control as the control label to be exported; or,

[0133] If a specified mapping type exists in the name of the traversed control, obtain the corresponding label mapping method according to the specified mapping type, and obtain the control label to be exported from the name of the traversed control according to the label mapping method.

[0134] The control label processing device provided in this embodiment obtains the control name tree structure, the control label tree structure, and the mapping data between the control name and the control label; traverses the control name nodes of the control name tree structure, and judges whether the corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node; if the corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node, use the obtained control label node as the current control label node; judge whether the current control name matches the control name in the mapping data; if the current control name matches the control name in the mapping data, determine the first control label corresponding to the current control name according to the mapping data, and update the label of the current control label node to the first control label. In this way, the corresponding control label is automatically set for each control name of the page controls, without the need for manual cumbersome operations, reducing the manual operation cost, reducing the operation time for setting the control label, improving the operation efficiency of setting the control label, and the automatically set control label can meet the test requirements and improve the software test efficiency.

[0135] Embodiment 3

[0136] In addition, an embodiment of the present disclosure provides an electronic device, including a memory and a processor. The memory stores a computer program, and when the computer program runs on the processor, it executes the method for processing control tags provided in Embodiment 1.

[0137] The electronic device provided in an embodiment of the present invention can execute the steps of the method for processing control tags in Embodiment 1. To avoid repetition, details are not described herein again.

[0138] Embodiment 4

[0139] This application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the method for processing control tags provided in Embodiment 1.

[0140] In this embodiment, the computer-readable storage medium can be a read-only memory (ROM for short), a random access memory (RAM for short), a magnetic disk, an optical disk, or the like.

[0141] The computer-readable storage medium in this embodiment can execute the steps of the method for processing control tags provided in Embodiment 1. To avoid repetition, details are not described herein again.

[0142] In several embodiments provided by this application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and structure diagrams in the drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of the present invention. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the blocks can occur in a different order than marked in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the structure diagram and / or flowchart, as well as the combination of blocks in the structure diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0143] In addition, in each embodiment of the present invention, the various functional modules or units can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.

[0144] If the above-mentioned functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs.

[0145] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention.

Claims

1. A method for processing control labels, characterized in that, the method includes: obtaining a control name tree structure, a control label tree structure, and mapping data between the control name and the control label; traversing the control name nodes of the control name tree structure, and determining whether a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node; if a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node, then use the obtained control label node as the current control label node; judging whether the current control name matches the control name in the mapping data; if the current control name matches the control name in the mapping data, then determine a first control label corresponding to the current control name according to the mapping data, and update the label of the current control label node to the first control label; if the current control name does not match the control name in the mapping data, then judge whether the current control name is a parent control name; if the current control name is a parent control name, then set a parent control label corresponding to the parent control name; update the label of the current control label node to the parent control label.

2. The method according to claim 1, characterized in that, the method further includes: if the current control name is not a parent control name, then judge whether there is a sibling control name for the current control name; if there is a sibling control name for the current control name, then judge whether there is a corresponding sibling control label node for the sibling control name; if there is a corresponding sibling control label node for the sibling control name, then obtain the sibling control label of the sibling control label node, and update the label of the sibling control label node to the sibling control label.

3. The method according to claim 2, characterized in that, the method further includes: if there is no corresponding sibling control label node for the sibling control name, then create a first control label node corresponding to the sibling control name, and set a control label for the first control label node according to the sibling control name.

4. The method according to claim 1, characterized in that, the method further includes: if a corresponding control label node cannot be obtained from the control label tree structure according to the current control name, then create a second control label node corresponding to the current control name; set a second control label corresponding to the current control name, and set the label of the second control label node to the second control label.

5. The method according to claim 1, characterized in that, the method further includes: judging whether the control name to be removed is the same as the control name in the mapping data; if the control name to be removed is the same as the control name in the mapping data, then delete the control name to be removed and its corresponding control label from the mapping data.

6. The method according to claim 1, characterized in that, obtaining the control label tree structure includes: Traverse the controls on the page and obtain the control labels to be exported according to the names of the traversed controls; Record the label paths of each control label to be exported; Generate the control label tree structure according to each of the said label paths.

7. According to the method described in claim 6, wherein, the obtaining the control labels to be exported according to the names of the traversed controls includes: judging whether the name of the traversed control matches the label of the traversed control, and taking the control label that matches the control name as the control label to be exported; or, if there is a specified mapping type in the name of the traversed control, obtaining the corresponding label mapping method according to the specified mapping type, and obtaining the control label to be exported from the name of the traversed control according to the label mapping method.

8. A device for processing control labels, wherein, the device includes: an obtaining module, configured to obtain a control name tree structure, a control label tree structure, and mapping data between a control name and a control label; a first judging module, configured to traverse the control name nodes of the control name tree structure and judge whether a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node; a processing module, configured to, if a corresponding control label node can be obtained from the control label tree structure according to the current control name of the current control name node, take the obtained control label node as the current control label node; a second judging module, configured to judge whether the current control name matches the control name in the mapping data; a setting module, configured to, if the current control name matches the control name in the mapping data, determine a first control label corresponding to the current control name according to the mapping data, and update the label of the current control label node to the first control label; if the current control name does not match the control name in the mapping data, judge whether the current control name is a parent control name; if the current control name is a parent control name, set the parent control label corresponding to the parent control name; update the label of the current control label node to the parent control label.

9. An electronic device, wherein, it includes a memory and a processor, the memory stores a computer program, and the computer program executes the method for processing control labels described in any one of claims 1 to 7 when running on the processor.

Citation Information

Patent Citations

  • A label adding method and device for an IOS system

    CN109814957A