Test method, device, computer equipment and computer readable storage medium

CN116049009BActive Publication Date: 2026-09-04SHENZHEN SMARTMORE TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202310144824.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-29
Publication Date
2026-09-04
Estimated Expiration
2043-01-29

AI Technical Summary

Technical Problem

[0004]然而,采用人工方式编写测试脚本,以对待测试的应用软件进行测试的方法,使得测试流程较为复杂,导致测试的效率较低

Benefits of technology

[0019]上述测试方法、装置、计算机设备、计算机可读存储介质和计算机程序产品,对待测试界面的界面图像进行对象识别,得到识别对象集合以及识别对象集合中各识别对象分别对应的属性值要求,实现了自动化的对象识别,减少手动标注的工作量;然后基于识别对象对应的属性值要求确定属性值集合,从识别对象集合中确定测试对象,并将测试对象中各识别对象分别对应的属性值集合输入到已训练的测试方案生成模型中,已训练的测试方案生成模型可以自动生成用例覆盖率高且数量较少的目标测试方案,无需人工编写测试脚本的流程,实现了目标测试方案的生成,并且可以基于目标测试方案对测试对象进行测试,实现了自动化测试,从而提高了测试的效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116049009B_ABST
    Figure CN116049009B_ABST
Patent Text Reader

Abstract

The application relates to a test method, a device, computer equipment and a computer readable storage medium. The method comprises the following steps: performing object recognition on an interface image of a to-be-tested interface to obtain an identified object set and attribute value requirements corresponding to each identified object in the identified object set; obtaining an attribute value set corresponding to the identified object; the attribute value set is determined based on a test case design method matched with the attribute value requirements and the identified object; obtaining a test object determined from the identified object set; inputting the attribute value set corresponding to each identified object in the test object into a trained test scheme generation model to generate at least one target test scheme of the test object; and testing the test object based on the target test scheme. The method can improve the test efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a testing method, apparatus, computer equipment, and computer-readable storage medium. Background Technology

[0002] With the development of the internet, application software is emerging in an endless stream. Before an application software goes live, it needs to be tested. Due to the explosive growth in demand for software testing, software testing is gradually evolving from manual testing to automated testing.

[0003] In traditional techniques, test scripts are written manually for the application software to be tested, and then the test scripts are executed to obtain the test results of the application software.

[0004] However, manually writing test scripts to test the application software makes the testing process more complex and results in lower testing efficiency. Summary of the Invention

[0005] This application provides a testing method, apparatus, computer equipment, and computer-readable storage medium that can improve testing efficiency.

[0006] Firstly, this application provides a testing method, including:

[0007] Perform object recognition on the interface image of the interface to be tested to obtain a set of recognized objects and the attribute value requirements corresponding to each recognized object in the set of recognized objects;

[0008] Obtain the set of attribute values ​​corresponding to the identified object; the set of attribute values ​​is determined by the test case design method based on the attribute value requirements and the identification object.

[0009] Obtain the test object determined from the set of identified objects; the test object includes at least one identified object from the set of identified objects;

[0010] The attribute value set corresponding to each identified object in the test object is input into the trained test scheme generation model to generate at least one target test scheme for the test object; the test object is tested based on each target test scheme.

[0011] Secondly, this application also provides a testing apparatus, comprising:

[0012] The object recognition module is used to perform object recognition on the interface image of the interface to be tested, and obtain the set of recognized objects and the attribute value requirements corresponding to each recognized object in the set of recognized objects;

[0013] The attribute value acquisition module is used to obtain the set of attribute values ​​corresponding to the identified object; the set of attribute values ​​is determined based on the test case design method that matches the attribute value requirements and the identified object.

[0014] The test object acquisition module is used to acquire test objects determined from the set of identified objects; the test objects include at least one identified object in the set of identified objects.

[0015] The test plan generation module is used to input the attribute value set corresponding to each identified object in the test object into the trained test plan generation model to generate at least one target test plan for the test object; the test plan execution module is used to test the test object based on each target test plan.

[0016] Thirdly, this application also provides a computer device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described test method.

[0017] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-described test method.

[0018] Fifthly, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps in the above-described test method.

[0019] The aforementioned testing methods, apparatus, computer equipment, computer-readable storage media, and computer program products perform object recognition on the interface image of the interface to be tested, obtaining a set of recognized objects and the attribute value requirements corresponding to each recognized object in the set, thus achieving automated object recognition and reducing the workload of manual annotation. Then, based on the attribute value requirements corresponding to the recognized objects, an attribute value set is determined, and test objects are identified from the set of recognized objects. The attribute value sets corresponding to each recognized object in the test objects are input into a trained test plan generation model. The trained test plan generation model can automatically generate target test plans with high test case coverage and a small number of test cases, eliminating the need for manual writing of test scripts. This realizes the generation of target test plans, and the test objects can be tested based on the target test plans, achieving automated testing and thus improving testing efficiency. Attached Figure Description

[0020] Figure 1 An application environment diagram of a testing method provided in an embodiment of this application;

[0021] Figure 2 A flowchart illustrating a testing method provided in an embodiment of this application;

[0022] Figure 3 A schematic diagram illustrating the interaction between an object recognition model and a test scheme generation model provided in an embodiment of this application;

[0023] Figure 4 A flowchart illustrating a training object recognition model provided in an embodiment of this application;

[0024] Figure 5 A flowchart illustrating another testing method provided in an embodiment of this application;

[0025] Figure 6 A structural block diagram of a testing device provided in an embodiment of this application;

[0026] Figure 7 An internal structural diagram of a computer device provided in an embodiment of this application;

[0027] Figure 8 An internal structural diagram of another computer device provided in an embodiment of this application;

[0028] Figure 9 This is an internal structural diagram of a computer-readable storage medium provided in an embodiment of this application. Detailed Implementation

[0029] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0030] The testing method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, computer device 102 communicates with server 104 via a communication network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be located in the cloud or on other network servers.

[0031] Specifically, computer device 102 stores the interface image of the interface to be tested. Server 104 obtains the interface image of the interface to be tested from computer device 102 and performs object recognition to obtain a set of recognized objects and the attribute value requirements corresponding to each recognized object in the set of recognized objects; obtains the attribute value set corresponding to the recognized objects; the attribute value set is determined by a test case design method based on the attribute value requirements and the matching of recognized objects; obtains the test objects determined from the set of recognized objects; the test objects include at least one recognized object in the set of objects; inputs the attribute value set corresponding to each recognized object in the test objects into a trained test plan generation model to generate at least one target test plan for the test objects; and tests the test objects based on each target test plan. After obtaining the test results of the interface to be tested, server 104 can send the test results to computer device 102. Computer device 102 receives the test results and saves them.

[0032] The computer device 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices, such as smartwatches, smart bracelets, and head-mounted devices. The server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0033] In some embodiments, such as Figure 2 As shown, a testing method is provided, which is applied to... Figure 1 Taking server 104 as an example, the explanation includes the following steps:

[0034] Step 202: Perform object recognition on the interface image of the interface to be tested to obtain the set of recognized objects and the attribute value requirements corresponding to each recognized object in the set of recognized objects.

[0035] The interface to be tested can be a functional interface within a target application or webpage, and it includes at least one object. An object refers to a functional control within the interface to be tested. Object types include at least one of input controls, selection controls, or click controls. Input controls are used to receive input information and are also called input boxes; selection controls are used to select options and are also called selection boxes; click controls are used to navigate to pages or implement page interactions and are also called buttons. The interface image can be a screenshot of the interface to be tested. The interface image includes objects and corresponding prompts. Prompts are text information corresponding to the objects, used to characterize the object's attributes. Prompts can be text on the interface image, such as the default text "Please enter your username" displayed in an input box, or manually annotated information.

[0036] The identified object is obtained by performing object recognition on the interface image. The identified object set is a collection consisting of at least one identified object. Each identified object has an object identifier, which represents its type. For example, if the object identifier is "input," the identified object is an input control; if the object identifier is "select," the identified object is a selection control. Different types of identified objects have different attributes. For example, input controls have multiple input control attributes, including input data length and input data type, while selection controls have option attributes. Attribute value requirements are the operational requirements corresponding to each attribute of the identified object. Different identified objects have different attribute value requirements. For example, the attribute value requirements for input controls include an input data length of 11 characters.

[0037] Specifically, the server acquires the interface image of the interface to be tested, and then inputs the interface image into a trained object recognition model for object recognition, obtaining a set of recognized objects and the corresponding object identifier and attribute value requirements for each recognized object in the set. Object recognition includes the icon of the recognized object and the corresponding prompt information. The prompt information can be text on the interface image, such as the default text "Please enter username" displayed in the input box, or manually annotated information. The trained object recognition model has the function of recognizing objects in the interface image and their corresponding attribute value requirements. For example, if the interface image contains an input control and its corresponding prompt information, such as "Please enter 5-9 characters of text," object recognition of the interface image yields the object identifier "input," and the attribute value requirement is an input data length of [5,9] and an input data type of character.

[0038] In some embodiments, if there is no prompt information corresponding to the identified object in the interface image, the server can use the default attribute value requirement corresponding to the object identifier as the attribute value requirement for the identified object. The default attribute value requirement is preset according to the type of the object. For example, if the identified object is an input control and the object identifier is "input", the default attribute value requirement for "input" is: the input data length is arbitrary and the input data type is arbitrary.

[0039] Step 204: Obtain the set of attribute values ​​corresponding to the identified object; the set of attribute values ​​is determined by the test case design method based on the matching of attribute value requirements and the identified object.

[0040] The attribute value set is a collection of the attribute values ​​or operation types of the identified object. It is determined based on the attribute value requirements of the identified object and the test case design method that matches the identified object. The test case design method is used to design test cases for the attribute value requirements of the identified object to obtain the attribute value set. Test case design methods include equivalence class partitioning, boundary value partitioning, or cause-effect graphing, etc. Different test case design methods match different types of identified objects. For example, if the attribute value requirements for the input control include an input data length of 5-9, then the attribute value set obtained by using boundary value partitioning includes: input data length [4, 5, 6, 8, 9, 10].

[0041] Specifically, the server determines the set of attribute values ​​corresponding to each identified object based on the attribute value requirements of the identified object and the test case design method for matching the identified object. For example, if the identified object is an input control, and the attribute value requirements of the input control are that the input data length is 5-9, the input data type is at least one of numbers or letters, and the test case design method for matching the input control includes at least one of equivalence class partitioning or boundary value partitioning, then the set of attribute values ​​of the input control includes: input data length [4, 5, 6, 8, 9, 10], valid input types [numbers, letters, numbers and letters], and invalid input types [special symbols, Chinese characters].

[0042] Step 206: Obtain the test object determined from the set of identified objects; the test object includes at least one identified object from the set of identified objects.

[0043] The test object refers to at least one identification object corresponding to a function point in the interface to be tested. For example, the two selection controls corresponding to the filtering function point can be used as a test object.

[0044] Specifically, the server determines the test object from the set of identified objects. This can be done by identifying one identified object as a single test object, or by identifying multiple identified objects corresponding to the same functional point as a single test object. For example, the test object can be determined manually based on whether multiple identified objects correspond to the same functional point, or it can be determined based on the attribute value requirements corresponding to the identified object. The prompt information corresponding to the object can also include the corresponding functional point, so the attribute value requirements corresponding to the identified object can also include the corresponding functional point. Assuming the set of identified objects includes three identified objects: an input control, selection control 1, and selection control 2, and the attribute value requirements for the input control include: functional point 1, selection control 1 includes: functional point 2, and selection control 2 includes: functional point 2, then the input control can be identified as a single test object, and selection control 1 and selection control 2 can be identified as a single test object. Step 208: Input the attribute value sets corresponding to each identified object in the test object into the trained test plan generation model to generate at least one target test plan for the test object.

[0045] One approach is to combine attribute values ​​of each identified object within the test object to generate multiple test plans. However, this approach suffers from exhaustive execution, leading to low testing efficiency. A trained test plan generation model, on the other hand, is a model trained on a pre-trained model to generate test plans. This model generates multiple test plans based on attribute value combinations and then selects at least one target test plan from these. For example, if an input control has m possible input lengths and n possible input types, the resulting combinations will produce m*n test plans. These m*n plans may contain redundant plans with identical results. The trained model can remove these redundant plans and output the remaining plans to obtain the target test plans. This reduces the number of test plans while maintaining testing effectiveness, thus improving testing efficiency.

[0046] Specifically, the server can input the attribute value set corresponding to each identified object in the test object into a trained test plan generation model to generate at least one target test plan for the test object. For example, if the test object is a target input control with the following attribute value set: input data length [4, 5, 6, 8, 9, 10], valid input types [number, letter, number and letter], and invalid input types [special symbols, Chinese characters], the generated target test plans include: [5, number]. Here, the target input control is the test object determined from the set of identified objects.

[0047] Step 210: Test the test objects based on each target test plan.

[0048] Specifically, the server generates test cases corresponding to each target test plan based on at least one target test plan for the test object. Test cases are data or operation instructions used to test the test object. For example, if the target test plan is [8, letters], the corresponding test case could be a randomly generated string of 8 letters, such as "abcdefgh". The server can then use the test cases to test the test object in the interface under test. For example, inputting "abcdefgh" into the corresponding target input control yields the test case results for the test object in the interface under test. The test case results are the test results corresponding to the target test plan.

[0049] In some embodiments, the server obtains test case results and then compares them with preset test results, which are the correct test results for pre-set test objects. Based on the comparison results, the server determines whether the target test plan passes the test. For each target test plan, if the comparison is consistent, the server determines that the target test plan passes the test; if the comparison is inconsistent, the server determines that the target test plan fails the test. For example, after an input control inputs a letter of length 8, the preset test result is to prompt "Input correct". If the test case result is to prompt "Input incorrect", then the target test plan fails the test.

[0050] In the above testing method, object recognition is performed on the interface image of the interface to be tested to obtain a set of recognized objects and the attribute value requirements corresponding to each recognized object in the set, thus realizing automated object recognition and reducing the workload of manual annotation. Then, based on the attribute value requirements corresponding to the recognized objects, an attribute value set is determined, and test objects are identified from the set of recognized objects. The attribute value set corresponding to each recognized object in the test object is input into a trained test plan generation model. The trained test plan generation model can automatically generate target test plans with high test case coverage and a small number of test cases. This process eliminates the need for manual writing of test scripts, realizes the generation of target test plans, and enables automated testing of test objects based on target test plans, thereby improving testing efficiency.

[0051] In some embodiments, the step of obtaining a trained test scheme generation model includes:

[0052] Retrieve the set of attribute values ​​corresponding to at least one sample object;

[0053] The attribute value set of each sample object is input into the test scheme generation model to be trained to predict the test scheme, and at least one predicted test scheme is obtained for each sample object.

[0054] Based on the difference between the predicted test scheme and the actual test scheme of the sample object, the parameters of the test scheme generation model to be trained are adjusted to obtain the trained test scheme generation model.

[0055] The sample object can be an object in a sample interface image, which is used to train the object recognition model. The predicted test plan is obtained by the test plan generation model through test plan prediction. The real test plan is the test plan with the highest coverage after deduplication from the results of permutations and combinations. There can be one or multiple sample objects. For example, the set of attribute values ​​corresponding to the input sample object during training can be the set of attribute values ​​of an input control or the set of attribute values ​​corresponding to multiple selection controls.

[0056] In this embodiment, by adjusting the parameters of the test plan generation model to be trained based on the difference between the predicted test plan and the actual test plan based on the sample object, a trained test plan generation model is obtained. This allows the trained test plan generation model to generate test plans with high test case coverage and a small number of test cases, thereby reducing exhaustive execution and further improving testing efficiency.

[0057] In some embodiments, the attribute value requirement is obtained through a trained object recognition model; the step of obtaining the trained object recognition model includes:

[0058] Obtain a sample interface image; the sample interface image must include at least one sample object and the corresponding actual attribute values ​​of the sample object.

[0059] The sample interface image is input into the object recognition model to be trained to perform object recognition, and the predicted attribute values ​​of each sample object in the sample interface image are obtained.

[0060] Based on the difference between the predicted attribute value requirements of the sample object and the actual attribute value requirements of the sample object, the parameters of the object recognition model to be trained are adjusted to obtain the trained object recognition model.

[0061] The sample interface image can be a screenshot of a functional interface in the application, and the actual attribute value requirement corresponding to the sample object can be obtained by annotating the sample object. For example, it can be at least one of input, [5, 9], numbers, or letters.

[0062] Specifically, such as Figure 4As shown, obtaining a trained object recognition model involves four steps: First, manual annotation: by collecting a training sample set including a large number of sample interface images, the sample objects in the sample interface images are annotated to obtain sample interface images containing the actual attribute value requirements corresponding to the sample objects; Second, model creation: the initial values ​​of the parameters corresponding to the convolutional layers, activation functions, hidden units, etc. of the object recognition model are set to obtain the object recognition model to be trained; Third, model training: the server inputs the sample interface images into the object recognition model to be trained for object recognition, outputs the predicted attribute value requirements, and then uses the difference between the predicted attribute value requirements and the actual attribute value requirements to obtain the model loss value. The parameters of the object recognition model are adjusted using the model loss value until the model converges, resulting in a trained object recognition model; Fourth, model evaluation: by inputting a small number of sample interfaces into the trained object recognition model, for example, 20% of the training sample set, the recognition accuracy of the trained object recognition model is evaluated based on the output predicted attribute value requirements.

[0063] In some embodiments, such as Figure 3 As shown, the input data for the test scheme generation model can be obtained from the set of recognized objects output by the object recognition model and the attribute value requirements corresponding to each recognized object in the set of recognized objects.

[0064] In this embodiment, the object recognition model to be trained is trained using sample interface images to obtain a trained object recognition model. This allows for the automated recognition and labeling of objects in interface images, reducing the need for manual labeling of the interface and improving testing efficiency.

[0065] In some embodiments, the set of objects to be identified includes a target input control; the set of attribute values ​​of the target input control includes a set of sub-attribute values ​​corresponding to the attributes of multiple input controls.

[0066] The attribute value set corresponding to each identified object in the test object is input into the trained test scheme generation model to generate at least one target test scheme for the test object, including:

[0067] When the test object is a target input control, the set of sub-attribute values ​​corresponding to the attributes of multiple input controls is input into the trained test plan generation model to generate at least one target test plan for the test object.

[0068] The target test plan includes target attribute values ​​corresponding to multiple input control properties, target attribute values ​​corresponding to input control properties, and a set of sub-attribute values ​​corresponding to input control properties.

[0069] The target input control refers to the input control that is determined as the test object from the set of identified objects. The input control attribute is the attribute corresponding to the input control. The input control attribute includes the input data length and the input data type. That is, the attribute value set of the input control includes the sub-attribute value set corresponding to the input data length and the sub-attribute set corresponding to the input data type.

[0070] Specifically, when the test object is a target input control, the server inputs the sub-attribute value requirements corresponding to the input data length and the sub-attribute requirements corresponding to the input data type into the trained test scheme generation model to generate at least one target test scheme for the target input control. For example, the attribute value requirements of the target test control are: input data length is 11, input data type is number, the sub-attribute value set corresponding to the input data length is [10, 11, 12], and the sub-attribute value set corresponding to the input data type includes: valid input type [number], invalid input type [letter, Chinese character, special symbol]. The server inputs [10, 11, 12], [number], [letter, Chinese character, special symbol] into the trained test scheme generation model, and the generated target test schemes include: [10, number], [11, number], [12, number], [11, Chinese character], [11, special symbol], [11, Chinese character and number], [11, special symbol and number].

[0071] In this embodiment, when the test object is a target input control, the trained test plan generation model can generate at least one target test plan for the test object, thereby realizing automated testing of the input control in the interface to be tested based on the target test plan, and improving the efficiency of testing.

[0072] In some embodiments, the set of identified objects further includes multiple selection controls that have constraints on each other;

[0073] The attribute value set corresponding to each identified object in the test object is input into the trained test scheme generation model to generate at least one target test scheme for the test object, including:

[0074] When the test object consists of multiple selection controls with constraints, the attribute value set corresponding to each selection control is input into the trained test plan generation model to generate at least one target test plan for the test object.

[0075] In this context, multiple selection controls with constraints refer to situations where the currently selected option in one selection control affects the options displayed in the other selection controls. For example, if there is a constraint between the first and second selection controls, and the first selection control's options are [Sports, Other], then if the first selection control's currently selected option is "Sports," the second selection control will display [Basketball, Football, Running]; conversely, if the first selection control's currently selected option is "Other," the second selection control will display [Movie, Music, Painting]. The set of attribute values ​​corresponding to a selection control includes a selection action and an option list. The selection action can be a click operation, and the option list consists of the options within the selection control.

[0076] Specifically, when the test object consists of multiple selection controls with constraints, the server inputs the attribute value set corresponding to each selection control into a trained test plan generation model to generate at least one target test plan for the test object. The target test plans generated for multiple selection controls with constraints include test plans that combine the attribute value sets corresponding to different selection controls based on the constraints. For example, the target test plan for the first and second selection controls might include [click, sports, basketball], indicating that clicking "sports" in the options of the first selection control and then clicking "basketball" in the second selection control would be performed.

[0077] In this embodiment, when the test object is a selection control with constraints, the trained test plan generation model can generate at least one target test plan for the test object, thereby realizing automated testing of multiple selection controls in the interface to be tested based on the target test plan, and improving the efficiency of testing.

[0078] In some embodiments, testing the test object based on each target test scheme includes:

[0079] Obtain the location information of the test object; the location information of the test object includes the location information of each identification object in the test object; the location information of the identification object is used to characterize the position of the identification object in the interface to be tested;

[0080] Based on the target test plan and the location information of the test object, the test object is tested.

[0081] The location information of the identified object represents its position on the interface under test. For example, the location information of the identified object could be the pixel coordinates of the identified object on the interface under test.

[0082] Specifically, the object recognition model also includes an object location recognition network, which has the function of determining the position of the recognized object in the interface image. The server can input the interface image into the object location recognition network in the trained object recognition model to obtain the location information corresponding to each recognized object in the object set. After determining the test object and at least one target test plan for the test object, the server obtains the location information corresponding to each recognized object in the test object, and then uses the target test plan and the location information of the test object to test the test object in the interface to be tested.

[0083] In this embodiment, by obtaining the location information of the test object, the test object is tested based on the location information of each target test plan and the test object. Compared with the existing method of writing test scripts, no coding and maintenance are required, realizing automated testing and thus improving the efficiency of testing.

[0084] In some embodiments, testing the test object is performed based on the location information of each target test scheme and the test object, including:

[0085] Based on the location information of the test object, determine the test object from the interface to be tested;

[0086] Generate test cases corresponding to each target test plan; the test cases corresponding to the target test plan refer to test cases that conform to the target test plan.

[0087] The test objects are tested using the test cases corresponding to each target test plan.

[0088] Test cases can be generated based on the target test plan and are used to test the test object. For example, if the test object is a target input control and the target test plan is [8, letters], the corresponding test case can be a randomly generated string of 8 letters, such as abcdefgh.

[0089] Specifically, when the server performs testing on the interface to be tested of the target application, it determines the test object from the interface to be tested based on the location information of the test object, and generates test cases corresponding to each target test scheme for the test object. Then, it uses the test cases corresponding to each target test scheme to test the test object and obtain the test case results. For example, if abcdefgh is entered into the target input control, the "input successful" prompt message will be obtained on the page to be tested.

[0090] In this embodiment, by automatically generating test cases and using these test cases to complete automated testing of the test object, the efficiency of testing is further improved.

[0091] In some embodiments, such as Figure 5 As shown, a testing method is provided. Taking the application of this method to a server as an example, the method includes the following steps:

[0092] Step 502: Obtain the interface image of the interface to be tested, input the interface image into the trained object recognition model for object recognition, and obtain the set of recognized objects and the attribute value requirements and position information corresponding to each recognized object in the set of recognized objects.

[0093] The trained object recognition model also includes an object location recognition network, which is used to determine the location information of the object to be recognized.

[0094] Step 504: Based on the attribute value requirements corresponding to each identified object and the test case design method for matching the identified objects, determine the set of attribute values ​​corresponding to each identified object.

[0095] The attribute value set is determined by a test case design method that matches attribute value requirements and identified objects.

[0096] Step 506: Determine the test object from the set of identified objects.

[0097] The test object includes at least one of the target input control or multiple selection controls with constraints.

[0098] Step 508: Input the set of attribute values ​​corresponding to each identified object in the test object into the trained test scheme generation model to generate at least one target test scheme for the test object.

[0099] Step 510: Obtain the location information corresponding to each identified object in the test object to obtain the location information of the test object.

[0100] Step 512: Determine the test object from the interface to be tested based on the location information of the test object.

[0101] Step 514: Generate test cases corresponding to each target test plan for the test object.

[0102] Step 516: Use the test cases corresponding to the target test plan to test the test objects in the interface to be tested.

[0103] In this embodiment, object recognition is performed on the interface image of the interface to be tested to obtain a set of recognized objects and the attribute value requirements and location information corresponding to each recognized object in the set. This achieves automated object recognition and reduces the workload of manual annotation. The trained test plan generation model can automatically generate target test plans with high test case coverage and a small number of test cases, eliminating the need for manual writing of test scripts. This achieves the generation of target test plans and test cases based on the target test plans. Thus, test objects are automatically tested based on the test cases and the location information of the test objects, achieving automated testing and improving testing efficiency.

[0104] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0105] Based on the same inventive concept, this application also provides a testing apparatus for implementing the testing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more testing apparatus embodiments provided below can be found in the limitations of the testing method described above, and will not be repeated here.

[0106] In some embodiments, such as Figure 6 As shown, a testing apparatus is provided, comprising:

[0107] The object recognition module 602 is used to perform object recognition on the interface image of the interface to be tested, and obtain the set of recognized objects and the attribute value requirements corresponding to each recognized object in the set of recognized objects.

[0108] The attribute value acquisition module 604 is used to acquire the set of attribute values ​​corresponding to the identified object; the set of attribute values ​​is determined by the test case design method based on the matching of attribute value requirements and the identified object.

[0109] The test object acquisition module 606 is used to acquire test objects determined from the identification object set; the test objects include at least one identification object in the identification object set.

[0110] The test plan generation module 608 is used to input the attribute value set corresponding to each identified object in the test object into the trained test plan generation model to generate at least one target test plan for the test object.

[0111] The test plan execution module 610 is used to test the test object based on each target test plan.

[0112] In some embodiments, the testing apparatus further includes a first model training module, which is specifically used for:

[0113] Retrieve the set of attribute values ​​corresponding to at least one sample object;

[0114] The attribute value set of each sample object is input into the test scheme generation model to be trained to predict the test scheme, and at least one predicted test scheme is obtained for each sample object.

[0115] Based on the difference between the predicted test scheme and the actual test scheme of the sample object, the parameters of the test scheme generation model to be trained are adjusted to obtain the trained test scheme generation model.

[0116] In some embodiments, the attribute value requirement is to be obtained through a trained object recognition model; the testing apparatus further includes a second model training module, which is specifically used for:

[0117] Obtain a sample interface image; the sample interface image must include at least one sample object and the corresponding actual attribute values ​​of the sample object.

[0118] The sample interface image is input into the object recognition model to be trained to perform object recognition, and the predicted attribute values ​​of each sample object in the sample interface image are obtained.

[0119] Based on the difference between the predicted attribute value requirements of the sample object and the actual attribute value requirements of the sample object, the parameters of the object recognition model to be trained are adjusted to obtain the trained object recognition model.

[0120] In some embodiments, the set of objects to be identified includes a target input control; the set of attribute values ​​of the target input control includes a set of sub-attribute values ​​corresponding to the attributes of multiple input controls.

[0121] In terms of generating at least one target test plan for the test object by inputting the set of attribute values ​​corresponding to each identified object in the test object into the trained test plan generation model, the test plan generation module 608 is specifically used for:

[0122] When the test object is a target input control, the set of sub-attribute values ​​corresponding to the attributes of multiple input controls is input into the trained test plan generation model to generate at least one target test plan for the test object.

[0123] The target test plan includes target attribute values ​​corresponding to multiple input control properties, target attribute values ​​corresponding to input control properties, and a set of sub-attribute values ​​corresponding to input control properties.

[0124] In some embodiments, the set of identified objects further includes multiple selection controls that have constraints on each other;

[0125] In terms of generating at least one target test plan for the test object by inputting the set of attribute values ​​corresponding to each identified object in the test object into the trained test plan generation model, the test plan generation module 608 is specifically used for:

[0126] When the test object consists of multiple selection controls with constraints, the attribute value set corresponding to each selection control is input into the trained test plan generation model to generate at least one target test plan for the test object.

[0127] In some embodiments, in the aspect of testing the test object based on each target test plan, the test plan execution module 610 is specifically used for:

[0128] Obtain the location information of the test object; the location information of the test object includes the location information of each identification object in the test object; the location information of the identification object is used to characterize the position of the identification object in the interface to be tested;

[0129] Based on the target test plan and the location information of the test object, the test object is tested.

[0130] In some embodiments, in the aspect of testing the test object based on each target test plan, the test plan execution module 610 is specifically used for:

[0131] Based on the location information of the test object, determine the test object from the interface to be tested;

[0132] Generate test cases corresponding to each target test plan; the test cases corresponding to the target test plan refer to test cases that conform to the target test plan.

[0133] The test objects are tested using the test cases corresponding to each target test plan.

[0134] Each module in the aforementioned testing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0135] In some embodiments, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores relevant data related to the test method. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in the aforementioned test method.

[0136] In some embodiments, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 8As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it performs the steps in the aforementioned test method. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0137] Those skilled in the art will understand that Figure 7 and Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0138] In some embodiments, a computer device is provided, the computer device including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps in the above-described test method.

[0139] In some embodiments, a computer-readable storage medium 900 is provided, on which a computer program 902 is stored. When executed by a processor, the computer program 902 implements the steps in the image data processing method described above. Its internal structure diagram can be as follows: Figure 9 As shown.

[0140] In some embodiments, a computer program product is provided, which includes a computer program that, when executed by a processor, implements the steps in the above-described test method.

[0141] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0142] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0143] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0144] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A testing method, characterized in that, include: The trained object recognition model performs object recognition on the interface image of the test interface to obtain a set of recognized objects and the attribute value requirements and location information corresponding to each recognized object in the set. This includes: when no prompt information corresponding to the recognized object exists in the interface image, using the default attribute value requirement corresponding to the object identifier as the attribute value requirement for the recognized object, where the default attribute value requirement is preset according to the type of the recognized object; the trained object recognition model has the function of recognizing objects in the interface image and their corresponding attribute value requirements, thereby achieving automated recognition and annotation of the recognized objects in the interface image; the attribute value requirements at least include operation requirements corresponding to input control attributes and operation requirements corresponding to option attributes, where the operation requirements corresponding to input control attributes include input data length and input data type; object recognition includes the icon of the recognized object and the corresponding prompt information; the trained object recognition model also includes an object location recognition network, which is used to determine the location information of the recognized object; Based on the test case design method that matches the attribute value requirements and the identification objects, the attribute value set corresponding to each identification object is determined; the attribute value set is a set composed of the attribute values ​​or operation types of the identification objects; the attribute value set includes a sub-attribute value set corresponding to the length of the input data and a sub-attribute set corresponding to the data type of the input data. Obtaining a test object determined from the set of identified objects includes: determining one of the identified objects as one test object; or, determining multiple identified objects corresponding to the same function point as one test object; the test object includes at least one identified object in the set of identified objects; the test object refers to at least one identified object corresponding to a function point in the interface to be tested; The attribute value set corresponding to each identified object in the test object is input into a trained test plan generation model to generate at least one target test plan for the test object. The trained test plan generation model is obtained by adjusting the parameters of the test plan generation model to be trained based on the difference between the predicted test plan and the real test plan of the sample object. The real test plan is the test plan with high coverage after deduplication from the results of permutation and combination. The trained test plan generation model has the function of permuting and combining attribute value sets to generate multiple test plans corresponding to the test object, and selecting at least one target test plan from each of the test plans. Among them, the target test plan generated for multiple selection controls with constraints includes a test plan that combines the attribute value sets corresponding to different selection controls based on constraints. The test object is tested based on each of the target test schemes.

2. The method according to claim 1, characterized in that, The steps for obtaining the trained test scheme generation model include: Retrieve the set of attribute values ​​corresponding to at least one sample object; The attribute value set of each of the sample objects is input into the test scheme generation model to be trained to predict the test scheme, thereby obtaining at least one predicted test scheme corresponding to the sample object. Based on the difference between the predicted test scheme and the actual test scheme of the sample object, the parameters of the test scheme generation model to be trained are adjusted to obtain the trained test scheme generation model.

3. The method according to claim 1, characterized in that, The attribute value must be obtained through a trained object recognition model; The steps to obtain the trained object recognition model include: Obtain a sample interface image; the sample interface image includes at least one sample object and the actual attribute value requirements corresponding to the sample object; The sample interface image is input into the object recognition model to be trained for object recognition, and the predicted attribute values ​​corresponding to each sample object in the sample interface image are obtained. Based on the difference between the predicted attribute value requirements of the sample object and the actual attribute value requirements of the sample object, the parameters of the object recognition model to be trained are adjusted to obtain the trained object recognition model.

4. The method according to claim 1, characterized in that, The set of objects to be identified includes target input controls; the set of attribute values ​​of the target input controls includes a set of sub-attribute values ​​corresponding to the attributes of multiple input controls. The step of inputting the attribute value set corresponding to each identified object in the test object into the trained test scheme generation model to generate at least one target test scheme for the test object includes: When the test object is the target input control, the set of sub-attribute values ​​corresponding to the attributes of the multiple input controls is input into the trained test plan generation model to generate at least one target test plan for the test object. The target test scheme includes target attribute values ​​corresponding to the multiple input control attributes, and the target attribute values ​​corresponding to the input control attributes belong to the set of sub-attribute values ​​corresponding to the input control attributes.

5. The method according to claim 4, characterized in that, The set of objects to be identified also includes multiple selection controls that have constraints on each other; The step of inputting the attribute value set corresponding to each identified object in the test object into the trained test scheme generation model to generate at least one target test scheme for the test object includes: When the test object is a plurality of selection controls with constraints, the attribute value set corresponding to each selection control is input into a trained test scheme generation model to generate at least one target test scheme for the test object.

6. The method according to claim 1, characterized in that, The testing of the test object based on each of the target test schemes includes: Obtain the location information of the test object; the location information of the test object includes the location information corresponding to each identification object in the test object; the location information of the identification object is used to characterize the position of the identification object in the interface to be tested; The test object is tested based on the target test schemes and the location information of the test object.

7. The method according to claim 6, characterized in that, The step of testing the test object based on each of the target test schemes and the location information of the test object includes: The test object is determined from the interface to be tested based on the location information of the test object; Generate test cases corresponding to each of the target test schemes; the test cases corresponding to the target test schemes refer to test cases that conform to the target test schemes. The test object is tested using the test cases corresponding to each of the target test schemes.

8. A testing device, characterized in that, include: The object recognition module is used to perform object recognition on the interface image of the test interface using a trained object recognition model, obtaining a set of recognized objects and the attribute value requirements and location information corresponding to each recognized object in the set. This includes: when no prompt information corresponding to the recognized object exists in the interface image, using the default attribute value requirement corresponding to the object identifier as the attribute value requirement for the recognized object, where the default attribute value requirement is preset according to the type of the recognized object; the trained object recognition model has the function of recognizing objects in the interface image and their corresponding attribute value requirements, thereby achieving automated recognition and annotation of the recognized objects in the interface image; the attribute value requirements at least include operation requirements corresponding to input control attributes and operation requirements corresponding to option attributes, where the operation requirements corresponding to input control attributes include input data length and input data type; the object recognition includes the icon of the recognized object and the corresponding prompt information; the trained object recognition model also includes an object location recognition network, which is used to determine the location information of the recognized object; The attribute value acquisition module is used to determine the attribute value set corresponding to the identified object based on the test case design method that matches the attribute value requirements and the identified object; the attribute value set is a set composed of the values ​​or operation types of the attributes of the identified object; the attribute value set includes a sub-attribute value set corresponding to the length of the input data and a sub-attribute set corresponding to the data type of the input data. The test object acquisition module is used to acquire test objects determined from the set of identified objects, including: determining one of the identified objects as one test object; or, determining multiple identified objects corresponding to the same function point as one test object; the test object includes at least one identified object in the set of identified objects; the test object refers to at least one identified object corresponding to a function point in the interface to be tested; The test plan generation module is used to input the attribute value set corresponding to each identified object in the test object into a trained test plan generation model to generate at least one target test plan for the test object. The trained test plan generation model is obtained by adjusting the parameters of the test plan generation model to be trained based on the difference between the predicted test plan and the real test plan of the sample object. The real test plan is the test plan with high coverage after deduplication from the results of permutation and combination. The trained test plan generation model has the function of permuting and combining attribute value sets to generate multiple test plans corresponding to the test object, and selecting at least one target test plan from each of the test plans. Among them, the target test plan generated for multiple selection controls with constraints includes a test plan that combines the attribute value sets corresponding to different selection controls based on constraints. The test plan execution module is used to test the test object based on each of the target test plans.

9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Interface test case generation method and device and storage medium

    CN110032515A

  • User interface test method and related device

    CN112749081A

  • Test case generation method and device, electronic equipment and storage medium

    CN114328201A

  • Test case generation method and device

    CN119166511A

  • Test case generation method and device, equipment, medium and product

    CN119782183A