CN114116512A - Test method, test device, electronic equipment and storage medium - Google Patents

Test method, test device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114116512A
CN114116512A CN202111467550.0A CN202111467550A CN114116512A CN 114116512 A CN114116512 A CN 114116512A CN 202111467550 A CN202111467550 A CN 202111467550A CN 114116512 A CN114116512 A CN 114116512A
Authority
CN
China
Prior art keywords
test
target picture
result
picture
test equipment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111467550.0A
Other languages
Chinese (zh)
Inventor
袁子惠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Spreadtrum Communications Tianjin Co Ltd
Original Assignee
Spreadtrum Communications Tianjin Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Spreadtrum Communications Tianjin Co Ltd filed Critical Spreadtrum Communications Tianjin Co Ltd
Priority to CN202111467550.0A priority Critical patent/CN114116512A/en
Publication of CN114116512A publication Critical patent/CN114116512A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/53Querying
    • G06F16/532Query formulation, e.g. graphical querying

Abstract

The embodiment of the invention provides a test method, a test device, electronic equipment and a storage medium, wherein the method comprises the following steps: sending at least one executable instruction to the test equipment, so that the test equipment runs the at least one executable instruction to generate a running result and captures the running result to obtain a running result screenshot; receiving at least one operation result screenshot sent by the test equipment; intercepting a target picture from at least one operation result screenshot; searching a sample picture corresponding to the target picture from the established sample picture database; and comparing the target picture with the sample picture corresponding to the target picture to generate a comparison result. The embodiment of the invention receives at least one operation result screenshot sent by the test equipment, so that the electronic equipment can automatically and accurately receive all the operation result screenshots, thereby accurately and efficiently obtaining the test result and improving the test efficiency.

Description

Test method, test device, electronic equipment and storage medium
[ technical field ] A method for producing a semiconductor device
The embodiment of the invention relates to the technical field of testing, in particular to a testing method, a testing device, electronic equipment and a storage medium.
[ background of the invention ]
On part of platform operating systems, no suitable Graphical User Interface (GUI) automatic testing framework is available for replacing manual testing; the UIAutomator automatic testing frame can be used for testing the GUI on a part of platforms, but the UIAutomator automatic testing frame has the defects that some pictures cannot be obtained and controls cannot be found, and the GUI automatic testing cannot be accurately carried out. In the existing testing method, all testing pictures cannot be automatically and accurately obtained, and the testing efficiency is reduced.
[ summary of the invention ]
In view of this, embodiments of the present disclosure provide a testing method, an apparatus, an electronic device, and a storage medium, so as to improve testing efficiency.
In a first aspect, an embodiment of the present invention provides a testing method, where the method includes:
sending at least one executable instruction to test equipment, so that the test equipment runs the at least one executable instruction to generate a running result and captures the running result to obtain a running result screenshot;
receiving at least one operation result screenshot sent by the test equipment;
intercepting a target picture from at least one operation result screenshot;
searching a sample picture corresponding to the target picture from the established sample picture database;
and comparing the target picture with a sample picture corresponding to the target picture to generate a comparison result.
In a possible implementation manner, before sending the at least one executable instruction to the testing device, the method further includes:
establishing physical connection with the test equipment;
testing the test equipment through the established physical connection to determine a communication medium corresponding to the test equipment;
and establishing a communication transmission channel with the test equipment according to the communication medium.
In a possible implementation manner, after comparing the target picture with a sample picture corresponding to the target picture and generating a comparison result, the method further includes:
and generating a test report according to the comparison result.
In a possible implementation manner, after establishing a communication transmission channel with the test device according to the communication medium, the method further includes:
receiving equipment information sent by the test equipment through the communication transmission channel;
comparing the target picture with a sample picture corresponding to the target picture to generate a comparison result, and then, further comprising:
and generating a test report according to the equipment information and the comparison result.
In a possible implementation manner, after receiving at least one operation result screenshot sent by the test device, the method further includes:
receiving an operation log generated by the test equipment according to the operation condition of the executable instruction;
after comparing the target picture with the sample picture corresponding to the target picture and generating a comparison result, the method further includes:
and generating a test report according to the running log and the comparison result.
In a possible implementation manner, before sending the at least one executable instruction to the testing device, the method further includes:
establishing script data;
and analyzing the script data to generate at least one executable instruction.
In a possible implementation manner, before the searching out the sample picture corresponding to the target picture from the established sample picture database, the method further includes:
establishing a sample picture database;
and storing the sample picture to the sample picture database.
In a second aspect, an embodiment of the present invention provides a testing apparatus, including:
the test equipment comprises a first sending module, a second sending module and a control module, wherein the first sending module is used for sending at least one executable instruction to the test equipment so that the test equipment runs the at least one executable instruction to generate a running result and captures the running result to obtain a running result screenshot;
the first receiving module is used for receiving at least one operation result screenshot sent by the testing equipment;
the first interception module is used for intercepting a target picture from at least one operation result screenshot;
the first searching module is used for searching a sample picture corresponding to the target picture from the established sample picture database;
and the first generation module is used for comparing the target picture with the sample picture corresponding to the target picture to generate a comparison result.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions which, when executed by the apparatus, cause the apparatus to perform the method of testing of the first aspect or any possible implementation of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where the computer-readable storage medium includes a stored program, and when the program runs, a device in which the computer-readable storage medium is located is controlled to execute the test method in the first aspect or any possible implementation manner of the first aspect.
In the technical scheme provided by the embodiment of the invention, at least one executable instruction is sent to the test equipment, so that the test equipment runs the at least one executable instruction to generate a running result and captures the running result to obtain a running result screenshot; receiving at least one operation result screenshot sent by the test equipment; intercepting a target picture from at least one operation result screenshot; searching a sample picture corresponding to the target picture from the established sample picture database; and comparing the target picture with the sample picture corresponding to the target picture to generate a comparison result. The embodiment of the invention receives at least one operation result screenshot sent by the test equipment, so that the electronic equipment can automatically and accurately receive all the operation result screenshots, thereby accurately and efficiently obtaining the test result and improving the test efficiency.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow chart of a testing method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another testing method provided by embodiments of the present invention;
FIG. 3 is a flowchart of a method for comparing a target picture with a sample picture according to an embodiment of the present invention;
FIG. 4 is a flow chart of another method for comparing a target picture with a sample picture according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a testing apparatus according to an embodiment of the present invention;
fig. 6 is a schematic diagram of an electronic device according to an embodiment of the present invention.
[ detailed description ] embodiments
For better understanding of the technical solutions of the present invention, the following detailed descriptions of the embodiments of the present invention are provided with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" as used herein is merely one type of association that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
Fig. 1 is a flowchart of a testing method according to an embodiment of the present invention, and as shown in fig. 1, the method includes:
step 101, sending at least one executable instruction to the test equipment, so that the test equipment runs the at least one executable instruction to generate a running result, and performing screenshot on the running result to obtain a running result screenshot.
And 102, receiving at least one operation result screenshot sent by the test equipment.
And 103, intercepting a target picture from at least one operation result screenshot.
And step 104, searching a sample picture corresponding to the target picture from the established sample picture database.
And 105, comparing the target picture with the sample picture corresponding to the target picture to generate a comparison result.
In the technical scheme of the test method provided by the embodiment of the invention, at least one executable instruction is sent to the test equipment, so that the test equipment runs the at least one executable instruction to generate a running result and captures the running result to obtain a running result screenshot; receiving at least one operation result screenshot sent by the test equipment; intercepting a target picture from at least one operation result screenshot; searching a sample picture corresponding to the target picture from the established sample picture database; and comparing the target picture with the sample picture corresponding to the target picture to generate a comparison result. The embodiment of the invention receives at least one operation result screenshot sent by the test equipment, so that the electronic equipment can automatically and accurately receive all the operation result screenshots, thereby accurately and efficiently obtaining the test result and improving the test efficiency.
Fig. 2 is a flowchart of another testing method provided in the embodiment of the present invention, as shown in fig. 2, the method includes:
step 201, establishing script data, and analyzing the script data to generate at least one executable instruction.
The steps of the embodiments of the present invention may be performed by an electronic device. Electronic devices include, but are not limited to, cell phones, tablet computers, pocket PCs, desktop computers, wearable devices, and the like.
The electronic equipment establishes script data, wherein the script data comprises executable instructions; the electronic equipment analyzes the script data to generate at least one executable instruction. The executable instruction is an instruction sent by the electronic device to the testing device for the testing device to execute. The script data further comprises at least one of screenshot information of at least one operation result screenshot, picture comparison precision parameters, sending sequence of executable instructions, position information for storing the operation result screenshot or timeout duration. For example, the electronic device creates script data using a format of a json grammar.
Step 202, establishing a sample picture database, and storing the sample picture in the sample picture database.
In the embodiment of the invention, each sample picture has a unique Identity identification number (ID), and each ID consists of a script name and a character string. The electronic equipment establishes a sample picture database, and stores the sample pictures into the sample picture database in a classified manner according to the types of executable instructions, wherein the types of the executable instructions include but are not limited to clicking, vertical sliding, horizontal sliding, long pressing and the like. The database also needs to store the storage path of the sample picture, the function identification code and the resolution gray scale of the operating system and other basic picture information.
Step 203, establishing a physical connection with the test equipment.
In the embodiment of the present invention, the testing device includes, but is not limited to, a mobile phone, a tablet computer, a portable PC, a desktop computer, a wearable device, and the like. The electronic device establishes a physical connection with the test device. For example, the electronic device establishes a connection with the test device through a data line.
And step 204, testing the test equipment through the established physical connection to determine a communication medium corresponding to the test equipment.
In the embodiment of the present invention, the communication medium includes a Universal Serial Bus (USB) port and a Diag port. The electronic equipment sends at least one connection request message to the testing equipment, wherein each connection request message comprises operation platform information and a communication medium; the test equipment receives at least one connection request message, and the communication medium of the at least one connection request message is the same as the communication medium corresponding to the test equipment; if the test equipment judges that the operation platform information in the connection request message is the same as the operation platform information of the test equipment, sending a connection request return message to the electronic equipment, wherein the connection request return message is used for representing the operation platform information corresponding to the test equipment; the electronic equipment determines operation platform information corresponding to the testing equipment according to the read connection request return message; and the electronic equipment inquires the communication medium corresponding to the operating platform information corresponding to the test equipment according to the set corresponding relation between the operating platform information and the communication medium. The corresponding relation between the operation platform information and the communication medium comprises the following steps: the corresponding relation between the android platform information and the USB port, the corresponding relation between the Yocot platform information and the USB port, the corresponding relation between the YunOS platform information and the USB port and the corresponding relation between the Mocor platform information and the Diag port.
For example, the electronic device sends three connection request messages to the test device, where the operation platform information included in one connection request message is android platform information, and the communication medium is a USB port; the operation platform information included in the other connection request message is Yocot platform information, and the communication medium is a USB port; the other connection request message includes operating platform information of Mocor platform information and communication medium of Diag port. The method comprises the steps that operation platform information corresponding to test equipment is android platform information, a communication medium is a USB port, the test equipment receives at least one connection request message, the communication medium of the at least one connection request message is the same as the communication medium corresponding to the test equipment, namely the communication media are the USB ports, namely the operation platform information included in one connection request message is the android platform information, and the communication medium is the USB port; the operating platform information included in the other connection request message is Yocot platform information, and the communication medium is a USB port. And the test equipment judges that the operation platform information in the connection request message is the same as the operation platform information of the test equipment, namely the operation platform information is android platform information. The test equipment sends a connection request return message to the electronic equipment, wherein the connection request return message is "%", and the "%" is used for indicating that the operation platform information corresponding to the test equipment is android platform information. The electronic equipment determines that the operation platform information corresponding to the test equipment is android platform information according to the fact that the read connection request return message is "%", and inquires out that the communication medium corresponding to the android platform information is a USB port according to the set corresponding relation between the operation platform information and the communication medium.
Step 205, establishing a communication transmission channel with the testing device according to the communication medium.
In the embodiment of the invention, the electronic device and the testing device can perform data interaction through the established communication transmission channel, for example, the electronic device can send executable instructions and the like to the testing device according to the communication transmission channel, and the testing device can also send operation result screenshots and the like to the electronic device according to the communication transmission channel.
And step 206, receiving the device information sent by the test device through the communication transmission channel.
In the embodiment of the invention, the test equipment sends equipment information to the electronic equipment; the electronic equipment receives equipment information sent by the testing equipment through the communication transmission channel. The device information includes operating system version information of the test device. For example, when the platform of the test equipment is an Android platform, sending an Android software version number, an Android platform version number and a hardware number; when the platform of the test equipment is a Yocoto platform, sending a Yocoto software version number and a hardware number; when the platform of the testing equipment is a Mocor platform, sending a Mocor software version number and a hardware number; and when the platform of the test equipment is a YunOS platform, sending a YunOS software version number and hardware information. The electronic equipment receives equipment information sent by the testing equipment through the communication transmission channel.
And step 207, sending at least one executable instruction to the test equipment, so that the test equipment runs the at least one executable instruction to generate a running result, and performing screenshot on the running result to obtain a running result screenshot.
In the embodiment of the invention, the screenshot of the operation result is the picture of the whole screen interface of the test equipment. The electronic equipment analyzes the script data to generate at least one executable instruction, wherein the executable instruction comprises at least one of the type of the executable instruction and the initial or ending coordinate position of the operation action; the electronic equipment sequentially sends executable instructions to the test equipment; after receiving the executable instruction, the test equipment runs the executable instruction to generate a running result; the test equipment carries out screenshot on the operation result to obtain a screenshot of the operation result; the test equipment sends the operation result screenshot to the electronic equipment; and the electronic equipment receives the operation result screenshot sent by the test equipment. For example, the electronic device analyzes script data to generate a plurality of executable instructions, and sends 1 executable instruction to the test device; after receiving the 1 executable instruction, the test equipment runs the executable instruction to generate a running result; the test equipment carries out screenshot on the operation result to obtain 1 screenshot of the operation result; the test equipment sends 1 operation result screenshot to the electronic equipment; the electronic equipment receives 1 operation result screenshot sent by the testing equipment; and the electronic equipment sends the next executable instruction to the testing equipment until the electronic equipment sends the last executable instruction to the testing equipment, and receives the last operation result screenshot sent by the testing equipment.
In a possible implementation manner, the electronic device terminates the test if it receives a failure prompt sent when the test device fails to run the executable instruction. For example, the electronic device sends executable instructions to the test equipment; if the test equipment fails to operate the executable instruction, sending a failure prompt to the electronic equipment; and the electronic equipment receives the failure prompt sent by the testing equipment and terminates the test.
And step 208, receiving an operation log generated by the test equipment according to the operation condition of the executable instruction.
In the embodiment of the invention, after the test equipment receives and runs the executable instruction, the running condition of the executable instruction is monitored, and the running log is generated according to the running condition of the executable instruction. The test equipment sends the last operation result screenshot to the electronic equipment and then sends an operation log to the electronic equipment; and the electronic equipment receives an operation log generated by the test equipment according to the operation condition of the executable instruction.
And step 209, intercepting a target picture from at least one operation result screenshot.
In the embodiment of the invention, the script data further comprises screenshot information of a screenshot from at least one running result screenshot, and the screenshot information comprises position information of a target picture appearing in the running result screenshot. And the electronic equipment intercepts a target picture from at least one operation result screenshot according to screenshot information of the screenshot from at least one operation result screenshot and the ID of the at least one operation result screenshot. For example, the electronic device captures a first target picture from the first operation result screenshot according to the ID of the first operation result screenshot and screenshot information of the first operation result screenshot.
Step 210, finding out a sample picture corresponding to the target picture from the established sample picture database.
In the embodiment of the invention, the ID of the target picture is the same as the ID of the sample picture corresponding to the target picture, and if the ID of the sample picture which is the same as the ID of the target picture is searched from the sample picture database according to the ID of the target picture, the electronic equipment determines the sample picture corresponding to the target picture.
And step 211, comparing the target picture with the sample picture corresponding to the target picture to generate a comparison result.
In the embodiment of the invention, the target picture and the sample picture corresponding to the target picture are compared by adopting a histogram algorithm or a perceptual hash algorithm to generate a comparison result.
In a possible implementation manner, fig. 3 is a flowchart of a method for comparing a target picture with a sample according to an embodiment of the present invention, and as shown in fig. 3, step 211 may include:
step 2111, generating a first array according to the destination picture.
In the embodiment of the invention, the size and the color of the target picture are adjusted; dividing the adjusted target picture into at least one pixel; calculating a first gray value of each pixel in at least one pixel; generating a first average gray value according to at least one first gray value; a first array is generated according to the at least one first gray value and the first average gray value.
Wherein generating the first array according to the at least one first gray value and the first average gray value comprises: the electronic equipment judges whether the first gray value is larger than the first average gray value or not; if the first gray value is judged to be larger than the first average gray value, recording the first judgment result as a first mark; if the first gray value is judged to be smaller than the first average gray value, recording a second judgment result as a second mark; if the first gray value is equal to the first average gray value, recording a third judgment result as a third mark; after all the first gray values are judged, the electronic equipment generates a first array according to at least one of the first mark, the second mark or the third mark. The first judgment result is that the electronic device judges that the first gray value is greater than the first average gray value, the second judgment result is that the electronic device judges that the first gray value is less than the first average gray value, and the third judgment result is that the electronic device judges that the first gray value is equal to the first average gray value.
In the embodiment of the invention, for example, the electronic device adjusts the size of the target picture, simplifies the color of the picture, and adjusts the target picture into the gray picture; dividing the adjusted target picture into 64 pixels according to the size of 8 x 8; calculating a first gray value of each pixel, and calculating 64 first gray values according to 64 pixels; averaging the 64 first gray values to calculate a first average gray value; judging whether the first gray value of any pixel is greater than the first average gray value or not; if the first gray value is judged to be larger than the first average gray value, recording a first judgment result as 1; if the first gray value is judged to be smaller than the first average gray value, recording a second judgment result as 0; if the first gray value is equal to the first average gray value, recording a third judgment result as 0.5; and after judging the 64 first gray values, generating a first array according to at least one of judged 1, 0 or 0.5.
And step 2112, generating a second array according to the sample picture.
In the embodiment of the invention, the size and the picture color of the sample picture are adjusted; dividing the adjusted sample picture into at least one pixel; calculating a second gray value of each pixel of the at least one pixel; generating a second average gray value according to at least one second gray value; and generating a second array according to the at least one second gray value and the second average gray value.
Wherein generating the second array according to the at least one second gray value and the second average gray value comprises: the electronic equipment judges whether the second gray value is larger than the second average gray value or not; if the second gray value is larger than the second average gray value, recording a fourth judgment result as a first mark; if the second gray value is smaller than the second average gray value, recording a fifth judgment result as a second mark; and if the second gray value is equal to the second average gray value, recording a sixth judgment result as a third mark. The electronic device generates a second array from at least one of the first tag, the second tag, or the third tag. The fourth judgment result is that the electronic device judges that the second gray value is greater than the second average gray value, the fifth judgment result is that the electronic device judges that the second gray value is smaller than the second average gray value, and the sixth judgment result is that the electronic device judges that the second gray value is equal to the second average gray value.
In the embodiment of the invention, for example, the electronic device adjusts the size of the sample picture, simplifies the picture color, and adjusts the sample picture into the gray picture; dividing the adjusted sample picture into 64 pixels according to the size of 8 x 8; calculating a second gray value of each pixel, and calculating 64 second gray values according to 64 pixels; averaging the 64 second gray values to calculate a second average gray value; comparing the 64 gray values with the second average gray value respectively, and judging whether the second gray value of a certain pixel is larger than the second average gray value or not; if the second gray value is larger than the second average gray value, recording a fourth judgment result as 1; if the second gray value is smaller than the second average gray value, recording a fifth judgment result as 0; if the second gray value is equal to the second average gray value, recording a sixth judgment result as 0.5; after judging 64 second gray values, generating a second array according to at least one of judged '1', '0' or '0.5'.
And step 2113, generating a first image similarity according to the first array and the second array.
In the embodiment of the invention, the electronic equipment counts out a first number of the first array with the same identification at the same position as that of the second array, and generates a first picture similarity according to the ratio of the first number to the second number; wherein the second number is the number of all marks in the first array or the number of all marks in the second array, and the mark is at least one of the first mark, the second mark or the third mark. For example, the first array includes at least one first mark and at least one second mark, and the electronic device counts the total number of all the first marks and all the second marks in the first array as a second number.
In a possible implementation manner, fig. 4 is a flowchart of another method for comparing a target picture with a sample picture according to an embodiment of the present invention, as shown in fig. 4, step 211 may include:
and step 2114, generating a first histogram according to the target picture.
In the embodiment of the invention, the electronic equipment adjusts the size and the color of the target picture; generating at least one pixel value according to the adjusted target picture; a first histogram is generated based on at least one pixel value. For example, the electronic device adjusts the size of the target picture and adjusts the target picture into a grayscale picture; generating at least one pixel value according to the adjusted target picture, wherein the type of each pixel value is a floating point type; a first histogram is generated from one or more pixel values.
And step 2115, generating a second histogram according to the sample picture.
In the embodiment of the invention, the electronic equipment adjusts the size and the color of the sample picture; generating at least one pixel value according to the adjusted sample picture; a second histogram is generated from the at least one pixel value. For example, the electronic device adjusts the size of the sample picture, and the sample picture is adjusted to be a gray picture; generating at least one pixel value according to the adjusted sample picture, wherein the type of each pixel value is a floating point type; a first histogram is generated from one or more pixel values.
And step 2116, generating a second image similarity according to the first histogram and the second histogram.
In the embodiment of the present invention, the formula for generating the second picture similarity is as follows:
Figure BDA0003392183360000131
Figure BDA0003392183360000132
k is 1, 2; wherein d (H)1,H2) Is the second picture similarity, H1Is a first histogram, H2Is a second histogram, H1(I) For any one pixel value in the first histogram,
Figure BDA0003392183360000133
is the average of all pixel values in the first histogram, H2(I) For any pixel value in the second histogram,
Figure BDA0003392183360000134
is the average of all pixel values in the second histogram.
And step 212, generating a test report according to the comparison result.
In the embodiment of the invention, the electronic equipment generates the test report according to the comparison result, and the test report comprises at least one comparison result.
Or, in another possible implementation manner, the electronic device generates a test report according to the operation log and the comparison result, where the test report includes the operation log and the comparison result.
Or, in another possible implementation manner, the electronic device generates a test report according to the device information and the comparison result, where the test report includes the device information and the comparison result.
Or, in another possible implementation manner, the electronic device generates a test report according to the device information, the operation log, and the comparison result, where the test report includes the device information, the operation log, and the comparison result.
In one embodiment, step 206 and step 208 may be performed before step 212.
In the technical scheme of the test method provided by the embodiment of the invention, at least one executable instruction is sent to the test equipment, so that the test equipment runs the at least one executable instruction to generate a running result and captures the running result to obtain a running result screenshot; receiving at least one operation result screenshot sent by the test equipment; intercepting a target picture from at least one operation result screenshot; searching a sample picture corresponding to the target picture from the established sample picture database; and comparing the target picture with the sample picture corresponding to the target picture to generate a comparison result. The embodiment of the invention receives at least one operation result screenshot sent by the test equipment, so that the electronic equipment can automatically and accurately receive all the operation result screenshots, thereby accurately and efficiently obtaining the test result and improving the test efficiency.
Compared with the prior art, the method can be used for automatically testing the GUI in a plurality of platforms such as a Mocor platform, a Yocoto platform, an Android platform and the like, so that manual testing is replaced.
Fig. 5 is a schematic structural diagram of a testing apparatus according to an embodiment of the present invention, and as shown in fig. 5, the testing apparatus includes: the device comprises a sending module 11, a first receiving module 12, an intercepting module 13, a searching module 14 and a first generating module 15.
The first sending module 11 is connected to the first receiving module 12, the first receiving module 12 is connected to the first truncating module 13, the first truncating module 13 is connected to the first searching module 14, and the first searching module 14 is connected to the first generating module 15.
The first sending module 11 is configured to send at least one executable instruction to the test device, so that the test device runs the at least one executable instruction to generate a running result, and captures the running result to obtain a running result screenshot; the first receiving module 12 is configured to receive at least one operation result screenshot sent by the testing device; the first interception module 13 is configured to intercept a target picture from at least one operation result screenshot; the first searching module 14 is configured to search a sample picture corresponding to the target picture from the established sample picture database; the first generating module 15 is configured to compare the target picture with a sample picture corresponding to the target picture, and generate a comparison result.
In the embodiment of the present invention, the apparatus further includes: a first establishing module 16, a determining module 17 and a second establishing module 18.
The first establishing module 16 is connected with the determining module 17, and the determining module 17 is connected with the second establishing module 18.
The first establishing module 16 is used for establishing physical connection with the test equipment; the determining module 17 is configured to perform a test with the testing device through the established physical connection to determine a communication medium corresponding to the testing device; the second establishing module 18 is configured to establish a communication transmission channel with the testing device according to the communication medium.
In the embodiment of the present invention, the apparatus further includes: a second generation module 19.
The second generation module 19 is connected to the first generation module 15.
The second generating module 19 is configured to generate a test report according to the comparison result.
In the embodiment of the present invention, the apparatus further includes: the second receiving module 20 and the third generating module 21.
The second receiving module 20 is connected to the second establishing module 18 and the first sending module 11, and the third generating module 21 is connected to the first generating module 15.
The second receiving module 20 is configured to receive device information sent by the test device through the communication transmission channel; the third generating module 21 is configured to generate a test report according to the device information and the comparison result.
In the embodiment of the present invention, the apparatus further includes: a third receiving module 22 and a fourth generating module 23.
The third receiving module 22 is connected to the first receiving module 12 and the first intercepting module 13, and the fourth generating module 23 is connected to the first generating module 15.
The third receiving module 22 is configured to receive an operation log generated by the testing device according to the operation condition of the executable instruction; the fourth generating module 23 is configured to generate a test report according to the running log and the comparison result.
In the embodiment of the present invention, the apparatus further includes: a third establishing module 24 and a fifth generating module 25.
The third establishing module 24 is connected to the fifth generating module 25, and the fifth generating module 25 is connected to the first sending module 11.
The third establishing module 24 is used for establishing script data; the fifth generating module 25 is configured to parse the script data to generate at least one executable instruction.
In the embodiment of the present invention, the apparatus further includes: a fourth building module 26 and a database storage module 27.
The fourth building module 26 is connected to the database storage module 27, and the database storage module 27 is connected to the first sending module 11.
The fourth establishing module 26 is configured to establish a sample picture database; the database storage module 27 is configured to store the sample picture in the sample picture database.
In the technical scheme of the testing device provided by the embodiment of the invention, at least one executable instruction is sent to the testing equipment, so that the testing equipment runs the at least one executable instruction to generate a running result and captures the running result to obtain a running result screenshot; receiving at least one operation result screenshot sent by the test equipment; intercepting a target picture from at least one operation result screenshot; searching a sample picture corresponding to the target picture from the established sample picture database; and comparing the target picture with the sample picture corresponding to the target picture to generate a comparison result. The embodiment of the invention receives at least one operation result screenshot sent by the test equipment, so that the electronic equipment can automatically and accurately receive all the operation result screenshots, thereby accurately and efficiently obtaining the test result and improving the test efficiency.
The embodiment of the invention provides a computer-readable storage medium, which includes a stored program, wherein when the program runs, the electronic device where the computer-readable storage medium is located is controlled to execute the embodiment of the test method.
An embodiment of the present invention provides an electronic device, including: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions which, when executed by the electronic device, cause the electronic device to perform embodiments of the testing method described above.
Fig. 6 is a schematic diagram of an electronic device according to an embodiment of the present invention. As shown in fig. 6, the electronic apparatus 2 of the embodiment includes: the processor 31, the memory 32, and the computer program 33 stored in the memory 32 and capable of running on the processor 31, where the computer program 33 is executed by the processor 31 to implement the testing method in the embodiment, and in order to avoid repetition, the detailed description is omitted here.
The electronic device 2 includes, but is not limited to, a processor 31, a memory 32. Those skilled in the art will appreciate that fig. 6 is merely an example of the electronic device 2 and does not constitute a limitation of the electronic device 2 and may include more or fewer components than shown, or combine certain components, or different components, e.g., a network device may also include an input-output device, a network access device, a bus, etc.
The Processor 31 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 32 may be an internal storage unit of the electronic device 2, such as a hard disk or a memory of the electronic device 2. The memory 32 may also be an external storage device of the electronic device 2, such as a plug-in hard disk provided on the electronic device 2, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory 32 may also include both an internal storage unit and an external storage device of the electronic device 2. The memory 32 is used to store computer programs and other programs and data required by the network device. The memory 32 may also be used to temporarily store data that has been output or is to be output.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions in actual implementation, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a computer readable storage medium and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) or a Processor (Processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned computer-readable storage media comprise: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method of testing, comprising:
sending at least one executable instruction to test equipment, so that the test equipment runs the at least one executable instruction to generate a running result and captures the running result to obtain a running result screenshot;
receiving at least one operation result screenshot sent by the test equipment;
intercepting a target picture from at least one operation result screenshot;
searching a sample picture corresponding to the target picture from the established sample picture database;
and comparing the target picture with a sample picture corresponding to the target picture to generate a comparison result.
2. The method of claim 1, wherein prior to sending the at least one executable instruction to the test device, further comprising:
establishing physical connection with the test equipment;
testing the test equipment through the established physical connection to determine a communication medium corresponding to the test equipment;
and establishing a communication transmission channel with the test equipment according to the communication medium.
3. The method according to claim 1, wherein after comparing the target picture with the sample picture corresponding to the target picture and generating a comparison result, the method further comprises:
and generating a test report according to the comparison result.
4. The method of claim 2, wherein after establishing the communication transmission channel with the testing device according to the communication medium, further comprising:
receiving equipment information sent by the test equipment through the communication transmission channel;
comparing the target picture with a sample picture corresponding to the target picture to generate a comparison result, and then, further comprising:
and generating a test report according to the equipment information and the comparison result.
5. The method of claim 1, wherein after receiving at least one screenshot of the run result sent by the test device, further comprising:
receiving an operation log generated by the test equipment according to the operation condition of the executable instruction;
after comparing the target picture with the sample picture corresponding to the target picture and generating a comparison result, the method further includes:
and generating a test report according to the running log and the comparison result.
6. The method of claim 1, wherein prior to sending the at least one executable instruction to the test device, further comprising:
establishing script data;
and analyzing the script data to generate at least one executable instruction.
7. The method of claim 1, wherein before the step of searching the sample picture corresponding to the target picture from the established sample picture database, the method further comprises:
establishing a sample picture database;
and storing the sample picture to the sample picture database.
8. A test apparatus, comprising:
the sending module is used for sending at least one executable instruction to the test equipment so that the test equipment runs the at least one executable instruction to generate a running result and captures the running result to obtain a running result screenshot;
the first receiving module is used for receiving at least one operation result screenshot sent by the testing equipment;
the intercepting module is used for intercepting a target picture from at least one operation result screenshot;
the searching module is used for searching a sample picture corresponding to the target picture from the established sample picture database;
and the first generation module is used for comparing the target picture with the sample picture corresponding to the target picture to generate a comparison result.
9. An electronic device, comprising: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions which, when executed by the apparatus, cause the apparatus to perform the testing method of any of claims 1 to 7.
10. A computer-readable storage medium, comprising a stored program, wherein the program, when executed, controls an apparatus in which the computer-readable storage medium is located to perform the testing method of any of claims 1 to 7.
CN202111467550.0A 2021-12-03 2021-12-03 Test method, test device, electronic equipment and storage medium Pending CN114116512A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111467550.0A CN114116512A (en) 2021-12-03 2021-12-03 Test method, test device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111467550.0A CN114116512A (en) 2021-12-03 2021-12-03 Test method, test device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114116512A true CN114116512A (en) 2022-03-01

Family

ID=80366338

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111467550.0A Pending CN114116512A (en) 2021-12-03 2021-12-03 Test method, test device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114116512A (en)

Similar Documents

Publication Publication Date Title
KR20190026641A (en) Method of character recognition of claims document, apparatus, server and storage medium
KR102002024B1 (en) Method for processing labeling of object and object management server
CN111309618B (en) Page element positioning method, page testing method and related devices
CN110675940A (en) Pathological image labeling method and device, computer equipment and storage medium
CN112100431A (en) Evaluation method, device and equipment of OCR system and readable storage medium
CN112732567B (en) Mock data testing method and device based on ip, electronic equipment and storage medium
CN110288755A (en) The invoice method of inspection, server and storage medium based on text identification
CN112559341A (en) Picture testing method, device, equipment and storage medium
CN113378835A (en) Labeling model training method, sample labeling method and related device
CN112241739A (en) Method, device, equipment and computer readable medium for identifying text errors
CN111881740A (en) Face recognition method, face recognition device, electronic equipment and medium
CN110826646A (en) Robot vision testing method and device, storage medium and terminal equipment
CN112286780B (en) Method, device, equipment and storage medium for testing recognition algorithm
CN116431468A (en) Test method, test device, test processing equipment and storage medium
CN114116512A (en) Test method, test device, electronic equipment and storage medium
CN113342627B (en) Application service monitoring method and monitoring system of terminal
JP2022185143A (en) Text detection method, and text recognition method and device
WO2022105120A1 (en) Text detection method and apparatus from image, computer device and storage medium
CN112257768B (en) Method and device for identifying illegal financial pictures and computer storage medium
US11657489B2 (en) Segmentation of continuous dynamic scans
CN105302715A (en) Application user interface acquisition method and apparatus
CN112966671A (en) Contract detection method and device, electronic equipment and storage medium
CN109753217B (en) Dynamic keyboard operation method and device, storage medium and electronic equipment
CN112287738A (en) Text matching method and device for graphic control, medium and electronic equipment
CN113627399B (en) Topic processing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination