Method, device and medium for generating test data based on UI design prototype file

By parsing UI design prototype files, the system automatically identifies page structure and functions, and generates structured test data. This solves the problems of delayed test case generation and reliance on manual intervention in existing technologies, and achieves efficient and reliable automatic generation of test data.

CN122195827APending Publication Date: 2026-06-12FUJIAN ZIXUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FUJIAN ZIXUN INFORMATION TECH CO LTD
Filing Date
2026-02-27
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

In existing technologies, test cases can only be generated after the software development is completed. It is impossible to write test cases during the design phase, and it relies on manual conversion of UI design prototypes into test cases, which is inefficient, has uncontrollable quality, and cannot understand business semantics.

Method used

By parsing UI design prototype files, the system automatically identifies page structure and functions, generates structured test data, including establishing label-input control mappings, extracting interactive UI controls and business rule text, identifying function categories based on statistical and semantic features, and automatically generating test data.

Benefits of technology

This approach enables testing to be moved forward, improving generation efficiency and quality, reducing labor costs, and generating test data that is more relevant to business scenarios and easier to maintain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122195827A_ABST
    Figure CN122195827A_ABST
Patent Text Reader

Abstract

The application provides a test data generation method and device based on a UI design prototype file, equipment and a medium, the method comprises the following steps: receiving a UI design prototype file, the UI design prototype file is a structured document exported by an interactive prototype design tool; analyzing the document structure of the UI design prototype file, identifying and extracting the page structure data therein; for each page node, element extraction is performed; based on the statistical characteristics and semantic characteristics of the UI element set, the function category of the page node is identified; according to the identified function category and the corresponding UI element set, structured test data for software testing is generated, the automatic generation of test data in the design stage is realized, the test efficiency is improved; through intelligent analysis and classification, the accuracy and business fitting degree of the test data are improved; the human cost of test case writing and maintenance is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of testing technology, and in particular to a method, apparatus, device, and medium for generating test data based on UI design prototype files. Background Technology

[0002] In software development, testing is a crucial step in ensuring software quality. Executing the test process, as an important component of software testing, typically requires writing numerous test cases for different page types and interaction scenarios to complete the test process. Currently, test case writing mainly relies on testers manually analyzing requirements documents and UI design prototypes. This method has the following problems: 1. Time lag: Most existing solutions require software development to be completed before test cases can be generated, making it impossible to complete test cases before software development. 2. Information gap: The UI design prototype in the product design phase contains a wealth of business information, but this information cannot be directly converted into test cases; 3. Dependence on manual intervention: The conversion from UI design prototypes to test cases relies entirely on manual understanding and writing, which is inefficient and prone to errors. 4. Uncontrollable quality: Manually written test cases vary in quality, and coverage is difficult to guarantee; 5. Lack of semantic understanding: Existing design-based solutions can only identify UI components, but cannot understand business semantics or generate complete functional test cases.

[0003] Therefore, there is an urgent need for a method and device that can automatically parse page structure, intelligently identify page functions, and generate high-quality test data based on UI design prototypes during the software design phase. Summary of the Invention

[0004] The technical problem to be solved by this invention is to provide a method, apparatus, device and medium for generating test data based on UI design prototype files, so as to realize the automatic generation of test data in the design stage and improve testing efficiency; improve the accuracy and business relevance of test data through intelligent parsing and classification; and reduce the human cost of writing and maintaining test cases.

[0005] In a first aspect, the present invention provides a method for generating test data based on a UI design prototype file, comprising the following steps: Step 1: Receive the UI design prototype file, which is a structured document exported from an interactive prototyping tool; Step 2: Analyze the document structure of the UI design prototype file, identify and extract the page structure data, which includes at least one page node; Step 3: For each of the page nodes, perform the following element extraction operations: By analyzing the positional relationship between label elements and associated input controls in the document structure, a mapping relationship between label text and corresponding input control identifiers is established. Based on predefined interactive control selection rules, interactive UI controls within the page nodes are extracted to generate a set of UI elements. The interactive UI controls include input controls, buttons, drop-down selection boxes, text boxes, and clickable links. For input controls, the label text in the mapping relationship is used as the control name. Based on a preset set of business rule keywords, descriptive text content that meets the length threshold and contains business rule keywords is extracted from the page nodes and added to the UI element set as a business rule description element. Step 4: Based on the statistical and semantic features of the UI element set, identify the functional categories of the page nodes, wherein the statistical features include the number and proportion of various interactive UI controls, and the semantic features include functional keywords in the control text content; Step 5: Generate structured test data for software testing based on the identified functional categories and the corresponding set of UI elements.

[0006] Secondly, the present invention provides a test data generation device based on a UI design prototype file, comprising: The file receiving module receives UI design prototype files, which are structured documents exported from an interactive prototyping tool. The page parsing module parses the document structure of the UI design prototype file, identifies and extracts the page structure data therein, and the page structure data includes at least one page node; The element extraction module performs the following element extraction operations for each of the page nodes: By analyzing the positional relationship between label elements and associated input controls in the document structure, a mapping relationship between label text and corresponding input control identifiers is established. Based on predefined interactive control selection rules, interactive UI controls within the page nodes are extracted to generate a set of UI elements. The interactive UI controls include input controls, buttons, drop-down selection boxes, text boxes, and clickable links. For input controls, the label text in the mapping relationship is used as the control name. Based on a preset set of business rule keywords, descriptive text content that meets the length threshold and contains business rule keywords is extracted from the page nodes and added to the UI element set as a business rule description element. The category recognition module identifies the functional categories of the page nodes based on the statistical and semantic features of the UI element set. The statistical features include the number and proportion of various interactive UI controls, and the semantic features include functional keywords in the control text content. The data generation module generates structured test data for software testing based on the identified functional categories and the corresponding set of UI elements.

[0007] Thirdly, the present invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in the first aspect.

[0008] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0009] One or more technical solutions provided by this invention have at least the following technical effects or advantages: 1. Enables forward testing: It can automatically generate test data based on UI prototypes during the software design phase, significantly advancing test preparation work and shortening the overall development and testing cycle.

[0010] 2. Improved generation efficiency and quality: By automatically parsing page structure, intelligently associating tags and inputs, and recognizing business rules, it can quickly generate comprehensive and logically clear structured test data, reducing errors and omissions caused by manual intervention.

[0011] 3. Possesses scenario understanding capabilities: By analyzing the statistical and semantic features of UI elements, it intelligently identifies the functional categories of the page (such as data input, data query, data display, etc.), making the generated test data more closely match the actual business scenario of the page.

[0012] 4. Reduced maintenance costs: When the UI prototype changes, simply rerun this method to quickly update the test data, significantly reducing the maintenance costs and workload of test cases.

[0013] 5. Improved standardization: The automatically generated test data has a unified format and standardized description, which is conducive to team collaboration and test process management.

[0014] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0015] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0016] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the device in Embodiment 2 of the present invention. Detailed Implementation

[0017] The overall concept of the technical solution in this application is as follows: A method for generating test data based on UI design prototype files is provided, which includes the following steps: S101. Receive UI design prototype files; UI design prototype files are typically exported from interactive prototyping tools such as Axure RP, Mockplus, and Figma. They are in HTML format, containing document structure, styles, and interaction information. This method accepts this file as input. S102. Parse the file and extract page structure data; Load the file using an HTML parsing library (such as cheerio) and build the Document Object Model (DOM). First, attempt to locate the main content container (such as the #base or body element). Next, extract page identifier information: prioritize extracting from the heading elements (h1-h3) or data-label attributes of the main container; if extraction fails or does not meet validity rules (such as insufficient length or purely technical terms), then read the HTML file. <title> Extract the tag content and remove tool suffixes (such as "-Axure RP"), then use the cleaned result as the page name. The core code is as follows:< / title> async parseHtmlFile(filePath: string): Promise <axureparseresult>{ const html = await fs.readFile(filePath, 'utf-8'); const $ = cheerio.load(html); const pages: AxurePage[] = []; const mainContainers = ['#base', 'body']; / / From <title> Extracting real page names from tags< / title> const titleText = $('head title').text().trim(); let cleanedTitle = titleText; if (titleText) { cleanedTitle = titleText .replace( / \s*-\s*Axure\s*RP.*$ / i, '') .replace( / \s*\|\s*Axure.*$ / i, '') .trim(); } for (const selector of mainContainers) { const mainElem = $(selector); if (mainElem.length > 0) { const mainPage = this.extractPage($, mainElem[0]); if (mainPage.elements.length > 0) { / / If the extracted name is invalid, force use <title> Name in< / title> if (!this.isValidBusinessName(mainPage.name)) { if (cleanedTitle && this.isValidBusinessName(cleanedTitle)){ mainPage.name = cleanedTitle; } else { mainPage.name = 'Main Page'; } } pages.push(mainPage); break } } } / / ... Returns the parsing result }; Finally, page nodes containing information such as page name and URL are generated; S103. For each page node, perform element extraction; this includes three core sub-steps: S1031. Establish a label-input mapping relationship. Traverse the page nodes for label elements with a specific style class (e.g., ax_default label). For each label element, extract its plain text. Then, starting from the position of the label element in the DOM, search forward within a predetermined range (e.g., the next 3 adjacent elements) according to the document flow order, looking for elements containing input, select, textarea, or other input controls. If found, record the ID of the associated container element containing the input control and establish a mapping pair with the label text. This method effectively associates visually adjacent labels and input boxes that are not directly nested in the DOM structure; the core code is as follows: private extractElements($: cheerio.CheerioAPI, pageElem:cheerio.Element): AxureElement[] { const elements: AxureElement[] = []; const labelMap = new Map<string, string> (); / / Establish label-input association mapping $(pageElem).find('.ax_default.label').each((i, labelElem) => { const $label = $(labelElem); const labelText = $label.text().trim().replace( / [::\s]+$ / , ''); let $nextSibling = $label.next(); let attempts = 0; / / Search for related elements sequentially according to document order. while ($nextSibling.length > 0 && attempts < 3) { const nextId = $nextSibling.attr('id'); if (nextId) { const hasInput = $nextSibling.find('input, select,textarea').length > 0; if (hasInput) { labelMap.set(nextId, labelText); / / Establish mapping relationship break } } $nextSibling = $nextSibling.next(); / / Continue searching for the next adjacent element attempts++ } }); / / ... Continue extracting elements }; S1032. Extract interactive UI controls; Based on the mapping relationship established in the previous step and predefined selectors (such as input, button, a[href], [data-label]), extract all interactive controls. For each extracted element, record its ID, type (tagName), name (preferably using the mapped tag text, then name and data-label attributes), placeholder, display text, and value. Simultaneously, filter out hidden elements with display: none or visibility: hidden by checking the style attribute; the core code is as follows: / / Continue with the extractElements method const selectors = [ 'input', 'button', 'select', 'textarea', 'a[href]', '[data-label]', '[onclick]', '.btn', '.button', '[role="button"]', '[type="submit"]' ]; $(pageElem).find(selectors.join(', ')).each((i, elem) => { const $elem = $(elem); const type = elem.tagName ? elem.tagName.toLowerCase() : 'unknown'; / / Skip hidden elements const style = $elem.attr('style') || ''; if ( / display\s*:\s*none / i.test(style) || / visibility\s*:\s*hidden / i.test(style)) { return; } let text = $elem.text().trim(); let name = $elem.attr('name') || $elem.attr('data-name') || $elem.attr('data-label'); const placeholder = $elem.attr('placeholder'); let value = $elem.attr('value'); / / Associate label text (using the mapping established using S1031) const parentId = $elem.parent().attr('id'); if (parentId && labelMap.has(parentId)) { name = labelMap.get(parentId)!; } if (!text && !name && !placeholder && !value) { return; } elements.push({ id: $elem.attr('id') || `elem-${i}`, type, name, placeholder, text, value }); }); S1033. Extract the business rule description text; iterate through all div elements on the page and extract their text content. If the text length exceeds a threshold (e.g., 50 characters) and contains preset business keywords (e.g., "approval", "verification", "rules", "interception"), it is considered text describing business logic and added to the UI element collection as a special "business rule description" element; the core code is as follows: / / Continue with the extractElements method / / Extract business rule text $(pageElem).find('div').each((i, elem) => { const $elem = $(elem); const text = $elem.text().trim(); / / Determine if it is a business rule: length > 50 and contains keywords if (text.length > 50 && (text.includes('Review') || text.includes('Verification') || text.includes('rules') || text.includes('intercept'))) { elements.push({ id: $elem.attr('id') || `note-${i}`, type: 'div', name: 'Business Rules Description' text: text.substring(0, 1000) / / Limit the length }); } }); return elements. S104. Based on the set of UI elements, identify the functional category; Calculate the statistical characteristics of the UI element set: number of input controls (input, select), number of buttons (button, button-like div), and number of text display elements (long text div). Analyze semantic features: identify whether the button text contains keywords such as "query," "search," "save," and "submit." The determination is based on the following rules: If there is a button containing the keyword "query" or "search", and the ratio of the number of text display elements to the number of input controls is greater than the threshold N (e.g., 2), then it is determined to be a data query function category (usually corresponding to "list page" or "management page" in the industry). If there is a button containing the keywords "Save" or "Submit", and the number of input controls is greater than or equal to the threshold M (e.g., 3), then it is determined to be a data input function category (usually corresponding to "form page" or "edit page" in the industry). If the number of input controls is 0 and the number of text display elements is greater than the threshold P (e.g., 10), it is determined to be a data display function category (usually corresponding to "details page" or "view page" in the industry). If some of the conditions of multiple rules mentioned above are met simultaneously, it is determined to be a mixed function category; If none of the conditions are met, the function category is determined to be undefined. The core code is as follows: private detectPageType(page: AxurePage): 'list' | 'form' | 'detail' | 'dialog' | 'mixed' | 'unknown' { const inputCount = page.elements.filter(e => e.type === 'input' || e.type === 'select').length; const buttonCount = page.elements.filter(e => e.type === 'button').length; const divCount = page.elements.filter(e => e.type === 'div' &&e.text && e.text.length > 5).length; / / Rule 1: Query button + data display → list page const queryButtons = page.elements.filter(e => e.type === 'button' && e.text && (e.text.includes('Query') || e.text.includes('Search')) ); / / Rule 2: Save / Submit button → Form page const formButtons = page.elements.filter(e => e.type === 'button' && e.text && (e.text.includes('Save') || e.text.includes('Submit')) ); / / Rule 3: Page Name Keywords const nameLower = page.name.toLowerCase(); If `nameLower.includes('List')` || `nameLower.includes('Management')`, then return `'list'`. If `nameLower.includes('New')` || `nameLower.includes('Edit')`, return `'form'`. If `nameLower.includes('Details')` || `nameLower.includes('View')`, then return `'detail'`. / / Rule 4: Button Text + Element Proportion Analysis if (queryButtons.length > 0 && divCount > inputCount * 2) return'list'; if (formButtons.length > 0 && inputCount >= 3) return 'form'; if (inputCount === 0 && divCount > 10) return 'detail'; if (inputCount > 0 && divCount > 0) return 'mixed'; return 'unknown'; } S105. Generate structured test data based on the functional categories and UI element sets; Based on the identified functional categories, different test case template generation strategies are invoked: For data input function categories: generate field validation test cases (required, format, length), submission function test cases, data display test cases, etc.; For data query function categories: generate query condition combination test cases, null value query test cases, pagination and sorting test cases, result export test cases, etc.; For data display function categories: generate data integrity check test cases, link jump verification test cases, no-action submission verification test cases, etc.; The generated test data is output in a structured format (such as JSON, XML, or a specific test case language), which can be directly imported into test management tools or used by test scripts. Example 1

[0018] like Figure 1 As shown, this embodiment provides a method for generating test data based on UI design prototype files, characterized by the following steps: Step 1: Receive the UI design prototype file, which is a structured document exported from an interactive prototyping tool; Step 2: Analyze the document structure of the UI design prototype file, identify and extract the page structure data, which includes at least one page node; Step 3: For each of the page nodes, perform the following element extraction operations: By analyzing the positional relationship between label elements and associated input controls in the document structure, a mapping relationship between label text and corresponding input control identifiers is established, that is, a mapping relationship between label text and the identifier of the associated container element of the corresponding input control is established. Based on predefined interactive control selection rules, interactive UI controls within the page nodes are extracted to generate a set of UI elements. The interactive UI controls include input controls, buttons, drop-down selection boxes, text boxes, and clickable links. For input controls, the label text in the mapping relationship is used as the control name. Based on a preset set of business rule keywords, descriptive text content that meets the length threshold and contains business rule keywords is extracted from the page nodes and added to the UI element set as a business rule description element. Step 4: Based on the statistical and semantic features of the UI element set, identify the functional categories of the page nodes, wherein the statistical features include the number and proportion of various interactive UI controls, and the semantic features include functional keywords in the control text content; Step 5: Generate structured test data for software testing based on the identified functional categories and the corresponding set of UI elements.

[0019] In this embodiment, preferably, the step of parsing the document structure of the UI design prototype file and identifying and extracting page structure data includes: Read the title metadata of the UI design prototype file; Based on predefined container positioning rules, the main page container is located from the document object model of the UI design prototype file. The container positioning rules include: prioritizing the selection of a specific main container identifier exported by the prototyping tool; if the specific main container does not exist, then selecting the document root-level content container. Extract initial page identification information from the main content container; Verify whether the initial page identification information conforms to the preset validity rules; If the initial page identification information fails verification, a tool suffix cleanup operation is performed on the title metadata to obtain the final page identification information; The page node is generated based on the main content container and the final page identifier information.

[0020] In this embodiment, preferably, the validity rule includes at least one of the following: The length of the identification information is checked, requiring that the length of the identification information is not less than the first threshold. Non-pure numeric sequences are checked to exclude identifiers consisting entirely of numbers. Exclude predefined technical terms from the check, and exclude identifier information that belongs to the predefined technical term set; Language composition check requires that the identifier information meet at least one of the following language features: (a) Contains ideographic characters; (b) Contains a continuous letter sequence and the sequence length is not less than the second threshold; The tool suffix cleanup operation performed on the title metadata includes: Retrieve the original title text from the title metadata; Using predefined pattern matching rules, remove standardized suffix information automatically added by the prototyping tool from the original title text; The text after removing the suffix information will be used as the final page identification information; The standardized suffix information includes at least one of the following types: The format begins with a separator followed by the name of the prototyping tool and version information; The entry begins with a separator followed by "Powered by" and a suffix indicating the prototyping tool. The tool-related identifiers include the tool name, the tool service platform name, or a combination thereof. Standardized identifier suffixes for files exported from prototyping tools.

[0021] In this embodiment, preferably, establishing the mapping relationship between the label text and the input control identifier by analyzing the positional relationship includes: Iterate through the elements with tag-based styles within the page nodes; For each tag element, retrieve its contained text content; Starting from the position of the tag element in the document, search for related elements containing the input control within the subsequent predetermined search range according to the document order; When a related element containing an input control is found, obtain the unique identifier of the related element; Establish a key-value mapping relationship between the unique identifier and the text content.

[0022] In this embodiment, preferably, the functional category identification of the page nodes based on the statistical and semantic features of the UI element set includes: Count the number of the following categories in the UI element set: number of input controls, number of button controls, and number of text display elements; Identify whether the text content of button controls contains preset functional keywords; Function categories are determined based on the following rules: If there is a button whose text content contains query keywords, and the ratio of the number of text display elements to the number of input controls exceeds the first threshold, it is identified as a data query function category. If there is a button whose text content contains keywords related to submission, and the number of input controls exceeds the second threshold, it is identified as a data input function category. If the number of input controls is zero and the number of text display elements exceeds the third threshold, it is identified as a data display function category; If it meets some of the recognition criteria of multiple categories at the same time, it is identified as a mixed functional category; If it does not meet any of the identification criteria, it is identified as an undefined functional category.

[0023] In this embodiment, preferably, the data query function category page features include: the page is used to display multiple data records and supports conditional filtering; The data input function category page is characterized by: the page being used to collect user input information and submit it to the designated system; The characteristics of the data display function category page include: the page is used to display detailed information of a single data object and does not support editing.

[0024] In this embodiment, preferably, step 5 specifically comprises: When identified as a data input function category, test cases for field validation, format validation, and required field checks are generated based on the input control in the UI element set, and test cases for submission actions are generated based on the submit button control. When identified as a data query function category, test cases for query condition combination are generated based on the query condition input controls in the UI element set, and test cases for sorting function, pagination operation, and result set display are generated based on the data display elements. When identified as a data display function category, data integrity display test cases are generated based on the text display elements in the UI element set, and test cases are generated to verify the read-only state of page controls.

[0025] Based on the same inventive concept, this application also provides an apparatus corresponding to the method in Embodiment 1, as detailed in Embodiment 2. Example 2

[0026] like Figure 2 As shown, this embodiment provides a test data generation device based on a UI design prototype file, including: The file receiving module receives UI design prototype files, which are structured documents exported from an interactive prototyping tool. The page parsing module parses the document structure of the UI design prototype file, identifies and extracts the page structure data therein, and the page structure data includes at least one page node; The element extraction module performs the following element extraction operations for each of the page nodes: By analyzing the positional relationship between label elements and associated input controls in the document structure, a mapping relationship between label text and corresponding input control identifiers is established. Based on predefined interactive control selection rules, interactive UI controls within the page nodes are extracted to generate a set of UI elements. The interactive UI controls include input controls, buttons, drop-down selection boxes, text boxes, and clickable links. For input controls, the label text in the mapping relationship is preferentially used as the control name. The input controls include at least one of the following types of form elements: text input box, password input box, drop-down selection box, multi-line text input box, checkbox, and radio button. Based on a preset set of business rule keywords, descriptive text content that meets the length threshold and contains business rule keywords is extracted from the page nodes and added to the UI element set as a business rule description element. The category recognition module identifies the functional categories of the page nodes based on the statistical and semantic features of the UI element set. The statistical features include the number and proportion of various interactive UI controls, and the semantic features include functional keywords in the control text content. The data generation module generates structured test data for software testing based on the identified functional categories and the corresponding set of UI elements.

[0027] In this embodiment, preferably, the step of parsing the document structure of the UI design prototype file and identifying and extracting page structure data includes: Read the title metadata of the UI design prototype file; Based on predefined container positioning rules, the main page container is located from the document object model of the UI design prototype file. The container positioning rules include: prioritizing the selection of a specific main container identifier exported by the prototyping tool; if the specific main container does not exist, then selecting the document root-level content container. Extract initial page identification information from the main content container; Verify whether the initial page identification information conforms to the preset validity rules; If the initial page identification information fails verification, a tool suffix cleanup operation is performed on the title metadata to obtain the final page identification information; The page node is generated based on the main content container and the final page identifier information.

[0028] In this embodiment, preferably, the validity rule includes at least one of the following: The length of the identification information is checked, requiring that the length of the identification information is not less than the first threshold. Non-pure numeric sequences are checked to exclude identifiers consisting entirely of numbers. Exclude predefined technical terms from the check, and exclude identifier information that belongs to the predefined technical term set; Language composition check requires that the identifier information meet at least one of the following language features: (a) Contains ideographic characters; (b) Contains a continuous letter sequence and the sequence length is not less than the second threshold; The tool suffix cleanup operation performed on the title metadata includes: Retrieve the original title text from the title metadata; Using predefined pattern matching rules, remove standardized suffix information automatically added by the prototyping tool from the original title text; The text after removing the suffix information will be used as the final page identification information; The standardized suffix information includes at least one of the following types: The format begins with a separator followed by the name of the prototyping tool and version information; The entry begins with a separator followed by "Powered by" and a suffix indicating the prototyping tool. The tool-related identifiers include the tool name, the tool service platform name, or a combination thereof. Standardized identifier suffixes for files exported from prototyping tools.

[0029] In this embodiment, preferably, establishing the mapping relationship between the label text and the input control identifier by analyzing the positional relationship includes: Iterate through the elements with tag-based styles within the page nodes; For each tag element, retrieve its contained text content; Starting from the position of the tag element in the document, search for related elements containing the input control within the subsequent predetermined search range according to the document order; When a related element containing an input control is found, obtain the unique identifier of the related element; Establish a key-value mapping relationship between the unique identifier and the text content, and the mapping relationship is used to provide semantic names for input control.

[0030] In this embodiment, preferably, the functional category identification of the page nodes based on the statistical and semantic features of the UI element set includes: Count the number of the following categories in the UI element set: number of input controls, number of button controls, and number of text display elements; Identify whether the text content of button controls contains preset functional keywords; Function categories are determined based on the following rules: If there is a button whose text content contains query keywords, and the ratio of the number of text display elements to the number of input controls exceeds the first threshold, it is identified as a data query function category. If there is a button whose text content contains keywords related to submission, and the number of input controls exceeds the second threshold, it is identified as a data input function category. If the number of input controls is zero and the number of text display elements exceeds the third threshold, it is identified as a data display function category; If it meets some of the recognition criteria of multiple categories at the same time, it is identified as a mixed functional category; If it does not meet any of the identification criteria, it is identified as an undefined functional category.

[0031] In this embodiment, preferably, the data query function category page features include: the page is used to display multiple data records and supports conditional filtering; The data input function category page is characterized by: the page being used to collect user input information and submit it to the designated system; The characteristics of the data display function category page include: the page is used to display detailed information of a single data object and does not support editing.

[0032] In this embodiment, preferably, the data generation module specifically comprises: When identified as a data input function category, test cases for field validation, format validation, and required field checks are generated based on the input control in the UI element set, and test cases for submission actions are generated based on the submit button control. When identified as a data query function category, test cases for query condition combination are generated based on the query condition input controls in the UI element set, and test cases for sorting function, pagination operation, and result set display are generated based on the data display elements. When identified as a data display function category, data integrity display test cases are generated based on the text display elements in the UI element set, and test cases are generated to verify the read-only state of page controls.

[0033] Since the apparatus described in Embodiment 2 of the present invention is an apparatus used to implement the method of Embodiment 1 of the present invention, those skilled in the art can understand the specific structure and variations of the apparatus based on the method described in Embodiment 1 of the present invention, and therefore will not be described again here. All apparatuses used in the method of Embodiment 1 of the present invention fall within the scope of protection of the present invention.

[0034] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to Embodiment 1, as detailed in Embodiment 3. Example 3

[0035] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it can implement any of the implementation methods in Embodiment 1.

[0036] Since the electronic device described in this embodiment is the device used to implement the method in Embodiment 1 of this application, those skilled in the art can understand the specific implementation method and various variations of the electronic device in this embodiment based on the method described in Embodiment 1 of this application. Therefore, how the electronic device implements the method in the embodiment of this application will not be described in detail here. Any device used by those skilled in the art to implement the method in the embodiment of this application falls within the scope of protection of this application.

[0037] Based on the same inventive concept, this application provides a storage medium corresponding to Embodiment 1, as detailed in Embodiment 4. Example 4

[0038] This embodiment provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it can implement any of the implementation methods in Embodiment 1.

[0039] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied 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.

[0040] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0041] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0042] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0043] While specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and not intended to limit the scope of the invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the invention should be covered within the scope of protection of the claims of the present invention.< / axureparseresult>

Claims

1. A method for generating test data based on UI design prototype files, characterized in that, Includes the following steps: Step 1: Receive the UI design prototype file, which is a structured document exported from an interactive prototyping tool; Step 2: Analyze the document structure of the UI design prototype file, identify and extract the page structure data, which includes at least one page node; Step 3: For each of the page nodes, perform the following element extraction operations: By analyzing the positional relationship between label elements and associated input controls in the document structure, a mapping relationship between label text and corresponding input control identifiers is established. Based on predefined interactive control selection rules, interactive UI controls within the page nodes are extracted to generate a set of UI elements. The interactive UI controls include input controls, buttons, drop-down selection boxes, text boxes, and clickable links. For input controls, the label text in the mapping relationship is used as the control name. Based on a preset set of business rule keywords, descriptive text content that meets the length threshold and contains business rule keywords is extracted from the page nodes and added to the UI element set as a business rule description element. Step 4: Based on the statistical and semantic features of the UI element set, identify the functional categories of the page nodes, wherein the statistical features include the number and proportion of various interactive UI controls, and the semantic features include functional keywords in the control text content; Step 5: Generate structured test data for software testing based on the identified functional categories and the corresponding set of UI elements.

2. The method according to claim 1, characterized in that, The process of parsing the document structure of the UI design prototype file and identifying and extracting page structure data includes: Read the title metadata of the UI design prototype file; Based on predefined container positioning rules, the main page container is located from the document object model of the UI design prototype file. The container positioning rules include: prioritizing the selection of a specific main container identifier exported by the prototyping tool; if the specific main container does not exist, then selecting the document root-level content container. Extract initial page identification information from the main content container; Verify whether the initial page identification information conforms to the preset validity rules; If the initial page identification information fails verification, a tool suffix cleanup operation is performed on the title metadata to obtain the final page identification information; The page node is generated based on the main content container and the final page identifier information.

3. The method according to claim 2, characterized in that, The validity rules include at least one of the following: The length of the identification information is checked, requiring that the length of the identification information is not less than the first threshold. Non-pure numeric sequences are checked to exclude identifiers consisting entirely of numbers. Exclude predefined technical terms from the check, and exclude identifier information that belongs to the predefined technical term set; Language composition check requires that the identifier information meet at least one of the following language features: (a) Contains ideographic characters; (b) Contains a continuous letter sequence and the sequence length is not less than the second threshold; The tool suffix cleanup operation performed on the title metadata includes: Retrieve the original title text from the title metadata; Using predefined pattern matching rules, remove standardized suffix information automatically added by the prototyping tool from the original title text; The text after removing the suffix information will be used as the final page identification information; The standardized suffix information includes at least one of the following types: The format begins with a separator followed by the name of the prototyping tool and version information; The entry begins with a separator followed by "Powered by" and a suffix indicating the prototyping tool. The tool-related identifiers include the tool name, the tool service platform name, or a combination thereof. Standardized identifier suffixes for files exported from prototyping tools.

4. The method according to claim 1, characterized in that, The process of establishing a mapping relationship between label text and input control identifiers by analyzing positional relationships includes: Iterate through the elements with tag-based styles within the page nodes; For each tag element, retrieve its contained text content; Starting from the position of the tag element in the document, search for related elements containing the input control within the subsequent predetermined search range according to the document order; When a related element containing an input control is found, obtain the unique identifier of the related element; Establish a key-value mapping relationship between the unique identifier and the text content.

5. The method according to claim 1, characterized in that, The method of identifying the functional categories of page nodes based on statistical and semantic features of UI element sets includes: Count the number of the following categories in the UI element set: number of input controls, number of button controls, and number of text display elements; Identify whether the text content of button controls contains preset functional keywords; Function categories are determined based on the following rules: If there is a button whose text content contains query keywords, and the ratio of the number of text display elements to the number of input controls exceeds the first threshold, it is identified as a data query function category. If there is a button whose text content contains keywords related to submission, and the number of input controls exceeds the second threshold, it is identified as a data input function category. If the number of input controls is zero and the number of text display elements exceeds the third threshold, it is identified as a data display function category; If it meets some of the recognition criteria of multiple categories at the same time, it is identified as a mixed functional category; If it does not meet any of the identification criteria, it is identified as an undefined functional category.

6. The method according to claim 5, characterized in that, The features of the data query function category page include: the page is used to display multiple data records and supports conditional filtering; The data input function category page is characterized by: the page being used to collect user input information and submit it to the designated system; The characteristics of the data display function category page include: the page is used to display detailed information of a single data object and does not support editing.

7. The method according to claim 5 or 6, characterized in that, Step 5 specifically involves: When identified as a data input function category, test cases for field validation, format validation, and required field checks are generated based on the input control in the UI element set, and test cases for submission actions are generated based on the submit button control. When identified as a data query function category, test cases for query condition combination are generated based on the query condition input controls in the UI element set, and test cases for sorting function, pagination operation, and result set display are generated based on the data display elements. When identified as a data display function category, data integrity display test cases are generated based on the text display elements in the UI element set, and test cases are generated to verify the read-only state of page controls.

8. A test data generation device based on a UI design prototype file, characterized in that: include: The file receiving module receives UI design prototype files, which are structured documents exported from an interactive prototyping tool. The page parsing module parses the document structure of the UI design prototype file, identifies and extracts the page structure data therein, and the page structure data includes at least one page node; The element extraction module performs the following element extraction operations for each of the page nodes: By analyzing the positional relationship between label elements and associated input controls in the document structure, a mapping relationship between label text and corresponding input control identifiers is established. Based on predefined interactive control selection rules, interactive UI controls within the page nodes are extracted to generate a set of UI elements. The interactive UI controls include input controls, buttons, drop-down selection boxes, text boxes, and clickable links. For input controls, the label text in the mapping relationship is used as the control name. Based on a preset set of business rule keywords, descriptive text content that meets the length threshold and contains business rule keywords is extracted from the page nodes and added to the UI element set as a business rule description element. The category recognition module identifies the functional categories of the page nodes based on the statistical and semantic features of the UI element set. The statistical features include the number and proportion of various interactive UI controls, and the semantic features include functional keywords in the control text content. The data generation module generates structured test data for software testing based on the identified functional categories and the corresponding set of UI elements.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 7.

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