CN115495341A - Test method of picture recognition interface, storage medium and electronic device - Google Patents

Test method of picture recognition interface, storage medium and electronic device Download PDF

Info

Publication number
CN115495341A
CN115495341A CN202210982375.7A CN202210982375A CN115495341A CN 115495341 A CN115495341 A CN 115495341A CN 202210982375 A CN202210982375 A CN 202210982375A CN 115495341 A CN115495341 A CN 115495341A
Authority
CN
China
Prior art keywords
test
picture
target
interface
file
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
CN202210982375.7A
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.)
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Original Assignee
Qingdao Haier Technology Co Ltd
Haier Smart Home 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 Qingdao Haier Technology Co Ltd, Haier Smart Home Co Ltd filed Critical Qingdao Haier Technology Co Ltd
Priority to CN202210982375.7A priority Critical patent/CN115495341A/en
Publication of CN115495341A publication Critical patent/CN115495341A/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/3684Test management for test design, e.g. generating new test cases
    • 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

Abstract

The application discloses a test method of a picture recognition interface, a storage medium and an electronic device, which relate to the technical field of computers, and the test method of the picture recognition interface comprises the following steps: acquiring the same public information corresponding to picture identification interfaces pre-established in a test file under different test environments; acquiring a target server address corresponding to a target test environment; and performing target test on the picture recognition interface in a target test environment by using the test file according to the public information and the target server address. The invention solves the problem of lower applicability, reusability and transportability of the test script used for testing different types of picture identification interfaces under different environments in the related technology, and achieves the technical effect of improving the applicability, reusability and transportability of the test script of the picture identification interfaces.

Description

Test method of picture recognition interface, storage medium and electronic device
Technical Field
The present disclosure relates to the field of computers, and in particular, to a method for testing a picture recognition interface, a storage medium, and an electronic device.
Background
In the related art, more and more interfaces are required to be tested for the image recognition interfaces, for example, a gesture image recognition interface, a human face image recognition interface, a food material image recognition interface, a water washing label image recognition interface, a shoe image recognition interface and the like.
In the prior art, a written test script can be used for executing a test flow to test a picture identification interface, but at present, variables such as a picture path, a picture name, expected data and the like included in the test script for the picture identification interface are not parameterized, and a picture transcoding method is not extracted, that is, each interface in each test environment adopts a respective fixed single test method, so that the test scripts exist independently, only the fixed environment and the fixed interface can be tested, the test script cannot be suitable for testing different types of picture identification interfaces in different test environments, and the applicability, the reusability and the transportability are low.
Aiming at the problems of lower applicability, reusability and portability of test scripts used for testing different types of picture identification interfaces in different environments in the related art, no effective solution exists at present.
Disclosure of Invention
The embodiment of the invention provides a test method, a storage medium and an electronic device for a picture recognition interface, which at least solve the problems of low applicability, reusability and transportability of a test script used for testing the picture recognition interface.
According to an embodiment of the present invention, a method for testing a picture recognition interface is provided, including: acquiring the same public information corresponding to picture recognition interfaces which are created in advance in a test file under different test environments; acquiring a target server address corresponding to a target test environment; and performing target test on the picture identification interface in the target test environment by using the test file according to the public information and the target server address.
Optionally, before obtaining the same public information corresponding to the picture identification interface created in advance in the test file under different test environments, the method further includes: creating a test folder corresponding to the picture identification interface; the method for acquiring the same public information corresponding to the picture identification interface pre-established in the test file under different test environments comprises the following steps: acquiring the test files included in the test folder; and acquiring the public information pre-created in the test file.
Optionally, the public information includes at least one of: a common variable; acquiring a signature method for calling the picture identification interface; the method comprises the steps of obtaining picture names from a test picture folder at random, wherein the test picture folder comprises the test picture folder, the test picture folder is used for storing a first picture to be tested and a standard picture used for comparing with the first picture, and the first picture comprises the standard picture; a method for converting the picture into a target format supported by the picture identification interface; HTTP header management method.
Optionally, in a case that the public information includes a method for obtaining a signature for calling the picture recognition interface and the HTTP header management method: the HTTP information header management method comprises the step of sending the signature information acquired by the method for acquiring the signature for calling the picture recognition interface to the HTTP information header corresponding to the picture recognition interface.
Optionally, the target test includes a functional test, and performing the functional test on the picture recognition interface in the target test environment by using the test file according to the public information and the target server address includes at least one of: under the condition that the public information comprises the HTTP information header management method, calling the HTTP information header management method by using the test file, and acquiring a first parameter value corresponding to the HTTP information header; transmitting a first target parameter value into an HTTP (hyper text transport protocol) information header of the picture identification interface corresponding to the target server address by using the test file, testing the picture identification interface in the target test environment, and determining a target test result, wherein the first target parameter value comprises the first parameter value and/or a second parameter value different from the first parameter value, and the target test result comprises a check result of the first target parameter value; acquiring a third parameter value included in the picture identification interface by using the test file, wherein the third parameter value includes the common variable when the common information includes the common variable; transmitting a second target parameter value into the picture identification interface corresponding to the target server address by using the test file, testing the picture identification interface in the target test environment by using the test file, and determining a target test result, wherein the second target parameter value comprises the third parameter value and/or a fourth parameter value different from the third parameter value, and the target test result comprises a check result of the second target parameter value; acquiring names of one or more standard pictures from an expected result tag file included in the test folder by using the test file, traversing the standard pictures in the test picture folder based on the names of the standard pictures, and acquiring a target picture to be compared currently; traversing the first picture in the test picture folder by using the test file based on the expected result tag file to obtain a third picture to be tested currently and a first identification result tag of the third picture and the target picture which are stored in the expected result tag file in advance; calling the method for converting the picture into the target format supported by the picture identification interface by using the test file, and converting the formats of the target picture and the third picture into the target format; and transmitting the third picture converted into the target format and the target picture converted into the target format into the picture identification interface corresponding to the target server address by using the test file, identifying the third picture in the target test environment by using the test file to obtain a second identification result label of the third picture and the target picture, and determining a target test result according to the first identification result label and the second identification result label.
Optionally, determining a target test result according to the first identification result tag and the second identification result tag, including: determining that the target test result is successful under the condition that the first identification result is the same as the second identification result; and determining that the target test result is a failure when the first recognition result and the second recognition result are different.
Optionally, the target test includes a performance test, and when the public information includes the method for randomly obtaining the picture name from the test picture folder, the performing, according to the public information and the target server address, the performance test on the picture recognition interface in the target test environment by using the test file includes: acquiring an instruction for executing a performance test execution file, and a first number of threads which need to be concurrent for performing a performance test on the picture identification interface, wherein the performance test execution file corresponds to the target server address; randomly acquiring a fourth picture to be tested currently in the test picture folder by utilizing each thread in the first number of threads according to the method for randomly acquiring the picture name from the test picture folder; converting the format of the fourth picture into a fifth picture of the target format to be tested currently by utilizing the method of converting the picture into the target format supported by the picture identification interface by the test file; and simultaneously calling the picture identification interfaces through the first number of threads in the target test environment by using the test file to obtain a performance test result, wherein each thread in the first number of threads is used for calling the picture identification interface to identify the fifth picture, and the performance test result comprises the average response time of calling the picture identification interface by the first number of threads.
According to another embodiment of the present invention, there is provided a test apparatus for a picture recognition interface, including: the first acquisition module is used for acquiring the same public information corresponding to the picture identification interface which is created in the test file in advance under different test environments; the second acquisition module is used for acquiring a target server address corresponding to the target test environment; and the test module is used for carrying out target test on the picture identification interface in the target test environment by using the test file according to the public information and the target server address.
According to yet another embodiment of the invention, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program, when executed by a processor, performs the steps of the method as set forth in any one of the above.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
According to the invention, the public information corresponding to the picture recognition interfaces which are created in advance in the test file under different test environments is firstly obtained, the target server address corresponding to the target test environment is obtained, the picture recognition interfaces are subjected to target test in the target test environment corresponding to the target server address by using the test file according to the target server address and the public information, and then the purpose of testing the picture recognition interfaces by extracting the public information corresponding to different test environments from different types of picture recognition interfaces in the test file and finding the corresponding target test environment according to the target server address so as to test the picture recognition interfaces in the target environment can be realized. Therefore, the problem that the applicability, reusability and portability of the test scripts used for testing different types of picture identification interfaces in different environments in the related technology are low can be solved, and the technical effect of improving the applicability, reusability and portability of the test scripts of the picture identification interfaces is achieved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive labor.
Fig. 1 is a schematic diagram of a hardware environment of an interaction method of an intelligent device according to an embodiment of the present application;
FIG. 2 is a flow chart illustrating testing of an optional picture recognition interface according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a test folder structure corresponding to an optional picture recognition interface according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a test folder structure corresponding to an optional picture recognition interface according to an embodiment of the present invention;
FIG. 5 is a flow chart of an optional functional test of the picture recognition interface according to an embodiment of the present invention;
FIG. 6 is a flow chart of an optional performance test of the picture recognition interface according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a test apparatus for an optional picture recognition interface according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present application better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to one aspect of the embodiment of the application, a method for testing a picture recognition interface is provided. The method for testing the picture recognition interface is widely applied to testing scenes such as a gesture picture recognition interface, a face picture recognition interface, a food material picture recognition interface, a washing mark picture recognition interface, a shoe picture recognition interface and the like.
Optionally, in this embodiment, the method for testing the picture recognition interface may be applied to a hardware environment formed by the terminal device 102 and the server 104 as shown in fig. 1. As shown in fig. 1, a server 104 is connected to the terminal device 102 through a network, and may be configured to provide services (e.g., application services, etc.) for the terminal or a client installed on the terminal, and a database may be provided on the server or separately from the server, and is configured to provide data storage services for the server 104.
The network may include, but is not limited to, at least one of: wired network, wireless network. The wired network may include, but is not limited to, at least one of: wide area networks, metropolitan area networks, local area networks, which may include, but are not limited to, at least one of the following: WIFI (Wireless Fidelity), bluetooth. The terminal device 102 may not be limited to a PC, a mobile phone, or a tablet computer.
In this embodiment, a method for testing a picture recognition interface running on the mobile terminal is provided, and fig. 2 is a flowchart of a method for testing an optional picture recognition interface according to an embodiment of the present invention, as shown in fig. 2, the flowchart includes the following steps:
step S202, acquiring the same public information corresponding to the picture identification interface pre-created in the test file under different test environments;
the test file may be a script file for testing the picture recognition interface, or may be another file that can execute a test procedure of the picture recognition interface, where a file type of the test file is not limited. The image recognition interface may be a gesture image recognition interface, a face image recognition interface, a food material image recognition interface, a water washing mark image recognition interface, or a shoe image recognition interface, and the like, and the type of the image recognition interface is not limited herein. The different test environments may be acceptance test environments, simulation test environments, or production environments, and the type of test environment is not limited herein. The common information may be a variable or a method common to different types of picture identification interfaces in different test environments, or may be a common configuration file, and the like, where the common information is not limited herein. If the test file is a test script file, the picture recognition interface is a gesture picture recognition interface, and the public information includes a public variable and a public method, the same public variable or public method corresponding to the gesture picture recognition interface created in advance in the test script file under different test environments can be obtained.
Step S204, acquiring a target server address corresponding to a target test environment;
the target test environment may be an acceptance test environment, a simulation test environment, or a production environment, and the target server address may be a server IP address corresponding to the target test environment. Assuming that the target test environment is an acceptance test environment, the IP address of the server corresponding to the acquisition of the acceptance test environment is IP address 1.
Step S206, according to the public information and the target server address, the image recognition interface is subjected to target test in the target test environment by using the test file.
If the public information is a public variable and a public method, the address of the target server is an IP address 1, and the test file is a test script file, the corresponding target test environment can be found to be an acceptance test environment through the IP address 1, and according to the public variable and the public method, the test script is used for executing an interface test process, and the target test of the picture identification interface is realized in the acceptance test environment.
Through the steps, firstly, the public information corresponding to the picture recognition interfaces which are created in the test file in advance under different test environments is obtained, the target server addresses corresponding to the target test environments are obtained, the picture recognition interfaces are subjected to target test in the target test environments corresponding to the target server addresses by using the test file according to the target server addresses and the public information, then the public information corresponding to the different test environments of the different types of picture recognition interfaces is extracted from the test file, the corresponding target test environments are found according to the target server addresses, so that the picture recognition interfaces are tested in the target environments, and the purpose that the picture recognition interfaces are tested by sharing the same public information under the different test environments of the different types of picture recognition interfaces can be achieved. Therefore, the problem that the applicability, reusability and transportability of the test scripts used for testing different types of picture identification interfaces under different environments in the related technology are low can be solved, and the technical effect of improving the applicability, reusability and transportability of the test scripts of the picture identification interfaces is achieved.
Optionally, before obtaining the same public information corresponding to the picture recognition interface created in advance in the test file under different test environments, the method further includes: creating a test folder corresponding to the picture identification interface; the obtaining of the same public information corresponding to the picture recognition interface created in advance in the test file under different test environments includes: acquiring the test files included in the test folder; and acquiring the public information pre-created in the test file.
As an optional implementation manner, before obtaining the public information, a folder corresponding to the picture recognition interface may be created, and is used to store related files that need to be used when the picture recognition interface is tested, and if the gesture recognition picture interface is tested, the corresponding folder may be created as the gesture recognition interface folder, as shown in fig. 3, a schematic diagram of a test folder structure corresponding to an optional picture recognition interface according to an embodiment of the present invention is shown, and a test file (for example, the test script file in fig. 3) may also be stored in the test folder for unified storage and management. After the test file is stored in the test folder, the test file included in the test folder may be acquired first, and further, the common information created in advance in the test file may be acquired.
Optionally, the public information includes at least one of: a common variable; acquiring a signature method for calling the picture identification interface; the method comprises the steps of obtaining picture names from a test picture folder at random, wherein the test picture folder comprises the test picture folder, the test picture folder is used for storing a first picture to be tested and a standard picture used for comparing with the first picture, and the first picture comprises the standard picture; a method for converting the picture into a target format supported by the picture identification interface; HTTP message header management method.
As an alternative embodiment, the common information may include the same common variables that need to be used when testing the picture recognition interface, for example, the common variables may be a test picture path variable path, an interface name variable function, a timestamp variable timestamp, and the like, which are defined in the user-defined variable-common variable in fig. 4, where the selection of the common variables is not limited.
The public information may further include a method for obtaining a signature for invoking the picture recognition interface, for example, the method may be a method Sign () for obtaining a signature as shown in fig. 4, and may be used to obtain signature information Sign that needs to be used when the interface is invoked, for example, the method may be implemented by importing a third party jar package as shown in fig. 4: and g, realizing Sign, calling and acquiring a signature method Sign () through transmitting parameters appkey, clientid and timestamp, and generating signature information Sign.
The public information may further include a method for randomly acquiring a picture name from a test picture folder, such as a Random CSV Data Set configuration method as in fig. 4, and may be used to randomly acquire a picture to be tested from pre-stored picture names, such as by outputting a pictureName variable in the form of an incoming getmeasure _ pictureName.
The public information may further include a method for converting a picture into a target format supported by the picture recognition interface, where the target format may be a Base64 format, and the method for converting a picture into a target format supported by the picture recognition interface may be an ImageToBase64 () method for implementing picture conversion to Base64 in a BeanShell pre-processor as in fig. 4, and a third party jar packet may be introduced: com, test, imagedecoderbase64, transferring a parameter (test picture absolute path) and calling an imagebase 64 () method to generate a variable data (picture byte stream) in a target format, and transferring the data into a picture identification interface.
The public information may further include an HTTP header management method, where the HTTP header management method is used to extract information required in the HTTP header corresponding to the picture identification interface and transmit the extracted information to the HTTP header corresponding to the picture identification interface, for example, as shown in fig. 4, information such as variable clientid, timestamp, sign, and appid may be extracted and transmitted to the HTTP header corresponding to the picture identification interface.
Optionally, in a case that the public information includes a method for acquiring a signature for calling the picture recognition interface and the HTTP header management method: the HTTP information header management method comprises the step of sending the signature information acquired by the method for acquiring the signature for calling the picture recognition interface to the HTTP information header corresponding to the picture recognition interface.
As an optional implementation manner, in the case that the public information includes a method for acquiring a signature for calling the picture recognition interface and an HTTP header management method, the signature information may be acquired by calling the signature of the picture recognition interface, and then the signature information is acquired by using the HTTP header management method and is transmitted to an HTTP header corresponding to the picture recognition interface, that is, the HTTP header management method may acquire and transmit the signature information.
Optionally, the target test includes a functional test, and performing the functional test on the picture recognition interface in the target test environment by using the test file according to the public information and the target server address includes at least one of: under the condition that the public information comprises the HTTP information header management method, calling the HTTP information header management method by using the test file, and acquiring a first parameter value corresponding to the HTTP information header; transmitting a first target parameter value into an HTTP (hyper text transport protocol) information header of the picture identification interface corresponding to the target server address by using the test file, testing the picture identification interface in the target test environment, and determining a target test result, wherein the first target parameter value comprises the first parameter value and/or a second parameter value different from the first parameter value, and the target test result comprises a check result of the first target parameter value; acquiring a third parameter value included in the picture identification interface by using the test file, wherein the third parameter value includes the common variable when the common information includes the common variable; transmitting a second target parameter value into the picture identification interface corresponding to the target server address by using the test file, testing the picture identification interface in the target test environment by using the test file, and determining a target test result, wherein the second target parameter value comprises the third parameter value and/or a fourth parameter value different from the third parameter value, and the target test result comprises a check result of the second target parameter value; acquiring names of one or more standard pictures from an expected result tag file included in the test folder by using the test file, traversing the standard pictures in the test picture folder based on the names of the standard pictures, and obtaining a target picture to be compared currently; traversing the first picture in the test picture folder by using the test file based on the expected result tag file to obtain a third picture to be tested currently and a first identification result tag of the third picture and the target picture which are stored in the expected result tag file in advance; calling the method for converting the picture into the target format supported by the picture identification interface by using the test file, and converting the formats of the target picture and the third picture into the target format; and transmitting the third picture converted into the target format and the target picture converted into the target format into the picture identification interface corresponding to the target server address by using the test file, identifying the third picture in the target test environment by using the test file to obtain a second identification result label of the third picture and the target picture, and determining a target test result according to the first identification result label and the second identification result label.
As an optional implementation manner, according to the public information and the address of the target server, the function test may be performed on the picture identification interface in the target test environment by using the test file, where the function test may be divided into three parts, that is, the test is performed on the input parameters in the HTTP header corresponding to the picture identification interface, the test is performed on the input parameters included in the picture identification interface, and the test is performed on the identification result of the picture to be compared, which is input in the picture identification interface.
A first test scenario: when testing the input parameters in the HTTP message header corresponding to the picture recognition interface, assuming that the test file is a test script file, and under the condition that the public information includes the HTTP message header management method, the HTTP message header management method may be called by running the test script file, and a first parameter value corresponding to the HTTP message header corresponding to the picture recognition interface is obtained, where the first parameter value is used to represent a parameter value included in the HTTP message header, for example, the first parameter value may be signature information sign, timestamp information timestamp, and the like, and a value of the first parameter value is not limited here. Assuming that the address of the target server is an address a, the test environment corresponding to the address a is an acceptance test environment, the first target parameter value includes a first parameter value and/or a second parameter value different from the first parameter value, it should be noted that the first parameter value is a correct parameter value, the second parameter value is an incorrect parameter value, and the correct parameter value and the incorrect parameter value need to be respectively transmitted into the HTTP header, so as to verify that the interface can normally process the correct parameter value and complete the function of the interface when the correct first parameter value is transmitted, and a reasonable response can be made under the condition of transmitting the incorrect parameter value. Such as returning corresponding error information, etc.
If the first target parameter value is the first parameter value, the first parameter value may be transmitted to an HTTP header of the picture identification interface corresponding to the address a by running the test script file, the picture identification interface is tested in an acceptance test environment, and a target test result is determined, where the target test result may be that the interface returns expected response information or information that the parameter is wrong, and the target test result here is only a result of performing a functional test on the picture identification interface, and the form of the target test result is not limited.
Assuming that the first target parameter value is the second parameter value, the second parameter value may be transmitted to the HTTP header of the picture identification interface corresponding to the address a by running the test script file, the picture identification interface is tested in an acceptance test environment, and a target test result is determined, where the target test result may be information that the interface returns an expected error response or an accurate return code, and the target test result here is only a result of performing a functional test on the picture identification interface, and the form of the target test result is not limited.
Assuming that the first target parameter value is the first parameter value and the second parameter value, the first parameter value and the second parameter value may be transmitted to an HTTP header of the picture recognition interface corresponding to the address a by running the test script file, the picture recognition interface is tested in an acceptance test environment, and a target test result is determined, where the target test result may be that the interface returns expected response information, or may be that other response information is returned, where the target test result is only a result of performing a functional test on the picture recognition interface, and a form of the target test result is not limited.
A second test scenario: when an input parameter included in the picture identification interface is tested, assuming that the test file is a test script file, a third parameter value in the picture identification interface may be obtained through a test script, for example, the third parameter value may be a picture path information parameter path included in a common variable, or another parameter value (for example, parameter 1) not in the common variable, the second target parameter value includes a third parameter value, and/or a fourth parameter value different from the third parameter value, it needs to be noted that the third parameter value is a correct parameter value, and the fourth parameter value is an incorrect parameter value, and the correct parameter value and the incorrect parameter value need to be respectively transmitted to the picture identification interface, so as to verify that the interface can normally process the correct parameter value and complete a function of the interface when the correct third parameter value is transmitted, and a reasonable response can be made under the condition that the incorrect parameter value is transmitted. Such as returning corresponding error information, etc.
Assuming that the second target parameter value is a third parameter value, the third parameter value may be transmitted to the picture identification interface corresponding to the address a by running the test script file, the picture identification interface is tested in an acceptance test environment, and a target test result is determined, where the target test result may be information that the interface returns an expected response or information that the parameter is wrong, where the target test result is only a result of performing a functional test on the picture identification interface, and the form of the target test result is not limited.
Assuming that the second target parameter value is a fourth parameter value, the fourth parameter value may be transmitted to the picture identification interface corresponding to the address a by running the test script file, the picture identification interface is tested in an acceptance test environment, and a target test result is determined, where the target test result may be that the interface returns expected error response information or that the interface returns correct return code information, and the target test result here is only a result of performing a functional test on the picture identification interface, and the form of the target test result is not limited.
If the second target parameter value is the third parameter value and the fourth parameter value, the third parameter value and the fourth parameter value may be transmitted to the picture recognition interface corresponding to the address a by running the test script file, the picture recognition interface is tested in an acceptance test environment, and a target test result is determined, where the target test result may be that the interface returns expected response information or other response information that is not an expected result, where the target test result is only a result of performing a functional test on the picture recognition interface, and the form of the target test result is not limited.
A third test scenario: assuming that the test file is a test script file and the picture recognition interface is a gesture picture recognition interface, under the condition of testing the recognition result of the picture to be recognized input in the picture recognition interface, the name of one or more standard pictures is obtained by running the test script file (which may be a test script image-capture-adapter. Jmx in fig. 3) in an expected result tag file pre-stored in the test file. The expected result tag file may be a file in a CSV format, such as a gesture test shown in fig. 3, a CSV file, where the test folder may be a gesture recognition interface folder shown in fig. 3, and may be used for the gesture test, the CSV file acquires a name of a standard picture to be traversed, and traverses the standard picture in the test picture folder based on the name of the standard picture, and the test folder may be all gesture picture folders shown in fig. 3, so as to obtain a target picture to be currently compared. The CSV file is used for obtaining a first identification result label of the third picture and the target picture, wherein the first identification result label can be matched or not matched or other identification result labels capable of identifying the matching relationship between the third picture and the target picture, and the representation form of the identification result labels is not limited. It should be noted that formats of pictures to be tested may be many, so that all pictures to be transmitted into the interface need to be subjected to format conversion, and converted into a target format that can be supported by the picture identification interface, a test script file needs to be run to call a method for converting a picture into a target format that can be supported by the picture identification interface, and formats of a target picture and a third picture are converted into a target format, where the target format may be a base64 format, or a format that can be processed by other image identification interfaces, and the target format is not limited here. Then, the test script file can be operated to transmit the third picture data1 converted into the base64 format and the target picture data2 converted into the base64 format into the picture identification interface corresponding to the target server address, the test script file is operated to identify the third picture in a target test environment to obtain a second identification result label of the third picture and the target picture, and a target test result is determined according to the first identification result label and the second identification result label.
Optionally, determining a target test result according to the first identification result tag and the second identification result tag, including: determining that the target test result is successful under the condition that the first identification result is the same as the second identification result; and determining that the target test result is a failure when the first recognition result and the second recognition result are different.
As an optional embodiment, if the first recognition result is a match and the second recognition result is a match, it indicates that the first recognition result and the second recognition result are the same, and the target test result may be determined to be successful.
Assuming that the first recognition result is a match and the second recognition result is a mismatch, it indicates that the first recognition result and the second recognition result are different, and the target test result may be determined to be a failure.
Optionally, the target test includes a performance test, and in a case that the public information includes the method of randomly obtaining the picture name from the test picture folder, performing the performance test on the picture recognition interface in the target test environment by using the test file according to the public information and the target server address includes: acquiring an instruction for executing a performance test execution file, and a first number of threads which need to be concurrent for performing a performance test on the picture identification interface, wherein the performance test execution file corresponds to the target server address; randomly acquiring a fourth picture to be tested in the test picture folder by utilizing each thread in the first number of threads according to the method for randomly acquiring the picture name from the test picture folder; converting the format of the fourth picture into a fifth picture of the target format to be tested currently by using the method of converting the picture into the target format supported by the picture identification interface through the test file; and simultaneously calling the picture identification interfaces through the first number of threads in the target test environment by using the test file to obtain a performance test result, wherein each thread in the first number of threads is used for calling the picture identification interface to identify the fifth picture, and the performance test result comprises the average response time of calling the picture identification interface by the first number of threads.
Bat file, after obtaining the instruction that needs to execute the performance test execution file, obtaining a first number of threads that need to be concurrent for performing the performance test on the picture recognition interface, where the first number may be 100, 1000, or 10000, and there is no limitation to the first number that needs to be concurrent. Assuming that the first number is 100, a fourth picture to be tested at present can be randomly obtained in the test picture folder by using any one of the 100 threads according to a method of randomly obtaining a picture name from the test picture folder, and a test script file is run to convert the format of the fourth picture into a fifth picture in a target format to be tested at present by converting the picture into a target format supported by the picture recognition interface, and assuming that the target format is a base64 format, the format of the fourth picture can be converted into the fifth picture in a base64 to be tested at present. The method comprises the steps that a test script file is operated, a picture identification interface is called through 100 threads simultaneously in a target test environment, a performance test result is obtained, it needs to be stated that each thread of the 100 threads calling the picture identification interface simultaneously transfers a randomly acquired fourth picture into a fifth picture in a target format, the fifth picture is transferred into the picture identification interface to call the picture identification interface, different threads can share the same method for randomly acquiring picture names from a test picture folder, the same method for converting pictures into the target format supported by the picture identification interface can be called, and the fourth pictures randomly acquired by different threads can be the same or different because of random acquisition. Finally, the average response time of the picture recognition interface called by the 100 threads can be obtained through the interface response time corresponding to the 100 threads, and the performance test result of the picture recognition interface is obtained.
As an alternative embodiment, the gesture picture recognition service interface test can be used as an example, and the functions of the gesture picture recognition interface (including access parameter checking, error code verification) and the 24 basic gesture picture recognition result labels are verified to be correct and the interface performance (average response time < =1000ms, tps) can be verified under 3 test environments (acceptance, simulation, production), respectively.
Fig. 3 is a folder directory structure corresponding to a single interface when testing the single interface, where the folder name is named as the tested interface, and includes: the method comprises the steps of testing a picture folder, a testing script (which can be a meter testing script), a csv/txt file (picture name list, expected data and the like) to be tested and a performance testing script (which can be double-clicked to run a background script, and a complete performance testing report folder is automatically generated after the completion).
FIG. 4 is a diagram of a jmeter script test framework required for interface test (function & performance), where the script name is named by the interface to be tested, and the structure is as follows: under a test plan, extracting public information-public variable needed in the test, a method for acquiring a signature, a method for randomly acquiring picture names from a large number of test picture folders (performance test), a method for converting pictures into base64 and an HTTP information header manager; the 3 test environments (acceptance/simulation/production) are 6 thread groups, wherein each environment function and performance respectively establishes one thread group, and parameters of each thread group, such as thread number, test duration and the like, can be independently configured without influencing each other, and can respectively test the interface function and performance; the monitor-the number of the results and the aggregated report can analyze and check the integral test condition of each independent request and interface respectively.
Fig. 5 is an interface functional framework, which includes interface input and output parameter correctness verification, and specified picture (24 basic gestures) identification tag result verification, and is applicable to testing in each environment by only modifying and calling server and url of the corresponding environment. Fig. 5 is a flowchart illustrating an interface function test implemented in a test environment by a thread group, which may be implemented by adding a simple controller for testing parameter information in an HTTP header corresponding to a picture recognition interface. Each request may correspond to a test of a parameter, for example, a test of a signature parameter sign may be performed, and a correct sign value and an incorrect sign value may be respectively transmitted to test whether functional logic processing of the picture recognition interface on the signature parameter sign value is correct. It is also possible to test the parameter information in the picture recognition interface by adding another simple controller. Each request may correspond to a test of a parameter, for example, a test of a picture path parameter may be performed, and a correct picture path parameter and an incorrect picture path parameter may be respectively transmitted to test whether the functional logic processing of the picture path parameter value of the picture identification interface is correct. A circulation controller can be added for circularly verifying the pictures to be tested and identifying the 24 basic gesture pictures.
Fig. 6 is an interface performance testing framework, where thread attribute values such as different thread numbers and testing durations need to be configured in a thread group, and after a performance testing script (image-capture-adapter) file is double-clicked in an interface testing folder, a complete performance testing report can be automatically generated, and through comparing and analyzing various testing data, numerical indexes such as the average response duration of the interface and TPS can be obtained.
In this embodiment, a device for testing a picture recognition interface is further provided, and fig. 7 is a block diagram of a structure of a device for testing an optional picture recognition interface according to an embodiment of the present invention, where the device includes:
a first obtaining module 72, configured to obtain the same public information corresponding to the picture identification interface created in advance in the test file in different test environments;
a second obtaining module 74, configured to obtain a target server address corresponding to the target test environment;
and a testing module 76, configured to perform a target test on the image recognition interface in the target testing environment by using the test file according to the public information and the target server address.
Optionally, the apparatus further comprises: the system comprises a creating module, a testing module and a judging module, wherein the creating module is used for creating a testing folder corresponding to a picture identification interface before acquiring the same public information corresponding to the picture identification interface which is created in advance in a testing file under different testing environments; the first obtaining module further includes: a first acquisition unit configured to acquire the test file included in the test folder; a second acquisition unit configured to acquire the common information created in advance in the test file.
Optionally, the public information includes at least one of: a common variable; acquiring a signature method for calling the picture identification interface; the method comprises the steps of obtaining picture names from a test picture folder at random, wherein the test picture folder comprises the test picture folder, the test picture folder is used for storing a first picture to be tested and a standard picture used for comparing with the first picture, and the first picture comprises the standard picture; a method for converting the picture into a target format supported by the picture identification interface; HTTP header management method.
Optionally, in a case that the public information includes a method for acquiring a signature for calling the picture recognition interface and the HTTP header management method: the HTTP information header management method comprises the step of sending the signature information acquired by the method for acquiring the signature for calling the picture recognition interface to the HTTP information header corresponding to the picture recognition interface.
Optionally, the target test includes a functional test, and the test module 76 is configured to perform the functional test on the image recognition interface in the target test environment by using the test file according to the public information and the target server address in the following manner: under the condition that the public information comprises the HTTP information header management method, calling the HTTP information header management method by using the test file, and acquiring a first parameter value corresponding to the HTTP information header; transmitting a first target parameter value into an HTTP (hyper text transport protocol) header of the picture identification interface corresponding to the target server address by using the test file, testing the picture identification interface in the target test environment, and determining a target test result, wherein the first target parameter value comprises the first parameter value and/or a second parameter value different from the first parameter value, and the target test result comprises a check result of the first target parameter value; acquiring a third parameter value included in the picture identification interface by using the test file, wherein the third parameter value includes the common variable when the common information includes the common variable; transmitting a second target parameter value into the picture identification interface corresponding to the target server address by using the test file, testing the picture identification interface in the target test environment by using the test file, and determining a target test result, wherein the second target parameter value comprises the third parameter value and/or a fourth parameter value different from the third parameter value, and the target test result comprises a verification result of the second target parameter value; acquiring names of one or more standard pictures from an expected result tag file included in the test folder by using the test file, traversing the standard pictures in the test picture folder based on the names of the standard pictures, and obtaining a target picture to be compared currently; traversing the first picture in the test picture folder by using the test file based on the expected result tag file to obtain a third picture to be tested currently and a first identification result tag of the third picture and the target picture which are stored in the expected result tag file in advance; calling the method for converting the picture into the target format supported by the picture identification interface by using the test file, and converting the formats of the target picture and the third picture into the target format; and transmitting the third picture converted into the target format and the target picture converted into the target format into the picture identification interface corresponding to the target server address by using the test file, identifying the third picture in the target test environment by using the test file to obtain a second identification result label of the third picture and the target picture, and determining a target test result according to the first identification result label and the second identification result label.
Optionally, the test module 76 is configured to determine the target test result according to the first identification result tag and the second identification result tag by: determining that the target test result is successful under the condition that the first identification result is the same as the second identification result; and determining that the target test result is a failure when the first recognition result and the second recognition result are different.
Optionally, the target test includes a performance test, and in a case that the public information includes the method of randomly obtaining the picture name from the test picture folder, the test module 76 is configured to implement the performance test on the picture recognition interface in the target test environment by using the test file according to the public information and the target server address in the following manner: acquiring an instruction for executing a performance test execution file, and a first number of threads which need to be concurrent for performing a performance test on the picture identification interface, wherein the performance test execution file corresponds to the address of the target server; randomly acquiring a fourth picture to be tested currently in the test picture folder by utilizing each thread in the first number of threads according to the method for randomly acquiring the picture name from the test picture folder; converting the format of the fourth picture into a fifth picture of the target format to be tested currently by utilizing the method of converting the picture into the target format supported by the picture identification interface by the test file; and simultaneously calling the picture identification interfaces through the first number of threads in the target test environment by using the test file to obtain a performance test result, wherein each thread in the first number of threads is used for calling the picture identification interface to identify the fifth picture, and the performance test result comprises the average response time of calling the picture identification interface by the first number of threads.
It should be noted that the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.
In the present embodiment, the above-mentioned computer-readable storage medium may be configured to store a computer program for executing the steps of:
s1, acquiring the same public information corresponding to picture recognition interfaces which are created in advance in a test file under different test environments;
s2, acquiring a target server address corresponding to a target test environment;
and S3, performing target test on the picture identification interface in the target test environment by using the test file according to the public information and the target server address.
In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
In an exemplary embodiment, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
In an exemplary embodiment, the processor may be configured to execute the following steps by a computer program:
s1, acquiring the same public information corresponding to picture recognition interfaces pre-established in a test file under different test environments;
s2, acquiring a target server address corresponding to a target test environment;
and S3, performing target test on the picture identification interface in the target test environment by using the test file according to the public information and the target server address.
It will be apparent to those skilled in the art that the various modules or steps of the invention described above may be implemented using a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and they may be implemented using program code executable by the computing devices, such that they may be stored in a memory device and executed by the computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into various integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The foregoing is only a preferred embodiment of the present application and it should be noted that, as will be apparent to those skilled in the art, numerous modifications and adaptations can be made without departing from the principles of the present application and such modifications and adaptations are intended to be considered within the scope of the present application.

Claims (10)

1. A test method for a picture recognition interface is characterized by comprising the following steps:
acquiring the same public information corresponding to picture identification interfaces pre-established in a test file under different test environments;
acquiring a target server address corresponding to a target test environment;
and performing target test on the picture identification interface in the target test environment by using the test file according to the public information and the target server address.
2. The method of claim 1,
before the same public information corresponding to the picture recognition interface created in advance in the test file under different test environments is acquired, the method further includes: creating a test folder corresponding to the picture identification interface;
the obtaining of the same public information corresponding to the picture recognition interface created in advance in the test file under different test environments includes: acquiring the test files included in the test folder; and acquiring the public information pre-created in the test file.
3. The method of claim 2, wherein the common information comprises at least one of:
a common variable;
acquiring a signature method for calling the picture identification interface;
the method comprises the steps of obtaining picture names from a test picture folder at random, wherein the test picture folder comprises the test picture folder, the test picture folder is used for storing a first picture to be tested and a standard picture used for comparing with the first picture, and the first picture comprises the standard picture;
a method for converting the picture into a target format supported by the picture identification interface;
HTTP header management method.
4. The method according to claim 3, wherein in the case where the common information includes a method of obtaining a signature for calling the picture recognition interface and the HTTP header management method:
the HTTP information header management method comprises the step of sending the signature information acquired by the method for acquiring the signature for calling the picture identification interface to the HTTP information header corresponding to the picture identification interface.
5. The method of claim 3, wherein the target test comprises a functional test, and wherein performing the functional test on the picture recognition interface in the target test environment using the test file according to the public information and the target server address comprises at least one of:
under the condition that the public information comprises the HTTP information header management method, calling the HTTP information header management method by using the test file, and acquiring a first parameter value corresponding to the HTTP information header; transmitting a first target parameter value into an HTTP (hyper text transport protocol) header of the picture identification interface corresponding to the target server address by using the test file, testing the picture identification interface in the target test environment, and determining a target test result, wherein the first target parameter value comprises the first parameter value and/or a second parameter value different from the first parameter value, and the target test result comprises a check result of the first target parameter value;
acquiring a third parameter value included in the picture identification interface by using the test file, wherein the third parameter value includes the common variable when the common information includes the common variable; transmitting a second target parameter value into the picture identification interface corresponding to the target server address by using the test file, testing the picture identification interface in the target test environment by using the test file, and determining a target test result, wherein the second target parameter value comprises the third parameter value and/or a fourth parameter value different from the third parameter value, and the target test result comprises a check result of the second target parameter value;
acquiring names of one or more standard pictures from an expected result tag file included in the test folder by using the test file, traversing the standard pictures in the test picture folder based on the names of the standard pictures, and obtaining a target picture to be compared currently; traversing the first picture in the test picture folder by utilizing the test file based on the expected result tag file to obtain a third picture to be tested currently and a first identification result tag of the third picture and the target picture which are stored in the expected result tag file in advance; calling the method for converting the picture into the target format supported by the picture identification interface by using the test file, and converting the formats of the target picture and the third picture into the target format; and transmitting the third picture converted into the target format and the target picture converted into the target format into the picture identification interface corresponding to the target server address by using the test file, identifying the third picture in the target test environment by using the test file to obtain a second identification result label of the third picture and the target picture, and determining a target test result according to the first identification result label and the second identification result label.
6. The method of claim 5, wherein determining a target test result from the first recognition result tag and the second recognition result tag comprises:
determining that the target test result is successful under the condition that the first identification result is the same as the second identification result;
and determining that the target test result is a failure when the first recognition result and the second recognition result are different.
7. The method of claim 3, wherein the target test comprises a performance test, and in the case that the public information includes the method of randomly obtaining a picture name from a test picture folder, performing the performance test on the picture recognition interface in the target test environment using the test file according to the public information and the target server address comprises:
acquiring an instruction for executing a performance test execution file, and a first number of threads which need to be concurrent for performing a performance test on the picture identification interface, wherein the performance test execution file corresponds to the address of the target server;
randomly acquiring a fourth picture to be tested in the test picture folder by utilizing each thread in the first number of threads according to the method for randomly acquiring the picture name from the test picture folder;
converting the format of the fourth picture into a fifth picture of the target format to be tested currently by utilizing the method of converting the picture into the target format supported by the picture identification interface by the test file;
and simultaneously calling the picture identification interfaces through the first number of threads in the target test environment by using the test file to obtain a performance test result, wherein each thread in the first number of threads is used for calling the picture identification interface to identify the fifth picture, and the performance test result comprises the average response time of calling the picture identification interface by the first number of threads.
8. A testing device for a picture recognition interface is characterized by comprising:
the first acquisition module is used for acquiring the same public information corresponding to the picture identification interface which is created in advance in the test file under different test environments;
the second acquisition module is used for acquiring a target server address corresponding to the target test environment;
and the testing module is used for carrying out target testing on the picture identification interface in the target testing environment by using the testing file according to the public information and the target server address.
9. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, wherein the computer program, when being executed by a processor, carries out the steps of the method as claimed in any one of the claims 1 to 7.
10. An electronic device comprising a memory and a processor, wherein the memory has a computer program stored therein, and the processor is configured to execute the computer program to perform the method of any of claims 1 to 7.
CN202210982375.7A 2022-08-16 2022-08-16 Test method of picture recognition interface, storage medium and electronic device Pending CN115495341A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210982375.7A CN115495341A (en) 2022-08-16 2022-08-16 Test method of picture recognition interface, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210982375.7A CN115495341A (en) 2022-08-16 2022-08-16 Test method of picture recognition interface, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN115495341A true CN115495341A (en) 2022-12-20

Family

ID=84465673

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210982375.7A Pending CN115495341A (en) 2022-08-16 2022-08-16 Test method of picture recognition interface, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN115495341A (en)

Similar Documents

Publication Publication Date Title
US20200117692A1 (en) Systems and methods for web analytics testing and web development
CN111177005B (en) Service application testing method, device, server and storage medium
US9639444B2 (en) Architecture for end-to-end testing of long-running, multi-stage asynchronous data processing services
CN108628748B (en) Automatic test management method and automatic test management system
CN109800258B (en) Data file deployment method, device, computer equipment and storage medium
CN107241315B (en) Access method and device of bank gateway interface and computer readable storage medium
CN114500690B (en) Interface data processing method and device, electronic equipment and storage medium
CN109684052B (en) Transaction analysis method, device, equipment and storage medium
CN116155771A (en) Network anomaly test method, device, equipment, storage medium and program
CN112070608B (en) Information processing method, device, medium and electronic equipment
CN111200523A (en) Middle station system configuration method, device, equipment and storage medium
CN114745295A (en) Data acquisition method, device, equipment and readable storage medium
CN113315828A (en) Traffic recording method and device, traffic recording equipment and storage medium
CN110515855B (en) Simulation control method, server and system for application program
CN109614327B (en) Method and apparatus for outputting information
CN114328274A (en) Test template generation method and device, computer equipment and storage medium
CN115994079A (en) Test method, test device, electronic apparatus, storage medium, and program product
CN115705190A (en) Method and device for determining dependence degree
CN115242684B (en) Full-link pressure measurement method and device, computer equipment and storage medium
CN110362294A (en) Development task executes method, apparatus, electronic equipment and storage medium
CN115495341A (en) Test method of picture recognition interface, storage medium and electronic device
CN111273970B (en) Calling method, device, system, medium and electronic equipment of intelligent contract
CN114296880A (en) Service request processing method, device, equipment and medium based on large-scale cluster
CN110618943A (en) Security service test method and device, electronic equipment and readable storage medium
CN114205276B (en) Performance test method and device for product management system and electronic equipment

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