Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
As described in the background art, methods for operating application software by visually impaired people and eyesight impaired people are different, and when operating application software, visually impaired people may first open screen reading software, and then operate each element in a page through a barrier-free operation gesture, for example, visually impaired people may read an element attribute value through a one-finger touch operation, turn a page through a two-finger drag operation, and perform element selection or jump to a related page through a single-point double-click operation. Although the screen reading software can provide the most basic barrier-free use experience for the user, the complex page design causes many problems that the barrier-free function is not supported, for example, the screen reading software may read some elements as english, or the read information is not consistent with the actual information, or some elements in the page cannot be selected, and the problem that the barrier-free function is not supported brings inconvenience to the visually impaired user to operate the application software.
Furthermore, after the barrier-free function of the page is optimized, it also becomes an important task to test the page after the barrier-free function is optimized. Specifically, when the barrier-free function of the page is tested, barrier-free operation is often required to be performed on each element in the page one by one to trigger the screen reading software to read each element in the page, then whether the reading result is consistent with the actual meaning of the element or not is compared, and finally, a page test result is generated according to the comparison result. Although one-time barrier-free function optimization may be performed only on one picture control in the page, when the picture control is tested and verified, regression testing needs to be performed on other elements in the page to verify whether the picture control interferes with barrier-free functions of the other elements in the page. Under the circumstance, the testing method of triggering the elements one by the tester and comparing the reading results and the attribute values of the elements is obviously too time-consuming and labor-consuming, and the identification of the elements by the traditional element identification method can cause the problem of non-adaptation of the test scene, for example, the identification of the elements in a complex page by a simple element identification method can cause some elements in the page to be effectively identified, the identification of the elements in the simple page by a complex element identification method can cause more test resource waste, and the problems can cause the completeness of the page function and the test efficiency to be effectively verified, so that the purpose of page test cannot be achieved.
In view of the above problem, in an embodiment, as shown in fig. 1, a page testing method is provided, which is described by taking an example that the method is applied to a client such as a smart phone, a smart tablet, a smart portable device, and the like, and includes the following steps:
101. and receiving test configuration information of the target page, wherein the test configuration information comprises a page traversal mode switching threshold.
Specifically, before testing the target page, the client may first receive test configuration information issued by the server, and perform customized design on the page testing process through the test configuration information. The test configuration information may include a page traversal mode switching threshold. In this embodiment, the page traversal mode may be multiple, and the applicable page test scenario of each mode is different. For example, the page traversal mode may include a screen segmentation traversal mode, an element identification traversal mode, an image text traversal mode, and the like, where the screen segmentation traversal mode refers to a traversal mode in which a page is cut by a boundary coordinate value of an element to obtain the element, and the page traversal mode may be applicable to page design with fewer page elements and clearer element boundaries, and has the advantages of less resource occupation and high traversal efficiency; the element identification traversal mode refers to a traversal mode for acquiring elements through page image characteristics or page structure information, and the page traversal mode can be suitable for page design with fewer page elements, clear image characteristics or complete page structure, and has the advantages of less occupied resources and high traversal efficiency; the image text traversal mode refers to a traversal mode of acquiring elements through image control identification and text identification, and the page traversal mode can be suitable for page design with more page elements or more complex element design and has the advantage of high element identification accuracy. The tester can adjust the page traversal mode switching threshold according to the actual situation of the target page, so that the target page can adapt to the page traversal mode which accords with the characteristics of the target page to perform element traversal. In this embodiment, the test content is customized and set through the test configuration information, so that the page test accuracy and the test efficiency can be improved.
102. And determining the page traversal mode of the target page according to the page traversal mode switching threshold and the number of elements in the target page, and traversing the elements in the target page through the page traversal mode of the target page to generate an element structure tree of the target page.
Wherein, the target page refers to a page to be tested; the page traversal mode refers to a method for identifying attribute values and coordinate values of elements in a page; the element structure tree refers to a page element list of a tree structure composed of element attribute values and element coordinate values.
Specifically, the client may obtain the number of elements in the target page in an image control recognition manner, and then compare the number of elements in the target page with a configured page traversal mode switching threshold, so as to determine the page traversal mode of the target page according to the comparison result, for example, the determined page traversal mode may be one of a screen segmentation traversal mode, an element identification traversal mode, and an image text traversal mode, and finally, the client may traverse each element in the target page by using the determined page traversal mode, so as to generate an element structure tree of the target page. In this embodiment, although the mode of traversing the pattern recognition elements of various pages is different, the finally generated element structure tree includes the attribute values and coordinate values of the elements in the target page.
103. And executing voice conversion operation on each element in the element structure tree of the target page to obtain a voice text of each element in the target page.
The voice conversion operation refers to an operation of decoding and converting voice signals read aloud into voice texts, the operation of performing voice conversion on the elements refers to an operation of performing selection on the elements, triggering screen reading software to read attribute values of the elements, and then decoding and converting the read voice signals into the voice texts.
Specifically, the element structure tree of the target page comprises attribute values and coordinate values of elements, and according to the coordinate values of the elements in the element structure tree, the client can select the elements in the element structure tree in a screen reading mode to simulate a one-finger touch operation of a visually impaired person, so that the screen reading software is triggered to perform voice reading on the attribute values of the elements in the element structure tree in sequence, and the client can acquire the read voice signals through the voice signal acquirer and decode and output the acquired voice signals, so that the voice text of the elements in the target page is obtained.
104. And comparing the voice text of each element in the target page with the attribute value of each element in the element structure tree of the target page to obtain the test result of the target page.
The attribute value of the element refers to information which is read when screen reading software is triggered to carry out voice reading on the element, and the information comprises information such as the name, the type and the numerical value of the element. For example, the attribute value of an element may be "filter button", or "message tag", or "picture", or the like.
Specifically, the voice text after the voice conversion of each element in the target page should be consistent with the attribute value comparison of each corresponding element in the element structure tree of the target page, or consistent with the key information comparison. For example, after image control recognition and text recognition are performed on one element in the target page, it is obtained that the character information of the element is 'food takeout', the type of the image control is 'button', after information integration, the attribute value of the element is 'food takeout button', the coordinate value of the element is a coordinate value '(10, 10)' after character coordinate value and image control coordinate value are integrated, after voice conversion operation is performed on the coordinate value of the element, it is obtained that the voice text of the element is also 'food takeout button', then the element comparison is successful, and a piece of comparison information is generated. In this embodiment, the client may perform one-to-one comparison between the speech text of each element and the attribute values of each element in the element structure tree while decoding and outputting the speech text to obtain the information comparison result of each element, or may perform one-to-one comparison between the entire speech text of each element and the attribute values of all elements in the element structure tree after decoding and outputting all the speech texts to obtain the information comparison result of each element, and the client may further integrate the two comparison results, i.e., integrate the result of the real-time comparison and the result of the offline comparison to obtain the information comparison result of each element, and finally, the client may retain and store the information that is consistent in comparison, and label the information that is inconsistent in comparison or the information that is missing in comparison, so as to obtain the final test result of the target page, and in addition, the test result of the target page can also comprise information such as an element structure tree of the target page, a voice text and a comparison passing rate of each element in the target page and the like.
The page testing method provided by this embodiment includes first receiving test configuration information, comparing a page traversal mode switching threshold in the test configuration information with the number of elements in a target page to determine a page traversal mode of the target page, traversing the elements in the target page through the page traversal mode to generate an element structure tree of the target page, then performing a voice conversion operation on each element in the element structure tree of the target page to obtain a voice text of each element in the target page, and finally comparing the voice text of each element in the target page with an attribute value of each element in the element structure tree of the target page to obtain a test result of the target page. According to the method, the page traversal mode is switched by setting the page traversal mode switching threshold, and the page traversal mode is switched by the page traversal mode switching threshold, so that the page designs with different element numbers and different types can be automatically adapted to the page traversal mode matched with the page traversal mode, the waste of test resources is reduced, and the test efficiency is improved. In addition, the method establishes the element structure tree, converts the attribute values of the elements in the element structure tree into the voice texts, and compares the voice texts of the elements with the attribute values of the corresponding elements, so that whether the barrier-free function of each element in the page reaches the expected level can be quickly verified, the efficiency of page testing is further improved, the stability of a link is also ensured, and the experience problem of visually impaired users is solved in time.
Further, as a refinement and an extension of the specific implementation of the above embodiment, in order to fully illustrate the implementation process of the embodiment, a page testing method is provided, as shown in fig. 2, the method includes the following steps:
201. receiving test configuration information of a target page, wherein the test configuration information comprises a page traversal mode switching threshold, page links, page traversal time, element operation times and target test content.
Specifically, before testing the target page, the client may first receive test configuration information issued by the server, and perform customized design on the page testing process through the test configuration information. The test configuration information may include one or more items of information of a page traversal mode switching threshold, a page link, a page traversal time, an element operation number, and target test content. In this embodiment, the page traversal mode may be multiple, and the applicable page test scenario of each mode is different. For example, the page traversal pattern may include a screen segmentation traversal pattern, an element identification traversal pattern, an image text traversal pattern, and the like, where the screen segmentation traversal pattern may be applicable to a page design with fewer page elements and a clearer element boundary, and has the advantages of less resource occupation and high traversal efficiency; the element identification traversal mode can be suitable for page design with fewer page elements and clear image features or complete page structure, and has the advantages of less occupied resources and high traversal efficiency; the image text traversal mode is suitable for page design with more page elements or more complex element design, and has the advantage of high element identification accuracy. The tester can adjust the page traversal mode switching threshold according to the actual situation of the target page, so that the target page can adapt to the page traversal mode which accords with the characteristics of the target page to perform element traversal.
Furthermore, the tester can further improve the accuracy, comprehensiveness and testing efficiency of the page testing by configuring page links, page traversal time, element operation times and target testing content. For example, through page linking, a client can directly jump to a target page for development testing, so that the link jump operation is reduced, and the page testing efficiency is improved; through the page traversal time, the client can perform cyclic traversal on the target page within the specified time, so that all elements in the target page can be obtained completely, and element omission is avoided; through the element operation times, the client can repeatedly operate each element in the target page, so that all the elements in the target page are ensured to be completely executed; through the target test content, the client can quickly verify the specified content and obtain a verification result.
In the embodiment, the test configuration information of the target page is issued by using the server, so that the test efficiency and the test integrity can be improved, the test effect can be improved, and the test method can be applied to various types of page test scenes.
202. And determining the page traversal mode of the target page according to the page traversal mode switching threshold and the number of elements in the target page, and traversing the elements in the target page through the page traversal mode of the target page to generate an element structure tree of the target page.
Wherein, the target page refers to a page to be tested; the page traversal mode refers to a method for identifying attribute values and coordinate values of elements in a page; the element structure tree refers to a page element list of a tree structure composed of element attribute values and element coordinate values.
Specifically, the client may obtain the number of elements in the target page in an image control recognition manner, and then compare the number of elements in the target page with a configured page traversal mode switching threshold, so as to determine the page traversal mode of the target page according to the comparison result, for example, the determined page traversal mode may be one of a screen segmentation traversal mode, an element identification traversal mode, and an image text traversal mode, and finally, the client may traverse each element in the target page by using the determined page traversal mode, so as to generate an element structure tree of the target page. In this embodiment, although the mode of traversing the pattern recognition elements of various pages is different, the finally generated element structure tree includes the attribute values and coordinate values of the elements in the target page.
In an optional embodiment, if the test configuration information includes a page link, step 202 may specifically be: and jumping to a target page according to the page link, calling an image control library, identifying the image controls in the target page to obtain the number of the image controls in the target page, and finally comparing the number of the image controls in the target page with a page traversal mode switching threshold value of the target page to obtain a page traversal mode of the target page. In the embodiment, the client can directly jump to the target page through the page link of the target page, so that the jump logic before the target page is omitted. For example, when performing page optimization, a page developer only modifies one page of the "shop detail page", so that the client can directly jump to the "shop detail page" for testing through page links in the test configuration information, and does not need to jump to the "shop detail page" through a home page search. By the mode, the page testing efficiency can be improved, and the target page can not be effectively tested and verified when the jump logic in front of the target page is in a problem.
In an optional embodiment, if the test configuration information includes a page traversal time, step 202 may specifically be: and before the page traversal time is over, circularly traversing the elements in the target page through a set page traversal mode of the target page to generate an element structure tree of the target page. In the embodiment, after the first element traversal is finished, the target page can be subjected to second traversal, third traversal and the like until the configured page traversal time is finished.
In an alternative embodiment, the page traversal mode switching threshold includes a first threshold and a second threshold, and the page traversal mode includes a screen segmentation traversal mode, an element identification traversal mode, and an image text traversal mode. Then, the method for determining the page traversal pattern of the target page in step 203 may include the following steps: if the number of elements in the target page is less than or equal to a first threshold value, determining that the page traversal mode of the target page is a screen segmentation traversal mode; if the number of elements in the target page is larger than a first threshold and smaller than a second threshold, determining that the page traversal mode of the target page is an element identification traversal mode; and if the number of the elements in the target page is larger than or equal to the second threshold, determining that the page traversal mode of the target page is the image text traversal mode.
In this embodiment, both the first threshold and the second threshold of the page traversal mode switching threshold may be configured at the server, so that before testing, a tester may configure the first threshold and the second threshold according to the number of elements of the test page, the page design complexity, and the page design characteristics, thereby enabling the test page to adapt to the page traversal mode most suitable for its own characteristics. For example, for a page with definite page module division, the first threshold and the second threshold may be set relatively higher, so as to save testing resources of the client; for a page with complex page design and easy recognition error, the first threshold and the second threshold can be set relatively lower to improve the accuracy of element recognition.
In an alternative embodiment, when the page traversal mode of the target page is the screen division traversal mode, the method for generating the element structure tree of the target page may include the following steps: firstly, according to the page size of a target page, traversing the boundary coordinate values of all elements in the target page according to a preset coordinate sequence, carrying out block segmentation on the target page according to the boundary coordinate values of all elements, then calculating the central coordinate values of all blocks in the target page according to the coordinate values of the elements corresponding to all blocks in the target page, finally reading the attribute values of the elements corresponding to all blocks in the target page, and generating an element structure tree of the target page according to the attribute values of the elements corresponding to all blocks in the target page and the central coordinate values of all blocks. The element identification method is suitable for the condition that the number of page elements is small and the element boundaries are clear, and the elements in the page are traversed through a screen segmentation traversal mode, so that the resource consumption can be reduced, and the test efficiency can be improved.
In an optional embodiment, when the page traversal pattern of the target page identifies a traversal pattern for an element, the method for generating the element structure tree of the target page may include the following steps: firstly, extracting information from image features in a target page and/or page structure information in the target page to obtain identification information of each element in the target page and coordinate values of each element, then reading an attribute value of each element in the target page according to the identification information of each element in the target page, and finally generating an element structure tree of the target page according to the attribute value of each element in the target page and the coordinate values of each element in the target page. The element identification method is suitable for the conditions that page elements are few, image features are clear or a page structure is complete, the elements in the page are traversed through the element identification traversal mode, resource consumption can be reduced, and testing efficiency is improved.
In an alternative embodiment, when the page traversal pattern of the target page is the image text traversal pattern, the method for generating the element structure tree of the target page may include the following steps: firstly, calling an image control library, identifying image controls in a target page to obtain the type and coordinate values of each image control in the target page, then carrying out text identification on the target page to obtain a character list of the target page and the central coordinate values of each segment of characters, and finally generating an element structure tree of the target page according to the type and coordinate values of each image control in the target page, the character list of the target page and the central coordinate values of each segment of characters.
In this embodiment, the image control library refers to a set of image controls, in which all designed image controls, including icons and pictures of various types, are stored, and by uploading the screenshot image of the target page to the image control library, the page image can be compared with each image control in the image control library, so that each image control in the page image and the type of each image control are identified, and by positioning each image control, the coordinate value of each image control can be obtained.
Further, the text recognition may specifically be an OCR text recognition technology, and by the text recognition technology, all the characters in the target page may be recognized, and by positioning the coordinate positions where the characters are located and analyzing the character contents, the character information and the central coordinate values of each segment of characters may be obtained. Finally, the coordinate value of each image control is compared with the central coordinate value of each segment of characters, the corresponding relation between the image control and each segment of characters can be found, so that the coordinate value of each element is determined, the attribute value of each element can be obtained according to the character information of each segment of characters in the character list and the type of the image control, and the element structure tree of the target page can be constructed according to the coordinate value of each element and the attribute value of each element.
The element identification method in the embodiment does not need to depend on element control types and page writing specifications, is suitable for the condition that page elements are more or page design is more complex, and can effectively reduce the problem of element identification deviation caused by different screen sizes of the test terminal and the problem of element identification errors caused by unobvious page image characteristics, thereby effectively improving the accuracy of element identification.
203. And executing voice conversion operation on each element in the element structure tree of the target page to obtain a voice text of each element in the target page.
The voice conversion operation refers to an operation of decoding and converting voice signals read aloud into voice texts, the operation of performing voice conversion on the elements refers to an operation of performing selection on the elements, triggering screen reading software to read attribute values of the elements, and then decoding and converting the read voice signals into the voice texts.
Specifically, the element structure tree of the target page comprises attribute values and coordinate values of elements, and according to the coordinate values of the elements in the element structure tree, the client can select the elements in the element structure tree in a screen reading mode to simulate a one-finger touch operation of a visually impaired person, so that the screen reading software is triggered to perform voice reading on the attribute values of the elements in the element structure tree in sequence, and the client can acquire the read voice signals through the voice signal acquirer and decode and output the acquired voice signals, so that the voice text of the elements in the target page is obtained.
In an optional embodiment, if the test configuration information includes the number of element operations, step 203 may specifically be: and executing the voice conversion operation with the corresponding times of the element operation times on each element in the element structure tree of the target page to obtain the voice text of each element in the target page. For example, the number of element operations in the test configuration information is 3, and then the number of element operations performed on each element in the element structure tree of the target page is also 3. By the method, each element of the target page can be operated for multiple times, so that the integrity of operation is ensured, and the elements are prevented from being omitted.
In an alternative embodiment, the specific implementation flow of step 203 may include the following steps: the method comprises the steps of firstly, carrying out clicking operation on each element in an element structure tree of a target page to obtain a voice signal of each element in the target page, then carrying out feature extraction on the voice signal of each element in the target page through a voice signal collector, inputting the extracted features into an acoustic model to obtain a voice signal coding value of each element, and finally decoding the voice signal coding value of each element through a voice model and a pronunciation dictionary to obtain a voice text of each element in the target page.
In the embodiment, the voice signal is obtained by performing the automatic click operation on each element in the element structure tree, and the voice signal is converted into the voice text, so that the element operation speed can be increased, and the test efficiency can be improved.
204. And comparing the voice text of each element in the target page with the attribute value of each element in the element structure tree of the target page to obtain the test result of the target page.
The attribute value of the element refers to information which is read when screen reading software is triggered to carry out voice reading on the element, and the information comprises information such as the name, the type and the numerical value of the element. For example, the attribute value of an element may be "filter button", or "message tag", or "picture", or the like.
Specifically, the voice text after the voice conversion of each element in the target page should be consistent with the attribute value comparison of each corresponding element in the element structure tree of the target page, or consistent with the key information comparison. For example, after image control recognition and text recognition are performed on one element in the target page, it is obtained that the character information of the element is 'food takeout', the type of the image control is 'button', after information integration, the attribute value of the element is 'food takeout button', the coordinate value of the element is a coordinate value '(10, 10)' after character coordinate value and image control coordinate value are integrated, after voice conversion operation is performed on the coordinate value of the element, it is obtained that the voice text of the element is also 'food takeout button', then the element comparison is successful, and a piece of comparison information is generated.
In this embodiment, the client may perform one-to-one comparison between the speech text of each element and the attribute values of each element in the element structure tree while decoding and outputting the speech text to obtain the information comparison result of each element, or may perform one-to-one comparison between the entire speech text of each element and the attribute values of all elements in the element structure tree after decoding and outputting all the speech texts to obtain the information comparison result of each element, and the client may further integrate the two comparison results, i.e., integrate the result of the real-time comparison and the result of the offline comparison to obtain the information comparison result of each element, and finally, the client may retain and store the information that is consistent in comparison, and label the information that is inconsistent in comparison or the information that is missing in comparison, so as to obtain the final test result of the target page, and in addition, the test result of the target page can also comprise information such as an element structure tree of the target page, a voice text and a comparison passing rate of each element in the target page and the like.
In an optional embodiment, if the test configuration information includes target test content, step 204 may specifically be: and comparing the voice text of each element corresponding to the target test content in the target page with the attribute value of each element corresponding to the element structure tree of the target page to obtain the test result of the target page. In the embodiment, by pre-configuring the target test content in the target page, the elements corresponding to the target test content can be quickly verified, the verification result is obtained, and the page test efficiency is improved.
In an alternative embodiment, the specific implementation flow of step 204 may include the following steps: firstly, comparing the voice text of each element in a target page converted in real time with the attribute value of each corresponding element in an element structure tree of the target page one by one to obtain a real-time first comparison result, then integrating the voice text of each element in the target page to obtain the voice text of the target page, integrally comparing the voice text of the target page with the attribute values of all elements in the element structure tree of the target page to obtain an offline second comparison result, and finally integrating the real-time first comparison result and the offline second comparison result to obtain a test result of the target page. In the embodiment, by combining the real-time information comparison result with the offline information comparison result, the comparison results can be verified and complemented mutually, and the integrity of data comparison is ensured.
In the above embodiment, the method for performing real-time alignment may include the following steps: the method comprises the steps of comparing the voice texts of all elements in a target page with the attribute values of corresponding elements in an element structure tree of the target page one by one, generating comparison success information of the elements for the elements with the same comparison value, reading the attribute values of the elements for the elements with different comparison values, converting the elements into voice texts, comparing the attribute values of the elements with the voice texts of the elements again, generating comparison success information of the elements for the elements with the same comparison value after the comparison again, generating comparison failure information of the elements for the elements with different comparison values after the comparison again, and generating a first comparison result according to the comparison success information of the elements and the comparison failure information of the elements. It is to be understood that the method for off-line comparison may also refer to the present embodiment, and will not be described herein again. According to the embodiment, the information which fails in comparison is verified again, so that the comparison error caused by element identification error or decoding error can be avoided, and the test accuracy is improved.
In the above embodiment, the method for integrating the first alignment result and the second alignment result may comprise the following steps: and reserving the same comparison information in the first comparison result and the second comparison result, and labeling the different comparison information and the missing comparison information in the first comparison result and the second comparison result so as to obtain the test result of the target page. In addition, the test result of the target page may further include information such as an element structure tree of the target page, a voice text and a comparison passing rate of each element in the target page. In the embodiment, the information with the same comparison is reserved, and the information with different or missing comparison is marked, so that the testing personnel can quickly know the process information and the result information of information comparison, and the accuracy of the test result is improved.
205. And when the element structure tree of the target page contains the page jump element, executing operation on the page jump element, and jumping to the associated page corresponding to the page jump element.
206. And carrying out image control identification and text identification on the associated page, and generating an element structure tree of the associated page according to the identification result.
207. And executing voice conversion operation on each element in the element structure tree of the associated page to obtain a voice text of each element in the associated page.
208. And comparing the voice text of each element in the associated page with the attribute value of each element in the element structure tree of the associated page to obtain the test result of the associated page.
The page jump element refers to an element capable of jumping to other pages, and other related pages of the target page can be jumped to, for example, an upper page or a lower page of the target page by executing a single-point double-click operation on the page jump element, so that a new page is entered.
Specifically, if the element structure tree of the target page includes a page jump element, a single-point double-click operation may be performed on the page jump element, and the page jump may be performed to an associated page corresponding to the page jump element, where the associated page may be an upper page or a lower page of the target page. And finally, comparing the voice text of each element in the associated page with the attribute value of each element in the element structure tree of the associated page to obtain a test result of the associated page. In this embodiment, the description of each embodiment in steps 202 to 204 may be referred to for a manner of performing element recognition, voice conversion, and comparison test on the associated page, and this embodiment is not described herein again.
The page testing method provided by this embodiment can improve the testing efficiency and testing integrity of the target page by receiving the testing configuration information of the target page, and is helpful for improving the testing effect, so that the testing method can be applied to various types of page testing scenarios, and the method can automatically adapt the page traversal mode suitable for the current testing scenario by comparing the number of elements in the page with the page traversal mode switching threshold, and can identify the elements in the target page and the associated page through the automatically adapted page convenience mode, so as to improve the comprehensiveness of the page testing, reduce the resource consumption of the client, improve the accuracy of element identification, and avoid the elements from being missed during identification, and in addition, the method can convert the attribute values of the elements in the element structure tree into the voice text by establishing the element structure tree, and the voice text of each element is compared with the attribute value of the corresponding element, so that the efficiency of page testing can be improved, the stability of a link is ensured, and the experience problem of a visually impaired user is solved in time.
Further, as a refinement and an extension of the above embodiments, in order to fully describe the implementation process of the present embodiment, the present embodiment describes the page testing method proposed by the above embodiments by an example. As shown in fig. 3, the implementation flow of the page testing method in this example is as follows: a tester configures test configuration information at a server according to a test scene, such as a page traversal mode switching threshold, a page link, page traversal time, element operation times and target test content, then issues the test configuration information to a client through the server, the client opens application software to be tested, jumps to a target page through the configured page link, identifies and acquires the number of elements in the target page through an image control, compares the number of elements with the page traversal mode switching threshold, obtains a page traversal mode according to a comparison result, such as one of a screen segmentation traversal mode, an element identification traversal mode and an image text traversal mode, traverses the elements in the target page through the page traversal mode to obtain an element structure tree of the target page, and selects each element in the element structure tree by using screen reading software, and reading the information of each element, collecting and converting the read voice signal by using a voice signal collector, outputting a voice text, comparing the voice text with the attribute values of each element in the element structure tree, storing the comparison result, generating a test report of a target page after all the elements are traversed, and completing the page test. It should be understood that the steps of the page test are only used to illustrate the whole process of the page test, and are not a limitation on the implementation method of each step.
Further, as a specific implementation of the method shown in fig. 1 to fig. 3, the present embodiment provides a page testing apparatus, as shown in fig. 4, the apparatus includes: a configuration information receiving module 31, a page element traversing module 32, an element voice converting module 33, and a test result generating module 34.
A configuration information receiving module 31, configured to receive test configuration information of a target page, where the test configuration information includes a page traversal mode switching threshold;
the page element traversing module 32 is configured to determine a page traversal pattern of the target page according to the page traversal pattern switching threshold and the number of elements in the target page, traverse the elements in the target page through the page traversal pattern of the target page, and generate an element structure tree of the target page;
the element voice conversion module 33 is configured to perform a voice conversion operation on each element in the element structure tree of the target page to obtain a voice text of each element in the target page;
the test result generating module 34 may be configured to compare the voice text of each element in the target page with the attribute value of each element in the element structure tree of the target page, so as to obtain a test result of the target page.
In a specific application scenario, the test configuration information further includes a page link; the page element traversal module 32 may be further configured to jump to a target page according to the page link; calling an image control library, and identifying the image controls in the target page to obtain the number of the image controls in the target page; and comparing the number of the image controls in the target page with a page traversal mode switching threshold value of the target page to obtain a page traversal mode of the target page.
In a specific application scenario, the test configuration information further includes page traversal time; the page element traversal module 32 may be further configured to perform a cyclic traversal on the elements in the target page through the page traversal mode of the target page before the page traversal time is over, so as to generate an element structure tree of the target page.
In a specific application scenario, the page traversal mode switching threshold comprises a first threshold and a second threshold, and the page traversal mode comprises a screen segmentation traversal mode, an element identification traversal mode and an image text traversal mode; the page element traversal module 32 is specifically configured to determine that the page traversal mode of the target page is the screen segmentation traversal mode if the number of elements in the target page is less than or equal to a first threshold; if the number of elements in the target page is larger than a first threshold and smaller than a second threshold, determining that the page traversal mode of the target page is an element identification traversal mode; and if the number of the elements in the target page is larger than or equal to the second threshold, determining that the page traversal mode of the target page is the image text traversal mode.
In a specific application scenario, when the page traversal mode of the target page is the screen segmentation traversal mode, the page element traversal module 32 is specifically configured to traverse the boundary coordinate values of the elements in the target page according to the page size of the target page and according to a predetermined coordinate sequence, and perform block segmentation on the target page according to the boundary coordinate values of the elements; calculating the central coordinate value of each block in the target page according to the coordinate value of the element corresponding to each block in the target page; and reading the attribute value of the element corresponding to each block in the target page, and generating an element structure tree of the target page according to the attribute value of the element corresponding to each block in the target page and the central coordinate value of each block.
In a specific application scenario, when the page traversal mode of the target page is the element identification traversal mode, the page element traversal module 32 may be specifically configured to perform information extraction on image features in the target page and/or page structure information in the target page, so as to obtain identification information of each element in the target page and a coordinate value of each element; reading the attribute values of the elements in the target page according to the identification information of the elements in the target page; and generating an element structure tree of the target page according to the attribute value of each element in the target page and the coordinate value of each element in the target page.
In a specific application scenario, when the page traversal mode of the target page is the image text traversal mode, the page element traversal module 32 may be specifically configured to invoke an image control library, identify an image control in the target page, and obtain coordinate values of each image control in the target page; performing text recognition on the target page to obtain a character list of the target page and a central coordinate value of each segment of characters; and generating an element structure tree of the target page according to the coordinate values of the image controls in the target page, the character list of the target page and the central coordinate values of the characters.
In a specific application scenario, the test configuration information further includes element operation times; the element voice conversion module 33 is further configured to determine, according to the number of element operations, a predetermined number of times for performing voice conversion on each element in the element structure tree of the target page; and executing voice conversion operation for preset times on each element in the element structure tree of the target page to obtain a voice text of each element in the target page.
In a specific application scenario, the element voice conversion module 33 may be specifically configured to perform a click operation on each element in an element structure tree of a target page to obtain a voice signal of each element in the target page; extracting the characteristics of the voice signals of all elements in the target page through a voice signal collector, and inputting the extracted characteristics into an acoustic model to obtain the voice signal coding values of all elements; and decoding the voice signal coding value of each element through the voice model and the pronunciation dictionary to obtain the voice text of each element in the target page.
In a specific application scenario, the test configuration information further includes target test content; the test result generating module 34 may further be configured to compare the voice text of each element in the target page corresponding to the target test content with the attribute value of each element in the element structure tree of the target page, so as to obtain the test result of the target page.
In a specific application scenario, the test result generating module 34 is specifically configured to compare the speech text of each element in the target page with the attribute values of each corresponding element in the element structure tree of the target page one by one, so as to obtain a first comparison result; integrating the voice texts of all elements in the target page to obtain the voice text of the target page, and integrally comparing the voice text of the target page with the attribute values of all elements in the element structure tree of the target page to obtain a second comparison result; and integrating the first comparison result and the second comparison result to obtain a test result of the target page.
In a specific application scenario, the test result generating module 34 is specifically configured to compare the voice texts of the elements in the target page with the attribute values of the corresponding elements in the element structure tree of the target page one by one; generating comparison success information of the elements aiming at the elements with the same comparison value, reading attribute values of the elements aiming at the elements with different comparison values, converting the elements into voice texts, and comparing the attribute values of the elements with the voice texts of the elements again; generating comparison success information of the elements aiming at the elements with the same comparison values after the secondary comparison, and generating comparison failure information of the elements aiming at the elements with different comparison values after the secondary comparison; and generating a first comparison result according to the comparison success information of the elements and the comparison failure information of the elements.
In a specific application scenario, the test result generating module 34 may be specifically configured to reserve the same comparison information in the first comparison result and the second comparison result, and label the different comparison information and the missing comparison information in the first comparison result and the second comparison result to obtain the test result of the target page.
In a specific application scenario, as shown in fig. 5, the apparatus further includes a page jump module 35, where the page jump module 35 is specifically configured to, when an element structure tree of a target page includes a page jump element, perform an operation on the page jump element, and jump to an associated page corresponding to the page jump element; the page element traversing module 32 may be further configured to determine a page traversing mode of the associated page according to the page traversing mode switching threshold and the number of elements in the associated page, traverse the elements in the associated page through the page traversing mode of the associated page, and generate an element structure tree of the associated page; the element voice conversion module 33 may be further configured to perform a voice conversion operation on each element in the element structure tree of the associated page to obtain a voice text of each element in the associated page; the test result generating module 34 may be further configured to compare the voice text of each element in the associated page with the attribute value of each element in the element structure tree of the associated page, so as to obtain a test result of the associated page.
It should be noted that other corresponding descriptions of the functional units related to the page testing apparatus provided in this embodiment may refer to the corresponding descriptions in fig. 1 to fig. 3, and are not repeated herein.
Based on the method shown in fig. 1 to 3, correspondingly, the present embodiment further provides a storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the page testing method shown in fig. 1 to 3.
Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, and the software product to be identified may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, or the like), and include several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the method according to the implementation scenarios of the present application.
Based on the method shown in fig. 1 to fig. 3 and the embodiments of the page testing apparatus shown in fig. 4 and fig. 5, in order to achieve the above object, the present embodiment further provides an entity device for page testing, which may specifically be a personal computer, a server, a smart phone, a tablet computer, a smart watch, or other network devices, and the entity device includes a storage medium and a processor; a storage medium for storing a computer program; a processor for executing a computer program for implementing the above-described method as shown in fig. 1 to 3.
Optionally, the entity device may further include a user interface, a network interface, a camera, a Radio Frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, and the like. The user interface may include a Display screen (Display), an input unit such as a keypad (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), etc.
Those skilled in the art will appreciate that the physical device structure for page testing provided in the present embodiment does not constitute a limitation to the physical device, and may include more or fewer components, or combine some components, or arrange different components.
The storage medium may further include an operating system and a network communication module. The operating system is a program for managing the hardware of the above-mentioned entity device and the software resources to be identified, and supports the operation of the information processing program and other software and/or programs to be identified. The network communication module is used for realizing communication among components in the storage medium and communication with other hardware and software in the information processing entity device.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present application can be implemented by software plus a necessary general hardware platform, and can also be implemented by hardware. By applying the technical scheme of the application, compared with the prior art, the method has the advantages that the page traversal mode is switched by setting the page traversal mode switching threshold value and switching the page traversal mode through the page traversal mode switching threshold value, so that page designs with different element numbers and different types can be automatically adapted to the page traversal mode matched with the page traversal mode, the waste of test resources is reduced, and the test efficiency is improved. In addition, the method establishes the element structure tree, converts the attribute values of the elements in the element structure tree into the voice texts, and compares the voice texts of the elements with the attribute values of the corresponding elements, so that whether the barrier-free function of each element in the page reaches the expected level can be quickly verified, the efficiency of page testing is further improved, the stability of a link is also ensured, and the experience problem of visually impaired users is solved in time.
Those skilled in the art will appreciate that the figures are merely schematic representations of one preferred implementation scenario and that the blocks or flow diagrams in the figures are not necessarily required to practice the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario may be distributed in the devices in the implementation scenario according to the description of the implementation scenario, or may be located in one or more devices different from the present implementation scenario with corresponding changes. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The above application serial numbers are for description purposes only and do not represent the superiority or inferiority of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of the present application, but the present application is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present application.