Method, system and equipment for automatically generating test report and medium

By constructing a dynamic data mapping configuration model and an adaptive layout rendering control model, the problems of low efficiency and messy layout in manual data entry during test report generation were solved, achieving full-process automation and high-quality report generation.

CN121997910APending Publication Date: 2026-05-08JIANGSU BAOWANGDA SOFTWARE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
JIANGSU BAOWANGDA SOFTWARE TECH CO LTD
Filing Date
2026-01-19
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing test report generation technologies suffer from low efficiency due to manual data entry, and errors in data mapping. In particular, dynamic filling of variable-length data leads to problems such as chaotic table layout across pages, abnormal truncation, and inconsistent document styles.

Method used

By constructing a dynamic data mapping configuration model, the mapping index between feature placeholders and multidimensional test source data is identified, a structured data stream is generated, and combined with an adaptive layout rendering control model, adaptive layout and style uniform processing of content entities and container space are achieved.

Benefits of technology

It automates the entire process from data parsing to report generation, eliminates manual input errors, solves the layout disorder problem caused by dynamic long data, and ensures the efficiency and quality of report generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121997910A_ABST
    Figure CN121997910A_ABST
Patent Text Reader

Abstract

The invention discloses a method, a system, equipment and a medium for automatically generating a test report, and belongs to the technical field of intelligent report generation. The method comprises the following steps: acquiring data and a template, and constructing a mapping model to generate a structured data stream; constructing an adaptive rendering model to implement dynamic typesetting; injecting data and generating a report in a unified mode. The system comprises a source data analysis module, a mapping model construction module, a structured data stream generation module, an adaptive rendering control module and a target report generation module. According to the invention, through a double-model architecture of dynamic data mapping and adaptive layout rendering, automatic and accurate filling of the test data is realized. The system can analyze the adaptation degree of the content entity and the container space in real time and intelligently execute paging truncation or non-destructive fine adjustment compression of the table, and the problem of layout collapse caused by dynamic variable-length data is thoroughly solved. The generated report is uniform in format and meets the standard, and the intelligent level and production efficiency of document processing are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent report generation technology, specifically to a method, system, device, and medium for the automated generation of test reports. Background Technology

[0002] With the deepening of digital transformation, massive amounts of multidimensional test data are generated in various industrial testing, software testing, and laboratory analysis scenarios. To meet the needs of industry compliance reviews and final business delivery, this structured or semi-structured raw data needs to be organized and compiled into standardized test reports. Currently, the mainstream report generation method has gradually transitioned from purely manual data entry to semi-automated tools. Utilizing scripting languages ​​or batch processing programs has improved the efficiency of data filling to a certain extent and has become a common practice in enterprise-level document processing.

[0003] However, existing semi-automated generation technologies still face numerous challenges when dealing with complex and ever-changing real-world applications. Firstly, the data mapping mechanism lacks flexibility. Traditional solutions often establish relationships based on fixed cell coordinates or hard-coded rules. Once the metadata structure of the source data is slightly adjusted, such as adding data columns or changing the field order, it often leads to mapping misalignment or even program crashes. A more critical issue lies in the rigidity of page layout. Existing technologies typically lack a mechanism for predicting the document container space and the visual height of content entities. Simple sequential filling logic cannot perceive the geometric constraints of page boundaries. When faced with dynamic tables of uncertain length or large blocks of text, layout anomalies frequently occur, such as abruptly truncating table rows, losing table header information when crossing pages, and placing critical data in the bottom edge of the page, severely impacting document readability. Using a one-size-fits-all forced pagination strategy can easily result in excessive white space on the page, ruining the overall aesthetics. Furthermore, non-standard formatting codes carried in the source data often pollute the global style of the target document, leading to messy fonts or broken borders in the generated report. Subsequent manual proofreading and adjustments still require significant manpower, making true end-to-end automated delivery difficult. Summary of the Invention

[0004] In view of the above-mentioned problems, the present invention provides a method, system, device and medium for automatically generating test reports.

[0005] Therefore, the technical problem solved by the present invention is that the existing test reports are inefficient to fill in manually and prone to errors in data mapping, especially the table layout chaos, truncation abnormalities and inconsistent document styles caused by dynamic filling of variable-length data.

[0006] To address the aforementioned technical problems, this invention provides the following technical solution: a method for automatically generating test reports, comprising: acquiring multidimensional test source data and a standardized document layout template, and parsing the metadata structure of the multidimensional test source data; identifying feature placeholders in the standardized document layout template, constructing a mapping index between the feature placeholders and the multidimensional test source data based on field attributes and contextual logic, and constructing a dynamic data mapping configuration model; through the dynamic data mapping configuration model, performing cleaning and type conversion of the multidimensional test source data, identifying dependencies between data items, and generating a structured data stream for content filling; combining the structured data stream with the layout constraints of the standardized document layout template, analyzing the adaptability of content entities and container space, and constructing an adaptive layout rendering control model for dynamic layout of table areas and text areas; based on the adaptive layout rendering control model, collaboratively injecting the structured data stream into the standardized document layout template, performing style unification processing, and generating a target test report.

[0007] As a preferred embodiment of the method for automatically generating test reports according to the present invention, the step of constructing a mapping index between the feature placeholders and the multidimensional test source data based on field attributes and contextual logical relationships, and constructing a dynamic data mapping configuration model includes: extracting the field semantic features and type constraint features of the multidimensional test source data, and simultaneously parsing the tag description information and format constraints of the feature placeholders; calculating the association matching degree between the field semantic features and the tag description information, and filtering out a primary candidate mapping set that meets a preset similarity benchmark; for polysemous conflict items in the primary candidate mapping set, analyzing the topological positioning of the feature placeholders in the document layout hierarchy, and comparing it with the logical belonging structure of the multidimensional test source data, and locking the unique mapping target through structured context verification; in response to locking the unique mapping target, serializing it into an index instruction set, and generating the dynamic data mapping configuration model.

[0008] As a preferred embodiment of the method for automatically generating test reports according to the present invention, the step of cleaning and type conversion of the multi-dimensional test source data through the dynamic data mapping configuration model, identifying the dependencies between data items, and generating a structured data stream for content filling includes: calling the preset verification logic in the dynamic data mapping configuration model, traversing the multi-dimensional test source data to identify abnormal null values ​​and non-standard format items, and performing data governance operations including removing invalid data and filling in default values; according to the target display specifications of the standardized document layout template, standardizing the numerical precision of the verified data and normalizing the units of measurement, and unifying the data expression paradigm; parsing the logical association attributes between data items, identifying discrete data items belonging to the same test object and the same test batch, and constructing multi-level data aggregation groups; in response to constructing the multi-level data aggregation groups, assigning time-series indexes and position tags to the data groups according to document reading logic, and encapsulating and generating the structured data stream with logical hierarchy.

[0009] As a preferred embodiment of the method for automatically generating test reports according to the present invention, the step of combining the layout constraints of the structured data stream and the standardized document layout template to analyze the fit between the content entity and the container space and construct an adaptive layout rendering control model includes: parsing the geometric dimensions of the table cells and the boundary coordinates of the text fields in the standardized document layout template to determine the effective accommodating space of the target container; calculating the estimated visual height required for complete rendering of the content based on the total number of characters, font size, and line spacing attributes of the content to be filled in the structured data stream; in response to obtaining the estimated visual height, comparing it with the available height threshold of the effective accommodating space to generate a space adaptation evaluation result including three levels: safe filling, critical warning, and overflow truncation; in response to generating the space adaptation evaluation result, mapping it to a preset layout adaptation rule base, establishing the triggering logic between different adaptation levels and layout adjustment actions, and constructing the adaptive layout rendering control model.

[0010] As a preferred embodiment of the method for automatically generating test reports according to the present invention, the step of mapping the spatial adaptation evaluation result to a preset layout adaptation rule base and establishing the triggering logic between different adaptation levels and layout adjustment actions includes: in response to the spatial adaptation evaluation result being determined to be an overflow truncation, identifying the indivisible attribute of the table rows in the structured data stream, and locking the last complete data row that the current page can accommodate; locating the pagination breakpoint based on the last complete data row, generating a pagination control instruction to forcibly end the rendering process of the current page, and migrating the remaining data to be filled to the next page container; in response to the data migrating to the next page container, calling the table header definition structure of the table area in the standardized document layout template, and reproducing the table header definition structure at the beginning position of the next page container; establishing a visual connection index between cross-page tables to maintain the semantic integrity of the structured data stream on continuous pages.

[0011] As a preferred embodiment of the method for automatically generating test reports according to the present invention, the step of mapping the spatial adaptation evaluation result to a preset layout adaptation rule base and establishing triggering logic between different adaptation levels and layout adjustment actions includes: responding to the spatial adaptation evaluation result being determined to be a critical warning, calculating the geometric deviation value of the content to be filled exceeding the effective accommodating space; calling a non-destructive layout compression algorithm based on the geometric deviation value, iteratively calculating the line spacing compression ratio or character spacing shrinkage step size until the estimated visual height converges to the range of the available height threshold; generating a layout fine-tuning instruction, forcibly adapting the content to be filled to the effective accommodating space while maintaining the overall layout structure of the standardized document layout template unchanged.

[0012] As a preferred embodiment of the method for automatically generating test reports according to the present invention, the step of injecting the structured data stream into the standardized document layout template based on the adaptive layout rendering control model and performing style unification processing to generate the target test report includes: in response to the completion of the operation of injecting the structured data stream into the standardized document layout template, traversing all nodes of the document to identify style pollution items caused by data source format; forcibly applying the global font family attributes and paragraph alignment rules defined by the standardized document layout template to cover the style pollution items; for table areas, detecting and repairing cell border breaks or background color discontinuities caused by dynamic data filling; and in response to the completion of all style correction operations, fixing the document rendering state and generating the target test report.

[0013] To address the aforementioned technical problems, this invention also provides the following technical solution: a system for automatically generating test reports, comprising a source data parsing module for acquiring multidimensional test source data and a standardized document layout template, and parsing the metadata structure of the multidimensional test source data; a mapping model construction module for identifying feature placeholders in the standardized document layout template, constructing a mapping index between the feature placeholders and the multidimensional test source data based on field attributes and contextual logic, and constructing a dynamic data mapping configuration model; a structured data stream generation module for cleaning and type conversion of the multidimensional test source data through the dynamic data mapping configuration model, identifying dependencies between data items, and generating a structured data stream for content filling; an adaptive rendering control module for analyzing the fit between content entities and container space by combining the structured data stream and the layout constraints of the standardized document layout template, constructing an adaptive layout rendering control model for dynamic layout of table areas and text areas; and a target report generation module for injecting the structured data stream into the standardized document layout template based on the adaptive layout rendering control model, performing style unification processing, and generating a target test report.

[0014] The present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method for automatically generating a test report.

[0015] The present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method for automatically generating a test report.

[0016] The beneficial effects of this invention are as follows: A dynamic mapping model achieves precise association between multi-dimensional source data and templates, eliminating manual input errors; an innovative adaptive layout rendering model is introduced, intelligently deciding on pagination truncation or non-destructive compression fine-tuning of tables based on the fit between content entities and container space, effectively solving the problem of layout disorder caused by dynamic long data; and a global style correction mechanism ensures that the final report conforms to standardized specifications. This invention achieves full automation from data parsing to report generation, significantly improving generation efficiency and layout quality while ensuring the semantic integrity of the document. Attached Figure Description

[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A flowchart illustrating a method for automating test report generation, as provided in one embodiment of the present invention.

[0019] Figure 2 This is a module diagram of a system for automatically generating test reports, provided as an embodiment of the present invention. Detailed Implementation

[0020] To enable those skilled in the art to better understand the present invention, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without inventive effort should fall within the protection scope of the present invention.

[0021] Example 1, referring to Figure 1 As one embodiment of the present invention, a method for automatically generating test reports is provided, comprising:

[0022] S1. Obtain multidimensional test source data and standardized document format template, and parse the metadata structure of the multidimensional test source data;

[0023] S2. Identify the feature placeholders in the standardized document layout template, construct a mapping index between the feature placeholders and the multidimensional test source data based on field attributes and contextual logic, and construct a dynamic data mapping configuration model;

[0024] S3. Through the dynamic data mapping configuration model, the multidimensional test source data is cleaned and its type is converted, and the dependencies between data items are identified to generate a structured data stream for content filling.

[0025] S4. Combining the structured data flow with the layout constraints of the standardized document layout template, analyze the adaptability between the content entity and the container space, and construct an adaptive layout rendering control model for dynamic layout of table areas and text areas.

[0026] S5. Based on the adaptive layout rendering control model, the structured data stream is collaboratively injected into the standardized document layout template, and style unification processing is performed to generate the target test report.

[0027] It should be noted that existing technologies for generating test reports often rely on fixed cell coordinates or hard-coded rules for data filling. This rigid mapping method is difficult to adapt to dynamic changes in the source data structure. Once the data column order is adjusted or fields are added or removed, it is very easy to cause mapping misalignment or even program failure. At the same time, traditional solutions lack a mechanism for predicting document layout space. When faced with dynamic tables containing a large number of uncertain rows, they cannot perceive the boundary constraints at the bottom of the page, which can easily cause table rows to be truncated at page breaks, table header information to be lost, or large areas of blank space on the page. In addition, the non-standard format of the source data often leads to a messy final document style, which not only reduces the readability of the report, but also requires a lot of manpower for secondary typesetting and repair.

[0028] Therefore, to address the aforementioned issues, this invention, through steps S1 to S5, first analyzes the structural characteristics of multidimensional test source data and standardized document layout templates. It then constructs a dynamic data mapping configuration model using field attributes and contextual logical relationships, thereby eliminating dependence on fixed coordinates and achieving flexible association between the data source and the template. Furthermore, this invention generates a structured data stream through cleaning and transformation, and analyzes the fit between content entities and container space based on layout constraints, constructing an adaptive layout rendering control model. This model can accurately calculate the layout, guiding pagination or fine-tuning strategies for table and text areas during dynamic filling. Finally, it collaboratively injects data and performs unified style processing. This invention not only ensures mapping stability when the data source structure changes but also solves the problems of page truncation and layout errors caused by dynamic long data. It automates and standardizes the entire process of test report generation, from data parsing to final generation, significantly improving the efficiency and quality of document generation.

[0029] Example 2, refer to Figure 1 and Figure 2 This is one embodiment of the present invention. Based on the previous embodiment, a method for automatically generating test reports is provided.

[0030] In this embodiment of the application, step S1 involves obtaining multidimensional test source data and a standardized document format template, and parsing the metadata structure of the multidimensional test source data, including the following steps A1 to A2:

[0031] A1: Receives multidimensional test source data containing discrete key-value features and time-series matrix features through a multi-channel data integration interface, and synchronously loads a standardized document format template with predefined layout specifications and feature placeholders;

[0032] A2: Perform a structured scan on the multidimensional test source data to identify data dimensions and field attributes, and generate a metadata structure object containing hierarchical belonging logic and type constraint definitions.

[0033] Specifically, in A1, the acquisition of multi-dimensional test source data encompasses the unified access of heterogeneous data. The system receives two types of data through a RESTful API interface or a local file stream reading mechanism: the first type is discrete parameters in key-value pair format, typically carried in JSON objects or flat database records, used to describe single attributes such as test item name, operator ID, and environmental parameters; the second type is list data in matrix format, typically carried in CSV files or Excel worksheets, used to describe voltage and current sampling values ​​or multi-channel sensor readings that change over time. Simultaneously, the standardized document layout template loaded by the system adopts the Office Open XML standard format. This template not only presets page margins, text area size, and title styles, but also embeds feature placeholders wrapped in specific text tags in specific coordinate fields to indicate the location for subsequent data injection.

[0034] Specifically, in A2, the metadata structure parsing process involves a deep deconstruction of the source data's inherent logic. The system first reads the list of discrete parameter keys to build an index dictionary. Then, for list data in matrix form, it automatically identifies the first row of text as the column header definition and infers the data type (e.g., floating-point, integer, or date / time) by sampling and analyzing the numerical characteristics of each column. Based on this, the system further counts the total number of rows and columns in the list data, analyzes the association keys between data tables, and abstracts the original heterogeneous data into metadata structure objects containing field names, data type descriptions, data length constraints, and hierarchical relationships, providing a standardized logical basis for subsequent data mapping and cleaning.

[0035] In this embodiment of the application, step S2 identifies feature placeholders in the standardized document layout template, constructs a mapping index between the feature placeholders and the multidimensional test source data based on field attributes and contextual logical relationships, and constructs a dynamic data mapping configuration model, including the following steps B1 to B3:

[0036] B1: Extract the field semantic features and type constraint features of the multidimensional test source data, and parse the label description information and format constraints of the feature placeholders.

[0037] B2: Calculate the correlation matching degree between the semantic features of the field and the label description information, and filter out the primary candidate mapping set that meets the preset similarity benchmark.

[0038] B3: For the polysemous conflict items in the primary candidate mapping set, analyze the topological positioning of the feature placeholder in the document layout hierarchy, compare the logical belonging structure of the multidimensional test source data, lock the unique mapping target through structured context verification, and serialize it into an index instruction set to generate the dynamic data mapping configuration model.

[0039] Specifically, in B2, the calculation logic for association matching integrates two dimensions: textual semantic similarity and data type compatibility. The system first converts the column header text of the source data and the label text of the placeholders into high-dimensional word vectors, calculating the cosine similarity between them as a semantic similarity component. Simultaneously, the system detects the data type of the source data fields, such as strings, floating-point numbers, or dates, and compares them with the format constraints required by the placeholders. If the two are compatible, a positive type incentive weight is given. Association Matching The specific calculation formula is expressed as follows: ,in This represents the semantic similarity components calculated based on word vectors. This function indicates type compatibility; its value is 1 if the data type is compatible with the format constraints, and 0 otherwise. The semantic weight coefficient and the type weight coefficient are separate, and their sum is 1. The system will calculate the resulting association matching degree. Compare with a preset similarity benchmark, and all Mapping pairs with values ​​greater than the benchmark are included in the primary candidate mapping set.

[0040] Specifically, in B3, structured context validation is primarily used to resolve ambiguity issues such as names with different meanings or names from different sources. When a placeholder label corresponds to multiple source data fields in the primary candidate mapping set, the system traverses the document's object model tree to extract the semantic information of the parent container node to which the feature placeholder belongs, such as the table title or chapter title. Simultaneously, the system traces back the hierarchical structure of the multi-dimensional test source data to obtain the test group or batch name to which the data column belongs. The system calculates the context matching score between the semantics of the parent container node and the semantics of the data hierarchy, selecting the source data field with the highest context matching score as the unique mapping target. The final generated dynamic data mapping configuration model is stored in the form of a serialized instruction set. This instruction set explicitly records the unique identifier of each feature placeholder, the corresponding source data access path, the preset data cleaning rules, and the formatting parameters during final rendering, providing precise guidance for subsequent data stream processing.

[0041] In an optional implementation, step S2, which constructs a mapping index between feature placeholders and multidimensional test source data, may further include introducing a fuzzy matching and synonym association mechanism based on an industry thesaurus. This transforms rigid string equality matching into flexible semantic association matching, ensuring accurate identification even if field names in the source data contain abbreviations, aliases, or spelling differences. This process not only verifies the literal consistency of field names but also involves retrieving a pre-built test domain terminology database, automatically associating synonyms such as voltage and potential difference, serial number and SN code. This effectively avoids mapping failures caused by different input habits of testers or inconsistent naming conventions of equipment manufacturers, thereby significantly improving the model's compatibility and generalization level with multi-source heterogeneous data.

[0042] In another optional implementation, the mapping index between feature placeholders and multidimensional test source data constructed in step S2 may also include an adaptive learning mechanism based on historical manual correction logs. This mechanism dynamically adjusts the weight distribution of mapping rules using past operation records to address the continuous recognition challenges of specially named or non-standard fields. This mechanism not only makes initial recommendations based on the current algorithm logic but also deeply analyzes the mapping relationships manually corrected by users in previous tasks, automatically memorizing and prioritizing correct target fields. This avoids repeating the same recognition errors in periodic report generation tasks, allowing the system to continuously evolve with increased usage frequency and gradually reduce the intervention cost of manual secondary configuration.

[0043] In this embodiment of the application, step S3 involves cleaning and type conversion of the multidimensional test source data through the dynamic data mapping configuration model, identifying the dependencies between data items, and generating a structured data stream for content filling, including the following steps C1 to C3:

[0044] C1: Call the preset verification logic in the dynamic data mapping configuration model, traverse the multi-dimensional test source data to identify abnormal null values ​​and non-standard format items, and perform data governance operations including invalid data removal and default value completion.

[0045] C2: Based on the target display specifications of the standardized document layout template, the numerical precision of the data that has passed the verification is standardized and the units of measurement are normalized to unify the data expression paradigm;

[0046] C3: Parse the logical relationship attributes between data items, identify discrete data items belonging to the same test object and the same test batch, construct multi-level data aggregation groups, and allocate time sequence indexes and position tags according to document reading logic, and encapsulate and generate the structured data stream with logical hierarchy.

[0047] Specifically, in C1, data governance operations are driven by a rule engine. The system performs a compliance scan on each source data item based on the cleaning rules defined in the configuration model. For null values ​​or garbled characters found during the scan, the system first checks if a default fill strategy exists for that field in the configuration model. If a default value definition exists, the system automatically replaces the anomaly with the preset default value to ensure data continuity; if the field is marked as a critical constraint and has no default value, the system marks the entire data record containing the anomaly as invalid and removes it from the processing queue to prevent cascading errors in subsequent calculations.

[0048] Specifically, in C2, the normalization of numerical precision and units of measurement follows the display requirements of the target document. The system reads the format code of the corresponding feature placeholder in the template to determine the number of decimal places and standard units for the target display. For numerical data, the system uses the following conversion logic: assuming the original data value is... The unit conversion factor is The target number of decimal places to retain is The processed standard value Represented as ,in This indicates the rounding function. For date data, the system uniformly converts it to the standardized date string format specified by the template, eliminating display differences caused by different timestamp formats in the source data.

[0049] Specifically, in C3, the generation of structured data streams is a reconstruction process from discrete to aggregated. Based on the logical hierarchy in the metadata structure, the system reorganizes the scattered test data into a hierarchical tree structure. First, the system creates a main group with the test object ID as the root node. Under the main group, subgroups are created based on the test batch number, and all time-series sampled data belonging to that batch are arranged as leaf nodes according to their timestamp order. Then, the system traverses this tree structure, assigning each node a globally unique traversal index and document insertion position label. Finally, the data object containing complete hierarchical information and sorting logic is serialized into a structured data stream in JSON or binary format. This data stream directly adapts to the subsequent rendering engine's reading interface, ensuring that the logical order of the data presented in the document is strictly consistent with the temporal logic of the testing process.

[0050] In this embodiment of the application, step S4 combines the structured data flow with the layout constraints of the standardized document layout template to analyze the fit between the content entity and the container space, and constructs an adaptive layout rendering control model, including the following steps D1 to D4:

[0051] D1: Analyze the geometric dimensions of the table cells and the boundary coordinates of the text fields in the standardized document layout template to determine the effective storage space of the target container;

[0052] D2: Based on the total number of characters, font size, and line spacing attributes of the content to be filled in the structured data stream, calculate the estimated visual height required for complete rendering of the content;

[0053] D3: In response to obtaining the estimated visual height, compare it with the available height threshold of the effective accommodating space to generate a space adaptation evaluation result that includes three levels: safe filling, critical warning, and overflow cutoff.

[0054] D4: In response to the generation of the spatial adaptation evaluation result, map it to the preset layout adaptation rule base, establish the trigger logic between different adaptation levels and layout adjustment actions, and construct the adaptive layout rendering control model.

[0055] Specifically, in D2, the calculation of visual height uses an accumulation algorithm based on the character rendering width. The system reads the number of characters in the text to be filled from the structured data stream. The font point count defined in the current template and the set line spacing coefficient Assume the effective width of the target cell is... The average rendering width of a single character is The estimated visual height required for full rendering of the content. The calculation formula is: in This represents the floor function. This formula can accurately simulate the physical number of lines after automatic text wrapping, thereby calculating the total height after data padding.

[0056] Specifically, in D4, the layout adaptation rule base includes processing strategies for different evaluation results. When the evaluation result is a critical warning, i.e., the visual height is estimated... Slightly larger than the available height threshold But deviation value Within a preset flexibility range (e.g., less than 50% of the single-line height), the system invokes a non-destructive layout compression algorithm to calculate the compression ratio. It generates fine-tuning instructions to compress the line spacing to... This forces content to be accommodated without pagination. When the evaluation result is overflow truncation, i.e. If the page exceeds the elastic limit, the system identifies the atomicity of the table rows, locks the last row of data that the current page can hold as the pagination breakpoint, and generates complex pagination control instructions that include inserting page breaks, copying the table header structure, and closing borders.

[0057] In one optional implementation, step S4, which analyzes the fit between the content entity and the container space, may also include a hierarchical compression strategy based on element type. This strategy categorizes various elements on the page into different compression sensitivity levels, allowing for intelligent selection of compression targets when a critical warning is triggered. This strategy not only calculates the overall overflow height but also prioritizes significantly compressing low-sensitivity areas such as paragraph spacing and blank lines, while carefully fine-tuning high-sensitivity areas such as table row height and font size. This ensures that while forcibly adapting the content to the current page, the visual clarity and reading comfort of core data areas are preserved to the greatest extent possible, avoiding overcrowding of key data rows due to uniform compression, which would make them difficult to identify.

[0058] In another optional implementation, step S4, which analyzes the fit between the content entity and the container space, may also include an intelligent pagination prediction mechanism based on data logic grouping. In scenarios where pagination truncation is necessary, this mechanism proactively seeks the natural boundaries of data subsets as the optimal breakpoints. This mechanism not only considers whether the physical space is sufficient to accommodate the next row of data but also pre-scans the logical affiliation attributes of subsequent data. If it finds that the remaining space on the current page is insufficient to accommodate the next complete test batch of data, it directly performs pagination in advance, forcibly migrating the entire data group to the next page for display. This avoids abruptly splitting related data belonging to the same test object onto two pages, effectively maintaining the logical continuity and integrity of the test report in terms of reading logic.

[0059] In this embodiment of the application, step S5, based on the adaptive layout rendering control model, involves injecting the structured data stream into the standardized document layout template and performing style unification processing to generate a target test report, including the following steps E1 to E3:

[0060] E1: In response to the rendering instructions issued by the adaptive layout rendering control model, the structured data stream is injected item by item into the corresponding node of the standardized document layout template, and the table header structure is dynamically cloned when the pagination breakpoint is triggered.

[0061] E2: In response to the completion of the data injection operation, iterate through all nodes in the document to identify style pollution caused by the data source format and force the application of global style rules.

[0062] E3: For table areas, detect and fix cell border breaks or background color discontinuities caused by dynamic data filling, and then solidify the document rendering state to generate the target test report.

[0063] Specifically, in E2, style pollution cleaning aims to eliminate non-standard rich text formatting embedded in the source data. The system traverses the generated document DOM tree, examining the properties of each text node. If a node is found to carry font families or color attributes not defined by the template, the system immediately removes them and forces the inheritance of the standard font and size defined in the parent paragraph style. For example, all English fonts sourced from Times New Roman are forcibly replaced with the Arial font specified in the template, ensuring the consistency of the visual style throughout the report.

[0064] Specifically, in E3, the table area repair primarily addresses visual gaps caused by pagination. When a table spans multiple pages, the system checks the bottom border properties of the previous page's table. If it's found to be open, a closed bottom border line is automatically added, with the line width and style strictly adhering to the template definition. Simultaneously, for tables with alternating row colors, the system recalculates the parity of the row indexes after each page transition and adjusts the background fill color of the first row of the next page's table to ensure the alternating row color visual continuity isn't interrupted by pagination. After all style corrections are complete, the system serializes the document object model in memory into the final binary document file, generating the report.

[0065] Example 3, referring to Figure 2 The above is an illustrative scheme of a method for automatically generating test reports. It should be noted that the technical solution of this system for automatically generating test reports and the technical solution of the method for automatically generating test reports described above belong to the same concept. Details not described in detail in this embodiment of the system for automatically generating test reports can be found in the description of the method for automatically generating test reports described above.

[0066] This embodiment also provides a system for automatically generating test reports, including:

[0067] The source data parsing module is used to obtain multidimensional test source data and standardized document format templates, and to parse the metadata structure of the multidimensional test source data.

[0068] The mapping model construction module is used to identify feature placeholders in the standardized document layout template, construct a mapping index between the feature placeholders and the multidimensional test source data based on field attributes and contextual logical relationships, and construct a dynamic data mapping configuration model.

[0069] The structured data stream generation module is used to clean and convert the multidimensional test source data through the dynamic data mapping configuration model, identify the dependencies between data items, and generate a structured data stream for content filling.

[0070] An adaptive rendering control module is used to combine the structured data stream with the layout constraints of the standardized document layout template, analyze the fit between the content entity and the container space, and construct an adaptive layout rendering control model for dynamic layout of table areas and text areas.

[0071] The target report generation module is used to inject the structured data stream into the standardized document layout template based on the adaptive layout rendering control model, and perform style unification processing to generate a target test report.

[0072] This embodiment also provides an electronic device applicable to a method for automatically generating test reports, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the method for automatically generating test reports as proposed in the above embodiment.

[0073] This embodiment also provides a storage medium on which a computer program is stored, which, when executed by a processor, implements a method for automatically generating test reports as proposed in the above embodiments.

[0074] The storage medium proposed in this embodiment and the method for automatically generating test reports proposed in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0075] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0076] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A method for automatically generating test reports, characterized in that, include: Obtain multidimensional test source data and standardized document format templates, and parse the metadata structure of the multidimensional test source data; Identify feature placeholders in the standardized document layout template, construct a mapping index between the feature placeholders and the multidimensional test source data based on field attributes and contextual logical relationships, and build a dynamic data mapping configuration model; The dynamic data mapping configuration model is used to clean and convert the multidimensional test source data, identify the dependencies between data items, and generate a structured data stream for content filling. By combining the structured data flow with the layout constraints of the standardized document layout template, the adaptability between content entities and container space is analyzed, and an adaptive layout rendering control model is constructed for the dynamic layout of table areas and text areas. Based on the adaptive layout rendering control model, the structured data stream is collaboratively injected into the standardized document layout template, and style unification processing is performed to generate the target test report.

2. The method for automatically generating test reports as described in claim 1, characterized in that: The process of constructing a mapping index between the feature placeholders and the multidimensional test source data based on field attributes and contextual logical relationships, and constructing a dynamic data mapping configuration model, includes: Extract the field semantic features and type constraint features of the multidimensional test source data, and parse the label description information and format constraints of the feature placeholders; Calculate the correlation matching degree between the semantic features of the field and the label description information, and filter out the primary candidate mapping set that meets the preset similarity benchmark; For the polysemous conflict items in the primary candidate mapping set, the topological positioning of the feature placeholder in the document layout hierarchy is analyzed, and the logical belonging structure of the multidimensional test source data is compared. The unique mapping target is locked through structured context verification. In response to locking the unique mapping target, it is serialized into an index instruction set to generate the dynamic data mapping configuration model.

3. The method for automatically generating test reports as described in claim 1, characterized in that: The process of cleaning and type conversion of the multidimensional test source data through the dynamic data mapping configuration model, identifying dependencies between data items, and generating a structured data stream for content population includes: The preset verification logic in the dynamic data mapping configuration model is invoked to traverse the multidimensional test source data to identify abnormal null values ​​and non-standard format items, and to perform data governance operations including removing invalid data and filling in default values. Based on the target display specifications of the standardized document layout template, the numerical precision of the data that has passed the verification is standardized and the units of measurement are normalized to unify the data expression paradigm. Analyze the logical relationship attributes between data items, identify discrete data items belonging to the same test object and the same test batch, and construct multi-level data aggregation groups; In response to constructing the multi-level data aggregation group, a time-series index and a location tag are assigned to the data group according to the document reading logic, and the structured data stream with logical hierarchy is encapsulated and generated.

4. The method for automatically generating test reports as described in claim 1, characterized in that: The step of combining the structured data stream with the layout constraints of the standardized document layout template to analyze the fit between content entities and container space, and constructing an adaptive layout rendering control model includes: The geometric dimensions of the table cells and the boundary coordinates of the text fields in the standardized document layout template are analyzed to determine the effective storage space of the target container. Based on the total number of characters, font size, and line spacing attributes of the content to be filled in the structured data stream, the estimated visual height required for complete rendering of the content is calculated. In response to obtaining the estimated visual height, it is compared with the available height threshold of the effective accommodating space to generate a space adaptation evaluation result that includes three levels: safe filling, critical warning, and overflow cutoff. In response to the generation of the spatial adaptation evaluation result, it is mapped to a preset layout adaptation rule base, and the triggering logic between different adaptation levels and layout adjustment actions is established to construct the adaptive layout rendering control model.

5. The method for automatically generating test reports as described in claim 4, characterized in that: The step of mapping the spatial adaptation evaluation results to a preset layout adaptation rule base and establishing the triggering logic between different adaptation levels and layout adjustment actions includes: In response to the space adaptation evaluation result determining that overflow truncation is performed, the indivisible attribute of the table rows in the structured data stream is identified, and the last complete data row that the current page is allowed to accommodate is locked. Based on the last complete data row, locate the pagination breakpoint, generate a pagination control instruction to forcibly end the rendering process of the current page, and migrate the remaining data to be filled to the next page container; In response to data migration to the next page container, the header definition structure of the table area in the standardized document layout template is invoked, and the header definition structure is reproduced at the beginning of the next page container; Establish a visual connection index between tables across pages to maintain the semantic integrity of the structured data flow across consecutive pages.

6. The method for automatically generating test reports as described in claim 4, characterized in that: The step of mapping the spatial adaptation evaluation results to a preset layout adaptation rule base and establishing the triggering logic between different adaptation levels and layout adjustment actions includes: In response to the spatial adaptation assessment result being determined as a critical warning, the geometric deviation value of the content to be filled exceeding the effective accommodating space is calculated; Based on the geometric deviation value, a non-destructive layout compression algorithm is invoked to iteratively calculate the line spacing compression ratio or character spacing compression step size until the estimated visual height converges to the available height threshold range. Generate layout adjustment instructions to force the content to be filled to fit into the effective space while maintaining the overall layout structure of the standardized document template.

7. The method for automatically generating test reports as described in claim 1, characterized in that: The process of injecting the structured data stream into the standardized document layout template based on the adaptive layout rendering control model, performing style unification processing, and generating the target test report includes: In response to the completion of the operation of injecting the structured data stream into the standardized document layout template, the document global nodes are traversed to identify style pollution items caused by the data source format. Force the application of the global font family attributes and paragraph alignment rules defined in the standardized document layout template, thereby overriding the style pollution items; For table areas, detect and fix cell border breaks or discontinuous background colors caused by dynamic data filling; Once all style correction operations have been completed, the document rendering state is fixed, and the target test report is generated.

8. A system for automatically generating test reports, employing a method for automatically generating test reports as described in any one of claims 1 to 7, characterized in that, include: The source data parsing module is used to obtain multidimensional test source data and standardized document format templates, and to parse the metadata structure of the multidimensional test source data. The mapping model construction module is used to identify feature placeholders in the standardized document layout template, construct a mapping index between the feature placeholders and the multidimensional test source data based on field attributes and contextual logical relationships, and construct a dynamic data mapping configuration model. The structured data stream generation module is used to clean and convert the multidimensional test source data through the dynamic data mapping configuration model, identify the dependencies between data items, and generate a structured data stream for content filling. An adaptive rendering control module is used to combine the structured data stream with the layout constraints of the standardized document layout template, analyze the fit between the content entity and the container space, and construct an adaptive layout rendering control model for dynamic layout of table areas and text areas. The target report generation module is used to inject the structured data stream into the standardized document layout template based on the adaptive layout rendering control model, and perform style unification processing to generate a target test report.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of a method for automatically generating a test report according to any one of claims 1 to 7.

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