Decoding test method and device for multi-dimensional code page

By automating the decoding test of multiple QR code pages, the key parameter fields and values ​​of the QR code image are obtained and judged, which solves the problem of low testing efficiency in the existing technology and realizes efficient and accurate QR code parameter testing.

CN114692032BActive Publication Date: 2025-12-23HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210322670.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-30
Publication Date
2025-12-23
Estimated Expiration
2042-03-30

AI Technical Summary

Technical Problem

In existing technologies, testing multiple QR code pages manually or by sampling is inefficient and incomplete, resulting in excessively long testing times.

Method used

By acquiring each QR code image from multiple QR code pages, determining its key parameter fields and values, judging whether it matches the preset parameter fields and values, generating decoding test results, and realizing automated verification.

Benefits of technology

It improves the efficiency and accuracy of QR code parameter correctness testing, reduces labor costs, and solves the problems of excessively long testing time and incomplete testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114692032B_ABST
    Figure CN114692032B_ABST
Patent Text Reader

Abstract

The application provides a multi-two-dimensional code page decoding test method and device. The method first acquires each two-dimensional code picture in a multi-two-dimensional code page to be tested, and then determines a key parameter field and a key parameter value corresponding to each two-dimensional code picture. For each two-dimensional code picture, it is judged whether the key parameter value corresponding to the key parameter field matches the parameter value corresponding to the preset parameter field, and a judgment result of the two-dimensional code picture is obtained. Finally, a decoding test result of the multi-two-dimensional code page to be tested is generated according to the judgment results of all two-dimensional code pictures, the automatic verification of the decoding content of the two-dimensional code in the multi-two-dimensional code page scene is realized, the test efficiency and accuracy of the correctness of the two-dimensional code parameters are effectively improved, the labor cost is reduced, and the problems of long test time and incompleteness caused by testing the page with multiple two-dimensional codes by using the manual or sampling method are solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and particularly relates to a decoding test method and device for a multi-two-dimensional code page. BACKGROUND

[0002] With the continuous development of science and technology, two-dimensional codes, as a new information storage, transmission and identification technology, have been widely applied. The application of two-dimensional codes greatly improves the speed of data acquisition and information processing, improves the working and living environment of people, and makes an important contribution to the scientific and modern management.

[0003] At present, for a Web page containing multiple two-dimensional codes, and each two-dimensional code has a one-to-one or one-to-many corresponding relationship with the fields of the page, for example, each name corresponds to a two-dimensional code, and each state corresponds to a two-dimensional code. Generally, artificial testing or sampling testing is used to check the decoding content of the two-dimensional codes in the page. However, artificial testing is low in efficiency and time-consuming; although sampling testing can reduce the testing time, it cannot be tested comprehensively. SUMMARY

[0004] To solve the problem that the existing artificial or sampling method is used to test the page containing multiple two-dimensional codes, resulting in long and incomplete testing time, the present application provides a decoding test method and device for a multi-two-dimensional code page.

[0005] To achieve the above-mentioned purpose, the embodiments of the present application provide the following technical solutions:

[0006] The present application discloses a decoding test method for a multi-two-dimensional code page, comprising:

[0007] Obtaining each two-dimensional code picture in the multi-two-dimensional code page to be tested;

[0008] Respectively determining the key parameter field and the key parameter value corresponding to each two-dimensional code picture;

[0009] For each two-dimensional code picture, respectively judging whether the key parameter value corresponding to the key parameter field matches the parameter value corresponding to the preset parameter field, to obtain the judgment result of the two-dimensional code picture;

[0010] According to the judgment results of all the two-dimensional code pictures, a decoding test result of the multi-two-dimensional code page to be tested is generated.

[0011] Optionally, in the decoding test method for the multi-two-dimensional code page, obtaining each two-dimensional code picture in the multi-two-dimensional code page to be tested comprises:

[0012] determine a page structure of the multi-two-dimensional code page to be tested and an html structure of the two-dimensional code picture;

[0013] perform global traversal in the page structure of the multi-two-dimensional code page to be tested based on the html structure of the two-dimensional code picture, to obtain each page element matched with the html structure of the two-dimensional code picture;

[0014] obtain each two-dimensional code picture in the multi-two-dimensional code page to be tested according to each matched page element.

[0015] Optionally, in the multi-two-dimensional code page decoding test method, the determination of the page structure of the multi-two-dimensional code page to be tested comprises:

[0016] determining upper and lower page limits of the two-dimensional code page to be tested;

[0017] obtaining the page structure of each two-dimensional code page in the upper and lower page limits respectively, to obtain the page structure of the multi-two-dimensional code page to be tested.

[0018] Optionally, in the multi-two-dimensional code page decoding test method, after obtaining each two-dimensional code picture in the multi-two-dimensional code page to be tested, the method further comprises:

[0019] respectively analyzing picture information of each two-dimensional code picture to obtain an analysis result;

[0020] judging whether the two-dimensional code picture contains a two-dimensional code according to the analysis result, and eliminating the picture not containing the two-dimensional code.

[0021] Optionally, in the multi-two-dimensional code page decoding test method, before the picture information of each two-dimensional code picture is analyzed to obtain the analysis result, the method further comprises:

[0022] respectively pre-processing each two-dimensional code picture; the pre-processing comprises one or more of improving picture brightness, improving picture sharpness, and improving picture contrast.

[0023] Optionally, in the multi-two-dimensional code page decoding test method, the determination of the key parameter field and the key parameter value corresponding to each two-dimensional code picture comprises:

[0024] performing a decoding and chain conversion operation on the two-dimensional code picture to obtain a decoding and chain conversion result of the two-dimensional code picture;

[0025] decoupling the decoding and chain conversion result based on a preset parameter feature to obtain a decoupling result of the decoding and chain conversion result;

[0026] Extract the key parameter field and the key parameter value in the decoupling result, to obtain the key parameter field and the key parameter value corresponding to the two-dimensional code picture.

[0027] Optionally, in the multi-two-dimensional code page decoding test method, judging whether the key parameter value corresponding to the key parameter field of the two-dimensional code picture matches the parameter value corresponding to the preset parameter field comprises:

[0028] Determining the field label corresponding to the key parameter field of the two-dimensional code picture;

[0029] Inputting the field label into a preset label library for traversal, to obtain a label parameter value matching the field label;

[0030] Judging whether the label parameter value is the same as the key parameter value of the two-dimensional code picture;

[0031] If the judgment result is the same, it is determined that the key parameter value corresponding to the key parameter field of the two-dimensional code picture matches the parameter value corresponding to the preset parameter field;

[0032] If the judgment result is not the same, it is determined that the key parameter value corresponding to the key parameter field of the two-dimensional code picture does not match the parameter value corresponding to the preset parameter field.

[0033] Optionally, in the multi-two-dimensional code page decoding test method, according to the judgment results of all the two-dimensional code pictures, a decoding test result of the multi-two-dimensional code page to be tested is generated, comprising:

[0034] Determining a preset automatic test report library for generating test results;

[0035] Inputting the judgment results of all the two-dimensional code pictures into the preset automatic test report library, to generate the decoding test result of the multi-two-dimensional code page to be tested.

[0036] The second aspect of the present application discloses a multi-two-dimensional code page decoding test device, comprising:

[0037] An acquisition unit is configured to acquire each two-dimensional code picture in a multi-two-dimensional code page to be tested;

[0038] A determination unit is configured to determine the key parameter field and the key parameter value corresponding to each two-dimensional code picture, respectively;

[0039] A judgment unit is configured to judge, for each two-dimensional code picture, whether the key parameter value corresponding to the key parameter field matches the parameter value corresponding to the preset parameter field, to obtain a judgment result of the two-dimensional code picture;

[0040] The generating unit is configured to generate a decoding test result of the multi-two-dimensional code page to be tested according to the judgment results of all the two-dimensional code pictures.

[0041] Optionally, the multi-two-dimensional code page decoding test device further comprises:

[0042] The analyzing unit is configured to analyze the picture information of each two-dimensional code picture respectively to obtain an analysis result.

[0043] The rejecting unit is configured to determine whether the two-dimensional code picture contains a two-dimensional code according to the analysis result, and to reject the picture that does not contain a two-dimensional code.

[0044] The multi-two-dimensional code page decoding test method provided by the application comprises the following steps: obtaining each two-dimensional code picture in a multi-two-dimensional code page to be tested; determining a key parameter field and a key parameter value corresponding to each two-dimensional code picture; judging, for each two-dimensional code picture, whether the key parameter value corresponding to the key parameter field of the two-dimensional code picture matches a parameter value corresponding to a preset parameter field to obtain a judgment result of the two-dimensional code picture; and generating a decoding test result of the multi-two-dimensional code page to be tested according to the judgment results of all the two-dimensional code pictures. The method realizes automatic verification of two-dimensional code decoding content in a multi-two-dimensional code page scenario, effectively improves the test efficiency and accuracy of the correctness of two-dimensional code parameters, reduces the labor cost, and solves the problems of long test time and incomprehensive test caused by testing a page containing multiple two-dimensional codes by using manual or sampling methods. BRIEF DESCRIPTION OF DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only the embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative labor based on the provided drawings.

[0046] Figure 1 A flowchart of a multi-two-dimensional code page decoding test method provided by the application;

[0047] Figure 2 A flowchart of a two-dimensional code picture acquisition method provided by the application;

[0048] Figure 3 A flowchart of a key parameter field and key parameter value determination method provided by the application;

[0049] Figure 4A flowchart for determining whether the key parameter value corresponding to the key parameter field of the two-dimensional code picture matches the parameter value corresponding to the preset parameter field is provided for the embodiments of the present application.

[0050] Figure 5 A flowchart for generating a decoding test result of a to-be-tested multi-two-dimensional code page is provided for the embodiments of the present application.

[0051] Figure 6 A flowchart for another decoding test method of a multi-two-dimensional code page is provided for the embodiments of the present application.

[0052] Figure 7 A structural schematic diagram of a decoding test device of a multi-two-dimensional code page is provided for the embodiments of the present application. DETAILED DESCRIPTION

[0053] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present application.

[0054] The embodiments of the present application provide a decoding test method of a multi-two-dimensional code page to solve the problem of long and incomplete test time caused by testing a page with multiple two-dimensional codes by using manual or sampling methods.

[0055] Referring to Figure 1 , the decoding test method of the multi-two-dimensional code page mainly includes the following steps:

[0056] S100, acquiring each two-dimensional code picture in a to-be-tested multi-two-dimensional code page.

[0057] The to-be-tested multi-two-dimensional code page is a web page with multiple two-dimensional codes that needs to be tested for two-dimensional code decoding. The two-dimensional code in the web page has a one-to-one or one-to-many correspondence with a certain field in the web page.

[0058] It should be noted that the to-be-tested multi-two-dimensional code page can be a certain page of a web end, of course, but is not limited to this, and can also be other web pages, which are not limited in the present application and are within the protection scope of the present application.

[0059] In actual application, the specific process of executing step S100, acquiring each two-dimensional code picture in a to-be-tested multi-two-dimensional code page, can be as shown in Figure 2 , mainly including steps S200 to S206.

[0060] S200, determine the page structure of the multi-two-dimensional code page to be tested and the html structure of the two-dimensional code picture.

[0061] Wherein, the upper and lower page limits of the two-dimensional code page to be tested can be determined first, and then the page structure of each two-dimensional code page in the upper and lower page limits is obtained respectively to obtain the page structure of the multi-two-dimensional code page to be tested. Specifically, after entering the two-dimensional code page to be tested, the page structure of the two-dimensional code page to be tested can be obtained through the element inspection function of the chrome browser.

[0062] It should be noted that assuming that a name corresponds to a two-dimensional code in a page, when the number of names is too large and one Web page cannot accommodate them, multiple Web pages are needed to display them, therefore, the upper and lower limits of the page to be tested are determined to facilitate subsequent global traversal of the html structure of the two-dimensional code picture in the page structure of the multi-two-dimensional code page to be tested.

[0063] In actual application, after the page structure of the multi-two-dimensional code page to be tested is determined, the elements required for locating the two-dimensional code picture can be located using the method in the selenium library. For example, if the two-dimensional code is in a <div id=main>QR code address structure, the element can be located by setting the value of id, and then the html structure of the multi-two-dimensional code page to be tested containing the two-dimensional code picture is constructed by combining the elements required for locating the two-dimensional code picture.

[0064] S202, based on the global traversal of the html structure of the two-dimensional code picture in the page structure of the multi-two-dimensional code page to be tested, obtain each page element matched with the html structure of the two-dimensional code picture.

[0065] In actual application, the global traversal of the html structure of the two-dimensional code picture in the page structure of the multi-two-dimensional code page to be tested can be performed to obtain each page element matched with the html structure of the two-dimensional code picture.

[0066] S204, according to each matched page element, obtain each two-dimensional code picture in the multi-two-dimensional code page to be tested.

[0067] In actual application, the related content of each two-dimensional code in the multi-two-dimensional code page to be tested is usually represented in the form of canvas (canvas) in html, which cannot be directly downloaded, so the to Data URL() method in js (JavaScript) is used to convert the canvas into base64 encoding format png, and the DataURL is returned for downloading to the server.

[0068] In other words, a preset image conversion method can be used to convert each QR code image in the multi-QR code page to PNG format.

[0069] It should be noted that the specific code for using the `to Data URL()` method in JavaScript to convert the canvas to a base64 encoded PNG and return a `DataURL` for download can be as follows:

[0070] var strDataURI=oCanvas.toDataURL();

[0071] / / returns

[0072] "data:image / png;base64,iuhaodfihpXXXXOFPOIoiuhfdaooXXXuuuhhqwek..."

[0073] S102. Determine the key parameter fields and key parameter values ​​corresponding to each QR code image.

[0074] In practical applications, the specific process of executing step S102, which involves determining the key parameter fields and values ​​corresponding to each QR code image, can be as follows: Figure 3 As shown, it mainly includes steps S300 to S304.

[0075] S300. Perform decoding and linking operations on the QR code image to obtain the decoding and linking result of the QR code image.

[0076] The ultra-lightweight qrdecode module can be used to decode and convert QR code images. The qrdecode.decode(filename) method completes the decoding and conversion process, yielding the decoded and converted QR code image. Specifically, Decode represents the content parameter to be recognized in the QR code, filename represents the name of the QR code image, and the return value is the recognized information (string type).

[0077] S302. Decouple the decoding and chaining results based on preset parameter features to obtain the decoupled results of the decoding and chaining results.

[0078] In practical applications, the decoding and chaining results can be decoupled by performing multiple string splitting operations based on preset parameter characteristics to obtain the decoupled result of the decoding and chaining results.

[0079] Among them, the preset parameter features can be determined according to the specific application environment and user needs. They are mainly the parameter features that can distinguish each QR code image in the multi-QR code page to be tested.

[0080] It should be noted that the specific program code for obtaining the decoupled result of the decoding and chaining can be as follows:

[0081] import qrdecode

[0082] def decode(filename):

[0083] res=qrdecode.decode(filename)

[0084] s1 = res.split("?")

[0085] s2 = s1[1].split("&")

[0086] s3=[]

[0087] for i in range(0,len(s2)):

[0088] s3.append(s2[i].split("="))

[0089] return s3

[0090] S304. Extract the key parameter fields and key parameter values ​​from the decoupling results to obtain the key parameter fields and key parameter values ​​corresponding to the QR code image.

[0091] In practical applications, after obtaining the decoupling results of the decoding and chaining, the key parameter fields and key parameter values ​​in the decoupling results can be extracted, and the extracted key parameter fields and key parameter values ​​can be correlated with the corresponding QR code images to obtain the key parameter fields and key parameter values ​​corresponding to each QR code image.

[0092] S104. For each QR code image, determine whether the key parameter value corresponding to its key parameter field matches the parameter value corresponding to the preset parameter field, and obtain the judgment result of the QR code image.

[0093] In practical applications, the specific process of determining whether the key parameter values ​​of the key parameter fields of a QR code image match the parameter values ​​of the preset parameter fields can be as follows: Figure 4 As shown, the main steps include the following:

[0094] S400, Determine the field labels corresponding to the key parameter fields of the QR code image.

[0095] In practical applications, the field labels corresponding to the key parameter fields of QR code images are pre-set by the user based on different key parameter fields. QR code images with the same key parameter fields have the same field labels.

[0096] S402, input the field label into the preset label library for traversal to obtain a label parameter value matched with the field label.

[0097] In practical application, the label parameter value matched with the field label is also preset, and the label parameter values matched with different field labels are different.

[0098] It should be noted that the field labels preset according to different key parameter fields are stored in the preset label library, and then the field label corresponding to the determined key field is traversed in the preset label library to obtain the label parameter value matched with the field label.

[0099] It should be further noted that if the label parameter value matched with the field label cannot be obtained after traversing the preset label library, it can be directly determined that the key parameter value corresponding to the key parameter field of the two-dimensional code picture does not match the parameter value corresponding to the preset parameter field.

[0100] S404, judge whether the label parameter value is the same as the key parameter value of the two-dimensional code picture.

[0101] In practical application, the matched label parameter value and the key parameter value of the two-dimensional code picture can be compared to determine whether the key parameter value corresponding to the key parameter field of the two-dimensional code picture matches the parameter value corresponding to the preset parameter field.

[0102] If the judgment result is the same, step S406 is executed; if the judgment result is not the same, step S408 is executed.

[0103] S406, determine that the key parameter value corresponding to the key parameter field of the two-dimensional code picture matches the parameter value corresponding to the preset parameter field.

[0104] In practical application, if the label parameter value is the same as the key parameter value of the two-dimensional code picture, it means that the key parameter value corresponding to the two-dimensional code passes the decoding test.

[0105] S408, determine that the key parameter value corresponding to the key parameter field of the two-dimensional code picture does not match the parameter value corresponding to the preset parameter field.

[0106] In practical application, if the label parameter value is not the same as the key parameter value of the two-dimensional code picture, it means that the key parameter value corresponding to the two-dimensional code does not pass the decoding test.

[0107] S106, generate a decoding test result of the multi-two-dimensional code page to be tested according to the judgment results of all two-dimensional code pictures.

[0108] In actual applications, the specific process of generating the decoding test result of the multi-two-dimensional code page according to the judgment results of all the two-dimensional code pictures in step S106 can be as shown in the following table: Figure 5 The specific process mainly includes the following steps:

[0109] S500, determine the preset automatic test report library for generating the test result.

[0110] In actual applications, the preset automatic test report library can be BeautifulReport, but is not limited to this. The preset automatic test report library can also be determined according to specific application environments and user needs, which is not limited in the present application and is within the protection scope of the present application.

[0111] S502, input the judgment results of all the two-dimensional code pictures into the preset automatic test report library to generate the decoding test result of the multi-two-dimensional code page.

[0112] In actual applications, the judgment results of all the two-dimensional code pictures can be input into the preset automatic test report library, and the decoding test result of the multi-two-dimensional code page can be generated by using the test report generation function of the preset automatic test report library.

[0113] Based on the above principle, the decoding test method of the multi-two-dimensional code page provided in the embodiment first acquires each two-dimensional code picture in the multi-two-dimensional code page to be tested, and then determines the key parameter field and the key parameter value corresponding to each two-dimensional code picture. For each two-dimensional code picture, it is judged whether the key parameter value corresponding to the key parameter field matches the parameter value corresponding to the preset parameter field, and the judgment result of the two-dimensional code picture is obtained. Finally, the decoding test result of the multi-two-dimensional code page to be tested is generated according to the judgment results of all the two-dimensional code pictures, which realizes the automatic verification of the decoding content of the two-dimensional code in the multi-two-dimensional code page scene, effectively improves the test efficiency and accuracy of the correctness of the two-dimensional code parameters, reduces the labor cost, and solves the problem of long test time and incomprehensive test caused by manual or sampling test on the page with multiple two-dimensional codes.

[0114] In addition, the decoding test method of the multi-two-dimensional code page provided in the present application can also be used for testing different systems and different pages under the condition of meeting the application conditions, and has wide adaptability.

[0115] Optionally, in another embodiment provided in the present application, after step S100 of acquiring each two-dimensional code picture in the multi-two-dimensional code page to be tested, referring to Figure 6 the decoding test method of the multi-two-dimensional code page can further include:

[0116] S600, respectively analyze the picture information of each two-dimensional code picture to obtain an analysis result.

[0117] In practical applications, the picture information of each two-dimensional code picture can be sequentially parsed using pyzbar.decode(img) to obtain the parsing results of each two-dimensional code picture.

[0118] Of course, the picture information of the two-dimensional code picture can also be parsed using other existing methods, and the specific method of parsing is not limited in the application and is within the protection scope of the application.

[0119] In practical applications, before performing step S600 and parsing each two-dimensional code picture to obtain the parsing results, each two-dimensional code picture can be preprocessed to improve the accuracy of subsequent elimination of two-dimensional code pictures according to the parsing results.

[0120] The preprocessing method can include one or more of improving the brightness of the picture, improving the sharpness of the picture, and improving the contrast of the picture.

[0121] Specifically, the brightness of the picture can be improved by configuring specific parameters using ImageEnhance.Brightness(img).enhance(2.0), the sharpness of the picture can be improved by configuring specific parameters using ImageEnhance.Sharpness(img).enhance(17.0), and the contrast of the picture can be improved by configuring specific parameters using ImageEnhance.Contrast(img).enhance(4.0).

[0122] Of course, it is not limited to this, and other existing methods can also be used to improve the brightness, sharpness, and contrast of the picture, and the application does not make specific limitations, which are within the protection scope of the application.

[0123] In practical applications, the specific program code for preprocessing the two-dimensional code picture can be as follows:

[0124] import pyzbar.pyzbar as pyzbar

[0125] def compare():

[0126] list_imgs=open_img()

[0127] for_img in list_imgs:

[0128] img=Image.open(_img)

[0129] img = ImageEnhance.Brightness(img).enhance(2.0) # increase brightness

[0130] img = ImageEnhance.Sharpness(img).enhance(17.0) # sharpen

[0131] img = ImageEnhance.Contrast(img).enhance(4.0) # increase contrast

[0132] img = img.convert('L') # grayscale

[0133] contains = pyzbar.decode(img)

[0134] if not contains:

[0135] return False

[0136] S602、According to the analysis result, it is judged whether the two-dimensional code picture contains a two-dimensional code, and the picture without containing a two-dimensional code is rejected.

[0137] In practical application, whether the two-dimensional code picture contains a two-dimensional code can be judged according to whether the analysis result is empty. If the analysis result is empty, it is judged that the two-dimensional code picture does not contain a two-dimensional code; if the analysis result is not empty, it is judged that the two-dimensional code picture contains a two-dimensional code.

[0138] It should be noted that the picture without containing a two-dimensional code is rejected to improve the accuracy of decoding test.

[0139] Based on the decoding test method of the multiple two-dimensional code page provided in the above embodiment, taking the chrome browser as an example, the decoding test method of the multiple two-dimensional code page is implemented as follows:

[0140] A: The html structure of the page to be tested can be viewed by shortcut key F12 to review elements, and the loop traversal logic is constructed according to the position of the two-dimensional code and the corresponding field in the html structure. And according to the test expectation, set the expected value of the parameter in the field corresponding to the two-dimensional code, which is used for the verification module.

[0141] B: According to the preset loop traversal logic, read the picture part and the corresponding field part in the html structure. Through the to Data URL() method in js, request the front-end interface to convert the pattern of the canvas part in html (mostly two-dimensional code) into base64 encoded format png, and then return the DataURL data. The browser driver directly downloads the two-dimensional code Data URL to the server for storage, and stores the relationship between the Data URL and the corresponding field.

[0142] C: Take out the picture and field data stored in the server, and clean the data through the data processing module to remove non-two-dimensional code pictures. First, use ImageEnhance.Brightness(img).enhanc(2.0), ImageEnhance.Sharpness(img).enhance(17.0), and ImageEnhance.Contrast(img).enhance(4.0) to configure specific parameters to improve the brightness, sharpness, and contrast of the picture to improve the cleaning accuracy. Then use pyzbar.decode(img) to analyze the picture in sequence. For the pictures that are parsed as empty, they are judged as non-two-dimensional codes, and the related data is cleared to release space. For the pictures that are successfully parsed, they are judged as two-dimensional codes, and the next decoding and chain operation is performed.

[0143] D: Use the qrdecode.decode(filename) method to complete all two-dimensional code decoding and chain conversion, and perform multiple string cutting operations to decouple according to the parameter characteristics, extract the key parameter field and value, and establish the relationship between each two-dimensional code related parameter and the corresponding field.

[0144] E: According to the last output data, compare the expected value of the parameter in the corresponding two-dimensional code field set in the test start stage one by one, and output True / False result.

[0145] F: Form a test report according to the output judgment data.

[0146] Optionally, another embodiment of the present application also provides a multi-two-dimensional code page decoding test device, please refer to Figure 7 , which mainly includes:

[0147] The acquisition unit 100 is used for acquiring each two-dimensional code picture in the multi-two-dimensional code page to be tested.

[0148] The determination unit 102 is used for determining the key parameter field and the key parameter value corresponding to each two-dimensional code picture, respectively.

[0149] The judgment unit 104 is configured to judge, for each two-dimensional code picture, whether the key parameter value corresponding to the key parameter field of the two-dimensional code picture matches the parameter value corresponding to the preset parameter field, to obtain a judgment result of the two-dimensional code picture.

[0150] The generation unit 106 is configured to generate a decoding test result of the multi-two-dimensional code page to be tested according to the judgment results of all the two-dimensional code pictures.

[0151] Optionally, the acquisition unit 100 is specifically configured to:

[0152] determine the page structure of the multi-two-dimensional code page to be tested and the html structure of the two-dimensional code picture.

[0153] perform global traversal of the page structure of the multi-two-dimensional code page to be tested based on the html structure of the two-dimensional code picture, to obtain each page element matched with the html structure of the two-dimensional code picture.

[0154] obtain each two-dimensional code picture in the multi-two-dimensional code page to be tested according to each matched page element.

[0155] Optionally, the acquisition unit 100 is specifically configured to, when determining the page structure of the multi-two-dimensional code page to be tested:

[0156] determine the upper and lower page limits of the two-dimensional code page to be tested.

[0157] acquire the page structure of each two-dimensional code page in the upper and lower page limits respectively, to obtain the page structure of the multi-two-dimensional code page to be tested.

[0158] Optionally, the apparatus further comprises:

[0159] The analysis unit is configured to analyze the picture information of each two-dimensional code picture respectively, to obtain an analysis result.

[0160] The elimination unit is configured to judge, according to the analysis result, whether the two-dimensional code picture contains a two-dimensional code, and eliminate the picture that does not contain a two-dimensional code.

[0161] Optionally, the apparatus further comprises:

[0162] The preprocessing unit is configured to pre-process each two-dimensional code picture respectively, and the preprocessing includes one or more of improving the brightness of the picture, improving the sharpness of the picture, and improving the contrast of the picture.

[0163] Optionally, the determination unit 102 is specifically configured to:

[0164] perform decoding and link conversion operation on the two-dimensional code picture, to obtain a decoding and link conversion result of the two-dimensional code picture.

[0165] The decoding chain switching result is decoupled based on a preset parameter feature, to obtain a decoupling result of the decoding chain switching result.

[0166] The key parameter field and the key parameter value in the decoupling result are extracted, to obtain the key parameter field and the key parameter value corresponding to the two-dimensional code picture.

[0167] Optionally, the judging unit 104 is specifically configured to:

[0168] The field label corresponding to the key parameter field of the two-dimensional code picture is determined.

[0169] The field label is input into a preset label library for traversal, to obtain a label parameter value matching the field label.

[0170] It is judged whether the label parameter value is the same as the key parameter value of the two-dimensional code picture.

[0171] If the judgment result is the same, it is determined that the key parameter value corresponding to the key parameter field of the two-dimensional code picture matches the parameter value corresponding to the preset parameter field.

[0172] If the judgment result is not the same, it is determined that the key parameter value corresponding to the key parameter field of the two-dimensional code picture does not match the parameter value corresponding to the preset parameter field.

[0173] Optionally, the generating unit 106 is specifically configured to:

[0174] A preset automatic test report library for generating test results is determined.

[0175] The judgment results of all two-dimensional code pictures are input into the preset automatic test report library, to generate a decoding test result of the multi-two-dimensional code page to be tested.

[0176] The decoding test device for a multi-two-dimensional code page provided in this embodiment is configured to: the obtaining unit 104 is configured to obtain each two-dimensional code picture in the multi-two-dimensional code page to be tested; the determining unit 102 is configured to determine the key parameter field and the key parameter value corresponding to each two-dimensional code picture, respectively; the judging unit 104 is configured to judge, for each two-dimensional code picture, whether the key parameter value corresponding to the key parameter field matches the parameter value corresponding to the preset parameter field, to obtain a judgment result of the two-dimensional code picture; and the generating unit 106 is configured to generate a decoding test result of the multi-two-dimensional code page to be tested according to the judgment results of all two-dimensional code pictures, to realize automatic verification of two-dimensional code decoding content in a multi-two-dimensional code page scenario, effectively improve test efficiency and accuracy, reduce labor costs, and solve the problem of long test time and incomprehensive test caused by testing a page with multiple two-dimensional codes by using manual or sampling methods.

[0177] Optionally, another embodiment of the present application also provides an electronic device, comprising: a processor and a memory, wherein:

[0178] The memory is configured to store computer instructions;

[0179] The processor is configured to execute the computer instructions stored in the memory, and specifically execute the decoding test method of the multi-two-dimensional code page according to any one of the above embodiments.

[0180] It should be noted that the related description of the decoding test method of the multi-two-dimensional code page can be referred to the corresponding embodiment, and will not be repeated here. Figures 1 to 6 The corresponding embodiment can be referred to, and will not be repeated here.

[0181] Optionally, another embodiment of the present application also provides a storage medium for storing a program, wherein the program is executed to implement the decoding test method of the multi-two-dimensional code page according to any one of the above embodiments.

[0182] It should be noted that the related description of the decoding test method of the multi-two-dimensional code page can be referred to the corresponding embodiment, and will not be repeated here. Figures 1 to 6 The corresponding embodiment can be referred to, and will not be repeated here.

[0183] The features described in each of the embodiments in the specification can be replaced or combined with each other, and the same or similar parts between each of the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. Especially, for the system or system embodiment, since it is basically similar to the method embodiment, it is described more simply, and the related part can be referred to the part of the method embodiment. The system and system embodiment described above are only illustrative, and the units described as separate components can be or can not be physically separated, and the components displayed as units can be or can not be physical units, that is, they can be located in one place, or can be distributed to multiple network units. According to the actual needs, part or all of the modules can be selected to achieve the purpose of the embodiment. Those skilled in the art can understand and implement without creative labor.

[0184] The professional person can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the present text can be realized by electronic hardware, computer software or combination of both. In order to clearly show the interchangeability of hardware and software, the components and steps of each example have been described in the above description. Whether the functions are realized by hardware or software depends on the specific application and design constraints of the technical solution. The professional person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0185] The foregoing description of the disclosed embodiments enables one skilled in the art to make or use the application. Numerous modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein can be applied to other embodiments without the use of the innovation falling outside the spirit or scope of the application. Therefore, the present application is not intended to be limited to the described embodiments, but rather is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

[0186] It is also to be noted that, as used in the specification and the appended claims, the singular forms "a," "an" and "the" include plural referents unless the context clearly dictates otherwise. Thus, for example, reference to "a component" or "the component" can include a plurality of such components unless the context clearly dictates otherwise. Additionally, the words "comprise," "comprises," and "comprising" and the like are to be construed in an inclusive sense, as opposed to an exclusive or exhaustive sense, unless the context dictates otherwise. Additionally, references to "a" or "an" item or "the" item are to be taken not to mean a single item, but rather one or more items, unless the context dictates otherwise. Further, to the extent that any definition or usage of a term is provided by TTA or by the U.S. Patent Office Glossary, that definition or usage is incorporated herein by reference.

Claims

1. A method of decoding a multi-two-dimensional code page, characterized by, The method comprises the following steps: Obtaining each two-dimensional code picture in a to-be-tested multi-two-dimensional code page; the to-be-tested multi-two-dimensional code page is a web page containing multiple two-dimensional codes and requiring two-dimensional code decoding test; Respectively determining the key parameter field and the key parameter value corresponding to each two-dimensional code picture, comprising: performing decoding and link conversion on the two-dimensional code picture to obtain a decoding and link conversion result of the two-dimensional code picture; decoupling the decoding and link conversion result based on a preset parameter feature to obtain a decoupling result of the decoding and link conversion result; extracting the key parameter field and the key parameter value in the decoupling result to obtain the key parameter field and the key parameter value corresponding to the two-dimensional code picture; For each two-dimensional code picture, respectively judging whether the key parameter value corresponding to the key parameter field matches the parameter value corresponding to the preset parameter field to obtain a judgment result of the two-dimensional code picture; Generating a decoding test result of the to-be-tested multi-two-dimensional code page according to the judgment results of all the two-dimensional code pictures.

2. The method of claim 1, wherein, Obtaining each two-dimensional code picture in a to-be-tested multi-two-dimensional code page comprises the following steps: Determining the page structure of the to-be-tested multi-two-dimensional code page and the html structure of the two-dimensional code picture; Performing global traversal in the page structure of the to-be-tested multi-two-dimensional code page based on the html structure of the two-dimensional code picture to obtain each page element matching the html structure of the two-dimensional code picture; Obtaining each two-dimensional code picture in the to-be-tested multi-two-dimensional code page according to each matched page element.

3. The method of claim 2, wherein, The method further comprises the following steps: Determining the upper and lower page limits of the to-be-tested multi-two-dimensional code page; Respectively obtaining the page structure of each two-dimensional code page in the upper and lower page limits to obtain the page structure of the to-be-tested multi-two-dimensional code page. After obtaining each two-dimensional code picture in the to-be-tested multi-two-dimensional code page, the method further comprises the following steps:

4. The method of claim 1, wherein, Respectively analyzing the picture information of each two-dimensional code picture to obtain an analysis result; Judging whether the two-dimensional code picture contains a two-dimensional code according to the analysis result, and eliminating the picture not containing a two-dimensional code. Before respectively analyzing the picture information of each two-dimensional code picture to obtain an analysis result, the method further comprises the following steps:

5. The method of claim 4, wherein, Respectively pre-processing each two-dimensional code picture; the pre-processing comprises one or more of improving picture brightness, improving picture sharpness, and improving picture contrast. The method further comprises the following steps:

6. The method of claim 1, wherein, Determining the field label corresponding to the key parameter field of the two-dimensional code picture; Inputting the field label into a preset label library for traversal to obtain a label parameter value matching the field label; Judging whether the label parameter value is the same as the key parameter value of the two-dimensional code picture; If the judgment result is the same, it is determined that the key parameter value corresponding to the key parameter field of the two-dimensional code picture matches the parameter value corresponding to the preset parameter field. ​ If the determination result is not the same, it is determined that the key parameter value corresponding to the key parameter field of the two-dimensional code picture does not match the parameter value corresponding to the preset parameter field.

7. The method of claim 1, wherein, According to the determination results of all the two-dimensional code pictures, a decoding test result of the to-be-tested multi-two-dimensional code page is generated, including: A preset automatic test report library for generating test results is determined; The determination results of all the two-dimensional code pictures are input into the preset automatic test report library to generate the decoding test result of the to-be-tested multi-two-dimensional code page.

8. A multi-two-dimensional-code page decoding test device, characterized by comprising: Including: An acquisition unit is configured to acquire each two-dimensional code picture in a to-be-tested multi-two-dimensional code page; the to-be-tested multi-two-dimensional code page is a web page containing multiple two-dimensional codes and requiring two-dimensional code decoding test; A determination unit is configured to determine the key parameter field and the key parameter value corresponding to each two-dimensional code picture, including: performing decoding and link conversion on the two-dimensional code picture to obtain a decoding and link conversion result of the two-dimensional code picture; decoupling the decoding and link conversion result based on a preset parameter feature to obtain a decoupling result of the decoding and link conversion result; and extracting the key parameter field and the key parameter value in the decoupling result to obtain the key parameter field and the key parameter value corresponding to the two-dimensional code picture; A judgment unit is configured to judge, for each two-dimensional code picture, whether the key parameter value corresponding to the key parameter field matches the parameter value corresponding to the preset parameter field to obtain a determination result of the two-dimensional code picture; A generation unit is configured to generate a decoding test result of the to-be-tested multi-two-dimensional code page according to the determination results of all the two-dimensional code pictures.

9. The apparatus for decoding test of multi two-dimensional code page according to claim 8, wherein, Further including: An analysis unit is configured to analyze the picture information of each two-dimensional code picture to obtain an analysis result; A rejection unit is configured to determine, according to the analysis result, whether the two-dimensional code picture contains a two-dimensional code, and to reject the picture that does not contain a two-dimensional code.

Citation Information

Patent Citations

  • Page testing method and device

    CN110232021A