Voice assistant resource search test method and device, platform, equipment and medium
By introducing test server and configuration file recognition technology into the voice assistant functional test platform, the problem of testing relies on natural language understanding and long test cycles in the existing technology is solved, and efficient and accurate voice assistant resource search test is achieved, which is suitable for Multi-machine testing and rapid iteration of projects.
Patent Information
- Application Number
- CN202411295854.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2024-12-17
AI Technical Summary
The existing technology relies on the accuracy of natural language understanding programs when testing voice assistants to search resources, resulting in recognition bias; the test cycle is long and difficult to compatible with multi-machine testing, and cannot adapt to the project rhythm of fast iteration and fast distribution; high development and maintenance costs , poor flexibility.
By introducing a test server into the voice assistant functional test platform, using resource data tables to build a test case collection, directly extracting data from the database to form test cases, omitting natural language understanding technology; the test client executes page jump, and the test server executes Result verification, realizes asynchronous execution and decoupling; uses configuration files to store resource types and identification, and performs result verification through text recognition.
It improves the accuracy of search resource testing, shortens the test cycle, supports multiple machines to simultaneous testing, reduces development and maintenance costs, and is suitable for the rapid iteration of project rhythm.
Smart Images

Figure CN119149424A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence and voice assistant function testing technology, and specifically to a testing method, device, platform, equipment and medium for voice assistant resource search. Background Art
[0002] At present, in the scenario of testing voice assistant search resources, it is usually manually awakened or automatically played on the client side, and then the audio is processed by the natural language understanding program, and then the client calls the downstream resource search server to return the search results. However, there are many problems with this method, such as: First, this method is very dependent on the accuracy of the natural language understanding program and the audio. Often the same audio case will be recognized as different results, resulting in serious deviations in search resources; second, test cases can usually only be executed sequentially on a single machine, which requires a longer test cycle, and this method is also difficult to be compatible with multi-machine testing, and cannot be applied to projects with fast iterations and releases; third, when the test client displays different resources, it is necessary to develop a large amount of code to parse the structure tree, which has high development and maintenance costs and poor flexibility. Summary of the invention
[0003] To solve the above problems, the present application provides a testing method, device, platform, equipment and medium for voice assistant resource search to overcome or at least partially overcome the shortcomings of the prior art.
[0004] This application adopts the following technical solutions:
[0005] In a first aspect, the present application provides a test method for a voice assistant resource search, the method being implemented through a voice assistant function test platform, the voice assistant function test platform comprising: a test server, a resource search terminal, and at least one test client, wherein the test server is respectively connected to the resource search terminal and each of the test clients in communication; the method is applied to the test server; the method comprises:
[0006] Constructing a request body according to the resource information of any test case in the test case set, and sending it to the interface to be tested of the resource search end to request the target resource path information, wherein the test case set is pre-constructed based on the resource data table, and the test case is a text format test case containing resource information;
[0007] Constructing a test message based on the resource information and the target resource path information, and sending the message to at least one target test client in a notification manner to request feedback information, wherein the feedback information at least includes: a screenshot of the resource page, a resource type, and a preset resource identifier;
[0008] The target resource test information is identified from the resource page screenshot according to the preloaded configuration file and the resource type in the feedback information, and the test result is determined according to the target resource test information and the preset resource identifier in the feedback information.
[0009] Optionally, in the above method, the test case set is constructed according to the following method:
[0010] Summarizing the resource types in the resource data table to obtain a resource type list;
[0011] Traverse the resource type list, and for the traversed resource type, randomly read the resource information of a resource from the resource data table, or read the resource information of a resource with the smallest resource ID as the test case corresponding to the currently traversed resource type, wherein the resource information includes: resource ID, resource type, and preset resource identifier.
[0012] Optionally, in the above method, constructing a request body according to resource information of any test case in the test case set includes:
[0013] For a test case, parse the resource ID and resource type from the resource information of the test case;
[0014] A request body is constructed in a form recognizable by the interface to be tested, wherein the request body includes a resource ID and a resource type.
[0015] Optionally, in the above method, the target resource path information is generated and returned by the resource search end according to the following method:
[0016] Parse the request body to obtain the target resource ID and target resource type carried in the request body;
[0017] According to the target resource ID, the resource database is searched to obtain the location path of the target resource;
[0018] The target resource path information is generated based on the page jump protocol format corresponding to the target resource type and the location path of the target resource.
[0019] Optionally, in the above method, constructing a test message based on the resource information and the target resource path information, and sending the test message to at least one target test client in the form of a notification, includes:
[0020] Obtaining a client identification code of at least one target test client;
[0021] Constructing at least one test message, wherein the test message includes: a client identification code, target resource path information, resource type, and a preset resource identifier;
[0022] According to the client identification code, the test message is sent to at least one of the target test clients in a notification manner.
[0023] Optionally, in the above method, the feedback message is generated and returned by the target test client according to the following method:
[0024] Parsing the test message to obtain resource type, target resource path information, and preset resource identifier;
[0025] Parsing the target resource path information to obtain the target resource location path, and jumping to the target resource interface according to the target resource location path;
[0026] Taking a screenshot of the target resource interface to obtain a screenshot of the target resource interface;
[0027] Generate feedback information, which includes: client identification code, target resource interface screenshot, resource type, and preset resource identifier.
[0028] Optionally, in the above method, identifying the target resource test information from the resource page screenshot according to the preloaded configuration file and the resource type in the returned information includes:
[0029] Read the corresponding configuration file according to the resource type in the returned information;
[0030] According to the location information in the configuration file, cutting out a corresponding sub-area in the resource page screenshot;
[0031] The target resource test information is identified from the sub-area using text recognition technology.
[0032] Optionally, the method further includes: if it is determined that the resource type in the feedback information does not belong to the test case set, directly determining the test result as failed;
[0033] or,
[0034] If the target resource test information cannot be identified from the sub-area, the test result is directly determined to be failed.
[0035] Optionally, in the above method, determining the test result according to the target resource test information and a preset resource identifier in the returned information includes:
[0036] If the target resource test information is consistent with the preset resource identifier, determining that the test result is passed;
[0037] If the target resource name is inconsistent with the preset resource identifier, the test result is determined to be failed.
[0038] In a second aspect, the present application also provides a test device for voice assistant resource search, the device comprising:
[0039] A resource request unit, used to construct a request body according to the resource information of any test case in the test case set, and send it to the interface to be tested of the resource search end to request the target resource path information, wherein the test case set is pre-constructed based on the resource data table, and the test case is a text format test case containing resource information;
[0040] A return request unit, configured to construct a test message based on the resource information and the target resource path information, and send the message to at least one target test client in a notification manner to request return information, wherein the return information at least includes: a screenshot of the resource page, a resource type, and a preset resource identifier;
[0041] The result analysis unit is used to identify the target resource test information from the resource page screenshot according to the preloaded configuration file and the resource type in the feedback information, and determine the test result according to the target resource test information and the preset resource identifier in the feedback information.
[0042] In a third aspect, the present application further provides a voice assistant function testing platform, the voice assistant function testing platform comprising: a testing server, a resource search terminal, and at least one testing client, wherein the testing server is respectively connected to the resource search terminal and each of the testing clients in a communication manner; wherein the testing server is deployed with the above-mentioned voice assistant resource search testing device;
[0043] The resource search end is used to search for resources according to the request body sent by the test server, and generate the target resource path information according to the search results and return it to the test server;
[0044] The test client is used to execute page jump, screenshot, and information reorganization according to the test information sent by the test server, generate feedback information, and return it to the test server.
[0045] In a fifth aspect, the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any of the above-mentioned voice assistant resource search test methods is implemented.
[0046] In a sixth aspect, the present application provides a computer-readable storage medium, which stores a computer program, and the computer program, when instructed by a processor, implements any of the above-mentioned voice assistant resource search test methods.
[0047] At least one of the above technical solutions adopted in this application can achieve the following beneficial effects:
[0048] The present application provides a voice assistant function testing platform, in which a test server is added between a test client and a resource search terminal, which is used to execute the voice assistant resource search testing method of the present application; and a test case set is constructed in advance, which is a set of multiple test cases in text form constructed according to a resource data table, and the test cases contain resource information of the resources. When testing the resource search function of the voice assistant, the test server reads any test case from the test case set, and then constructs a request body that can be recognized by the interface to be tested of the resource search end according to the resource information of the test case, and sends it to the interface to be tested; after receiving the request body, the resource search end performs a resource search, and generates the target resource path information according to the search results and returns it to the test server; the test server receives the target resource path information fed back by the resource search end, constructs a test message, and sends it to one or more target test clients in the form of a notification to request the return information of the target test client. The target test client performs page jump, screenshot, and information reorganization according to the test information sent by the test server to generate return information, and returns it to the test server. The return information at least includes: a screenshot of the resource page, a resource type, and a preset resource identifier; the test server identifies the target resource test information from the resource page screenshot according to the preloaded configuration file and the resource type in the return information, and finally, the test result is judged according to the target resource test information and the preset resource identifier in the return information. First, the present application changes the test cases in audio form to directly extract data from the real database table to form a test case set, uses the parameters in the resource data table as text test cases, and then initiates an interface request to the search resource end, thereby omitting the natural language understanding technology for audio recognition procedures, eliminating the test's dependence on audio results, and realizing the decoupling of the test of the natural language understanding program in the voice assistant and the test of the search resource program, thereby improving the accuracy of the search resource test; second, in the present application, the resource page jump is executed by the test client and the result verification is executed by the test server, realizing the asynchronous execution and decoupling of the page jump and the result verification, shortening the test cycle, and this method does not interfere with the tests between multiple machines, realizing simultaneous testing of multiple machines, which is more suitable for the current fast iteration and fast release of project rhythm; third, the "resource type-identification location area on the page" is stored in the form of a configuration file, realizing text recognition of the specified area of the page in the form of a configuration file, and comparing the recognition result with the preset resource identifier, thereby obtaining the test result, avoiding the development and maintenance of a large amount of parsing structure tree code, and reducing the testing cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0050] Figure 1 A schematic diagram of a scenario for testing a voice assistant function according to the prior art is shown;
[0051] Figure 2 A structural schematic diagram of a voice assistant function testing platform according to an embodiment of the present application is shown;
[0052] Figure 3 A flow chart of a method for testing a voice assistant resource search according to an embodiment of the present application is shown;
[0053] Figure 4 is a schematic diagram showing a business process of a test server executing result verification according to an embodiment of the present application;
[0054] Figure 5 A schematic diagram of the structure of a test device for voice assistant resource search according to an embodiment of the present application is shown;
[0055] Figure 6 A schematic structural diagram of a computer device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0057] Figure 1 A schematic diagram of a scenario for testing a voice assistant function according to the prior art is shown. Figure 1 It can be seen that in the prior art, the test client and the search resource end are usually directly connected. In the scenario of testing the voice assistant to search for resources, the test client is usually manually awakened or the audio is automatically played, and then the audio is processed and recognized by the natural language understanding program, and then the downstream search resource end is called. After searching for resources, the search resource end returns the resource path (schema) or sends the schema to the test client through adb. The voice assistant of the test client opens it, jumps to the page and verifies the results. After the page jumps and the results are verified, the test of the next use case is executed.
[0058] The following problems exist in this process: first, this method is highly dependent on the accuracy of natural language understanding programs and audio. Often, the same audio use case will be recognized as different results, resulting in serious deviations in search resources; second, this method requires waiting for the page to jump and verify the results before executing the test of the next use case. The test cycle required for such execution logic will be relatively long, and this method is also difficult to be compatible with multi-machine testing, and cannot be applied to projects with fast iterations and releases; third, in the result verification stage, it is necessary to determine whether the schema path is correct. Usually, the test client needs to parse the structure tree of the page after opening the page, and then obtain the attribute values of the component id, div, etc., to determine whether these attribute values are consistent with the preset attributes. However, when faced with different types of schema and page structure trees, this method requires the development of a set of parsing programs for each structure tree, and any change in any level in the structure tree requires the modification of the entire parsing logic, which has the problems of high development cost, high maintenance cost, and poor flexibility.
[0059] In view of the shortcomings of the prior art, this application is proposed. Figure 2 A schematic diagram of the structure of a voice assistant function test platform according to an embodiment of the present application is shown. Figure 2 It can be seen that the voice assistant function test platform 100 includes: a test server 110, a resource search terminal 120, and multiple test clients 130, wherein the test server 110 is respectively connected to the resource search terminal 120 and each test client 130 in communication; wherein the test server 110 deploys a voice assistant resource search test device that can implement the voice assistant resource search test method of the present application ( Figure 5 ); the test client 130 is installed with a program application for assisting the test. The resource search end 120 is used to search for resources according to the request body sent by the test server 110, and generate the target resource path information according to the search results and return it to the test server; the test client 130 is used to perform page jump, screenshot, and information reorganization according to the test information sent by the test server 110 to generate feedback information and return it to the test server 110.
[0060] Figure 3 A flow chart of a method for testing a voice assistant resource search according to an embodiment of the present application is shown. The method can be performed by Figure 2 The voice assistant function test platform shown is implemented, and the voice assistant resource search test method of the present application is applied to the test server 110. This embodiment includes steps S310 to S330:
[0061] Step S310: In response to a test start instruction, a request body is constructed according to the resource information of any test case in the test case set, and sent to the interface to be tested of the resource search end to request the target resource path information, wherein the test case set is pre-constructed based on the resource data table, and the test case is a text format case containing resource information.
[0062] The purpose of this application is to test whether the voice assistant's function of searching for resources is normal. Specifically, the resource search end exposes an interface to be tested. The purpose of the test is mainly to detect whether the interface to be tested can normally and accurately return the target resource information to be searched.
[0063] It should be noted that the method of this application is not limited to Figure 2 The voice assistant function testing platform shown can be any system or architecture that can implement the business logic of the voice assistant resource search testing method of this application, and this application does not limit this.
[0064] In the present application, a test case set in text format is constructed in advance, and a resource data table containing resource parameters is stored in a resource database. A test case in the form of text containing resource information can be constructed based on the resource data table, wherein the resource information may include but is not limited to: resource type, resource ID, preset resource identifier, etc., wherein the preset resource identifier for a resource can be understood as pre-set information that can characterize which resource it is, such as the preset resource identifier can be a preset resource name, a preset resource code, etc.
[0065] Since there are many types of resources, different resource types have different target page structure trees and resource schema (page jump protocol) formats. For example, "type1" type resources need to be displayed in the form of a list, and the schema format is tal: / / onlineclass / allres?opt=X&channelId=X; "type2" resources are displayed in the form of a video page, and the schema format is tal: / / onlineclass / math_accuracy?gradeId=X&source=X&mode=X&playmode=X. Therefore, when generating test cases, this application obtains parameters from the resource data table according to the resource type to construct test cases for the text class.
[0066] Specifically, in some embodiments, the test case set is constructed based on the resource data table, including: summarizing the resource types in the resource data table to obtain a resource type list; traversing the resource type list, and for the traversed resource type, randomly reading resource information of a resource from the resource data table, or reading resource information of a resource with the smallest resource ID as the test case corresponding to the currently traversed resource type, the resource information including: resource ID, resource type, and preset resource identifier.
[0067] Specifically, first summarize the resource types in the resource database table and save them as a resource type list A['type1', 'type2', 'type3'...], then traverse the resource type list A, and for the traversed resource type, such as type1, randomly read a resource information of a resource with a resource type of type1 in the resource data table, and generate a test case corresponding to type1; or, for the traversed resource type, such as type1, read the resource with the smallest resource ID under the resource type (usually there are multiple resources under one resource type), and generate a test case corresponding to type1; until the resource types in the resource type list A are traversed, the test cases corresponding to each resource type are obtained, thus forming a test case set. Since there is only one test case under each resource type in the test case set, a "minimum" test case set is formed, which not only ensures the comprehensiveness of the test case coverage, but also reduces the number of test cases. The resource information in each test case includes parameters such as resource ID, resource type, and preset resource identifier.
[0068] For the construction of a test case set, a pre-written script can be deployed on a test server. The test server communicates with a resource database and executes the script. The script reads relevant data from the resource database to realize the automatic construction of a test case set.
[0069] The test can be initiated by the staff, such as initiating the test on the test server through the form of a test start instruction, or the automatic test can be started by a scheduled task. This application does not limit this. For the sake of convenience, the following explanation will take the staff-initiated test as an example.
[0070] The test server responds to the test start instruction, in which the resource type and target test client may be specified, or may not be specified and a random test may be performed. This application does not limit this. For the sake of convenience, the following description will take random testing as an example.
[0071] When the test process is started, the test server reads any test case from the test case collection and then builds the request body according to the test case.
[0072] This application does not limit the format of the request body, as long as it is a format recognizable by the interface to be tested. In some embodiments, the construction of the request body according to the resource information of any test case in the test case set includes: for a test case, parsing the resource ID and resource type from the resource information of the test case; constructing the request body in a form recognizable by the interface to be tested, the request body including the resource ID and resource type.
[0073] Specifically, for example, the resource ID and resource type are extracted from a single test case, and then combined into a request body in a format that can be parsed by the interface to be tested on the resource search end to initiate a request to the interface to be tested, such as combining the request body in the format of {"resource_id": resource ID, "resource_type": resource type}.
[0074] After receiving the request body, the interface to be tested of the resource search end performs resource search according to the request body sent by the test server, generates the target resource path information according to the search result, and returns it to the test server.
[0075] Specifically, in some embodiments of the present application, the target resource path information is generated and returned by the resource search end according to the following method: parsing the request body to obtain the target resource ID and target resource type carried by the request body; searching in the resource database according to the target resource ID to obtain the location path of the target resource; generating the target resource path information based on the location path of the target resource according to the page jump protocol format corresponding to the target resource type.
[0076] The request body contains the resource ID and resource type. After receiving the request body, the resource search end parses the request body to obtain the resource ID and resource type, searches the resource database according to the resource ID, and obtains the search result, which usually refers to the path of the location of the searched resource. The target resource path information is generated according to the search result and returned to the test server. Note here that although the resource search end searches according to the resource ID, if there is a problem in any link of the entire link, the resource identifier of the resource it searches for may be inconsistent with the resource that the resource ID should originally correspond to.
[0077] After obtaining the search results, the resource search end records the resource of the search results as the target resource. Since the page jump protocol formats of different resource types are different, the target resource path information (schema) is constructed according to the page jump protocol format corresponding to the resource type of the target resource. The target resource path information includes the location path of the target resource. If the target resource is of type "type1", the target resource path information is constructed in the format of tal: / / onlineclass / allres? opt=X&channelId=X; if the target resource is of type "type2", the target resource path information is constructed in the format of tal: / / onlineclass / math_accuracy? gradeId=X&source=X&mode=X&playmode=X, and then it can be returned to the test server in the form of {"schema":schema}, specifically, it is returned to the test server in the form of an interface response through the aforementioned interface to be tested.
[0078] Step S320: construct a test message based on the resource information and the target resource path information, and send it to at least one target test client in the form of a notification to request feedback information, wherein the feedback information at least includes: a screenshot of the resource page, a resource type, and a preset resource identifier.
[0079] After receiving {"schema":schema} fed back by the resource search end, the test server parses the target resource path information schema from it, and further constructs a test message based on the resource information and target resource path information of the test case.
[0080] The test message is sent to the test client, which can perform corresponding operations according to the instructions of the test message and provide feedback to the test server.
[0081] Specifically, in some embodiments, constructing a test message based on the resource information and the target resource path information, and sending it to at least one target test client in the form of a notification, includes: obtaining a client identification code of at least one target test client; constructing at least one test message, the test message including: a client identification code, target resource path information, a resource type, and a preset resource identifier; and sending the test message to at least one target test client in the form of a notification according to the client identification code.
[0082] The client identification code is an identification code that represents the identity information of the test client, which can represent which test client it is. Here, the test server wants to send a test message to which client or clients, and constructs the test message according to the client identification code of the test client.
[0083] It should be noted that the test message is not limited to one, and multiple test messages can be constructed simultaneously for different test clients. For a test case, only the client identification codes are different in these test messages.
[0084] The customer identification code can be specified by relevant testers, or it can be the default group in the system, etc. It can be set according to actual conditions, and this application does not impose any restrictions on this.
[0085] For a test client, after determining its client identification code, the client identification code, the target resource path information obtained from the resource search end, the resource type obtained from the test case and the preset resource identifier are spliced together to form a test message. Among them, the target resource path information can be understood as the "question surface", and the resource type and the preset resource identifier can be understood as the "standard answer".
[0086] After the test message is constructed, it is sent to the corresponding test client in the form of "notification" according to the client identification code (device_SN), which is recorded as the target test client. Among them, "notification" can be implemented through the sandmessage method.
[0087] If multiple test clients are tested synchronously, multiple test messages containing different client identification codes are constructed, and the corresponding test messages are sent synchronously according to each client identification code.
[0088] The test client pre-installs a software package for auxiliary testing, such as an auxiliary test package in the form of an apk. When a target test client corresponding to the client identification code receives a test message, the target test client performs page jumps, screenshots, and information reorganization according to the test information sent by the test server to generate feedback information and return it to the test server.
[0089] Specifically, in some embodiments, the feedback message is generated and returned by the target test client according to the following method: parsing the test message to obtain the resource type, target resource path information, and a preset resource identifier; parsing the target resource path information to obtain the location path of the target resource, and jumping to the target resource interface according to the location path of the target resource; taking a screenshot of the target resource interface to obtain a screenshot of the target resource interface; generating feedback information, the feedback information including: a client identification code, a screenshot of the target resource interface, a resource type, and a preset resource identifier.
[0090] The target test client receives and parses the test message sent by the test server, obtains the resource type, target resource path information, and preset resource identifier; then obtains the location path of the target resource from the target resource path information, executes the PathParse(schema) function to jump to the resource page indicated by the location path of the target resource. After executing the PathParse function, it usually sleeps for a few seconds to wait for the resource loading and page rendering to complete.
[0091] After completing resource loading and page rendering, the target test client takes a screenshot of the current page to obtain a screenshot of the target resource interface. The target test client's client identification code, the screenshot of the target resource interface obtained by taking the screenshot, and the resource type and preset resource identifier sent by the test server in the test message are packaged to generate feedback information and returned to the test server.
[0092] Among them, the screenshot of the target resource interface can be understood as the "answer obtained through solving" given by the target test client corresponding to the client identification code; the resource type and the preset resource identifier can be understood as the "standard answer", which is sent from the test server and returned to the test server through the target test client. The reason for such a setting is that the test server can directly verify the result through the return message of the test server, especially in the case of multi-machine synchronous testing. For each test client, the test server can quickly obtain the "standard answer" of the test client, thereby improving the test efficiency.
[0093] Step S330: identifying target resource test information from the resource page screenshot according to the preloaded configuration file and the resource type in the feedback information, and determining a test result according to the target resource test information and a preset resource identifier in the feedback information.
[0094] The configuration file is pre-set and loaded in the test server. In the configuration file, the resource identifier position in different resource types is defined. For example, in the configuration file, the correspondence between the resource type and the resource identifier coordinates is stored in the format of {"type1":[left1, up1, right1, down1], "type2":[left2, up2, right2, down2]......}. Taking type1 as an example, type1 represents the resource type, and [left1, up1, right1, down1] is a coordinate, which represents the location information of the resource identifier in the screenshot of the resource page of type1.
[0095] After receiving the feedback information fed back by the test client, the test server can identify the target resource test information from the resource page screenshot according to the configuration file and the resource type in the feedback information. Specifically, in some embodiments, the target resource test information is identified from the resource page screenshot according to the preloaded configuration file and the resource type in the feedback information, including: reading the corresponding configuration file according to the resource type in the feedback information; cutting out the corresponding sub-area in the resource page screenshot according to the location information in the configuration file; and using text recognition technology to identify the target resource test information from the sub-area.
[0096] If the resource type is "type1", the test server will crop the sub-area 1 indicated by [left1, up1, right1, down1] of the target resource page screenshot (where the target resource test information is located in area 1); if the resource type is "type2", the test server will crop the sub-area 2 indicated by [left2, up2, right2, down2] of the target resource page screenshot (where the target resource test information is located in area 2).
[0097] After cropping, the target resource test information is identified from the cropped sub-area. Specifically, the test server transmits the cropped image to the OCR (image text recognition) service and obtains the recognition result. The recognition result is the resource identifier displayed in the resource page screenshot, which is recorded as the target resource test information.
[0098] In addition, if it is determined that the resource type in the feedback information does not belong to the test case set, the test result is directly determined to be "failed". For example, the test case set contains 3 resource types, namely type1, type2 and type3, but the resource type read from the feedback information is type4, which means that an error occurs in the above link, and the test result is directly determined to be "failed", and the reason code for failure can be further displayed.
[0099] Furthermore, the sub-area obtained after trimming may not contain any text information, which means that there is a problem in the above-mentioned link, such as an error in splicing the target resource path information on the search resource side. Therefore, if the target resource test information cannot be identified from the sub-area, the test result is directly determined to be failed.
[0100] Finally, the test result is determined based on the consistency between the target resource test information and the preset resource identifier in the feedback information. Specifically, in some embodiments, the test result is determined based on the target resource test information and the preset resource identifier in the feedback information, including: if the target resource test information is consistent with the preset resource identifier, then the test result is determined to be passed; if the target resource name is inconsistent with the preset resource identifier, then the test result is determined to be failed.
[0101] That is, the resource identifier displayed in the resource page screenshot obtained by OCR recognition is compared with the preset resource identifier in the returned information for consistency. If the two are consistent, it means that the test case is executed successfully between the resource search end and the test client, that is, the test result is passed; if the two are inconsistent, it means that there is at least one execution failure in the link of splicing the target resource path information on the search resource end and the link of the test client jump, that is, the test result is failed.
[0102] Figure 4 is a schematic diagram showing a business process of a test server executing result verification according to an embodiment of the present application, from Figure 4 It can be seen that the following is executed by the test server, and this embodiment includes:
[0103] Receive feedback from the test client.
[0104] Parse the resource type and preset resource identifier from the returned information.
[0105] Traverse the resource types in the test case set and determine whether the resource type parsed in the feedback information is the currently traversed resource type. If not, proceed to traversal of the next resource type; until all resource types in the test case set have been traversed. If it is determined that the resource type parsed in the feedback information does not belong to the test case set, directly determine the test result as failed.
[0106] If the resource type parsed in the returned information is the currently traversed resource type, the location information corresponding to the resource type is read from the configuration file.
[0107] The corresponding sub-area is captured in the target resource screenshot according to the read position information.
[0108] It is determined whether there is text content in the intercepted sub-area. If not, the test result is directly determined to be failed.
[0109] If it exists, the target resource test information is identified in the intercepted sub-area and compared with the preset resource identifier in the returned information for consistency. If they are consistent, the test result is determined to be passed; if they are inconsistent, the test result is determined to be failed.
[0110] Depend on Figure 3 It can be seen from the method shown that the present application provides a voice assistant function testing platform, in which a test server is added between the test client and the resource search end, which is used to execute the voice assistant resource search testing method of the present application; and a test case set is constructed in advance, and the test case set is a collection of multiple test cases in text form constructed according to the resource data table, and the test cases contain resource information of the resources. When testing the resource search function of the voice assistant, the test server reads any test case from the test case set, and then constructs a request body that can be recognized by the interface to be tested of the resource search end according to the resource information of the test case, and sends it to the interface to be tested; after receiving the request body, the resource search end performs a resource search, and generates the target resource path information according to the search results and returns it to the test server; the test server receives the target resource path information fed back by the resource search end, constructs a test message, and sends it to one or more target test clients in the form of a notification to request the return information of the target test client. The target test client performs page jump, screenshot, and information reorganization according to the test information sent by the test server to generate return information, and returns it to the test server. The return information at least includes: a screenshot of the resource page, a resource type, and a preset resource identifier; the test server identifies the target resource test information from the resource page screenshot according to the preloaded configuration file and the resource type in the return information, and finally, the test result is judged according to the target resource test information and the preset resource identifier in the return information. First, the present application changes the test cases in audio form to directly extract data from the real database table to form a test case set, uses the parameters in the resource data table as text test cases, and then initiates an interface request to the search resource end, thereby omitting the natural language understanding technology for audio recognition procedures, eliminating the test's dependence on audio results, and realizing the decoupling of the test of the natural language understanding program in the voice assistant and the test of the search resource program, thereby improving the accuracy of the search resource test; second, in the present application, the resource page jump is executed by the test client and the result verification is executed by the test server, realizing the asynchronous execution and decoupling of the page jump and the result verification, shortening the test cycle, and this method does not interfere with the tests between multiple machines, realizing simultaneous testing of multiple machines, which is more suitable for the current fast iteration and fast release of project rhythm; third, the "resource type-identification location area on the page" is stored in the form of a configuration file, realizing text recognition of the specified area of the page in the form of a configuration file, and comparing the recognition result with the preset resource identifier, thereby obtaining the test result, avoiding the development and maintenance of a large amount of parsing structure tree code, and reducing the testing cost.
[0111] Figure 5 A schematic diagram of the structure of a test device for searching for resources of a voice assistant according to an embodiment of the present application is shown. Figure 5 It can be seen that the test device 500 for voice assistant resource search includes:
[0112] The resource request unit 510 is used to construct a request body according to the resource information of any test case in the test case set, and send it to the interface to be tested of the resource search end to request the target resource path information, wherein the test case set is pre-constructed based on the resource data table, and the test case is a text format test case containing resource information;
[0113] A return request unit 520 is used to construct a test message based on the resource information and the target resource path information, and send it to at least one target test client in a notification manner to request return information, wherein the return information at least includes: a screenshot of the resource page, a resource type, and a preset resource identifier;
[0114] The result analysis unit 530 is used to identify the target resource test information from the resource page screenshot according to the preloaded configuration file and the resource type in the feedback information, and determine the test result according to the target resource test information and the preset resource identifier in the feedback information.
[0115] In some embodiments of the present application, the above-mentioned device also includes a test case set construction unit, which is used to summarize the resource types in the resource data table to obtain a resource type list; traverse the resource type list, and for the traversed resource type, randomly read the resource information of a resource from the resource data table, or read the resource information of a resource with the smallest resource ID as the test case corresponding to the currently traversed resource type, and the resource information includes: resource ID, resource type, and preset resource identifier.
[0116] In some embodiments of the present application, in the above-mentioned device, the resource request unit 510 is used to parse the resource ID and resource type from the resource information of a test case; and construct a request body in a form recognizable by the interface to be tested, wherein the request body includes the resource ID and resource type.
[0117] In some embodiments of the present application, in the above-mentioned device, the target resource path information is generated and returned by the resource search end according to the following method: parsing the request body to obtain the target resource ID and target resource type carried by the request body; searching in the resource database according to the target resource ID to obtain the location path of the target resource; generating the target resource path information based on the location path of the target resource according to the page jump protocol format corresponding to the target resource type.
[0118] In some embodiments of the present application, in the above-mentioned device, the return request unit 520 is used to obtain a client identification code of at least one target test client; construct at least one test message, the test message including: a client identification code, target resource path information, a resource type, and a preset resource identifier; and send the test message to at least one of the target test clients in the form of a notification according to the client identification code.
[0119] In some embodiments of the present application, in the above-mentioned device, the feedback message is generated and returned by the target test client according to the following method: parsing the test message to obtain the resource type, target resource path information, and a preset resource identifier; parsing the target resource path information to obtain the location path of the target resource, and jumping to the target resource interface according to the location path of the target resource; taking a screenshot of the target resource interface to obtain a screenshot of the target resource interface; generating feedback information, the feedback information including: a client identification code, a screenshot of the target resource interface, a resource type, and a preset resource identifier.
[0120] In some embodiments of the present application, in the above-mentioned device, the result analysis unit 530 is used to read the corresponding configuration file according to the resource type in the feedback information; cut out the corresponding sub-area in the resource page screenshot according to the location information in the configuration file; and use text recognition technology to identify the target resource test information from the sub-area.
[0121] In some embodiments of the present application, in the above-mentioned device, the result analysis unit 530 is further used to directly determine the test result as failed if it is determined that the resource type in the feedback information does not belong to the test case set.
[0122] In some embodiments of the present application, in the above-mentioned device, the result analysis unit 530 is used to determine that the test result is passed if the target resource test information is consistent with the preset resource identifier; if the target resource name is inconsistent with the preset resource identifier, determine that the test result is failed.
[0123] It should be noted that the above-mentioned voice assistant resource search test device 500 can implement the above-mentioned voice assistant resource search test method of the present application one by one, and will not be repeated here.
[0124] Figure 6 A schematic diagram showing the structure of a computer device according to an embodiment of the present application is shown. Figure 6As shown, the internal structure of the computer device may include a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, the functions or steps of the test method for voice assistant resource search of the present application are implemented.
[0125] In one embodiment, the computer device provided by the present application includes a memory and a processor, the memory stores a database and a computer program that can be run on the processor, and the processor implements the functions and steps of the voice assistant resource search test method of the present application when executing the computer program.
[0126] In one embodiment, a computer-readable storage medium is also provided, on which a computer program is stored. When the computer program is executed by a processor, the functions and steps of the test method for voice assistant resource search of the present application are implemented.
[0127] It should be noted that the above functions or steps that can be implemented by the computer device or computer-readable storage medium can refer to the relevant description in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0128] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0129] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0130] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A test method for voice assistant resource search, characterized in that: The method is implemented through a voice assistant function test platform, which includes: a test server, a resource search terminal, and at least one test client, wherein the test server is respectively connected to the resource search terminal and each of the test clients in communication; the method is applied to the test server; the method includes: Constructing a request body according to the resource information of any test case in the test case set, and sending it to the interface to be tested of the resource search end to request the target resource path information, wherein the test case set is pre-constructed based on the resource data table, and the test case is a text format test case containing resource information; Constructing a test message based on the resource information and the target resource path information, and sending the message to at least one target test client in a notification manner to request feedback information, wherein the feedback information at least includes: a screenshot of the resource page, a resource type, and a preset resource identifier; The target resource test information is identified from the resource page screenshot according to the preloaded configuration file and the resource type in the feedback information, and the test result is determined according to the target resource test information and the preset resource identifier in the feedback information.
2. The method according to claim 1, characterized in that: The test case set is constructed according to the following method: Summarizing the resource types in the resource data table to obtain a resource type list; Traverse the resource type list, and for the traversed resource type, randomly read the resource information of a resource from the resource data table, or read the resource information of a resource with the smallest resource ID as the test case corresponding to the currently traversed resource type, wherein the resource information includes: resource ID, resource type, and preset resource identifier.
3. The method according to claim 1, characterized in that The step of constructing a request body according to resource information of any test case in the test case set includes: For a test case, parse the resource ID and resource type from the resource information of the test case; A request body is constructed in a form recognizable by the interface to be tested, wherein the request body includes a resource ID and a resource type.
4. The method according to claim 1, characterized in that: The target resource path information is generated and returned by the resource search end according to the following method: Parse the request body to obtain the target resource ID and target resource type carried in the request body; According to the target resource ID, the resource database is searched to obtain the location path of the target resource; The target resource path information is generated based on the page jump protocol format corresponding to the target resource type and the location path of the target resource.
5. The method according to claim 1, characterized in that The step of constructing a test message based on the resource information and the target resource path information, and sending the message to at least one target test client in the form of a notification, includes: Obtaining a client identification code of at least one target test client; Constructing at least one test message, wherein the test message includes: a client identification code, target resource path information, resource type, and a preset resource identifier; According to the client identification code, the test message is sent to at least one of the target test clients in a notification manner.
6. The method according to claim 5, characterized in that The return message is generated and returned by the target test client according to the following method: Parsing the test message to obtain resource type, target resource path information, and preset resource identifier; Parsing the target resource path information to obtain the target resource location path, and jumping to the target resource interface according to the target resource location path; Taking a screenshot of the target resource interface to obtain a screenshot of the target resource interface; Generate feedback information, which includes: client identification code, target resource interface screenshot, resource type, and preset resource identifier.
7. The method according to claim 1, characterized in that The step of identifying target resource test information from the resource page screenshot according to the preloaded configuration file and the resource type in the returned information includes: Read the corresponding configuration file according to the resource type in the returned information; According to the location information in the configuration file, cutting out a corresponding sub-area in the resource page screenshot; The target resource test information is identified from the sub-area using text recognition technology.
8. The method according to claim 7, characterized in that The method further includes: if it is determined that the resource type in the feedback information does not belong to the test case set, directly determining the test result as failed; or, If the target resource test information cannot be identified from the sub-area, the test result is directly determined to be failed.
9. The method according to claim 1, characterized in that: The determining of the test result according to the target resource test information and the preset resource identifier in the returned information includes: If the target resource test information is consistent with the preset resource identifier, determining that the test result is passed; If the target resource name is inconsistent with the preset resource identifier, the test result is determined to be failed.
10. A test device for voice assistant resource search, characterized in that: The device comprises: A resource request unit, used to construct a request body according to the resource information of any test case in the test case set, and send it to the interface to be tested of the resource search end to request the target resource path information, wherein the test case set is pre-constructed based on the resource data table, and the test case is a text format test case containing resource information; A return request unit, configured to construct a test message based on the resource information and the target resource path information, and send the message to at least one target test client in a notification manner to request return information, wherein the return information at least includes: a screenshot of the resource page, a resource type, and a preset resource identifier; The result analysis unit is used to identify the target resource test information from the resource page screenshot according to the preloaded configuration file and the resource type in the feedback information, and determine the test result according to the target resource test information and the preset resource identifier in the feedback information.
11. A voice assistant function testing platform, characterized in that: The voice assistant function test platform comprises: a test server, a resource search terminal, and at least one test client, wherein the test server is respectively connected to the resource search terminal and each of the test clients in communication; wherein the test server is deployed with the voice assistant resource search test device according to claim 10; The resource search end is used to search for resources according to the request body sent by the test server, and generate the target resource path information according to the search results and return it to the test server; The test client is used to execute page jump, screenshot, and information reorganization according to the test information sent by the test server, generate feedback information, and return it to the test server.
12. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the test method for voice assistant resource search as described in any one of claims 1 to 9 is implemented.
13. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is instructed by the processor, it implements the test method for voice assistant resource search as described in any one of claims 1 to 9.
Citation Information
Cited By
Program testing method and system, electronic equipment, storage medium and program product
CN120892356A
Creation method and device of game assistant model, terminal equipment and storage medium
CN121570817A
