Canvas address-based test case generation method and related equipment
By receiving canvas addresses and generating test cases, obtaining canvas elements for pattern recognition and classification, and generating target metadata, it solves the problem of cumbersome writing of test cases in interface design and improves testing efficiency and accuracy.
Patent Information
- Application Number
- CN202410965683.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-11-15
AI Technical Summary
In interface design, the writing process of test cases is cumbersome and inefficient, and there is a possibility of errors, which affects the rapid iterative development of the product.
By receiving canvas address and test case generation requests, obtaining canvas elements, performing pattern recognition and classification, generating initial images, extracting features, generating target metadata, and generating test cases in combination with test case requests, simplifying the writing process of test cases.
Improve testing efficiency, reduce manual intervention, and realize rapid and automatic generation of test cases, improving testing efficiency and accuracy.
Smart Images

Figure CN118964180A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application belong to the field of data processing technology, and in particular, relate to a test case generation method based on a canvas address and related equipment. Background Art
[0002] In interface design, testers are required to write requirements and test cases. When writing test cases, they need to write a large number of test points and test steps required for the test. The writing process is cumbersome and there is a possibility of errors, which affects the test efficiency and is not conducive to rapid iterative product development. Summary of the invention
[0003] In view of this, an embodiment of the present application provides a test case generation method based on a canvas address and related devices to solve the problem of low testing efficiency in existing interface designs.
[0004] In a first aspect, an embodiment of the present application provides a test case generation method based on a canvas address, comprising:
[0005] Receive canvas address and test case generation request;
[0006] Acquire canvas elements according to the canvas address, analyze the canvas elements based on pattern recognition, identify different primitives and classify each primitive, acquire associations between the classified primitives, and combine the primitives with associations to obtain an initial image;
[0007] Inputting the initial image into a preset model, extracting features of the initial image through the preset model, classifying and screening the initial image based on the extracted features to obtain a target image, and generating target image metadata corresponding to the image content of the target image based on the target image;
[0008] A test case is generated according to the test case request and the target graph metadata.
[0009] As an implementable method of the present application, obtaining a canvas element according to the canvas address includes:
[0010] Verify whether the canvas address is valid. If valid, send an HTTP request to the target end through the canvas address, receive image data returned by the target end in response to the HTTP request, and obtain canvas elements based on the image data.
[0011] As an implementable manner of the present application, the verifying whether the canvas address is valid includes:
[0012] Obtain whether the address string of the canvas address conforms to the target format. If so, send a header file acquisition request to the target end based on the canvas address, receive header file information returned by the target end in response to the header file acquisition request, and determine whether the header file information points to a valid image format. If so, determine that the canvas address is valid.
[0013] As an exemplified manner of the present application, before the step of inputting the initial image into a preset model, the method further includes:
[0014] Acquire preprocessing parameters, and determine whether the initial image meets the resolution and size requirements according to the preprocessing parameters;
[0015] If not, the initial image is scaled until the requirement is met, and it is determined whether the initial image that meets the requirement has redundant background. If so, the initial image is cropped and denoised to obtain an initial image for input.
[0016] As an implementable manner of the present application, generating target metadata corresponding to the image content of the target image based on the target image includes:
[0017] Performing text recognition on the target image, and converting feature information of the image elements in the target image into a natural language description using the preset model;
[0018] The recognized text and the converted natural language description are output in a preset format as target image metadata corresponding to the target image content.
[0019] As an implementable manner of the present application, after the step of generating target metadata corresponding to the image content of the target image based on the target image, the method further includes:
[0020] The preset model is used to generate layout optimization parameters according to the target image element data, and the image elements in the target image are rearranged and spatially redistributed according to the layout optimization parameters.
[0021] As an implementable manner of the present application, the step of generating a test case according to the test case request and the target metadata includes:
[0022] Parsing the test case request to obtain requirement information;
[0023] Generate a test case template according to the requirement information, and obtain corresponding data from the target metadata according to the requirement information to fill in the test case template, so as to generate an initial test case;
[0024] The user operation is monitored in real time to obtain interaction information, and the initial test case is modified based on the interaction information to obtain and output the final test case.
[0025] In a second aspect, an embodiment of the present application provides a test case generation device based on a canvas address, comprising:
[0026] A request receiving unit, used for receiving a canvas address and a test case generation request;
[0027] a first processing unit, configured to obtain canvas elements according to the canvas address, analyze the canvas elements based on pattern recognition, identify different primitives and classify the primitives, obtain associations between the classified primitives, and combine the primitives with associations to obtain an initial image;
[0028] A second processing unit is used to input the initial image into a preset model, extract features of the initial image through the preset model, classify and screen the initial image based on the extracted features to obtain a target image, and generate target image metadata corresponding to its image content based on the target image;
[0029] A generating unit is used to generate a test case according to the test case request and the target graph metadata.
[0030] In a third aspect, an embodiment of the present application provides a computer device, including:
[0031] at least one processor; and,
[0032] a memory communicatively connected to the at least one processor; wherein,
[0033] The memory stores instructions that can be executed by the at least one processor. When the instructions are executed by the at least one processor, the at least one processor is enabled to execute the test case generation method based on the canvas address as described above.
[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer-readable instructions stored thereon, and when the computer-readable instructions are executed by at least one processor, the test case generation method based on the canvas address as described above is implemented.
[0035] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0036] The embodiment of the present application can extract canvas elements according to the canvas address, obtain graphic elements based on the canvas elements, and perform classification processing, and classify and filter the initial image obtained based on the association relationship of the classified graphic elements, and finally convert the filtered target image into target graphic element data, and generate test cases in combination with test case requests, which simplifies the process of writing tedious test cases in the interface testing process and improves the testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0038] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0039] Figure 2 A flowchart of a test case generation method based on a canvas address according to an embodiment of the present application;
[0040] Figure 3 A structural block diagram of a test case generation device based on a canvas address according to an embodiment of the present application;
[0041] Figure 4 This is a structural block diagram of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION
[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0043] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0044] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0045] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0046] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0047] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0048] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .
[0049] It should be noted that the test case generation method based on the canvas address provided in the embodiment of the present application is generally executed by a server, and accordingly, the test case generation device based on the canvas address is generally set in the server.
[0050] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0051] Continue to refer Figure 2 The embodiment of the present application provides a test case generation method based on a canvas address, which is applied to the test of interface design. The test case generation method based on a canvas address includes the following steps S21 to S24.
[0052] S21. Receive a canvas address and a test case generation request.
[0053] In interface design, the canvas can be understood as the basic page for graphics drawing. On the canvas, developers or users can add, edit, and delete various graphic elements. The elements in the canvas include shapes, paths, texts, images, interactions, and layers. These elements are composed of primitives. The canvas address (for example, des-devc l oud.ygsoft.com / necp / mapp / desi gn / genentity / des i gn / page / i ndex.html) points to such a page, which includes images to be processed in subsequent steps, and the image is composed of one or more of the aforementioned primitives.
[0054] In this embodiment, the server is connected to the front end, and a canvas address collection entrance is provided on the front end. The user inputs the canvas address. Along with the input of the canvas address, the user can also initiate a test case generation request, and pass the requirement information to the server through the request. In subsequent steps, the server will respond to the test case generation request and automatically generate a test case through the received canvas address and requirement information.
[0055] S22, obtaining canvas elements according to the canvas address, analyzing the canvas elements based on pattern recognition, identifying different primitives and classifying each primitive, obtaining the association relationship between the classified primitives, and combining the primitives with the association relationship to obtain an initial image.
[0056] In this embodiment, in the stage of obtaining canvas elements based on the canvas address, all the disorganized canvases containing all the primitives will be obtained. Classifying the primitives can facilitate primitive screening and content extraction in subsequent steps. In the subsequent steps of this embodiment, the extracted primitives will be sorted according to natural language to obtain readable primitive metadata, which will reflect the actual primitive location, category and other attributes.
[0057] After obtaining the canvas elements, the canvas content is analyzed through pattern recognition, and the primitives are identified and classified through pattern recognition. Specifically, the "primitives" (the basic components of the graphics) in the canvas image are automatically identified and distinguished through algorithms or models, and these primitives are classified into predefined categories, such as points, lines, shapes, icons, text or any other basic units that constitute the image.
[0058] The process of pattern recognition usually includes steps such as model training, feature extraction, and classification. The training model uses a labeled data set (i.e., a series of images of known categories) to train a classification model through machine learning or deep learning algorithms. The model assigns the primitives to the correct category based on the extracted features. Feature extraction is to extract features from the image that help distinguish different types of primitives. These features may include color, texture, shape, edge information, etc. Classification is to use the trained model to automatically classify the primitives into corresponding categories based on the learned patterns for new unlabeled images. It can be a direct feature match or a complex decision boundary to divide the categories.
[0059] This embodiment applies pattern recognition to automatically extract canvas information in a UI interface, so that a machine can understand and process canvas elements to obtain graphic elements and obtain the association relationship between graphic elements, thereby improving the efficiency and accuracy of automated processing.
[0060] In this embodiment, the association relationship between the graphic elements is determined by the lines between the graphic elements, and a plurality of graphic elements connected by the lines are extracted and combined into a complete content, that is, an initial image is obtained.
[0061] In one embodiment, the acquisition of canvas elements according to the canvas address includes: verifying whether the canvas address is valid, if valid, sending an HTTP request to the target end through the canvas address, receiving image data returned by the target end in response to the HTTP request, and acquiring canvas elements based on the image data. When verifying the canvas address in this embodiment, a technology for crawling in the network is used, such as using an HTTP request. This process can ensure that the canvas address is valid and accessible, and then the canvas element can be acquired according to the valid information in the canvas address. Since the canvas data can be directly acquired through the canvas address, data acquisition is convenient, which brings convenience to testers, is conducive to the rapid and automatic generation of test cases, and the test is highly convenient.
[0062] In one embodiment, verifying whether the canvas address is valid includes: obtaining whether the address string of the canvas address conforms to the target format, if so, sending a header file acquisition request to the target end based on the canvas address, receiving header file information returned by the target end in response to the header file acquisition request, and determining whether the header file information points to a valid image format, if so, determining that the canvas address is valid. When verifying the canvas address in this embodiment, a technology for crawling in the network is used, such as using an HTTP request, and this process can ensure that the canvas address is valid and accessible.
[0063] S23, inputting the initial image into a preset model, extracting features of the initial image through the preset model, classifying and screening the initial image based on the extracted features to obtain a target image, and generating target image metadata corresponding to its image content based on the target image;
[0064] In this step, at least one preset model will be loaded. The preset model is trained based on deep learning technology. The preset model can accurately identify features in the image through its internal neural network structure, extract features and classify the image, and convert the target image obtained after screening into target image metadata corresponding to its image content. The target image metadata formed by the preset model in this embodiment is more accurate, which is conducive to generating test cases with better testing effects.
[0065] In one embodiment, the generation of target graphic element data corresponding to the image content based on the target image includes: performing text recognition on the target image, and converting feature information of graphic elements in the target image into natural language descriptions using the preset model; and outputting the recognized text and the converted natural language descriptions in a preset format as target graphic element data corresponding to the target image content.
[0066] In this embodiment, the target graphic metadata is displayed in the form of text in a real page, and the content displayed on the page is the real content and relationship of the graphics in the canvas. Therefore, test requirements and test cases can be automatically generated based on the target graphic metadata in text form, which greatly improves the efficiency of testing cumbersome test cases. Test cases can be generated directly in the front-end interface for testers to use.
[0067] In one embodiment, before the step of inputting the initial image into a preset model, the method further includes: obtaining preprocessing parameters, and determining whether the initial image meets the resolution and size requirements based on the preprocessing parameters; if not, scaling the initial image until the requirements are met, and determining whether the initial image that meets the requirements has excess background, and if so, cropping and denoising the initial image to obtain an initial image for input.
[0068] This embodiment loads the image from the canvas address and performs necessary preprocessing on the image, such as scaling, cropping, denoising, etc., which can improve the accuracy of subsequent processing to generate target image metadata and is suitable for large-scale, high-precision image processing and data analysis.
[0069] S24: Generate a test case according to the test case request and the target graph metadata.
[0070] In one embodiment, the step of generating a test case based on the test case request and the target metadata includes: parsing the test case request to obtain requirement information; generating a test case template based on the requirement information, and obtaining corresponding data from the target metadata based on the requirement information to fill in the test case template and generate an initial test case; monitoring user operations in real time to obtain interaction information, modifying the initial test case based on the interaction information, obtaining a final test case and outputting it.
[0071] In this embodiment, the tester can ask questions (i.e., interactive information) based on the extracted target metadata or the generated initial test case. The preset model will add the tester's questions to the template metadata or the initial test case for merger, and then perform understanding and reasoning, and finally return the test case the user wants in a specific format. Of course, the tester can continue to ask questions based on this to generate more satisfactory test cases.
[0072] In one embodiment, after the step of generating target graphic element data corresponding to the image content based on the target image, the method further includes: enabling the preset model to generate layout optimization parameters according to the target graphic element data, and rearranging the positions and reallocating the spaces of the graphic elements in the target image according to the layout optimization parameters.
[0073] In this embodiment, by rearranging the positions and reallocating the spaces of the graphics elements, graphics elements with better layout can be obtained, and then generating target graphics element data can obtain test cases with better test effects.
[0074] In the above embodiment, since the test case generation process reduces manual intervention, directly obtaining the metadata through the canvas address can quickly help optimize the demand description content through the preset model. The model-assisted analysis has strong scalability and flexibility, and increases security and privacy protection. The canvas address method ensures data security.
[0075] According to the test case generation method based on canvas address provided in the embodiment of the present application, canvas elements can be extracted according to the canvas address, and classification processing can be performed after obtaining graphic elements based on the canvas elements, and classification and screening can be performed on the initial image obtained based on the association relationship of the classified graphic elements, and finally the screened target image is converted into target graphic element data, so as to realize efficient and accurate graphic element data conversion of the image in the canvas address, and then generate test cases in combination with the target graphic element data and the test case request, which simplifies the process of writing tedious test cases in the interface testing process and improves the testing efficiency.
[0076] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0077] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0078] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a test case generation device based on a canvas address, and the device embodiment is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0079] like Figure 3 As shown, the canvas address-based test case generation device described in this embodiment includes a request receiving unit 301, a first processing unit 302, a second processing unit 303 and a generating unit 304, wherein:
[0080] The request receiving unit 301 is used to receive a canvas address and a test case generation request; the first processing unit 302 is used to obtain a canvas element according to the canvas address, analyze the canvas element based on pattern recognition, identify different primitives and classify each primitive, obtain the association relationship between the classified primitives, and combine the primitives with association relationships to obtain an initial image; the second processing unit 303 is used to input the initial image into a preset model, extract features of the initial image through the preset model, classify and filter the initial image based on the extracted features to obtain a target image, and generate target primitive metadata corresponding to its image content based on the target image; the generation unit 304 is used to generate a test case according to the test case request and the target primitive metadata.
[0081] In one embodiment, when the first processing unit 302 obtains the canvas element according to the canvas address, it is specifically used to: verify whether the canvas address is valid; if valid, send an HTTP request to the target end through the canvas address, receive image data returned by the target end in response to the HTTP request, and obtain the canvas element based on the image data.
[0082] In one embodiment, when verifying whether the canvas address is valid, the first processing unit 302 is specifically used to: obtain whether the address string of the canvas address conforms to the target format; if so, send a header file acquisition request to the target end based on the canvas address; receive header file information returned by the target end in response to the header file acquisition request; determine whether the header file information points to a valid image format; if so, determine that the canvas address is valid.
[0083] In one embodiment, before inputting the initial image into a preset model, the first processing unit 302 is further used to: obtain preprocessing parameters, and determine whether the initial image meets the resolution and size requirements based on the preprocessing parameters; if not, scale the initial image until the requirements are met, and determine whether the initial image that meets the requirements has excess background, and if so, crop and denoise the initial image to obtain an initial image for input.
[0084] In one embodiment, when the second processing unit 303 generates target graphic element data corresponding to the image content of the target image based on the target image, it is specifically used to: perform text recognition on the target image, and convert the feature information of the graphic element in the target image into a natural language description using the preset model; output the recognized text and the converted natural language description in a preset format as the target graphic element data corresponding to the target image content.
[0085] In one embodiment, after generating target graphic element data corresponding to the image content based on the target image, the second processing unit 303 is further used to: enable the preset model to generate layout optimization parameters according to the target graphic element data, and rearrange the positions and spatially reallocate the graphic elements in the target image according to the layout optimization parameters.
[0086] In one embodiment, when generating a test case according to the test case request and the target metadata, the generation unit 304 is specifically used to: parse the test case request to obtain requirement information; generate a test case template according to the requirement information, and obtain corresponding data from the target metadata according to the requirement information to fill in the test case template and generate an initial test case; monitor user operations in real time to obtain interaction information, modify the initial test case based on the interaction information, obtain a final test case and output it.
[0087] For the specific processing process performed by the above-mentioned units, please refer to the relevant content in the above-mentioned method embodiment, which will not be expanded here.
[0088] According to the test case generation device based on canvas address provided in the embodiment of the present application, canvas elements can be extracted according to the canvas address, and classification processing can be performed after obtaining graphic elements based on the canvas elements. The initial image obtained based on the association relationship of the classified graphic elements can be classified and screened, and finally the screened target image can be converted into target graphic element data. The test case is generated in combination with the test case request, which simplifies the process of writing tedious test cases during interface testing and improves testing efficiency.
[0089] An embodiment of the present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the test case generation method based on the canvas address as described above is implemented, and has corresponding technical effects.
[0090] Please refer to Figure 4 , Figure 4It is a basic structural block diagram of the computer device of this embodiment. The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with components 41-43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0091] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0092] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. equipped on the computer device 4. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as the program code of the data table audit method, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.
[0093] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run the program code stored in the memory 41 or process data, such as running the program code of the data table audit method.
[0094] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.
[0095] In order to solve the above technical problems, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. The computer program can be executed by at least one processor to enable the at least one processor to execute the test case generation method based on the canvas address as described above, and have corresponding technical effects.
[0096] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0097] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
Claims
1. A test case generation method based on canvas address, characterized in that: include: Receive canvas address and test case generation request; Acquire canvas elements according to the canvas address, analyze the canvas elements based on pattern recognition, identify different primitives and classify each primitive, acquire associations between the classified primitives, and combine the primitives with associations to obtain an initial image; Inputting the initial image into a preset model, extracting features of the initial image through the preset model, classifying and screening the initial image based on the extracted features to obtain a target image, and generating target image metadata corresponding to the image content of the target image based on the target image; A test case is generated according to the test case request and the target graph metadata.
2. The test case generation method based on canvas address according to claim 1, characterized in that: The acquiring of the canvas element according to the canvas address comprises: Verify whether the canvas address is valid. If valid, send an HTTP request to the target end through the canvas address, receive image data returned by the target end in response to the HTTP request, and obtain canvas elements based on the image data.
3. The test case generation method based on canvas address according to claim 2, characterized in that: The verifying whether the canvas address is valid includes: Obtain whether the address string of the canvas address conforms to the target format. If so, send a header file acquisition request to the target end based on the canvas address, receive header file information returned by the target end in response to the header file acquisition request, and determine whether the header file information points to a valid image format. If so, determine that the canvas address is valid.
4. The test case generation method based on canvas address according to any one of claims 1 to 3, characterized in that: Before the step of inputting the initial image into a preset model, the method further comprises: Acquire preprocessing parameters, and determine whether the initial image meets the resolution and size requirements according to the preprocessing parameters; If not, the initial image is scaled until the requirement is met, and it is determined whether the initial image that meets the requirement has redundant background. If so, the initial image is cropped and denoised to obtain an initial image for input.
5. The test case generation method based on canvas address according to claim 4, characterized in that: The generating target metadata corresponding to the image content of the target image based on the target image comprises: Performing text recognition on the target image, and converting feature information of the image elements in the target image into a natural language description using the preset model; The recognized text and the converted natural language description are output in a preset format as target image metadata corresponding to the target image content.
6. The test case generation method based on canvas address according to claim 5, characterized in that: After the step of generating target metadata corresponding to the image content of the target image based on the target image, the method further includes: The preset model is used to generate layout optimization parameters according to the target image element data, and the image elements in the target image are rearranged and spatially redistributed according to the layout optimization parameters.
7. The test case generation method based on canvas address according to claim 5, characterized in that: The step of generating a test case according to the test case request and the target graph metadata comprises: Parsing the test case request to obtain requirement information; Generate a test case template according to the requirement information, and obtain corresponding data from the target metadata according to the requirement information to fill in the test case template, so as to generate an initial test case; The user operation is monitored in real time to obtain interaction information, and the initial test case is modified based on the interaction information to obtain and output the final test case.
8. A test case generation device based on canvas address, characterized in that: include: A request receiving unit, used for receiving a canvas address and a test case generation request; a first processing unit, configured to obtain canvas elements according to the canvas address, analyze the canvas elements based on pattern recognition, identify different primitives and classify the primitives, obtain associations between the classified primitives, and combine the primitives with associations to obtain an initial image; A second processing unit is used to input the initial image into a preset model, extract features of the initial image through the preset model, classify and screen the initial image based on the extracted features to obtain a target image, and generate target image metadata corresponding to its image content based on the target image; A generating unit is used to generate a test case according to the test case request and the target graph metadata.
9. A computer device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor. When the instructions are executed by the at least one processor, the at least one processor executes the test case generation method based on canvas address as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by at least one processor, the test case generation method based on canvas address according to any one of claims 1 to 7 is implemented.
