Software compatibility testing method and device, electronic equipment and storage medium
By performing dimensional conversion and peak/trough area extraction of the image to be tested, the problem of comparison failure and low accuracy caused by resolution differences in software testing is solved, and more efficient and accurate compatibility testing is achieved.
Patent Information
- Application Number
- CN202310842739.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-10
- Publication Date
- 2025-01-14
AI Technical Summary
Existing software testing methods have problems such as comparison failure caused by resolution differences in compatibility testing and low test accuracy, especially when comparing test images or manual screenshots, which easily introduce interference factors, resulting in low test accuracy.
By performing dimensional conversion of the image to be tested, the pixel distribution vector is obtained, the peak or valley areas are determined, the key areas are extracted, and compatibility tests are carried out based on these key areas to avoid the introduction of interference factors and improve the test accuracy.
Improve the accuracy and efficiency of tests, accurately extract key information of the images to be tested, enhance the accuracy of compatibility testing, and reduce the testing cost.
Smart Images

Figure CN119311567A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of software testing, and in particular to a software compatibility testing method and device, an electronic device, and a storage medium. Background Art
[0002] With the rapid development of mobile Internet, mobile devices of different brands and models have emerged, which have different sizes, screen resolutions, versions, and hardware and software. Newly developed application software needs to be able to run stably and effectively on different mobile devices. Therefore, compatibility testing is required before the application software goes online.
[0003] The current testing method is to compare test images of different devices or manually capture the test image content for comparison. The former method may cause comparison failure due to resolution differences, and the latter method will introduce interference factors that do not need to be compared, resulting in low test accuracy.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The purpose of the embodiments of the present disclosure is to provide a software compatibility testing method and device, an electronic device, and a storage medium, thereby solving the problems of software testing failure and low testing accuracy in the related art to a certain extent.
[0006] According to the first aspect of the present disclosure, a software compatibility testing method is provided, including: performing dimensional conversion on the images to be tested corresponding to each test terminal to obtain pixel distribution vectors corresponding to each image to be tested; the images to be tested are formed based on the target page of the test terminal for the target software; for a pixel distribution vector, traversing to determine at least one target area corresponding to the pixel distribution vector, the target area being the area where the peak or trough corresponding to the pixel distribution vector is located; based on the at least one target area, extracting the key area corresponding to the image to be tested; and performing compatibility testing on the target software based on the key areas corresponding to each image to be tested.
[0007] Optionally, the image to be tested is dimensionally converted, including: in response to the image to be tested being a color image, gray-scaling the image to be tested to obtain a corresponding gray-scale image; horizontally flattening the gray-scale image to obtain a corresponding pixel distribution vector; in response to the image to be tested being a gray-scale image, horizontally flattening the image to be tested to obtain a corresponding pixel distribution vector.
[0008] Optionally, before horizontally flattening, the method further includes: performing a transposition operation on a target image, where the target image is a grayscale image corresponding to the image to be tested.
[0009] Optionally, based on at least one target area, a key area corresponding to the image to be tested is extracted, including: determining a target segmentation method of the image to be tested based on the number of target areas corresponding to the first vector and the number of target areas corresponding to the second vector; the first vector is obtained by horizontally flattening the grayscale image to one dimension, and the second vector is obtained by horizontally flattening the grayscale image to one dimension after a transposition operation; segmenting the target image according to the target segmentation method; and taking each segmented area as a key area of the target image.
[0010] Optionally, the target segmentation method includes horizontal segmentation and vertical segmentation; according to the number of target areas corresponding to the first vector and the number of target areas corresponding to the second vector, the target segmentation method of the image to be tested is determined, including: if the number of target areas corresponding to the first vector is greater than or equal to the number of target areas corresponding to the second vector, the target segmentation method is determined to be horizontal segmentation; if the number of target areas corresponding to the first vector is less than the number of target areas corresponding to the second vector, the target segmentation method is determined to be vertical segmentation.
[0011] Optionally, the target image is segmented according to the target segmentation method, including: if the target segmentation method is horizontal segmentation, the position of the corresponding segmented area in the target image is determined according to the starting value and ending value of a target area in the pixel distribution vector, the height of the target image and the screen width of the test terminal; if the target segmentation method is vertical segmentation, the position of the corresponding segmented area in the target image is determined according to the starting value and ending value of a target area in the pixel distribution vector, the width of the target image and the screen height of the test terminal.
[0012] Optionally, before determining at least one target area corresponding to a pixel distribution vector, the method further includes: performing averaging processing on the target image to obtain a corresponding binary image.
[0013] Optionally, the method further includes: in response to receiving a target software test instruction, acquiring an image to be tested of each test terminal.
[0014] Optionally, the target software test instruction includes the number of segmentation times, and the method further includes: if the number of segmentation times is greater than 1, determining a target segmentation area in each segmentation area, the target segmentation area being a target area existing in a pixel distribution vector corresponding to the segmentation area; and extracting a key area within the target segmentation area based on the target area.
[0015] According to a second aspect of the present disclosure, a software compatibility testing device is provided, the device comprising: a dimensional conversion module, configured to perform dimensional conversion on an image to be tested corresponding to each test terminal, and obtain a pixel distribution vector corresponding to each image to be tested; the image to be tested is formed based on a target page of a target software for the test terminal; an area determination module, configured to traverse a pixel distribution vector to determine at least one target area corresponding to the pixel distribution vector, the target area being an area where a peak or a trough corresponding to the pixel distribution vector is located; a primary extraction module, configured to extract a key area corresponding to the image to be tested based on at least one target area; and a testing module, configured to perform compatibility testing on the target software based on the key areas corresponding to each image to be tested.
[0016] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method of any of the above embodiments is implemented.
[0017] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: one or more processors; and a storage device for one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to execute the method of any of the above embodiments.
[0018] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the method of any of the above embodiments is implemented.
[0019] The exemplary embodiments of the present disclosure may have some or all of the following beneficial effects:
[0020] In the software compatibility test method provided in the exemplary implementation of the present disclosure, the image to be tested corresponding to each test terminal can be dimensionally converted to obtain the corresponding pixel distribution vector, and the key information corresponding to the image to be tested can be extracted according to the target area in the pixel distribution vector, and then the compatibility test of the target software can be completed by comparing the key areas corresponding to the image to be tested of each test terminal. On the one hand, by extracting the key areas of the image to be tested for information comparison of the compatibility test, the introduction of interference factors and the entire image comparison method are avoided, and the test accuracy can be improved while improving the test efficiency. On the other hand, the pixel distribution law in the one-dimensional pixel distribution vector of the image to be tested is linked to the comparison object in the compatibility test, and the key areas are extracted based on the peaks or troughs of the pixel distribution vector for test comparison, which can accurately extract the key information of the image to be tested, prepare for subsequent test comparisons, and further improve the accuracy of the compatibility test.
[0021] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0023] Figure 1 One of the flowcharts of the software compatibility testing method according to an embodiment of the present disclosure is schematically shown.
[0024] FIG. 2( a ) schematically shows a grayscale image corresponding to an image to be tested according to an embodiment of the present disclosure.
[0025] Figure 2(b) is a visualization of the pixel distribution vector corresponding to Figure 2(a).
[0026] FIG. 3( a ) schematically shows a visualization diagram of a first vector according to an embodiment of the present disclosure.
[0027] FIG. 3( b ) schematically shows a visualization diagram of a second vector according to an embodiment of the present disclosure.
[0028] Figure 4 This is a visualization of the pixel distribution vector obtained after performing a secondary longitudinal segmentation on the key area corresponding to the third peak in Figure 2(b).
[0029] Figure 5 The second flowchart of the software compatibility testing process according to an embodiment of the present disclosure is schematically shown.
[0030] Figure 6 The structural block diagram of a software compatibility testing device according to an embodiment of the present disclosure is schematically shown.
[0031] Figure 7 A block diagram of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0032] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0033] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0034] The software compatibility testing method disclosed in the present invention can be applied to various software testing platforms including terminals and servers. The terminal may include a terminal corresponding to the server of the test platform, which is used to input test instructions and display test results, etc. And the test terminal is used to generate the target page of the software to be tested, that is, the image to be tested. The test terminal can be various mobile terminals such as mobile phones, tablets or wearable devices. The server can be the back-end server of the test platform, which is used to perform various computing services. Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud storage, etc., or a node in the blockchain, which is not limited in this example.
[0035] The software compatibility testing method disclosed in the embodiments of this specification is introduced below in conjunction with specific embodiments.
[0036] refer to Figure 1 As shown, a software compatibility testing method according to an exemplary embodiment of the present disclosure can be applied to a software testing platform and can include the following steps:
[0037] Step S110 , performing dimension conversion on the image to be tested corresponding to each test terminal to obtain a pixel distribution vector corresponding to each image to be tested, wherein the image to be tested is formed based on the target page of the test terminal for the target software.
[0038] Step S120 , for a pixel distribution vector, traverse to determine at least one target area corresponding to the pixel distribution vector, where the target area is an area where a peak or a trough corresponding to the pixel distribution vector is located.
[0039] Step S130: extracting a key area corresponding to the image to be tested according to at least one target area.
[0040] Step S140 , performing compatibility testing on the target software according to the key areas corresponding to each image to be tested.
[0041] In the software compatibility testing method provided in the present example implementation, in the software compatibility testing method provided in the present example implementation, the image to be tested corresponding to each test terminal can be dimensionally converted to obtain the corresponding pixel distribution vector, and the key area corresponding to the image to be tested can be extracted according to the target area in the pixel distribution vector, and then the compatibility test of the target software can be completed by comparing the key areas corresponding to the image to be tested of each test terminal. On the one hand, by extracting the key information of the image to be tested for information comparison of the compatibility test, the introduction of interference factors and the whole image comparison method are avoided, and the test accuracy can be improved while improving the test efficiency. On the other hand, the pixel distribution law in the one-dimensional pixel distribution vector of the image to be tested is linked to the comparison object in the compatibility test, and the key area is extracted based on the peak or trough of the pixel distribution vector for test comparison, which can accurately extract the key information of the image to be tested, prepare for subsequent test comparison, and further improve the accuracy of the compatibility test.
[0042] The following describes each step of the present disclosure in more detail.
[0043] In step S110, the image to be tested corresponding to each test terminal is dimensionally converted to obtain a pixel distribution vector corresponding to each image to be tested.
[0044] In this example implementation, each test terminal refers to each mobile terminal that needs to perform software testing, which may include different models, different display sizes and resolutions, different operating systems, etc., which are not limited in this example. The image to be tested is formed based on the target page of the test terminal for the target software, that is, each test terminal can generate a corresponding target page for the test task, and the target page can be used as the image to be tested for the corresponding test terminal. Each test terminal can generate one or several images to be tested (such as target pages) for the test task, and the compatibility test is performed between the images to be tested generated by different test terminals. The image to be tested can be a color image or a grayscale image, which is not limited in this example. The pixel distribution vector is a one-dimensional vector used to indicate the pixel distribution of the image to be tested, and the pixel distribution vector of the image to be tested can be obtained by dimensional conversion.
[0045] Exemplarily, if the image to be tested is a color image, the image to be tested is grayscaled to obtain a corresponding grayscale image; the grayscale image is horizontally flattened to one dimension to obtain a corresponding pixel distribution vector; if the image to be tested is a grayscale image, the image to be tested is horizontally flattened to one dimension to obtain a corresponding pixel distribution vector.
[0046] In this example implementation, the pixels in the color image are generally represented by R, G, and B components, and the grayscale processing can adopt the average method (the average value of the R, G, and B channel pixels is used as the grayscale pixel value), the maximum and minimum average method, the weighted average, etc., and a single-channel two-dimensional grayscale image is obtained by grayscale processing. Horizontal flattening refers to stretching the two-dimensional grayscale image along the X-axis direction, that is, arranging the pixel values into a row, such as the pixel values of the 2nd to Nth rows are arranged in sequence after the first row to form a one-dimensional pixel distribution vector. As shown in Figure 2, Figure 2 (a) is a grayscale image of the image to be tested, and Figure 2 (b) is a visual representation of the pixel distribution vector, where the horizontal axis is the pixel position and the vertical axis is the pixel value.
[0047] In some embodiments, the method may further include: performing averaging processing on the target image to obtain a corresponding binary image.
[0048] In this example implementation, the target image refers to the grayscale image corresponding to the image to be tested, that is, if the image to be tested is a color image, the target image is the grayscale image obtained after the image to be tested is grayscaled; if the image to be tested is a grayscale image, the target image is the image to be tested itself. The target image is averaged to convert the pixel values into 0 or 1. For example, the pixel average of the target image can be calculated first, and the pixel values of the pixels in the target image whose pixel values are greater than or equal to the pixel average are set to 1, and the pixel values of the pixels whose pixel values are less than the pixel average are set to 0. After the averaged processing, the corresponding binary image is obtained, and the target area, that is, the peak position, can be determined more quickly through the binary image. The averaged processing of this example can facilitate the rapid determination of the target area in the subsequent traversal process, avoid the calculation of pixel values in the traversal cycle process, and greatly save the amount of calculation.
[0049] In some embodiments, before flattening the grayscale image or the image to be tested horizontally to one dimension, the method further includes: performing a transposition operation on the target image.
[0050] In this example implementation, the target image refers to the grayscale image corresponding to the image to be tested. Since the pixel distribution vector corresponding to the image to be tested may have regularity in horizontal distribution or in vertical distribution, it is necessary to determine the direction of extracting the target area. Therefore, this example performs a transposition operation on the target image, that is, rotates the target image 90 degrees, and then flattens it horizontally to obtain the vertical distribution characteristics of the target image.
[0051] In step S120 , for a pixel distribution vector, traverse to determine at least one target area corresponding to the pixel distribution vector.
[0052] In this example implementation, the target area is the area where the peak or trough corresponding to the pixel distribution vector is located. The area where the peak or trough is located is used to indicate the clustering area of similar pixel values. If the target area is the area where the peak is located, it means that the pixel value of the target area is greater than the background. If the target area is the area where the trough is located, it means that the pixel value of the target area is less than the background. Each peak or trough can correspond to a target area, and a measured image can correspond to one or more target areas. For example, the area in the dotted box in Figure 2 (b) is the target area, and it can be seen that there are 5 target areas.
[0053] Exemplarily, for an image to be tested, the target area can be determined for the first vector (pixel distribution vector) obtained by horizontally flattening the corresponding grayscale image and the second vector (pixel distribution vector) obtained by horizontally flattening the corresponding grayscale image after transposition operation. In other words, an image to be tested can correspond to target areas in both horizontal and vertical directions. For Figure 2(a), the visualization result of the first vector determined by traversal is shown in Figure 3(a), and the visualization result of the second vector is shown in Figure 3(b). It can be seen from Figure 3 that the number of peaks (target areas) of the first vector is greater than that of the second vector.
[0054] In step S130, a key area corresponding to the image to be tested is extracted according to at least one target area.
[0055] In this example implementation, the target area determined in the pixel distribution vector can be used to obtain the key area of the target area on the grayscale image corresponding to the image to be tested. The clustering area (target area) of similar pixel values is determined by using a one-dimensional vector and then the key area of the two-dimensional grayscale image is obtained accordingly, so as to perform a content comparison test on the key area, and accurately extract the key area of the image by linking the one-dimensional pixel distribution of the image with the key area of the two-dimensional image. For example, for Figure 2 (b), the peak in each dotted box is a target area. From left to right, the first target area corresponds to the first line of text in Figure 2 (a), that is, the title of the image, the second target area corresponds to the second line of text in Figure 2 (a), the third target area corresponds to the "recommended list" in Figure 2 (a) and the corresponding three commodity areas, the fourth target area corresponds to the description text of the three commodities in Figure 2 (a), which is not shown in the figure; the fifth target area corresponds to the text of the listed good things in Figure 2 (a) and its corresponding commodity area and corresponding description text. It can be seen that the target area in the figure corresponds exactly to the key area in the grayscale image.
[0056] Since the target area can correspond to both horizontal and vertical directions, it is necessary to determine the target area determined in which direction to extract the key area. In this example, the key area extraction method can be determined by parameter configuration. For example, the extraction method 1 represents horizontal, 2 represents vertical, and 0 represents unspecified. It can also be determined by comparing the number of target areas in two directions. Exemplarily, the key area corresponding to the image to be tested can be extracted by the following steps.
[0057] In the first step, a target segmentation method of the image to be tested is determined according to the number of target regions corresponding to the first vector and the number of target regions corresponding to the second vector.
[0058] In this example implementation, the first vector is obtained by flattening the grayscale image horizontally to one dimension, and the target area corresponding to the first vector is determined to count the horizontal key area of the grayscale image corresponding to the image to be tested. The second vector is obtained by flattening the grayscale image horizontally to one dimension after transposition operation, and the target area corresponding to the second vector is determined to count the vertical key area of the grayscale image corresponding to the image to be tested.
[0059] Exemplarily, if the number of target areas corresponding to the first vector is greater than or equal to the number of target areas corresponding to the second vector, the target segmentation method is determined to be horizontal segmentation; if the number of target areas corresponding to the first vector is less than the number of target areas corresponding to the second vector, the target segmentation method is determined to be vertical segmentation. In other words, the segmentation method of the image to be tested can be determined by counting the number of horizontal and vertical target areas, so as to divide the grayscale image corresponding to the image to be tested into multiple key areas horizontally or vertically. As shown in Figure 3, the number of target areas for horizontal segmentation (5) in Figure 3 (a) is greater than the number of target areas for vertical segmentation (3) in Figure 3 (b), and horizontal segmentation can be used as the target segmentation method for the image in Figure 2 (a).
[0060] The second step is to segment the target image according to the target segmentation method.
[0061] In this example implementation, the target segmentation method may include horizontal segmentation and vertical segmentation, wherein horizontal segmentation is segmentation along the width direction of the image, and vertical segmentation is segmentation along the height direction of the image. The position of the corresponding segmented area in the target image can be determined by the starting point and the end point of the target area.
[0062] Exemplarily, if the target segmentation method is horizontal segmentation, the position of the corresponding segmented area in the target image is determined according to the starting value and ending value of a target area in the pixel distribution vector, the height of the target image, and the screen width of the test terminal.
[0063] In this example, the starting height value and ending height value of the corresponding segmented area in the target image can be determined based on the starting value and ending value of a target area in the pixel distribution vector and the height of the target image; the width of the corresponding segmented area can be determined based on the screen width of the test terminal.
[0064] If the target segmentation method is vertical segmentation, the position of the corresponding segmented area in the target image is determined according to the starting value and ending value of a target area in the pixel distribution vector, the width of the target image and the screen height of the test terminal.
[0065] In this example, the starting width value and ending width value of the corresponding segmented area in the target image can be determined based on the starting value and ending value of a target area in the pixel distribution vector and the width of the target image; the height of the corresponding segmented area in the target image can be determined based on the screen height of the test terminal.
[0066] For example, if the grayscale image corresponding to the image to be tested has a width of W, a height of H, and a number of pixels of X, then the calculation formula for the position of the segmented area of the horizontal segmentation can be expressed as:
[0067]
[0068]
[0069] Among them, ImgH1 is the starting height value of the segmented area, ImgH2 is the ending height value of the segmented area, Xbegin is the starting value of the peak / trough of the corresponding target area, Xfinal is the ending value of the peak / trough of the corresponding target area, and int represents the rounding down operation.
[0070] The calculation formula for the position of the segmented area obtained by vertical segmentation can be expressed as:
[0071]
[0072]
[0073] Wherein, ImgW1 is the starting width value of the segmented area, and ImgW2 is the ending width value of the segmented area.
[0074] In this example, for the first segmentation process of the image, for horizontal segmentation, the screen width of the test terminal can be used as the width of each segmented area; for vertical segmentation, the screen height in the test can be used as the height of each segmented area.
[0075] The third step is to use each segmented area as the key area of the target image.
[0076] In this exemplary implementation, each segmented area of the target image may be used as a key area to perform compatibility testing.
[0077] In step S140, compatibility testing is performed on the target software according to the key areas corresponding to each image to be tested.
[0078] In this example implementation, the compatibility test of the target software can be performed by comparing the key areas corresponding to the images to be tested of each test terminal, and the test results are determined based on the comparison results. For example, when the comparison results of the key areas are consistent, it is determined that the compatibility test of the target software has passed, and when the comparison results are inconsistent, it is determined that the compatibility test of the target software has failed. In some embodiments, a reference image can be set, and the compatibility test can be performed by comparing the images to be tested of each test terminal with the key areas of the reference image. The reference image can be uploaded to the test platform by the tester, or it can be the image to be tested of a certain test terminal, and this example does not limit this.
[0079] In some embodiments, in response to receiving a target software test instruction, an image to be tested of each test terminal is acquired.
[0080] In this example implementation, the target software test instruction can be generated in response to the target operation of the tester, and the test task can be executed based on the triggering of the target software test instruction. The parameters configured or added by the tester can be included in the test instruction. The target software test instruction can include parameters such as the number of segmentation times and / or the segmentation method, and can also include other test parameters, which are not limited in this example. The image to be tested can be uploaded in advance or obtained online from each test terminal, which is not limited in this example.
[0081] In some embodiments, the target software test instruction includes a number of segmentation times, and the method further includes: if the number of segmentation times is greater than 1, determining a target segmentation area in each segmentation area, the target segmentation area being a target area existing in a pixel distribution vector corresponding to the segmentation area; and extracting a key area within the target segmentation area based on the target area.
[0082] In this example implementation, when the number of segmentation times is greater than 1, it is necessary to perform a secondary segmentation on the key areas that can continue to be segmented to achieve a finer-grained test comparison and further improve the test accuracy. For each segmented area, the target area, that is, the area where the peak or trough is located, can be further determined in a segmentation direction different from the first segmentation method. The segmented area with a number of target areas greater than 1 can be used as the target segmentation area, and the target segmentation area can be segmented in the corresponding segmentation direction to extract the key area with smaller granularity. The key area corresponding to the third peak in Figure 3(a) can be segmented twice vertically. The pixel distribution vector obtained during the secondary segmentation process is as follows: Figure 4 As shown, from Figure 4It can be seen that there are still four peaks (target areas) in the key area in the vertical direction. The first peak corresponds to the "recommended list" text, and the other peaks correspond to a product area. It can be seen that the key area with smaller granularity can be extracted through secondary segmentation. For compatibility testing, smaller granularity comparison can reduce interference factors and thus improve test accuracy.
[0083] For example, the implementation process of the software compatibility testing method disclosed in the present invention is as follows: Figure 5 As shown, the test platform is used as an example for explanation, and it can be implemented through the following steps.
[0084] Step S501, in response to a target software test instruction, a corresponding image to be tested is obtained from each test terminal. The image to be tested is formed based on a target page of the target software by the test terminal.
[0085] Step S502, determine whether the image to be tested is a color image one by one, if so, go to S503, otherwise, take the image to be tested as the target image and go to S504 and S505.
[0086] Step S503 , grayscale processing is performed on the image to be tested to obtain a corresponding grayscale image, which is used as a target image.
[0087] Step S504, flatten the target image horizontally to obtain a corresponding pixel distribution vector, ie, a first vector, and then go to S506.
[0088] Step S505, transpose the target image and then flatten it horizontally to obtain a corresponding pixel distribution vector, ie, a second vector, and then go to S506.
[0089] Step S506, traverse the first vector and the second vector respectively, find the area where the corresponding peak or trough is located, and use the area where each peak or trough is located as a target area of the vector.
[0090] Step S507 , determining whether the number T1 of target regions corresponding to the first vector is greater than the number T2 of target regions corresponding to the second vector, if so, proceeding to S508 , otherwise proceeding to S509 .
[0091] Step S508, perform horizontal segmentation on the target image, and then go to S510.
[0092] Step S509, segment the target image vertically, and then go to S510.
[0093] Step S510: taking each segmented area as a key area of the target image.
[0094] Step S511 , performing compatibility testing on the target software according to the key areas corresponding to the images to be tested of each test terminal.
[0095] In this example, for the determined key area, it can be further determined whether there is a target area. If so, the key area is further segmented to extract a smaller granularity area.
[0096] The specific details of each step in this embodiment have been described in detail in the previous embodiments, so they will not be repeated here.
[0097] The present disclosure addresses the problem that a large number of test interference factors are introduced into the software testing process based on the entire image or based on manual screenshots, resulting in poor test accuracy. On the one hand, a comparison test is performed based on the key areas of the image to be tested, thereby avoiding the introduction of interference factors and improving test accuracy. On the other hand, the one-dimensional pixel distribution law of the image to be tested is mined, and the key areas of the image to be tested are extracted based on the distribution law. The inherent connection between the two is utilized to realize the extraction of the key areas of the image, and accurate testing of the software can be completed without human intervention, thereby improving test accuracy, improving test efficiency, and reducing test costs. In addition, testers can flexibly configure test objects and test accuracy, thereby improving test flexibility.
[0098] Furthermore, in this exemplary embodiment, a software compatibility testing device 600 is also provided. The software compatibility testing device 600 can be applied to a software testing platform. Figure 6 As shown, the software compatibility testing device 600 may include: a dimension conversion module 610, an area determination module 620, a one-time extraction module 630 and a testing module 640; wherein: the dimension conversion module 610 is configured to perform dimension conversion on the image to be tested corresponding to each test terminal to obtain a pixel distribution vector corresponding to each image to be tested; the area determination module 620 is configured to traverse a pixel distribution vector to determine at least one target area corresponding to the pixel distribution vector, the target area being the area where the peak or trough corresponding to the pixel distribution vector is located; the one-time extraction module 630 is configured to extract the key area corresponding to the image to be tested according to at least one target area; the testing module 640 is configured to perform compatibility testing on the target software according to the key areas corresponding to each image to be tested.
[0099] In an exemplary embodiment of the present disclosure, the dimensionality conversion module 610 is also configured to: in response to the image to be tested being a color image, grayscale the image to be tested to obtain a corresponding grayscale image; horizontally flatten the grayscale image to obtain a corresponding pixel distribution vector; in response to the image to be tested being a grayscale image, horizontally flatten the image to be tested to obtain a corresponding pixel distribution vector.
[0100] In an exemplary embodiment of the present disclosure, the apparatus 600 further includes a transposition module, which is configured to: perform a transposition operation on a target image before horizontal flattening, the target image being a grayscale image corresponding to the image to be tested.
[0101] In an exemplary embodiment of the present disclosure, the primary extraction module 630 is further configured to: determine a target segmentation method of the image to be tested according to the number of target areas corresponding to the first vector and the number of target areas corresponding to the second vector; the first vector is obtained by horizontally flattening the grayscale image to one dimension, and the second vector is obtained by horizontally flattening the grayscale image to one dimension after transposition operation; segment the target image according to the target segmentation method; and use each segmented area as a key area of the target image.
[0102] In an exemplary embodiment of the present disclosure, the target segmentation method includes horizontal segmentation and vertical segmentation; the primary extraction module 630 is also configured as follows: if the number of target areas corresponding to the first vector is greater than or equal to the number of target areas corresponding to the second vector, the target segmentation method is determined to be horizontal segmentation; if the number of target areas corresponding to the first vector is less than the number of target areas corresponding to the second vector, the target segmentation method is determined to be vertical segmentation.
[0103] In an exemplary embodiment of the present disclosure, the primary extraction module 630 is further configured as follows: if the target segmentation method is horizontal segmentation, the position of the corresponding segmented area in the target image is determined according to the starting value and ending value of a target area in the pixel distribution vector, the height of the target image, and the screen width of the test terminal; if the target segmentation method is vertical segmentation, the position of the corresponding segmented area in the target image is determined according to the starting value and ending value of a target area in the pixel distribution vector, the width of the target image, and the screen height of the test terminal.
[0104] In an exemplary embodiment of the present disclosure, the apparatus 600 further includes an averaging module, which is configured to: before determining at least one target region corresponding to a pixel distribution vector, perform averaging processing on the target image to obtain a corresponding binary image.
[0105] In an exemplary embodiment of the present disclosure, the apparatus 600 further includes an acquisition module, and the acquisition module is configured to: in response to receiving a target software test instruction, acquire an image to be tested of each test terminal.
[0106] In an exemplary embodiment of the present disclosure, the target software test instruction includes a number of segmentation times, and the device 600 also includes: a secondary extraction module, and the secondary extraction module is configured to: if the number of segmentation times is greater than 1, determine a target segmentation area in each segmentation area, and the target segmentation area is a target area that exists in the pixel distribution vector corresponding to the segmentation area; according to the target area, extract the key area within the target segmentation area.
[0107] The specific details of each module or unit in the above-mentioned software compatibility testing device have been described in detail in the corresponding software compatibility testing method, so they will not be repeated here.
[0108] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method in the following embodiment. For example, the electronic device may implement Figure 1 , Figure 5 The various steps shown, etc.
[0109] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0110] Refer to the following Figure 7 hereinafter describes an electronic device 700 according to such an embodiment of the present disclosure. Figure 7The electronic device 700 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0111] like Figure 7 As shown, the electronic device 700 is in the form of a general computing device. The components of the electronic device 700 may include, but are not limited to: the at least one processing unit 710, the at least one storage unit 720, a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710), and a display unit 740.
[0112] The storage unit stores program codes, which can be executed by the processing unit 710, so that the processing unit 710 executes the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification.
[0113] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 7201 and / or a cache storage unit 7202 , and may further include a read-only storage unit (ROM) 7203 .
[0114] The storage unit 720 may also include a program / utility 7204 having a set (at least one) of program modules 7205, such program modules 7205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0115] Bus 730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0116] The electronic device 700 may also communicate with one or more external devices 770 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 750. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 760. As shown, the network adapter 760 communicates with other modules of the electronic device 700 via a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RA identification systems, tape drives, and data backup storage systems, etc.
[0117] In an exemplary embodiment, a computer program product is also provided, including one or more instructions, which can be executed by a processor of a computer device to complete the software compatibility testing method provided by each of the above embodiments.
[0118] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.
[0119] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0120] It should be noted that, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in the specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc., which shall all be considered as part of the present disclosure.
[0121] It should be understood that the disclosure disclosed and defined in this specification extends to all alternative combinations of two or more individual features mentioned or evident in the text and / or the accompanying drawings. All these different combinations constitute multiple alternative aspects of the disclosure. The embodiments of this specification illustrate the best mode known for implementing the disclosure and will enable those skilled in the art to utilize the disclosure.
Claims
1. A software compatibility testing method, characterized in that: The method comprises: Performing dimension conversion on the image to be tested of each test terminal to obtain a pixel distribution vector corresponding to each image to be tested; the image to be tested is formed based on the target page of the test terminal for the target software; For a pixel distribution vector, traverse to determine at least one target area corresponding to the pixel distribution vector, the target area being an area where a peak or a trough corresponding to the pixel distribution vector is located; Extracting a key area corresponding to the image to be tested according to the at least one target area; The compatibility test of the target software is performed according to the key areas corresponding to each image to be tested.
2. The software compatibility testing method according to claim 1, characterized in that: The dimensional conversion of the image to be tested includes: In response to the image to be tested being a color image, grayscale processing is performed on the image to be tested to obtain a corresponding grayscale image; the grayscale image is horizontally flattened to obtain a corresponding pixel distribution vector; In response to the image to be tested being a grayscale image, the image to be tested is flattened horizontally to obtain a corresponding pixel distribution vector.
3. The software compatibility testing method according to claim 2, characterized in that: Before the lateral flattening, the method further comprises: A transposition operation is performed on a target image, where the target image is a grayscale image corresponding to the image to be tested.
4. The software compatibility testing method according to claim 3, characterized in that: Extracting a key area corresponding to the image to be tested according to the at least one target area includes: Determine the target segmentation method of the image to be tested according to the number of target areas corresponding to the first vector and the number of target areas corresponding to the second vector; the first vector is obtained by flattening the grayscale image horizontally to one dimension, and the second vector is obtained by flattening the grayscale image horizontally to one dimension after transposition operation; Segmenting the target image according to the target segmentation method; Each segmented area is used as a key area of the target image.
5. The software compatibility testing method according to claim 4, characterized in that: The target segmentation method includes horizontal segmentation and vertical segmentation; Determining a target segmentation method of the image to be tested according to the number of target areas corresponding to the first vector and the number of target areas corresponding to the second vector includes: If the number of target areas corresponding to the first vector is greater than or equal to the number of target areas corresponding to the second vector, determining that the target segmentation method is horizontal segmentation; If the number of target regions corresponding to the first vector is less than the number of target regions corresponding to the second vector, it is determined that the target segmentation method is vertical segmentation.
6. The software compatibility testing method according to claim 5, characterized in that: Segmenting the target image according to the target segmentation method includes: If the target segmentation mode is horizontal segmentation, determining the position of a corresponding segmentation area in the target image according to a starting value and an ending value of the target area in the pixel distribution vector, a height of the target image, and a screen width of the test terminal; If the target segmentation method is vertical segmentation, the position of the corresponding segmented area in the target image is determined according to the starting value and ending value of the target area in the pixel distribution vector, the width of the target image and the screen height of the test terminal.
7. The software compatibility testing method according to claim 3, before determining at least one target area corresponding to the pixel distribution vector, the method further comprises: The target image is subjected to averaging processing to obtain a corresponding binary image.
8. The software compatibility testing method according to claim 4, characterized in that: The method further comprises: In response to receiving the target software test instruction, the image to be tested of each test terminal is acquired.
9. The software compatibility testing method according to claim 8, characterized in that: The target software test instruction includes a number of divisions, and the method further includes: If the number of segmentation times is greater than 1, a target segmentation region is determined in each segmentation region, where the target segmentation region is a target region that exists in the pixel distribution vector corresponding to the segmentation region; According to the target region, a key region in the target segmentation region is extracted.
10. A software compatibility testing device, characterized in that: The device comprises: A dimension conversion module is configured to perform dimension conversion on the image to be tested corresponding to each test terminal to obtain a pixel distribution vector corresponding to each image to be tested; the image to be tested is formed based on the target page of the target software for the test terminal; A region determination module is configured to traverse the pixel distribution vector to determine at least one target region corresponding to the pixel distribution vector, wherein the target region is a region where a peak or a trough corresponding to the pixel distribution vector is located; A primary extraction module, configured to extract a key area corresponding to the image to be tested according to the at least one target area; The testing module is configured to perform compatibility testing on the target software according to the key areas corresponding to each image to be tested.
11. An electronic device, characterized in that: include: one or more processors; as well as A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the method according to any one of claims 1 to 9.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.