Generation method, test method, electronic equipment, storage medium and program product

By obtaining and classifying multiple types of test demand information, multimodal demand data are formed, and test cases are generated based on this, the problem of low quality of test cases in the existing technology is solved, and more efficient and accurate test case generation is achieved.

CN119621587APending Publication Date: 2025-03-14KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411874228.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

When generating test cases, it is difficult for the prior art to fully cover all possible usage scenarios, resulting in lower quality of test cases.

Method used

Multimodal requirement data is formed by obtaining multiple types of test requirements information (including text types and image types), classifying them and adding type identification. Then, based on the specified use cases, generate the rules and multimodal requirements data, generate the prompts for the model, and finally generate the test cases.

Benefits of technology

Through the use of multimodal demand data, cross-modal information complements each other, the quality and efficiency of test cases are improved, ensuring that test cases more comprehensively and accurately cover all possible scenarios of the functions to be tested.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621587A_ABST
    Figure CN119621587A_ABST
Patent Text Reader

Abstract

The invention provides a test case generation method, a test method, an electronic device, a readable storage medium and a computer program product.The test case generation method comprises the steps that firstly, test requirement information of a to-be-tested function is obtained, and the obtained test requirement information comprises multiple types of test requirements; the multiple types comprise a text type and an image type, then classifying the test demand information according to the types of the test demands, and adding different type identifiers to the obtained different types of test demands to obtain multi-modal demand data carrying multiple different type identifiers; wherein the multi-modal demand data comprises text data and image data, then generating a cue word of the model according to a specified case generation rule and the multi-modal demand data, and finally generating a test case of a function to be tested based on the cue word.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of computers, and more particularly to a method for generating a test case, a test method, an electronic device, a readable storage medium, and a computer program product. Background Art

[0002] When testers conduct QA (Quality Assurance) testing, they usually need to read and understand the content of the test requirements first, and then start manually designing test cases based on their understanding of the requirements. In order to make the test cases cover all possible usage scenarios as comprehensively as possible, the process of manually designing test cases usually takes a long time.

[0003] A common practice at present is to directly input the requirements into a large model to generate test cases. However, this method may miss effective information, which leads to low quality of generated test cases. Summary of the invention

[0004] The present disclosure provides a test case generation method, a test method, an electronic device, a readable storage medium, and a computer program product.

[0005] The first aspect of the present disclosure proposes a method for generating a test case, comprising: obtaining test requirement information of a function to be tested, wherein the obtained test requirement information includes multiple types of test requirements, and the multiple types include text types and image types; classifying the test requirement information according to the types of the test requirements, and adding different type identifiers to the obtained different types of test requirements to obtain multimodal requirement data carrying multiple different type identifiers, wherein the multimodal requirement data includes text data and image data; generating a prompt of a model according to specified use case generation rules and the multimodal requirement data; and generating a test case for the function to be tested based on the prompt.

[0006] According to some embodiments of the present disclosure, obtaining test requirement information of a function to be tested includes: obtaining a specified information carrier, and parsing content in the information carrier to obtain the test requirement information of the function to be tested.

[0007] According to some embodiments of the present disclosure, the information carrier includes a web page and / or a document.

[0008] According to some embodiments of the present disclosure, the acquired test requirement information also includes web page element tags, and the test requirement information is classified according to the type of the test requirement, including: identifying the test requirements contained in the test requirement information based on the web page element tags; and classifying the identified test requirements according to the type of the test requirement.

[0009] According to some embodiments of the present disclosure, the image type includes one or more of a flowchart type and an interaction diagram type.

[0010] According to some embodiments of the present disclosure, the multiple types further include code types, and the multimodal requirement data further includes code data.

[0011] According to some embodiments of the present disclosure, before generating the prompt of the model, the method further includes: converting the image data in the multimodal demand data into a specified encoding format for network transmission.

[0012] According to some embodiments of the present disclosure, before classifying the test requirement information, the method also includes: identifying and removing non-relevant content from the acquired test requirement information, the non-relevant content including one or more of content identified by a specified format, tracking requirement information, and document record information, and the specified format includes deletion lines.

[0013] According to some embodiments of the present disclosure, before generating the prompt of the model, the method also includes: searching based on the requirement data of at least one modality in the multimodal requirement data to obtain the associated knowledge information of the requirement data of the at least one modality; generating the prompt of the model based on the specified use case generation rules and the multimodal requirement data, including: generating the prompt of the model based on the specified use case generation rules, the multimodal requirement data and the associated knowledge information.

[0014] According to some embodiments of the present disclosure, the use case generation rule includes a use case generation instruction, and the use case generation instruction is used to instruct the model to generate a test case according to input requirement data.

[0015] According to some embodiments of the present disclosure, the use case generation rule also includes a use case format template, and the use case generation instruction is used to instruct the model to generate a test case that conforms to the use case format template according to the input requirement data.

[0016] According to some embodiments of the present disclosure, after generating a test case for the function to be tested based on the prompt, the method further includes: displaying the test case that conforms to the test case format template in a visual form.

[0017] According to some embodiments of the present disclosure, the test case includes one or more of test description information, assertion information, expected result information, and test environment information.

[0018] A second aspect of the present disclosure proposes a testing method, including: generating a test case for a function to be tested according to the test case generation method described in any of the above embodiments; and applying the test case to a specified platform for functional testing.

[0019] A third aspect of the present disclosure proposes an electronic device, comprising: a memory, the memory storing execution instructions; and a processor, the processor executing the execution instructions stored in the memory, so that the processor executes the method described in any one of the above embodiments.

[0020] A fourth aspect of the present disclosure provides a readable storage medium, wherein the readable storage medium stores a computer program, and when the computer program is executed by a processor, it is used to implement the method described in any of the above embodiments.

[0021] A fourth aspect of the present disclosure provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it is used to implement the method described in any of the above embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings illustrate exemplary embodiments of the present disclosure and together with the description serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.

[0023] Figure 1 A schematic diagram of an application scenario of a method for generating test cases according to some embodiments of the present disclosure is shown.

[0024] Figure 2-Figure 5 A schematic diagram of the overall process of a test case generation method M100 according to some embodiments of the present disclosure is shown.

[0025] Figure 6 A schematic diagram of the overall process of the testing method M200 according to some embodiments of the present disclosure is shown.

[0026] Figure 7 It is a schematic block diagram of the structure of a test case generation device according to an embodiment of the present invention.

[0027] Figure 8 It is a schematic block diagram of the structure of a testing device according to an embodiment of the present disclosure.

[0028] Fig. 9 It is a schematic block diagram of the structure of an electronic device 1000 equipped with a test case generation device according to an embodiment of the present disclosure.

[0029] Fig.101 is a schematic block diagram of the structure of an electronic device 2000 equipped with a testing device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0030] The present disclosure is further described in detail below in conjunction with the accompanying drawings and implementations. It is understood that the specific implementations described herein are only used to explain the relevant content, rather than to limit the present disclosure. It should also be noted that, for ease of description, only the parts related to the present disclosure are shown in the accompanying drawings.

[0031] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure can be combined with each other. The technical solution of the present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0032] Unless otherwise specified, the exemplary embodiments / embodiments shown will be understood as providing exemplary features of various details of some ways in which the technical concept of the present disclosure can be implemented in practice. Therefore, unless otherwise specified, the features of the various embodiments / embodiments can be combined, separated, interchanged and / or rearranged without departing from the technical concept of the present disclosure.

[0033] The terms used herein are for the purpose of describing specific embodiments, rather than being restrictive. As used herein, unless the context clearly indicates otherwise, the singular forms "one (kind, person)" and "said (the)" are also intended to include plural forms. In addition, when the terms "comprise" and / or "include" and their variations are used in this specification, it is explained that there are stated features, integral bodies, steps, operations, parts, assemblies and / or their groups, but it is not excluded that there are or add one or more other features, integral bodies, steps, operations, parts, assemblies and / or their groups. It should also be noted that, as used herein, the terms "substantially", "approximately" and other similar terms are used as approximate terms and not as degree terms, so that they are used to explain the inherent deviations of the measured values, calculated values ​​and / or provided values ​​that will be recognized by those of ordinary skill in the art.

[0034] When business personnel develop some new functions, testers are needed to test the new functions. Business personnel will provide the requirements document to the testers, who will need to spend a lot of time to understand the requirements document and then write test cases one by one, including functional testing, performance testing, security testing and other dimensions. For functional testing, testers need to manually write detailed test steps, expected results and possible exception handling processes, which takes a long time and is not conducive to project scheduling.

[0035] To improve the efficiency of generating test cases, testers can directly input all requirement documents into the big model, which will generate test cases. Although this method can reduce time consumption, the big model lacks targeted guidance in the process of generating test cases, resulting in inaccurate generated test cases and low relevance to the functions to be tested.

[0036] Alternatively, the tester can input only the summary of the requirement document into the big model. However, the summary only contains text, so the input of the big model is a single-modal requirement, and the summary may lose important information compared to the requirement document. Therefore, this method also has the problem that the generated use cases are not accurate enough and may have low relevance to the functions to be tested.

[0037] In addition, testers can also search for similar content in the vector database for all requirement documents to generate test cases, but this method lacks the ability to fully handle new or complex requirements. Therefore, this method also has the problem that the generated test cases are not accurate enough and may have low relevance to the functions to be tested.

[0038] To this end, the present disclosure proposes a method for generating test cases.

[0039] Figure 1 The application scenario diagram of the test case generation method of some embodiments of the present disclosure is shown. In the application scenario, a user terminal 10 and a test case generation platform 20 may be included. The user terminal 10 can communicate with the test case generation platform 20 to send and receive data or send and receive instructions. In the present disclosure, the user terminal 10 and the test case generation platform 20 each include at least one processor and at least one memory.

[0040] Exemplarily, the user terminal 10 may be a terminal device held by a user. The user terminal 10 is used to integrate multimodal demand data of the demand document provided by the business party and dynamically construct a prompt of a large model, and the constructed prompt is sent to the use case generation platform 20. The use case generation platform 20 generates an automated functional test case through the large model and the prompt.

[0041] exist Figure 1 The shapes and structures of the user terminal 10 and the use case generation platform 20 shown in the figure should not be understood as limiting the scope of protection of the present disclosure. In the present disclosure, "terminal devices" can be different types of electronic devices, for example, terminal devices can be tablet computers, laptop computers, desktop computers, etc.

[0042] Figure 2 FIG. 1 is a schematic diagram showing the overall flow of a method M100 for generating a test case according to some embodiments of the present disclosure. Figure 2The method shown includes step S110, step S120, step S130 and step S140. The method can be performed by electronic devices such as tablet computers and desktop computers.

[0043] S110, obtaining test requirement information of the function to be tested, wherein the obtained test requirement information includes multiple types of test requirements, and the multiple types include text type and image type.

[0044] The function to be tested can be a new function developed by the business party, such as a sorting function or display function added to the product introduction page. In the process of developing a new function or after completing the development, the business party can write a corresponding test requirement information carrier, such as a test requirement document, and provide the test requirement document to the test party. There can be one or more test requirement documents, and the test requirement document contains text for describing the test requirements and images for describing the test requirements. The tester of the test party can automatically obtain the test requirement information of the function to be tested through a script, and the test requirement information includes the above-mentioned test requirement document.

[0045] S120, classifying the test requirement information according to the type of the test requirement, and adding different type identifiers to the obtained different types of test requirements to obtain multimodal requirement data carrying multiple different type identifiers. The multimodal requirement data includes text data and image data.

[0046] In the test requirement document, text content and image content are mixed together, so the content in the test requirement document can be classified through a script. The classification method can be to classify all text content into text class and all image content into image class, so as to obtain two types of requirement data. Each type of requirement information belongs to a modality, so multi-modal requirement data is obtained. The obtained multi-modal requirement data can be regarded as a requirement model.

[0047] When dividing, each item of demand information is marked by adding a type identifier. For example, for an image, a corresponding type identifier is added to the image to mark the image, and the type identifier is used to indicate that the added object is an image. The same can be applied to other types of demand data, and the type identifiers of the demand data in the same category can be the same.

[0048] S130, generating prompts for the model according to the specified use case generation rules and multimodal requirement data.

[0049] The use case generation rule is part of the prompt, which is used to indicate that the target of the large model generation is a test case and how to apply multimodal requirement data to generate the test case. The large model can be a large language model (LLM). In this step, the prompt can be generated by a script. It is understandable that in different application scenarios or when testing different functions, the prompt can be dynamically adjusted to improve the accuracy and relevance of the use case.

[0050] S140, generating a test case for the function to be tested based on the prompt.

[0051] After obtaining the prompt, the prompt can be input into the big model through the script, so as to obtain the automated test case output by the big model. Among them, the big model can identify the type (text or image) of the demand data through the type identifier added in step S120. The big model can be configured in a specified use case generation platform, and the script can automatically log in to the use case generation platform and input the prompt to the corresponding position according to the platform requirements, and then trigger the use case generation platform to generate the test case. The generated automated test case can be used to automatically test the above-mentioned functions to be tested.

[0052] According to the test case generation method proposed in the embodiment of the present invention, the demand information containing multiple different carrier forms is classified, and the classified information can be effectively combined to form structured and systematic multimodal demand data (demand model). The multimodal demand data is used as the input of the large model to achieve cross-modal information complementarity. Compared with the demand data of a single modality, the expression form of the demand is enriched, more original demand information is included, and project deviations caused by information omissions or misunderstandings are effectively avoided, which significantly improves the quality and efficiency of demand processing. At the same time, on this basis, combined with dynamic prompt assembly, the flexibility of test case generation can be improved, various types of requirements can be processed comprehensively and accurately, and the large model can be guided to generate use cases more accurately, which has significant advantages in processing complex, multi-dimensional, and multi-modal product requirements and R&D design documents.

[0053] Figure 3 FIG. 1 is a schematic diagram showing the overall flow of a test case generation method M100 according to other embodiments of the present disclosure. Figure 3 In step S110, the method of obtaining the test requirement information of the function to be tested may include step S111.

[0054] S111, obtaining a designated information carrier, and parsing the content in the information carrier to obtain test requirement information of the function to be tested. The information carrier may include a web page and / or a document.

[0055] Taking a web page as an example, after the business party completes the writing of the web page containing the test requirements, it can store the web page content in a specified location on the server and provide the test party with a URL pointing to the specified location. The script accesses the URL to obtain the web page content containing the test requirements. The web page content is parsed to obtain text information and image information as the test requirement information.

[0056] Similarly, after the business party has written the requirements document, it can store the requirements document in a specified location on the server and provide the address of the specified location to the test party. The script obtains the requirements document through the address and parses the requirements document to obtain text information and image information as test requirements information.

[0057] The URL can be a wiki link. The enterprise wiki system is an internal knowledge management system that is used to centrally store, manage and share various information and knowledge of the enterprise. It can provide a unified platform for users to find, edit and update relevant information. The wiki link is the URL running under the wiki system.

[0058] Describing and delivering test requirements in the form of web pages or documents can provide the basic conditions for the diversified and multimodal expression of test requirements, allowing business parties to express test requirements more comprehensively in a variety of different forms.

[0059] The acquired test requirement information may also include web page element tags. Since the test requirements are expressed in the form of web pages, web pages can use element tags to represent different types of elements, such as text elements are marked by text tags, and image elements are marked by image tags. Based on this, when classifying the test requirements, the test requirements in the test requirement information can be classified according to the web page element tags in the test requirement information.

[0060] See more details Figure 3 , step S120 may include the following steps S121 and S122.

[0061] S121, identifying the test requirements included in the test requirement information according to the web page element tags.

[0062] Web page content can contain multiple different types of data wrapped in HTML (Hyper Text Markup Language) tags, including text data and image data. The element tags used to mark text elements can include the, used to indicate line breaks , used to indicate different levels of titles <h1>~< / h1> <h6>, used to represent the embedded image , and some tags for representing document structure. A web page may also contain tables and audio and video, so the web page element tag can also include some tags for representing tables and tags for representing embedded audio and video.

[0063] S122, classifying the identified test requirements according to the types of the test requirements, and adding different type identifiers to the obtained different types of test requirements, to obtain multimodal requirement data carrying multiple different type identifiers.

[0064] By parsing the web page content in step S111, the web page element tags and the data wrapped by each tag can be obtained. By identifying the text data wrapped by the text tag and the image data wrapped by the image tag, the test requirements expressed in the form of text and the test requirements expressed in the form of images are separately obtained, so that the text and the image form a separate type of test requirements. Each type of test requirement corresponds to a modality, thereby forming multimodal requirement data.

[0065] Then, a predefined first identifier for marking text is added to the test requirements of the text type, and a predefined second identifier for marking image is added to the test requirements of the image type, thereby obtaining text information and image information as test requirement information. It should be noted that the added first identifier is different from the text tag in the web page element tag, and the added second identifier is different from the image tag in the web page element tag.

[0066] After the multimodal demand data is obtained, the multimodal demand data may be arranged and integrated according to the page layout of the web page.

[0067] By identifying different types of test requirements according to the element tags of the web page, the test requirements can be accurately obtained without omissions.

[0068] It is understandable that the image types in the above multiple types of test requirements may include one or more of the flowchart type and the interaction diagram type. The flowchart type image can describe the application of the function to be tested from the operation process of the function, and the interaction diagram type image can describe the display of the function to be tested from the UI (User Interface) when the user applies the function to be tested.

[0069] Element tags used to identify flowchart types can include <mermaid>or <flowchart>.in, <mermaid>It is an extended syntax for generating charts. It supports many types of charts, such as flowcharts, sequence diagrams, Gantt charts, etc. After introducing the Mermaid JavaScript library, you can use it in HTML. <mermaid>Label. <flowchart>It can also be used to define flow charts. <flowchart>Can be <mermaid>Or other similar libraries to implement it.

[0070] The above-mentioned multiple types of test requirements may also include code types, and the above-mentioned multimodal requirement data may also include code data. Code type test requirements may describe the function to be tested from the perspective of principle and underlying operation. When dividing the test requirement information in step S120, for a section of code, a corresponding type identifier is added to the section of code to mark the section of code, and the type identifier is used to indicate that the added object is code. In the web page element tag, the element tag used to mark the code type may include <code>.

[0071] Continue reading Figure 3 Before executing step S130, step S123 may be executed first. Step S123 may be executed after completing the execution of step S122.

[0072] S123, converting the image data in the multimodal demand data into a specified encoding format for network transmission.

[0073] Images on web pages are usually in png (Portable Network Graphics) format, jpeg (Joint Photographic Experts Group) format, etc. In order to facilitate transmission in text protocols and to meet the format requirements of large models for input content, after completing classification and obtaining multimodal demand data, the image data can be converted into a different format.

[0074] The converted format may be Base64 format. Base64 format is a representation method based on printable characters to represent binary data, and is used to convert binary data into an ASCII (American Standard Code for Information Interchange) string. When performing encoding format conversion, the image is encoded into a string, and the string is used instead of the image address, so that the URL (Uniform Resource Locator) address of the image does not need to be used.

[0075] For text in multimodal data, there is no need to perform encoding format conversion because the text can be transmitted directly in the text protocol and meets the format requirements of the large model for input content.

[0076] Figure 4 FIG. 1 is a schematic diagram showing the overall flow of a test case generation method M100 according to other embodiments of the present disclosure. Figure 4 Before executing step S120, step S112 may be executed first. Step S112 may be executed after completing the execution of step S111.

[0077] S112, identifying and removing irrelevant content from the acquired test requirement information, wherein the irrelevant content may include one or more of content identified by a specified format, embedding requirement information, and document record information, and the specified format may include a strikethrough.

[0078] The requirement documents provided by the business party or the web pages that record the test requirements usually contain some information that is not related to the generation of test cases, such as requirement information about tracking points, such as update records of documents or files or other record information. For example, for updates or changes to functions, the function flow or trigger conditions or other operating content after the update may change compared to the function before the update. Therefore, you can use a strikethrough to mark the content that applies to the function before the update but not to the function after the update.

[0079] After the parsing is completed in step S111, the non-relevant content can be identified by the element tag, for example, by the <del>Tags are used to identify the deleted or changed content of the updated function compared to the pre-update function.

[0080] It is understood that key content can also be identified by element tags, such as by identifying the <strong>Label, used to highlight text <mark>The content marked by the tag is used to identify the key content in the test requirements. For the key content, a specific type identifier can be additionally added in step S120 to guide the large model to generate more accurate test cases.

[0081] The tracking point requirement information and document record information can be identified from the test requirement information by fuzzy matching. The fuzzy matching method can be a method of calculating the Levenshtein distance, a method of calculating the Jaccard similarity, or a method of calculating the Cosine similarity.

[0082] Among them, Levenshtein distance is an algorithm used to measure the degree of difference between two strings, that is, to calculate the minimum edit distance between two strings. It calculates the distance between strings based on the number of edit operations (insertion, deletion, substitution), and calculates the minimum number of operations required to convert one string into another. The smaller the Levenshtein distance, the more similar the two strings are.

[0083] Jaccard similarity is used to compare the similarity between two sets. It measures the similarity by calculating the ratio of the intersection and union of two sets. For text data, the text can be divided into words or characters as elements of the set, and then the Jaccard similarity is calculated.

[0084] Cosine similarity is a similarity measure used to measure the angle between two vectors. For text data, each text can be regarded as a vector, where each dimension represents a word or feature, and then the cosine similarity is calculated based on the angle between the vectors.

[0085] Step S112 is used to remove content that is not relevant to the generated test cases, thereby achieving deep cleaning and integration of demand data, filtering out redundancy and noise in the requirements, solving the problem of insufficient extraction of effective information, avoiding hallucinations in large models, and thus avoiding irrelevant or unreasonable generated test cases.

[0086] Continue reading Figure 4 Before executing step S130, step S124 may be executed first. Step S124 may be executed after completing step S123 or after completing step S122.

[0087] S124, searching according to demand data of at least one mode in the multi-modal demand data to obtain associated knowledge information of the demand data of at least one mode.

[0088] Correspondingly, in step S130, the method of generating prompts of the model according to the specified use case generation rules and multimodal requirement data may include step S131.

[0089] S131, generating prompts for the model according to the specified use case generation rules, multimodal requirement data and associated knowledge information.

[0090] Step S124 is used to perform knowledge enhancement, and retrieve relevant knowledge from the vector knowledge base through text requirements, so as to help the big model understand knowledge in step S131. For example, the current requirement obtained in step S110 corresponds to the function of "interpreting the map", but the requirement information does not contain the path of this function in the applied APP (application). When designing test cases, the big model will lack test cases for testing the path entrance of "interpreting the map". By combining step S124 and step S131, the information required for generating test cases can be supplemented, so that the generated test cases can be more comprehensively automated.

[0091] Exemplarily, in step S130, the use case generation rule may include a use case generation instruction. The use case generation instruction is used to instruct the model to generate a test case according to the input requirement data.

[0092] The use case generation instructions define how to convert different requirement elements into specific test cases. The use case generation instructions can be flexibly configured to meet the test requirements of different projects or products. The use case generation instructions can be as follows: "1. Logical analysis of demand content 1) Be good at analyzing the requirements based on user input, be able to sort out a clear logical structure based on the requirements, and be able to decompose complex requirements into easy-to-understand modules and sub-modules.

[0093] 2. Test case design method guidance 1) You are proficient in a variety of test case design methods, such as: equivalence class partitioning, boundary value analysis, cause-effect diagram method, orthogonal experimental design, and error guessing method. You can explain these test methods to users in a concise and clear way.

[0094] 3. Test case generation 1) Based on the logical structure of the content and combined with the business-related background / basic information / knowledge, formulas / rule descriptions (if any), skillfully and flexibly use a variety of use case design methods to design test cases. " The use case generation rule may also include a use case format template. Accordingly, the use case generation instruction is used to instruct the model to generate a test case that complies with the use case format template according to the input requirement data.

[0095] The use case format template can meet the needs of different test environments and automated testing tools. The use case format template can be set to markdown format, xmind format or other user-defined formats. Among them, markdown is a lightweight markup language that allows people to write documents in a plain text format that is easy to read and write, and then convert it into structured HTML (Hypertext Markup Language). Test cases in markdown format are readable and compatible, and structured output: test cases can be organized by titles, lists, tables, etc. to make the content clear and organized, and it is easy to convert markdown format to other formats such as HTML and PDF, which is convenient for use on different platforms.

[0096] XMind is a popular mind map format that uses a specific file format to save mind map data. Mind mapping is a graphical way of organizing and representing information, usually starting with a central concept or theme and expanding outward to related sub-concepts or branches. XMind usually contains multiple elements such as nodes, links, icons, etc., which together form a complex mind map. Test cases in XMind format can display test cases in a graphical way, which is convenient for intuitive understanding of the relationship between each test step, and can clearly display the hierarchical relationship of test cases, which is suitable for complex test scenarios. At the same time, you can add notes, links, attachments, etc. to each node to enrich the information of the test case.

[0097] By integrating use case generation instructions, deeply processed multimodal requirement data, and predefined output use case format templates in the prompt, the large model can be driven to generate more accurate and higher-quality functional test cases.

[0098] Figure 5 FIG. 1 is a schematic diagram showing the overall flow of a test case generation method M100 according to other embodiments of the present disclosure. Figure 5 After step S140 is completed, step S150 may also be executed.

[0099] S150, presenting the test cases that conform to the use case format template in a visual form.

[0100] For example, the use case format template adopts the above-mentioned XMind format. Since the XMind format is conducive to visual display, it can be visually displayed to the user after the use case is generated. The generated test case is equivalent to a configuration. The test case can include one or more of the test description information, assertion information, expected result information, and test environment information. The test case can be executed by clicking Execute on the platform.

[0101] Figure 6 FIG. 2 shows a schematic diagram of the overall process of the test method M200 according to some embodiments of the present disclosure. Figure 6 The method shown includes step S210 and step S220. The test method M200 can be executed by electronic devices such as tablet computers and desktop computers.

[0102] S210, generating a test case for the function to be tested according to a test case generation method.

[0103] S220, applying the test case to the specified platform for functional testing.

[0104] The test case generation method in step S210 may be the test case generation method M100 of any of the above embodiments. The specific process of generating a test case in the test case generation method M100 is shown in Figure 2-Figure 5 The execution of automated test cases requires support from the environment, data, and system, which can be provided by designated platforms, such as the interface automation test case platform and the UI automation test case platform.

[0105] Based on the test case generation method M100 of any one of the above embodiments, the present disclosure also provides a test case generation device. Figure 7 FIG. 1 is a schematic block diagram of a test case generation device according to an embodiment of the present disclosure. Figure 7 As shown, the test case generation device includes: an information acquisition module 1002 , an information classification module 1004 , a prompt generation module 1006 and a test case generation module 1008 .

[0106] The information acquisition module 1002 is used to acquire the test requirement information of the function to be tested. The acquired test requirement information includes multiple types of test requirements, including text type and image type.

[0107] The information classification module 1004 is used to classify the test requirement information according to the type of test requirement, and add different type identifiers to the obtained different types of test requirements to obtain multimodal requirement data carrying multiple different type identifiers. Among them, the multimodal requirement data includes text data and image data. The prompt generation module 1006 is used to generate prompts of the model according to the specified use case generation rules and multimodal requirement data.

[0108] The use case generation module 1008 is used to generate test cases for the functions to be tested based on the prompts.

[0109] The above modules can be implemented by computer program modules. The implementation process of the functions and effects of each module in the above device is specifically described in the implementation process of the corresponding steps in the above method, which will not be repeated here.

[0110] Based on the test method M200 of any one of the above embodiments, the present disclosure also provides a test device. Figure 8 FIG. 1 is a schematic block diagram of a test device according to an embodiment of the present disclosure. Figure 8 As shown, the testing device includes a test case generating device and a testing module 2002.

[0111] The test case generation device is used to generate test cases for the functions to be tested according to the test case generation method. Figure 7 As shown, the test case generation device includes: an information acquisition module 1002 , an information classification module 1004 , a prompt generation module 1006 , and a test case generation module 1008 .

[0112] The information acquisition module 1002 is used to acquire the test requirement information of the function to be tested. The acquired test requirement information includes multiple types of test requirements, including text type and image type.

[0113] The information classification module 1004 is used to classify the test requirement information according to the type of test requirement, and add different type identifiers to the obtained different types of test requirements to obtain multimodal requirement data carrying multiple different type identifiers. Among them, the multimodal requirement data includes text data and image data. The prompt generation module 1006 is used to generate prompts of the model according to the specified use case generation rules and multimodal requirement data.

[0114] The use case generation module 1008 is used to generate test cases for the functions to be tested based on the prompts.

[0115] The test module 2002 is used to apply the test cases to the specified platform for functional testing.

[0116] The above modules can be implemented by computer program modules. The implementation process of the functions and effects of each module in the above device is specifically described in the implementation process of the corresponding steps in the above method, which will not be repeated here.

[0117] The execution subject of the test case generation method in the specific implementation of the present disclosure may be an electronic device such as a tablet computer, a desktop computer, etc. Therefore, based on any of the above implementations, the present disclosure also provides an electronic device, which can execute the test case generation method of any of the implementations described above in the present disclosure, and the test case generation device of any of the implementations described above can be configured on the electronic device.

[0118] Fig. 9 1 is a schematic block diagram of an electronic device 1000 equipped with a test case generation device according to an embodiment of the present disclosure. Fig. 9 The test case generation device includes an information acquisition module 1002, an information classification module 1004, a prompt generation module 1006 and a test case generation module 1008.

[0119] The hardware structure of the electronic device 1000 can be implemented using a bus architecture. The bus architecture can include any number of interconnected buses and bridges, depending on the specific application and overall design constraints of the hardware. The bus 1100 connects various circuits including one or more processors 1200, memory 1300 and / or hardware modules together. The bus 1100 can also connect various other circuits 1400 such as peripherals, voltage regulators, power management circuits, external antennas, etc.

[0120] The bus 1100 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Component (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the figure only uses one connecting line, but does not mean that there is only one bus or one type of bus.

[0121] The processor 1200 may be a central processing unit (CPU). The processor 1200 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0122] The memory 1300 can be used as a non-transient computer-readable storage medium, and can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions of the computer program in the embodiment of the present disclosure. The processor 1200 implements the test case generation method by running the non-transient software programs, instructions and modules stored in the memory 1300.

[0123] The memory 1300 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function; the data storage area may store data created by the processor 1200, such as structural data, model data, sample data, stiffness evaluation results, etc. of the bridge. In addition, the memory 1300 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 1300 may optionally include a memory remotely arranged relative to the processor 1200, and these remote memories may be connected to the processor 1200 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0124] The execution subject of the test method in the specific implementation of the present disclosure may be an electronic device such as a tablet computer, a desktop computer, etc. Therefore, based on any of the above implementations, the present disclosure also provides an electronic device, which can execute the test method of any of the implementations described above in the present disclosure, and the test device of any of the implementations described above can be configured on the electronic device.

[0125] Fig.10 FIG. 2 is a schematic block diagram of an electronic device 2000 equipped with a test device according to an embodiment of the present disclosure. Fig.10 The test device includes an information acquisition module 1002, an information classification module 1004, a prompt generation module 1006, a use case generation module 1008 and a test module 2002. The structures, connection relationships and working principles of the electronic device 2000, the processor 2200, the memory 2300 and the other circuits 2400 can be found in the above description of the electronic device 1000, the processor 1200, the memory 1300 and the other circuits 1400, which will not be described in detail here.

[0126] The present disclosure also provides a readable storage medium, in which a computer program is stored, and the computer program is used to implement the above method when executed by a processor. "Readable storage medium" can be any device that can contain, store, communicate, propagate or transmit a program for use with an instruction execution system, device or equipment or in combination with these instruction execution systems, devices or equipment. More specific examples of readable storage media include the following: an electrical connection portion (electronic device) with one or more wirings, a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), an optical fiber device, and a portable read-only memory (CDROM), etc.

[0127] The present disclosure also provides a computer program product, and the method of the present disclosure can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed, the process or function of the present disclosure is executed in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device, a core network device, an OAM or other programmable device.

[0128] The computer program or instructions may be stored in a readable storage medium or transmitted from one readable storage medium to another readable storage medium, for example, the computer program or instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The readable storage medium may be any available medium that can be accessed or a data storage device such as a server, data center, etc. that integrates one or more available media. The available medium may be a magnetic medium, such as a floppy disk, a hard disk, or a magnetic tape; it may also be an optical medium, such as a digital video disk; it may also be a semiconductor medium, such as a solid state drive. The computer readable storage medium may be a volatile or non-volatile storage medium, or may include both volatile and non-volatile types of storage media.

[0129] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0130] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes 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 a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0131] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0132] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0133] In the description of this specification, the description with reference to the terms "one embodiment / method", "some embodiments / methods", "example", "specific example", or "some examples" etc. means that the specific features, structures, or characteristics described in conjunction with the embodiment / method or example are included in at least one embodiment / method or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment / method or example. Moreover, the specific features, structures, or characteristics described may be combined in any one or more embodiments / methods or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments / methods or examples described in this specification and features of different embodiments / methods or examples, unless they are contradictory.

[0134] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0135] Those skilled in the art should understand that the above embodiments are only for the purpose of clearly illustrating the present disclosure, and are not intended to limit the scope of the present disclosure. For those skilled in the art, other changes or modifications may be made based on the above disclosure, and these changes or modifications are still within the scope of the present disclosure.< / mark> < / strong> < / del> < / code> < / mermaid> < / flowchart> < / flowchart> < / mermaid> < / mermaid> < / flowchart> < / mermaid> < / h6>

Claims

1. A method for generating a test case, characterized in that: include: Acquire test requirement information of the function to be tested, wherein the acquired test requirement information includes multiple types of test requirements, and the multiple types include text type and image type; Classifying the test requirement information according to the type of the test requirement, and adding different type identifiers to the obtained different types of test requirements to obtain multimodal requirement data carrying multiple different type identifiers, wherein the multimodal requirement data includes text data and image data; Prompts for generating a model based on specified use case generation rules and the multimodal requirement data; and A test case for the function to be tested is generated based on the prompt.

2. The method for generating a test case according to claim 1, characterized in that: Get the test requirement information of the function to be tested, including: A designated information carrier is obtained, and the content in the information carrier is parsed to obtain the test requirement information of the function to be tested.

3. The method for generating a test case according to claim 2, characterized in that: The information carrier includes a web page and / or a document.

4. The method for generating a test case according to claim 1, characterized in that: The acquired test requirement information also includes web page element tags, and the test requirement information is classified according to the type of the test requirement, including: identifying the test requirements included in the test requirement information according to the web page element tag; and The identified test requirements are categorized by the type of test requirement being described.

5. The method for generating a test case according to claim 4, characterized in that: The image type includes one or more of a flowchart type and an interaction diagram type.

6. The method for generating a test case according to claim 4, characterized in that: The plurality of types further include code types, and the multimodal requirement data further include code data; Optionally, before generating the prompt of the model, the method further includes: Converting the image data in the multimodal demand data into a specified encoding format for network transmission; Optionally, before classifying the test requirement information, the method further includes: Identify and remove non-relevant content from the acquired test requirement information, wherein the non-relevant content includes one or more of content identified by a specified format, embedding requirement information, and document record information, wherein the specified format includes a strikethrough; Optionally, before generating the prompt of the model, the method further comprises: searching according to the demand data of at least one mode in the multimodal demand data to obtain the associated knowledge information of the demand data of the at least one mode; Generating a prompt for a model based on a specified use case generation rule and the multimodal requirement data, including: generating a prompt for a model based on a specified use case generation rule, the multimodal requirement data and the associated knowledge information; Optionally, the use case generation rule includes a use case generation instruction, and the use case generation instruction is used to instruct the model to generate a test case according to the input requirement data; Optionally, the use case generation rule further includes a use case format template, and the use case generation instruction is used to instruct the model to generate a test case that conforms to the use case format template according to the input requirement data; Optionally, after generating a test case for the function to be tested based on the prompt, the method further includes: Display the test cases that conform to the test case format template in a visual form; Optionally, the test case includes one or more of test description information, assertion information, expected result information, and test environment information.

7. A testing method, characterized in that: include: Generate a test case for the function to be tested by the test case generation method according to any one of claims 1 to 6; as well as Apply the test cases to the specified platform for functional testing.

8. An electronic device, characterized in that: include: A memory storing execution instructions; as well as A processor, wherein the processor executes the execution instructions stored in the memory, so that the processor executes the method according to any one of claims 1 to 7.

9. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, it is used to implement the method according to any one of claims 1 to 7.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program is used to implement the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Test case generation method and device

    CN120973690A

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

    CN121486258A