Test case generation method and device and storage medium

By establishing a test map and generating target test cases, the problem of low efficiency in the generation of test cases in the existing technology is solved, and automated test case generation is realized, which improves efficiency and reduces costs.

CN120196538APending Publication Date: 2025-06-24JINGDONG TECH HLDG CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311753980.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-19
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

When generating mobile test cases in the prior art, it is necessary to manually maintain the code logic corresponding to the keywords, resulting in inefficient generation.

Method used

By obtaining the multiple sets of page information corresponding to multiple pages of the application to be tested and the jump method information between pages, a test map is established, and a target test case is generated based on the test map.

Benefits of technology

Improve the efficiency of test case generation, reduce the need for manual maintenance and reuse logic, and reduce the time and cost of test case generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120196538A_ABST
    Figure CN120196538A_ABST
Patent Text Reader

Abstract

Embodiments of the invention disclose a test case generation method and apparatus, and a storage medium. The method comprises the steps of obtaining multiple groups of page information corresponding to multiple pages in a to-be-tested application and jump mode information between the pages; establishing a test map according to the multiple groups of page information and the jump mode information; and generating a target test case of the to-be-tested application according to the test map.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technologies, and in particular, to a test case generation method, an apparatus, and a storage medium. Background Art

[0002] With the development of mobile Internet technologies, application programs (APPs) have become the traffic entrance for a large number of users. To ensure the usage performance of APPs, it is necessary to test APPs using test cases before they are launched for use.

[0003] In related technologies, mobile test cases are generated by keywords. When generating test cases, efforts are made to reuse logic as much as possible, that is, to maintain the code logic corresponding to keywords. In the case of a large number of keywords, it is necessary to manually maintain the code logic corresponding to keywords one by one, thus reducing the generation efficiency of test cases. Summary of the Invention

[0004] To solve the above technical problems, embodiments of this application are expected to provide a test case generation method, an apparatus, and a storage medium, which can improve the generation efficiency of test cases.

[0005] The technical solution of this application is implemented as follows:

[0006] Embodiments of this application provide a test case generation method, and the test case generation method includes:

[0007] Obtain multiple groups of page information corresponding to multiple pages in the application program to be tested and the jump method information between pages;

[0008] Establish a test map according to the multiple groups of page information and the jump method information;

[0009] Generate target test cases for the application program to be tested according to the test map.

[0010] Embodiments of this application provide a test case generation apparatus, and the apparatus includes:

[0011] An obtaining unit, configured to obtain multiple groups of page information corresponding to multiple pages in the application program to be tested and the jump method information between pages;

[0012] A building unit, configured to establish a test map according to the multiple groups of page information and the jump method information;

[0013] A generating unit, configured to generate target test cases for the application program to be tested according to the test map.

[0014] Embodiments of this application provide a test case generation apparatus, and the apparatus includes:

[0015] A memory, a processor, and a communication bus, where the memory communicates with the processor through the communication bus, and the memory stores a program for generating test cases executable by the processor. When the program for generating test cases is executed, the above-mentioned test case generation method is executed by the processor.

[0016] An embodiment of the present application provides a storage medium, on which a computer program is stored, which is applied to a test case generation device. It is characterized in that when the computer program is executed by a processor, the above-mentioned test case generation method is implemented.

[0017] An embodiment of the present application provides a test case generation method, device, and storage medium. The test case generation method includes: obtaining multiple sets of page information corresponding to multiple pages in the application under test and information on the jump methods between pages; establishing a test map based on the multiple sets of page information and jump method information; generating target test cases for the application under test according to the test map. By adopting the above method implementation solution, the test case generation device obtains multiple sets of page information corresponding to multiple pages in the application under test and information on the jump methods between pages, so as to establish a test map based on the multiple sets of page information and the jump methods between pages, and thus can quickly generate target test cases for the application under test according to the test map, improving the efficiency of generating test cases. Description of the Drawings

[0018] Figure 1 It is a flowchart of a test case generation method provided by an embodiment of the present application;

[0019] Figure 2 It is a schematic diagram of the composition structure of a test case generation device provided by an embodiment of the present application Figure 1 ;

[0020] Figure 3 It is a schematic diagram of the composition structure of a test case generation device provided by an embodiment of the present application Figure 2 。 Detailed Embodiments

[0021] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0022] An embodiment of the present application provides a test case generation method. A test case generation method is applied to a test case generation device. Figure 1 It is a flowchart of a test case generation method provided by an embodiment of the present application. As Figure 1 shown, the test case generation method may include:

[0023] S101. Obtain multiple sets of page information corresponding to multiple pages in the application to be tested and the information on the page transition method between pages.

[0024] A test case generation method provided in an embodiment of the present application is applicable to the scenario of generating target test cases corresponding to an application to be tested.

[0025] In an embodiment of the present application, the test case generation device can be implemented in various forms. For example, the test case generation device described in the present application can include devices such as mobile phones, cameras, tablet computers, laptop computers, handheld computers, personal digital assistants (PDAs), portable media players (PMPs), navigation devices, wearable devices, smart bracelets, pedometers, etc., as well as devices such as digital TVs, desktop computers, servers, etc.

[0026] In an embodiment of the present application, the application to be tested can be any application, which can be specifically determined according to the actual situation, and the embodiments of the present application do not limit this.

[0027] In an embodiment of the present application, when the application to be tested is in use, there are multiple pages, and the user can perform operations such as viewing and clicking on these multiple pages for the user to use the application to be tested.

[0028] In an embodiment of the present application, multiple pages correspond one-to-one with multiple sets of page information, that is, one page corresponds to one set of page information.

[0029] In an embodiment of the present application, multiple sets of page information can be screenshots of multiple pages.

[0030] In an embodiment of the present application, the information on the page transition method between pages includes the adjustment operation method between pages and the information on the relevant interfaces that trigger page transitions.

[0031] It should be noted that the information on the page transition method between pages is the information on the page transition method between each pair of adjacent pages among multiple pages.

[0032] In an embodiment of the present application, the test case generation device can obtain multiple sets of page information corresponding to multiple pages in the application to be tested and the information on the page transition method between pages from the database; it can also obtain multiple sets of page information corresponding to multiple pages in the application to be tested and the information on the page transition method between pages from other devices; it can also obtain multiple sets of page information corresponding to multiple pages in the application to be tested and the information on the page transition method between pages through other means; the specific implementation method can be determined according to the actual situation, and the embodiments of the present application do not limit this.

[0033] In the embodiments of the present application, the test case generation device can capture the page screenshots of multiple pages, the operations of page jumps between pages, and the information of relevant interfaces, determine multiple groups of page information according to the page screenshots of multiple pages, and determine the page jump method information between pages according to the operations of page jumps between pages and the information of relevant interfaces.

[0034] S102. Establish a test map according to multiple groups of page information and jump method information.

[0035] In the embodiments of the present application, after the test case generation device obtains multiple groups of page information corresponding to multiple pages in the application under test and the page jump method information between pages, it can establish a test map according to multiple groups of page information and jump method information.

[0036] In the embodiments of the present application, the process of the test case generation device establishing a test map according to multiple groups of page information and jump method information includes: inputting multiple groups of page information into an image recognition model to obtain multiple page level information corresponding to multiple pages; establishing a test map according to multiple groups of page information, multiple page level information, and jump method information.

[0037] In the embodiments of the present application, the page level information is the page level of the page in the application under test. For example, page A is a first-level page in the application under test, page B is a second-level page in the application under test, page C is a third-level page in the application under test,....

[0038] In the embodiments of the present application, the image recognition model is used to recognize multiple page level information corresponding to multiple pages.

[0039] In the embodiments of the present application, the image recognition model can be a model configured in the test case generation device, or a model obtained by the test case generation device in other ways. The specific way for the test case generation device to obtain the image recognition model can be determined according to the actual situation, and the embodiments of the present application do not limit this.

[0040] In the embodiments of the present application, the test map is information for generating target test cases of the application under test.

[0041] In the embodiments of the present application, the process of the test case generation device establishing a test map according to multiple groups of page information, multiple page level information, and jump method information includes: arranging multiple groups of page information using multiple page level information to obtain an arrangement queue; establishing a connection relationship between adjacent page level information in the arrangement queue using jump method information; connecting multiple page level information in the arrangement queue in sequence according to the connection relationship to obtain a test map.

[0042] In the embodiments of the present application, multiple page level information can be used to arrange multiple groups of page information to obtain a tree-like arrangement queue. It is also possible to arrange multiple groups of page information using multiple page level information in other arrangement manners to obtain an arrangement queue; the specific implementation manner can be determined according to the actual situation, and the embodiments of the present application do not limit this.

[0043] In the embodiments of the present application, the process of the test case generation device connecting multiple page level information in the arrangement queue in sequence according to the connection relationship to obtain a test map includes: connecting multiple page level information in the arrangement queue in sequence using the connection relationship to obtain an initial test map; obtaining historical test cases and the execution records of the historical test cases; determining the execution paths and page assertions of the historical test cases according to the historical test cases and the execution records; adding the execution paths and page assertions to the initial test map to obtain a test map.

[0044] In the embodiments of the present application, the historical test cases can be test cases generated in the manner of the prior art.

[0045] It should be noted that the execution record is the relevant information recorded when the historical test case is executed.

[0046] In the embodiments of the present application, the test case generation device can obtain historical test cases and the execution records of the historical test cases in a database; it can also obtain historical test cases and the execution records of the historical test cases from other devices; the historical test cases and the execution records of the historical test cases can also be carried in the information input by the user; the specific manner for the test case generation device to obtain historical test cases and the execution records of the historical test cases can be determined according to the actual situation, and the embodiments of the present application do not limit this.

[0047] In the embodiments of the present application, the execution path of the historical test case is carried in the execution record; the page assertion is included in the historical test case.

[0048] In the embodiments of the present application, traverse the existing automated test cases and the execution records of the test cases (historical test cases and the execution records of the historical test cases), judge the picture categories of the screenshots in the test cases and the execution records through a picture recognition model and a classification algorithm, and collect the relevant information onto the map (initial test map). Specifically: reflect the paths of the existing automated test cases onto the APP map, and the test coverage can be shown on the map; associate the page assertions of the existing automated test cases with the relevant pages of the APP map to achieve the reuse of the assertion content; reflect the paths of the test cases onto the pages to maximize the reuse of the test case paths.

[0049] It can be understood that by reusing assertions and paths, the maintenance cost of test cases can be saved significantly.

[0050] In the embodiment of the present application, the process of the test case generation device inputting multiple groups of page information into the image recognition model to obtain multiple page-level information corresponding to multiple pages includes: adjusting multiple groups of page information according to a preset data type to obtain multiple groups of adjusted page information; inputting multiple groups of adjusted page information into the image classification model to obtain a first classification result; inputting multiple groups of adjusted page information into the optical character recognition model to obtain a second classification result; and determining multiple page-level information according to the first classification result and the second classification result.

[0051] It should be noted that the image recognition model includes an image classification model and an optical character recognition model.

[0052] In the embodiment of the present application, the preset data type can be the data type configured in the test case generation device, or the data type transmitted from other devices to the test case generation device, or the data type obtained by the test case generation device in other ways. The specific way for the test case generation device to obtain the preset data type can be determined according to the actual situation, and the embodiment of the present application does not limit this.

[0053] In the embodiment of the present application, the preset data type can be a picture data type with a pixel of 224*224 and having 3 channels (R, G, B). The preset data type can also be other data types, which can be specifically determined according to the actual situation, and the embodiment of the present application does not limit this.

[0054] It can be understood that by adjusting multiple groups of page information according to the preset data type, the sizes and numbers of channels of all input pictures are made consistent, enabling them to be correctly input into the image recognition model for training or prediction.

[0055] In the embodiment of the present application, the image classification model can be a resnet152 network model loaded according to transfer learning, or other network models. The specific image classification model can be determined according to the actual situation, and the embodiment of the present application does not limit this.

[0056] In the embodiment of the present application, the optical character recognition model can be a model constructed by an optical character recognition (OCR) algorithm, or other algorithm models. The specific one can be determined according to the actual situation, and the embodiment of the present application does not limit this.

[0057] In the embodiment of the present application, the process of determining multiple page level information according to the first classification result and the second classification result may be as follows: when the first classification result and the second classification result are the same, the page level information identified by the first classification result or the second classification result is used as the multiple page level information; when the first sub-result in the first classification result is different from the second sub-result in the second classification result, the page level information identified by the second classification result is used as the multiple page level information.

[0058] In the embodiment of the present application, before the test case generation device inputs multiple groups of page information into the image recognition model to obtain multiple page level information corresponding to multiple pages, it will also obtain multiple groups of sample page information and multiple sample page level information; and use the multiple groups of sample page information and multiple sample page level information to train the initial image recognition model to obtain the image recognition model.

[0059] In the embodiment of the present application, the test case generation device may obtain multiple groups of sample page information and multiple sample page level information from the sample database; it may also obtain multiple groups of sample page information and multiple sample page level information from other devices; it may also obtain multiple groups of sample page information and multiple sample page level information through other means; the specific way for the test case generation device to obtain multiple groups of sample page information and multiple sample page level information can be determined according to the actual situation, and the embodiment of the present application does not limit this.

[0060] In the embodiment of the present application, multiple groups of sample page information may be obtained first, and then the depth-first traversal algorithm is used to perform hierarchical traversal with a depth of 1, 2, 3... n for each page, so as to obtain multiple sample page level information.

[0061] In the embodiments of the present application, the initial image recognition model includes an initial image classification model and an initial optical character recognition model. Multiple groups of sample page information can be input into the initial image classification model to obtain multiple output page-level information; an initial loss value of the initial image classification model is determined according to the multiple output page-level information and the multiple sample page-level information. When the initial loss value is less than or equal to a preset model loss, a first image classification model is obtained; when the initial loss value is greater than the preset model loss, the initial image classification model is continuously trained using the multiple groups of sample page information and the multiple sample page-level information to obtain a trained model. When the loss value of the trained model is less than or equal to the preset model loss, the trained model is used as the first image classification model. Multiple groups of sample page information are input into the first image classification model to obtain multiple first output page-level information; multiple groups of sample page information are input into the initial optical character recognition model to obtain multiple second output page-level information; when the multiple first output page-level information is the same as the multiple second output page-level information, an image recognition model is determined according to the first image classification model and the initial optical character recognition model; when the multiple first output page-level information is different from the multiple second output page-level information, the model parameters of the first image classification model and the initial optical character recognition model are adjusted to obtain an adjusted first image classification model and an adjusted optical character recognition model. When the multiple first output page-level information obtained using the adjusted first image classification model and the adjusted optical character recognition model is different from the multiple second output page-level information, the model parameters of the adjusted first image classification model and the adjusted optical character recognition model are continuously adjusted until the multiple first output page-level information obtained using the adjusted first image classification model and the adjusted optical character recognition model is the same as the multiple second output page-level information, and an image recognition model is determined according to the adjusted first image classification model and the adjusted optical character recognition model.

[0062] It should be noted that if the image classification model is a resnet152 network model, when training the image classification model, all convolutional layers in resnet152 can be frozen. During the forward training and backpropagation processes, only the fully connected layer is trained, so that the feature extraction of the image remains unchanged and the aggregation classification is more targeted. During training, a classifier, a loss function, and an optimizer are redefined for the input image content, and a learning rate adjuster is added to help the data converge as much as possible; information such as the epoch iteration number, the number of batch image data processed, and the learning rate decay step is determined.

[0063] In the embodiment of the present application, after training is completed, a first image classification model is obtained. The first image classification model is used to classify the images (multiple groups of sample page information) collected during the execution of the automated test cases once; through the OCR algorithm, image features are extracted, and the feature content includes location information, feature identifiers, and classification information. The images that have completed the first classification are classified a second time; if the categories are the same for both the first classification and the second classification, the image classification is completed; if they are different, it is classified as an item to be classified; for the pages to be classified, manual classification can be performed, or after improving the model or the OCR algorithm, the second classification can be performed again, so as to train and obtain an image recognition model.

[0064] It should be noted that the preset model loss can be the model loss configured in the test case generation device, or the model loss transmitted from other devices to the test case generation device, or the model loss obtained by the test case generation device in other ways. The specific way for the test case generation device to obtain the preset model loss can be determined according to the actual situation, and the embodiments of the present application do not limit this.

[0065] S103. Generate target test cases for the application under test according to the test map.

[0066] In the embodiment of the present application, after the test case generation device establishes a test map based on multiple groups of page information and jump method information, it can generate target test cases for the application under test according to the test map.

[0067] In the embodiment of the present application, the process of the test case generation device generating target test cases for the application under test includes: when receiving a test case generation instruction corresponding to the application under test, obtaining the indicated page from the test case generation instruction; in the test map, obtaining the indicated page assertion corresponding to the indicated page; in the test map, starting from the indicated page, reversely searching for the parent page of the indicated page until the home page of the application under test to obtain multiple reverse pages; in the test map, starting from the home page, forwardly searching for the sub-pages of the home page until the indicated page to obtain multiple forward pages; generating target test cases according to the multiple forward pages, multiple reverse pages, the indicated page assertion, and the page jump method of the multiple forward pages or multiple reverse pages.

[0068] It should be noted that the indicated page is any one of multiple pages.

[0069] In the embodiment of the present application, the indicated page assertion is the assertion corresponding to the indicated page.

[0070] It should be noted that reverse and forward are in opposite directions. Exemplarily, after opening a certain e-commerce APP, the user can enter the home page of the APP, i.e., page A. After clicking on a certain product on the home page, the user can enter the product page, i.e., page B. After performing a certain operation on the product page, the user enters the next page, i.e., page C. After performing another operation on page C, the user enters page D. Then the parent page of page D is page C, the parent page of page C is page B, and the parent page of page B is page A. Starting from page D and searching backward for the parent page of page D until reaching the home page of the e-commerce APP, the multiple reverse pages obtained are page C, page B, and page A. Similarly, the sub-page of page A is page B, the sub-page of page B is page C, and the sub-page of page C is page D. Starting from the home page of the e-commerce APP (page A) and searching forward for the sub-pages of page A until reaching page D, the multiple forward pages obtained are page A, page B, and page C.

[0071] Exemplarily, on the APP map, for a specified page, the user can generate test cases with one click. The specific steps include: on the map, the user specifies a page and the existing assertions of this page as test requirements; reverse search: automatically detect the path to reach this page, generally starting from the specified page and searching backward for the parent pages that can reach this page until reaching the home page; forward search: starting from the home page, reach the target page in reverse order according to the results of the reverse path (the path data has been recorded when constructing the APP map, i.e., the operations of page jumps); combine the three types of information of page, operation, and assertion to form a test case data format, and generate the target test case according to the test case data format.

[0072] In the embodiment of the present application, after the test case generation device establishes a test map based on multiple groups of page information and jump method information, when receiving a test case generation instruction corresponding to the application under test, before obtaining the indicated page from the test case generation instruction, when the detection time arrives, the test case generation device inspects multiple pages, execution paths, and page assertions in the test map to obtain a detection result; and outputs the detection result.

[0073] In the embodiment of the present application, it can also be that when receiving an inspection instruction, the test case generation device inspects multiple pages, execution paths, and page assertions in the test map to obtain a detection result; specifically, the conditions for triggering the inspection of multiple pages, execution paths, and page assertions in the test map to obtain a detection result can be determined according to the actual situation, and the embodiment of the present application does not limit this.

[0074] In the embodiments of the present application, the detection time can be the time configured in the test case generation device, or the time transmitted to the test case device by other devices, or the time obtained by the test case generation device in other ways. Specifically, the way for the test case generation device to obtain the detection time can be determined according to the actual situation, and the embodiments of the present application do not limit this.

[0075] In the embodiments of the present application, the test case generation device can output the detection result to the display screen, or output the detection result in the form of voice, or output the detection result in other ways. Specifically, the way to output the detection result can be determined according to the actual situation, and the embodiments of the present application do not limit this.

[0076] In the embodiments of the present application, map problems are exposed in advance through the automatic execution of map inspection cases. Specifically, through the automatically generated inspection cases for the map page, path, and assertion, not only the map path problems are detected, but also the system is detected online to discover problems in advance.

[0077] In the embodiments of the present application, after the test case generation device generates the target test cases for the application under test according to the test map, it will also execute the target test cases.

[0078] In the embodiments of the present application, the test case generation device can execute the target test case immediately after generating the target test case; or execute the target test case when the test time arrives; specifically, the time to execute the target test case can be determined according to the actual situation, and the embodiments of the present application do not limit this.

[0079] It should be noted that the test time can be the time configured in the test case generation device, or the time transmitted to the test case generation device by other devices, or the time obtained by the test case generation device in other ways. Specifically, the way for the test case generation device to obtain the test time can be determined according to the actual situation, and the embodiments of the present application do not limit this.

[0080] In the embodiments of the present application, the target test case can be executed in the test case generation device, or the test case generation device can transmit the target test case to the target device and use the target device to execute the target test case. Among them, the target device is the device storing the application under test.

[0081] Exemplarily, the obtained use cases (target test cases) are sent to the mobile use case execution engine to execute the mobile use cases. The specific execution method can be implemented by means of the open-source accessibility service of Android, etc., which will not be elaborated here. Each time the user wants to test (or when triggered by a scheduled time point), test cases are generated in a timely manner and executed. Therefore, there is no need to maintain the content of the test cases, and only the integrity of the system map and the availability of each link on the map need to be maintained, greatly reducing the maintenance cost. For example: from page A to page B, there are 4 use cases on page B for different test assertions. The link from A to B is the button Button on page A. If Button changes to Button1 in this version update, originally, 4 use cases need to be maintained and modified. Assuming that the time to modify one use case is t minutes, then the maintenance cost caused by one modification is 4t minutes. In the current solution, only the button of the link from A to B on the system map needs to be maintained and modified to Button1, and the maintenance cost is t minutes. Compared with the original (existing technology), it is greatly reduced.

[0082] It can be understood that the test case generation device obtains multiple groups of page information corresponding to multiple pages in the application under test and the information on the jump methods between pages, and establishes a test map based on the multiple groups of page information and the information on the jump methods between pages, so that the target test cases of the application under test can be quickly generated according to the test map, improving the efficiency when generating test cases.

[0083] Based on the same inventive concept as the above test case generation method, an embodiment of the present application provides a test case generation device 1, corresponding to a test case generation method; Figure 2 The schematic composition structure of a test case generation device provided by an embodiment of the present application Figure 1 The test case generation device 1 may include:

[0084] An obtaining unit 11, configured to obtain multiple groups of page information corresponding to multiple pages in the application under test and the information on the jump methods between pages;

[0085] A building unit 12, configured to build a test map according to the multiple groups of page information and the jump method information;

[0086] A generating unit 13, configured to generate target test cases of the application under test according to the test map.

[0087] In some embodiments of the present application, the device further includes an input unit;

[0088] The input unit is configured to input the multiple groups of page information into an image recognition model to obtain multiple page level information corresponding to the multiple pages;

[0089] The establishing unit 12 is configured to establish a test map according to the multiple groups of page information, the multiple page level information, and the jump mode information.

[0090] In some embodiments of the present application, the apparatus further includes an arranging unit and a connecting unit;

[0091] The arranging unit is configured to arrange the multiple groups of page information by using the multiple page level information to obtain an arranged queue;

[0092] The establishing unit 12 is configured to establish a connection relationship between adjacent page level information in the arranged queue by using the jump mode information;

[0093] The connecting unit is configured to sequentially connect the multiple page level information in the arranged queue according to the connection relationship to obtain the test map.

[0094] In some embodiments of the present application, the apparatus further includes an adding unit and a determining unit;

[0095] The connecting unit is configured to sequentially connect the multiple page level information in the arranged queue according to the connection relationship to obtain an initial test map;

[0096] The obtaining unit 11 is configured to obtain historical test cases and execution records of the historical test cases;

[0097] The determining unit is configured to determine an execution path and page assertions of the historical test case according to the historical test case and the execution record;

[0098] The adding unit is configured to add the execution path and the page assertions to the initial test map to obtain the test map.

[0099] In some embodiments of the present application, the apparatus further includes an adjusting unit;

[0100] The adjusting unit is configured to adjust the multiple groups of page information according to a preset data type to obtain multiple groups of adjusted page information;

[0101] The input unit is configured to input the multiple groups of adjusted page information into a picture classification model to obtain a first classification result; the picture recognition model includes the picture classification model; input the multiple groups of adjusted page information into an optical character recognition model to obtain a second classification result; the picture recognition model includes the optical character recognition model;

[0102] The determining unit is configured to determine the multiple page level information according to the first classification result and the second classification result.

[0103] In some embodiments of the present application, the apparatus further includes a training unit;

[0104] The obtaining unit 11 is configured to obtain multiple groups of sample page information and multiple sample page level information;

[0105] The training unit is configured to train an initial image recognition model by using the multiple groups of sample page information and the multiple sample page level information to obtain the image recognition model.

[0106] In some embodiments of the present application, the apparatus further includes a searching unit;

[0107] The obtaining unit 11 is configured to, when receiving a test case generation instruction corresponding to the application under test, obtain an indication page from the test case generation instruction, where the indication page is any one of the multiple pages; in the test map, obtain an indication page assertion corresponding to the indication page;

[0108] The searching unit is configured to, in the test map, start from the indication page and reversely search for the parent page of the indication page until the home page of the application under test to obtain multiple reverse pages; in the test map, start from the home page and forwardly search for the sub-pages of the home page until the indication page to obtain multiple forward pages;

[0109] The generating unit 13 is configured to generate the target test case according to the multiple forward pages, the multiple reverse pages, the indication page assertion, and the page jump manner of the multiple forward pages or the multiple reverse pages.

[0110] In some embodiments of the present application, the apparatus further includes a detecting unit and an output unit;

[0111] The detecting unit is configured to, when the detection time arrives, perform a patrol inspection on multiple pages, execution paths, and page assertions in the test map to obtain a detection result;

[0112] The input unit is configured to output the detection result.

[0113] In some embodiments of the present application, the apparatus further includes an execution unit;

[0114] The execution unit is configured to execute the target test case.

[0115] It should be noted that in practical applications, the above-mentioned acquisition unit 11, establishment unit 12, and generation unit 13 can be implemented by the processor 14 on the test case generation device 1, specifically implemented by a CPU (Central Processing Unit), MPU (Microprocessor Unit), DSP (Digital Signal Processing), or field programmable gate array (FPGA, Field Programmable Gate Array), etc.; the above-mentioned data storage can be implemented by the memory 15 on the test case generation device 1.

[0116] An embodiment of the present application also provides a test case generation device 1, as Figure 3 shown. The test case generation device 1 includes: a processor 14, a memory 15, and a communication bus 16. The memory 15 communicates with the processor 14 through the communication bus 16. The memory 15 stores programs executable by the processor 14. When the programs are executed, the test case generation method as described above is executed through the processor 14.

[0117] In practical applications, the above-mentioned memory 15 can be a volatile memory, such as a random access memory (RAM); or a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD); or a combination of the above types of memories, and provides instructions and data to the processor 14.

[0118] An embodiment of the present application provides a computer-readable storage medium with a computer program stored thereon. When the program is executed by the processor 14, the test case generation method as described above is implemented.

[0119] It can be understood that the test case generation device obtains multiple sets of page information corresponding to multiple pages in the application under test and the jump method information between pages, and establishes a test map based on the multiple sets of page information and the jump method information between pages, so that the target test cases of the application under test can be quickly generated according to the test map, improving the efficiency when generating test cases.

[0120] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.

[0121] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or blocks.

[0122] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or blocks.

[0123] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or blocks.

[0124] As described above, only the preferred embodiments of the present application are given, and they are not used to limit the protection scope of the present application.

Claims

1. A test case generation method, characterized in that, The method includes: Obtaining multiple sets of page information corresponding to multiple pages in the application to be tested and information on the jump methods between the pages; Establishing a test map based on the multiple sets of page information and the jump method information; Generating target test cases for the application to be tested according to the test map.

2. The method according to claim 1, wherein The establishing of the test map according to the multiple sets of page information and the jump method information includes: Inputting the multiple sets of page information into an image recognition model to obtain multiple page level information corresponding to the multiple pages; Establishing a test map according to the multiple sets of page information, the multiple page level information, and the jump method information.

3. The method according to claim 2, characterized in that, The establishing of the test map according to the multiple sets of page information, the multiple page level information, and the jump method information includes: Arranging the multiple sets of page information using the multiple page level information to obtain an arrangement queue; Establishing connection relationships between adjacent page level information in the arrangement queue using the jump method information; Sequentially connecting the multiple page level information in the arrangement queue according to the connection relationships to obtain the test map.

4. The method according to claim 3, wherein The sequentially connecting of the multiple page level information in the arrangement queue according to the connection relationships to obtain the test map includes: Sequentially connecting the multiple page level information in the arrangement queue using the connection relationships to obtain an initial test map; Obtaining historical test cases and execution records of the historical test cases; Determining the execution paths and page assertions of the historical test cases according to the historical test cases and the execution records; Adding the execution paths and the page assertions to the initial test map to obtain the test map.

5. The method according to claim 2, wherein The inputting of the multiple sets of page information into an image recognition model to obtain multiple page level information corresponding to the multiple pages includes: Adjusting the multiple sets of page information according to a preset data type to obtain multiple sets of adjusted page information; Inputting the multiple sets of adjusted page information into an image classification model to obtain a first classification result; the image recognition model includes the image classification model; Inputting the multiple sets of adjusted page information into an optical character recognition model to obtain a second classification result; the image recognition model includes the optical character recognition model; Determining the multiple page level information according to the first classification result and the second classification result.

6. The method according to claim 2, wherein Before the inputting of the multiple sets of page information into an image recognition model to obtain multiple page level information corresponding to the multiple pages, the method further includes: Obtaining multiple sets of sample page information and multiple sample page level information; Training an initial image recognition model using the multiple sets of sample page information and the multiple sample page level information to obtain the image recognition model.

7. The method according to claim 1, characterized in that, The generating of the target test cases for the application to be tested according to the test map includes: When receiving a test case generation instruction corresponding to the application to be tested, obtaining an indicated page from the test case generation instruction, where the indicated page is any one of the multiple pages; In the test map, obtain the assertion of the indicated page corresponding to the indicated page; In the test map, starting from the indicated page, reverse search for the parent page of the indicated page until the home page of the application under test, to obtain a plurality of reverse pages; In the test map, starting from the home page, forward search for the sub-pages of the home page until the indicated page, to obtain a plurality of forward pages; Generate the target test case according to the plurality of forward pages, the plurality of reverse pages, the indicated page assertion, and the page jump method of the plurality of forward pages or the plurality of reverse pages.

8. The method according to claim 7, characterized in that, After establishing the test map according to the multiple groups of page information and the jump method information, before obtaining the indicated page from the test case generation instruction when receiving the test case generation instruction corresponding to the application under test, the method further includes: When the detection time arrives, perform a patrol inspection on multiple pages, execution paths, and page assertions in the test map to obtain a detection result; Output the detection result.

9. The method according to claim 1, characterized in that, After generating the target test case of the application under test according to the test map, the method further includes: Execute the target test case.

10. A test case generation device, characterized in that, The device includes: An acquisition unit, configured to acquire multiple groups of page information corresponding to multiple pages in the application under test and the jump method information between pages; A building unit, configured to build a test map according to the multiple groups of page information and the jump method information; A generation unit, configured to generate the target test case of the application under test according to the test map.

11. A test case generation device, characterized in that The device includes: A memory, a processor, and a communication bus. The memory communicates with the processor through the communication bus. The memory stores a program for generating test cases executable by the processor. When the program for generating test cases is executed, the method according to any one of claims 1 to 9 is executed by the processor.

12. A storage medium storing a computer program, which is applied to a test case generation device, characterized in that When the computer program is executed by the processor, the method according to any one of claims 1 to 9 is implemented.