Test script generation method and device, electronic equipment and storage medium

CN123011712APending Publication Date: 2026-10-30BEIJING GALAXY POWER EQUIP TECH CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611190652.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-06
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]本公开实施例提供了一种测试脚本生成方法、装置、电子设备及存储介质,可以解决现有技术中人工编码测试脚本效率低下、测试细则与脚本之间缺少明确对应关系的问题

Benefits of technology

通过对待处理测试文档集对应的文档内容进行识别,得到至少一个文档元素对应的文本片段,并识别出每个文本片段中的至少一个目标标准实体、并生成对应的可执行测试判据以及来源位置信息,根据每个文本片段中各个目标标准实体和对应的可执行测试判据,生成结构化数据,并将各个文本片段各自的结构化数据转换为适用于待执行测试平台和待测试设备的可执行测试脚本,实现了测试细则的自动解析和结构化,无需人工编写测试脚本,提高了测试脚本生成的效率;同时,由于在结构化数据中保留了与测试文档集对应的来源位置信息,并可在可执行测试脚本中插入暂停点以满足现场SOP门控要求,因此提高了测试执行的一致性和可追溯性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123011712A_ABST
    Figure CN123011712A_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a test script generation method and device, electronic equipment and storage medium, and relate to the technical field of aerospace. The method comprises: obtaining a set of test documents to be processed; identifying the document content corresponding to the set of test documents to obtain a text segment corresponding to at least one document element, and determining the source position information of each text segment in the set of test documents; determining at least one target standard entity in the text segment based on a pre-constructed domain knowledge graph; generating an executable test criterion corresponding to the text segment based on the criterion text in the text segment; and generating structured data conforming to a preset output structure based on each target standard entity in the text segment, the executable test criterion and the source position information, and then obtaining an executable test script. Embodiments of the present disclosure not only improve the efficiency of test script generation, but also improve the consistency and traceability of test execution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of aerospace technology, and more specifically, to a test script generation method, apparatus, electronic device, and storage medium. Background Technology

[0002] In the aerospace field, test guidelines refer to normative documents that specify in detail the methods, procedures, standards, conditions, and requirements for conducting test activities.

[0003] Currently, test details are usually transcribed into test scripts that can be executed by the test platform manually. However, manual transcription is inefficient and there is no clear correspondence between test details and scripts. Summary of the Invention

[0004] This disclosure provides a test script generation method, apparatus, electronic device, and storage medium, which can solve the problems of low efficiency in manually coding test scripts and the lack of a clear correspondence between test details and scripts in the prior art. The technical solution provided by this disclosure is as follows: According to one aspect of the present disclosure, a test script generation method is provided, the method comprising: Obtain the test document set to be processed; the test document set includes test details. The document content corresponding to the test document set is identified to obtain at least one text fragment corresponding to a document element, and the source location information of each text fragment in the test document set is determined. For each text segment, at least one target standard entity is identified in the text segment based on a pre-built domain knowledge graph; the domain knowledge graph includes multiple standard entities. For each text segment, an executable test criterion is generated based on the criterion text in the text segment; and structured data conforming to a preset output structure is generated based on each target standard entity in the text segment, the executable test criterion, and the source location information. Based on the structured data of each text fragment, an executable test script suitable for the test platform and the test device is obtained.

[0005] According to another aspect of the present disclosure, a test script generation apparatus is provided, the apparatus comprising: The acquisition module is used to acquire a set of test documents to be processed; the set of test documents includes test details. The text fragment determination module is used to identify the document content corresponding to the test document set, obtain at least one text fragment corresponding to a document element, and determine the source location information of each text fragment in the test document set. The target standard entity determination module is used to determine at least one target standard entity in each text segment based on a pre-built domain knowledge graph; the domain knowledge graph includes multiple standard entities. The structured data generation module is used to generate executable test criteria corresponding to each text segment based on the criteria text in the text segment; and to generate structured data that conforms to a preset output structure based on each target standard entity in the text segment, the executable test criteria, and the source location information. The executable test script determination module is used to obtain executable test scripts suitable for the test platform and the device under test based on the structured data of each text fragment.

[0006] According to another aspect of the present disclosure, an electronic device is provided, the 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 steps of any of the above-described test script generation methods.

[0007] According to another aspect of the present disclosure, a computer-readable storage medium is provided that stores a computer program, which, when executed by a processor, implements the steps of any of the test script generation methods described above.

[0008] According to one aspect of the present disclosure, a computer program product is provided, which includes a computer program that, when executed by a processor, implements the steps of any of the test script generation methods described above.

[0009] The beneficial effects of the technical solutions provided in this disclosure are: By identifying the document content corresponding to the test document set to be processed, at least one text fragment corresponding to a document element is obtained. At least one target standard entity in each text fragment is identified, and corresponding executable test criteria and source location information are generated. Based on each target standard entity and corresponding executable test criteria in each text fragment, structured data is generated. The structured data of each text fragment is then converted into executable test scripts suitable for the test platform and the test device to be executed. This achieves automatic parsing and structuring of test details, eliminating the need for manual writing of test scripts and improving the efficiency of test script generation. At the same time, since the source location information corresponding to the test document set is retained in the structured data, and pause points can be inserted in the executable test scripts to meet the on-site SOP gating requirements, the consistency and traceability of test execution are improved. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments of this disclosure will be briefly introduced below.

[0011] Figure 1 A flowchart illustrating a test script generation method provided in this embodiment of the disclosure; Figure 2 A schematic diagram illustrating an intelligent parsing and executable method for aerospace testing specifications provided in this embodiment of the disclosure; Figure 3 A flowchart of document recognition and structure extraction provided for embodiments of this disclosure; Figure 4 A flowchart of semantic extraction and entity linking provided for embodiments of this disclosure; Figure 5 A flowchart illustrating the generation of a constraint form and criterion provided in this disclosure embodiment; Figure 6 A flowchart illustrating structured output and script adaptation provided in this embodiment of the disclosure; Figure 7 A flowchart of human-machine collaborative execution and traceability provided in this embodiment of the disclosure; Figure 8 This is a schematic diagram of the structure of a test script generation device provided in an embodiment of the present disclosure; Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0012] The embodiments of this disclosure are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this disclosure, and do not constitute a limitation on the technical solutions of the embodiments of this disclosure.

[0013] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this disclosure mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element are connected through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term, for example, “A and / or B” or “A, B” indicates implementation as “A,” or implementation as “B,” or implementation as “A and B.”

[0014] To make the objectives, technical solutions, and advantages of this disclosure clearer, the embodiments of this disclosure will be described in further detail below with reference to the accompanying drawings.

[0015] First, the technical terms used in this disclosure will be introduced and explained: Knowledge graph: A structured semantic knowledge base used to describe concepts and their relationships.

[0016] HOLD point: A pre-set mandatory pause in the test process that can only be resumed after manual confirmation or when specific conditions are met, in order to ensure test safety.

[0017] SOP (Standard Operating Procedure): refers to an internal procedure designed to perform complex daily tasks within limited time and resources.

[0018] Assist / Semiauto / Auto modes: These refer to three human-machine collaboration modes, namely assisted execution (mainly manual, guided by the system), semi-automatic execution (partial automation, key steps require manual confirmation), and fully automatic execution (script-driven, with mandatory gating).

[0019] DSL (Domain Specific Language): A computer language designed for a specific application domain (such as aerospace testing) to express test logic and criteria.

[0020] The following description of several exemplary embodiments illustrates the technical solutions of this disclosure and the technical effects produced by these solutions. It should be noted that the following embodiments can be referenced, learned from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.

[0021] Figure 1 This is a flowchart illustrating a test script generation method provided in an embodiment of the present disclosure, as shown below. Figure 1 As shown, the method includes: Step S110: Obtain the test document set to be processed; the test document set includes test details.

[0022] Specifically, the set of test documents to be processed may include at least one test document, and at least one test document includes at least test details. The test document may be in the format of Word, PDF, Excel, etc.

[0023] Optionally, the number of test documents can be one, i.e., a single detailed document, or multiple, such as a main document (i.e., the document corresponding to the test details) and other supplementary documents, which can be in the form of tables, figures, text, etc.

[0024] The test documents in the test document set can be integrated to obtain the document content corresponding to the test document set. The document content corresponding to the test document set is based on natural language description.

[0025] Step S120: Identify the document content corresponding to the test document set to obtain at least one text fragment corresponding to a document element, and determine the source location information of each text fragment in the test document set.

[0026] Specifically, test details typically include document elements such as text paragraphs, tables, and step cards.

[0027] In this context, a step card can be understood as a list of specific actions that are performed and recorded item by item, arranged in a strict chronological order, and oriented towards the operational position. A step card can typically include: step number, operation role, operation action, object / parameter, expected result, criterion, HOLD / checkpoint, and exception handling, etc.

[0028] For example, the step card can be represented as: S3-02 (front end) Open V-101 → (back end) Confirm status bit = 1 and pressure is [0.48, 0.52] MPa → HOLD double confirmation → Abnormal: Timeout alarm for 30 seconds.

[0029] Based on the characteristics of the test rules, at least one document element can be pre-set, which may include paragraphs, tables, and step cards.

[0030] After obtaining the document content corresponding to the test document set, the document content can be identified and split into text fragments corresponding to each document element. The source location information of each text fragment in the test document set can be obtained. The source location information of the document fragment can include at least one of the chapter, page number, or row and column number of the document fragment in the test rules.

[0031] Optionally, the document content can be parsed based on preset rules to obtain the text fragments corresponding to each document element and the source location information of each text fragment; alternatively, the document content can be analyzed based on a trained structure extraction model to obtain the text fragments corresponding to each document element and the source location information of each text fragment.

[0032] Step S130: For each text fragment, based on the pre-built domain knowledge graph, determine at least one target standard entity in the text fragment; the domain knowledge graph includes multiple standard entities.

[0033] Specifically, a domain knowledge graph can be pre-constructed, which can include multiple standard entities. A standard entity can be understood as a standardized representation of the corresponding entity, and each standard entity can correspond to a unique entity identifier. Through the entity identifier, the testing platform can identify which device or parameter is being operated on.

[0034] Optionally, in rocket testing applications, multiple devices related to rocket testing, parameters of each device, actions in the test operation, and types of operators involved can be acquired, and corresponding standard entities and relationships between them can be established. For example, if a test instruction includes: Action A - Device B, then a connection relationship can be established between the standard entities "Action A" and "Device B".

[0035] After obtaining the text fragments corresponding to the document content, for each text fragment, the entities appearing in the text fragment can be linked with the standard entities in the domain standard graph to obtain at least one target standard entity in the text fragment.

[0036] Optionally, based on a pre-built domain knowledge graph, at least one target standard entity in the text fragment is identified, including: Obtain at least one candidate entity from a text segment and the relationship between two candidate entities in at least one entity pair; Identify the target standard entity that matches each candidate entity from multiple standard entities in the domain knowledge graph.

[0037] Specifically, after obtaining the text segments corresponding to the document content, for each text segment, at least one candidate entity in the text segment and the relationship between two candidate entities in at least one entity pair can be obtained through named entity recognition and relation extraction.

[0038] Optionally, obtaining at least one candidate entity in the text fragment and the relationship between two candidate entities in at least one entity pair includes: Named entity recognition is performed on the text fragment to obtain at least one candidate entity in the text fragment; The relationships between candidate entities are extracted from the text fragments to obtain at least one entity pair and the relationships between each entity pair.

[0039] Specifically, multiple entity categories can be predefined. These entity categories can include action entities, parameter entities, device entities, and operator type entities. For example, "open" in the text can be considered an action entity, and "PLC controller" can be considered a device entity.

[0040] For each text segment, named entity recognition is performed on the text segment based on multiple preset entity categories to obtain at least one candidate entity in the text segment.

[0041] After obtaining each candidate entity in the text fragment, the relationships between each candidate entity can be extracted based on the text fragment. Any two candidate entities that have a relationship are taken as an entity pair, and the relationship between each entity pair can be identified.

[0042] For example, named entity recognition can be performed based on a trained NER (Named Entity Recognition) model, and relation extraction can be performed based on a trained RE (Relation Extraction) model. The NER model and the RE model can be obtained by domain fine-tuning based on the BERT (Bidirectional Encoder Representations from Transformers) model.

[0043] In practical applications, different descriptions may appear in the test specifications for the same device or parameter. For example, for a certain parameter, some places use the English abbreviation, some use the full Chinese name, and some use the full English name.

[0044] For each candidate entity in the text fragment, a target standard entity that matches the candidate entity can be determined from multiple standard entities in a pre-built domain knowledge graph.

[0045] For example, the semantic similarity between a candidate entity and each standard entity can be calculated, and the standard entity with the highest semantic similarity can be taken as the target standard entity corresponding to the candidate entity.

[0046] For example, for each standard entity, a mapping relationship is set between the standard entity and multiple candidate entities; for each candidate entity, based on the preset mapping relationship, the standard entity corresponding to the candidate entity is obtained as the target standard entity.

[0047] Optionally, a target standard entity matching each candidate entity is determined from multiple standard entities in the domain knowledge graph, including: Based on the candidate entity and the contextual information of the text segment in which the candidate entity is located, the target standard entity that matches the candidate entity is determined from multiple standard entities in the domain knowledge graph.

[0048] Specifically, for each candidate entity, a target standard entity matching the candidate entity can be determined from multiple standard entities in the domain knowledge graph based on the contextual relationship between the candidate entity and the text segment in which the candidate entity is located.

[0049] For example, if the text fragment "open the first-level solenoid valve of the arrow" includes the candidate entity "open", and the object to be opened is determined to be the solenoid valve based on the context information of the text fragment, then the standard entity "VALVE_OPEN" in the domain knowledge graph can be used as the target standard entity corresponding to the candidate entity "open".

[0050] Based on a pre-built domain knowledge graph, each candidate entity in the text fragment is linked to a standard entity in the domain knowledge graph. This enables different representations of the same entity to be mapped to the same standard entity. The test platform can locate the correct entity and perform operations based on the unique entity identifier of the standard entity, avoiding confusion caused by different representations of the same entity in the test rules and improving the accuracy of the generated executable test scripts.

[0051] Optionally, for each candidate entity in the text fragment, the named entity recognition result and relation extraction result can be verified based on the matching result of the candidate entity in the domain knowledge graph.

[0052] The consistency of the named entity recognition results and relation extraction results output by the model with the domain knowledge graph can be verified to obtain the consistency verification result. The legality of the named entity recognition results and relation extraction results (e.g., whether the range is within a reasonable range) can also be verified to obtain the legality verification result. Combining the consistency verification result and the legality verification result, the confidence score of the identified entities and extracted relations can be obtained.

[0053] For example, if a candidate entity does not have a matching standard entity in the domain knowledge graph, it indicates that the candidate entity may not exist, and the identified candidate entity is inaccurate. For an entity pair, the relationship between the two candidate entities can be verified based on the relationship between their corresponding target standard entities in the domain knowledge graph. If there is no connection between these two target standard entities in the domain knowledge graph, the extracted relationship is inaccurate. Alternatively, if the connection between these two target standard entities in the domain knowledge graph is inconsistent with the relationship between the entity pair, the connection between the target standard entities in the domain knowledge graph can be used to correct the relationship between the entity pair.

[0054] Based on the source location information of the text fragment, the original text corresponding to the identified entities and extracted relationships in the test rules is obtained. By combining the confidence scores of the original text and the model output results, the named entity recognition results and relationship extraction results are further verified, thereby improving the reliability of the named entity recognition results and relationship extraction results.

[0055] Step S140: For each text segment, generate an executable test criterion corresponding to the text segment based on the criterion text in the text segment; generate structured data that conforms to the preset output structure based on each target standard entity, executable test criterion and source location information in the text segment.

[0056] Specifically, for each text fragment, text related to conditions, tolerances, dependencies, and timeouts can be used as criterion text, and the criterion text can be converted into executable test criteria.

[0057] In this context, criteria are specific, verifiable conditions or standards used in the test specifications to determine whether a single test step passes or fails. These typically manifest as explicit requirements for device status or parameter thresholds. Executable test criteria can be understood as test criteria that the platform can automatically execute, such as test criteria described in JSON format.

[0058] Each target standard entity in a text fragment can be integrated with executable test criteria based on a preset output structure, and the source location information of the text fragment can be added to the integrated data to obtain structured data corresponding to the text fragment. Since the structured data corresponding to the text fragment includes the source location information of the text fragment in the test document set, the traceability of test execution is improved.

[0059] The preset output structure includes multiple output fields, which can fill each target standard entity and executable test criteria in the text fragment into each output field of the preset output structure, and the filled output structure is used as structured data.

[0060] Optionally, the preset output structure can be represented as: {role, action, object, verify}, where role corresponds to the operator type field, action corresponds to the action field, object corresponds to the device field, and verify corresponds to the criterion field.

[0061] Optionally, based on the criterion text in the text fragment, an executable test criterion corresponding to the text fragment is generated, including: Extract the criterion text from the text fragment; Intent recognition is performed on the criterion text to obtain the target intent type corresponding to the criterion text; From multiple reference criterion configuration templates, select the reference criterion configuration template corresponding to the target intent type as the target criterion configuration template; Based on the target standard entities in the text fragment and the target criterion configuration template, the executable test criteria corresponding to the text fragment are determined.

[0062] Specifically, for each text segment, a criterion text can be extracted from the text segment. By performing intent recognition on the criterion text, the candidate intent type corresponding to the criterion text can be determined from multiple candidate intent types, which serves as the target intent type corresponding to the criterion text. Multiple candidate intent types can include range verification, state matching, timing checks, etc.

[0063] For each candidate intent type, a reference criterion configuration template corresponding to that candidate intent type can be pre-set. After determining the target intent type corresponding to the criterion text, the reference criterion configuration template corresponding to the target intent type can be used as the target criterion configuration template corresponding to that criterion text.

[0064] The reference criterion configuration template can include multiple criterion configuration fields. These fields can be filled into the corresponding criterion configuration fields in the target criterion configuration template based on the multiple target standard entities identified in the text fragment. The filled reference criterion configuration template can then be used as the configured executable test criterion.

[0065] Below is an example of an executable test criterion: { "criterionType": "range", / / Criterion type: range criterion "param": "TankPressure", / / Parameter to be measured: Tank pressure "unit": "MPa", / / Unit: Megapascals "target": 0.50, / / Target value: 0.50 MPa "tol": 0.02, / / Tolerance: ±0.02 MPa "timeout": 30, / / Timeout duration: 30 seconds "evidence": { / / Source of evidence "anchor": "3.3 / Table 7 / Row 2" / / reference position } } The test criterion provided in the above example means that "within 30 seconds, the tank pressure of the tested system should stabilize at 0.50 MPa, with an allowable error of ±0.02 MPa (i.e., 0.48-0.52 MPa). This test criterion is derived from Section 3.3 of the test specifications and row 2 of Table 7".

[0066] The reference criterion configuration template in the above example may include criterion type field, measured parameter field, parameter unit field, parameter target value field, parameter tolerance field, timeout field, and evidence source field.

[0067] Step S150: Based on the structured data of each text fragment, obtain an executable test script suitable for the test platform and the device to be tested.

[0068] Specifically, the structured data corresponding to each text fragment is a universally applicable data format, such as JSON or DSL, independent of the testing platform. For different testing platforms, the structured data of each text fragment can be converted into executable test scripts suitable for that specific platform.

[0069] Optionally, based on the structured data of each text fragment, an executable test script corresponding to the document set to be processed is obtained, including: The structured data of each text fragment is integrated to obtain comprehensive structured data; Obtain test information related to the test platform and the device under test; Based on the test information, the comprehensive structured data is converted into executable test scripts suitable for the test platform and the device under test.

[0070] Specifically, based on the position information of each text fragment in the document content, the structured data of each text fragment can be integrated to obtain the overall comprehensive structured data corresponding to the document content of the test document set.

[0071] Obtain test information related to the test platform and the device under test for the script to be executed. The test information may include the execution framework (e.g., Robot, Python or other self-developed framework), device communication protocol and instruction set, variable naming and unit system, etc.

[0072] Based on the test information, the comprehensive structured data is transformed to obtain an executable test script adapted to the test platform and the device to be tested.

[0073] Optionally, during the process of obtaining an executable test script based on comprehensive structured data, at least one pause point (i.e., a HOLD point) can be inserted to meet the gating requirements of the on-site SOP (Standard Operating Procedure).

[0074] For each text segment corresponding to structured data, pause point markers can be inserted into the structured data based on at least one of the following methods.

[0075] When a check prompt keyword appears in the text fragment, a pause point marker can be set in the structured data corresponding to the text fragment. The check prompt keywords include HOLD, pause, review, confirm, two people confirm, etc.

[0076] Optionally, the pause point identifier can be set by setting the hold field to true.

[0077] When a preset action type appears in the structured data, a pause point marker can be set in the structured data. The preset action type can include high-risk actions such as ignition, pressurization, power-on, and valve group opening and closing.

[0078] The confidence score corresponding to the executable test criteria in the structured data can be obtained. When the confidence score of the executable test criteria in the structured data is less than a preset threshold, a pause point marker can be set in the structured data.

[0079] The scores corresponding to the executable test criteria in this structured data are determined based on the following method: For each text segment, after generating an executable test criterion based on the criterion text in that text segment, the confidence score corresponding to the executable test criterion can be determined from multiple dimensions such as criterion parsing confidence (model / rule), entity link consistency, unit / threshold legality verification, and cross-position consistency (consistency between text and table).

[0080] During the process of converting comprehensive structured data into an executable test script, if a pause point is detected in the structured data, a pause point is inserted at the corresponding position in the executable test script.

[0081] By adding pause points to the executable test scripts, an organic combination of automated machine execution and manual confirmation of key steps was achieved, which not only improved testing efficiency but also ensured the high safety requirements of aerospace missions.

[0082] The method provided in this disclosure identifies the document content corresponding to the test document set to be processed, obtains text fragments corresponding to at least one document element, identifies at least one target standard entity in each text fragment, generates corresponding executable test criteria, generates structured data based on each target standard entity in each text fragment and the corresponding executable test criteria, and converts the structured data of each text fragment into executable test scripts suitable for the test platform and the device to be tested. This achieves automatic parsing and structuring of test details, eliminates the need for manual writing of test scripts, and improves the efficiency of test script generation.

[0083] The following section provides a detailed explanation of the process for automatically generating executable test scripts based on aerospace test guidelines, specifically for the aerospace field.

[0084] Figure 2 This is a schematic diagram of an intelligent parsing and executable method for aerospace testing specifications provided in an embodiment of this disclosure, as shown below. Figure 2 As shown, the method includes: Document Input and Structure Extraction: Unified adaptation to Word / PDF / Excel, automatic extraction of document elements such as paragraphs, tables, and step cards, structural normalization and error recovery, and output of multiple text fragments; Semantic extraction and entity linking: Based on the model, entity recognition of actions and devices is completed, and semantic disambiguation and unique identifier binding are achieved by combining knowledge graph, and semantic objects with confidence scores are output.

[0085] Constraint formalization and criterion generation: Time constraints, conditional branches, tolerances and timeouts are compiled into standardized state machines and predicate expressions to form an executable criterion configuration.

[0086] Structured output and script adaptation: Generate platform-independent JSON / DSL test tasks and adapt them to Python / Robot scripts as needed, while injecting SOP gating logic.

[0087] Human-machine collaborative execution and full-process traceability: Execution in Assist / Semiauto / Auto mode, the system verifies risks in real time and records a full-process traceability log of "instruction → feedback → evidence chain → judgment conclusion".

[0088] In one example, the system first inputs a detailed document containing "6.2 Device Self-Test" and specific steps (such as "1. Power on PLC..."). The system then converts this document into structured JSON data containing actions (action: POWER), devices (device: PLC), and verification items (verify). Finally, it generates an execution script and log containing "Exec POWER", "Check OK", and "HOLDConfirm".

[0089] Furthermore, the process includes version differentiation and incremental evolution closed loops, supporting the security evolution of the testing system by outputting the differences between adjacent versions and the affected test items. The affected list includes mappings of affected test steps / criteria / script fragments / device parameters. By comparing the details of adjacent versions, structural differentiation (chapter / table / step card), semantic differentiation (entity / action / threshold / unit / timing), and constraint differentiation (predicate / state machine changes) can be performed. Then, based on the dependency graph (step → device / parameter → script fragment), the scope of impact and regression items can be deduced.

[0090] For example, the "Liquid Oxygen Tank Pressurization Test Details" are converted into a structured test task list and criterion configuration, and adapted according to the target execution platform, the interface / protocol of the device under test, and the on-site SOP gating strategy to generate corresponding scripts / task configurations. The test manager releases the version of the details (denoted as V), and the operators upload the corresponding Word / PDF / Excel files to the system; the system automatically triggers the parsing process and marks the time point T0. The test details can target a single device, a group of devices, or a subsystem, and the test platform achieves unified processing through unique identifiers and device group modeling.

[0091] The input test document set includes documents in various formats such as the original detailed rules, tables, and flowcharts. In addition, a domain knowledge base needs to be built in advance, which includes a domain knowledge graph, a terminology database, and reference criterion configuration templates.

[0092] Figure 3 A flowchart for document recognition and structure extraction provided in this disclosure embodiment is shown below. Figure 3 As shown, the process includes: First, the system receives source files in various formats, including Word, PDF, and Excel documents. Then, a structured parsing engine reads the underlying information of the file, identifies the document type, and automatically identifies the hierarchical nesting relationships from chapter titles to the main text. Based on this, the system further locates and accurately extracts complex elements within the document, such as data tables, bulleted lists, and specific styled step cards. Furthermore, optical character recognition technology and typesetting logic verification automatically correct recognition errors and structural misalignments. After this entire processing flow, the original document is completely transformed into a highly standardized normalized intermediate representation, i.e., tree-structured data organized in JSON format, thus fully preserving the document's logical framework. In one example, when the input document is a Word document titled "6.2 Device Self-Check," the output result is: Section(title="Device Self-Check", content=[ListItems...]).

[0093] Figure 4A flowchart of semantic extraction and entity linking provided for embodiments of this disclosure is shown below. Figure 4 As shown, the process includes: The system receives structured text, including paragraphs, lists, or tables, as input and then feeds the data into a semantic understanding and linking engine for processing. Within this core engine, named entity recognition technology is used to extract key elements from the text, while a domain knowledge graph provides background knowledge support. These two technologies work together to standardize entity mapping and disambiguate context. After these steps, the system ultimately outputs standardized entity information containing a clear action type and a globally unique identifier. In one example, for the instruction "Open the first stage solenoid valve on the arrow," the system successfully parses it into the specific action VALVE_OPEN and maps "first stage on the arrow" to the device group DeviceGroup: Stage1_Valves (ID: G01).

[0094] Figure 5 A flowchart for generating a constraint form and criterion is provided for embodiments of this disclosure, such as... Figure 5 As shown, the process includes: The system acquires natural language descriptions containing information such as test conditions, tolerance ranges, logical dependencies, and timeout settings. These descriptions are then fed into the constraint compiler for in-depth processing. During the compilation phase, the system first performs predicate logic transformation and standardization to establish the decision logic. Next, it constructs a state machine to simulate complex timing and state transitions, and then performs unit normalization to ensure dimensional consistency. After these compilation steps, the system finally generates an executable criterion containing specific decision expressions, finite state machine logic, and configuration parameters. In one example, for the input constraint text "reach 10MPa ± 0.5MPa within 3 seconds," the system successfully parses it into the standardized verification instruction Verify(Target=10.0, Tol=0.5, Unit=MPa, Timeout=3s), thus achieving a seamless conversion from semantic description to automated decision logic.

[0095] Figure 6 A flowchart of structured output and script adaptation provided for embodiments of this disclosure, such as Figure 6 As shown, the process includes: An executable task model defined in a cross-platform format such as JSON or YAML is then fed into a script adapter engine for dual-path processing: During the code generation phase, the system maps general logic to the target syntax using techniques such as template matching, syntax transformation, and parameter injection; simultaneously, the security enhancement module inserts HOLD points into the code, attaches traceability metadata, and configures exception handling mechanisms to ensure operational safety. After the above processing, a target execution script adapted to specific environments such as Python and Robot is finally generated. In one example, the structured data is represented as JSON format {action: "POWER_ON", device: "PLC", hold: true}, and the converted script can be: Robot: Power On PLC; HOLD Point Confirmation - Backend.

[0096] Figure 7 A flowchart of human-machine collaborative execution and traceability provided for embodiments of this disclosure, such as... Figure 7 As shown, the process includes: The system first enters the execution mode selection phase, supporting switching between Assist, Semiauto, and Auto modes. Then, it enters the core collaborative execution engine, which operates continuously in a loop, sequentially executing command issuance and status verification, real-time risk detection, and triggering a HOLD point or dual-person review mechanism when manual intervention is required. After execution, the system generates a full-process traceability log, completely recording the correspondence between command flow, system feedback, and personnel operations. In one example, when performing "single-point control" of batch operations, if a critical command such as "group power-on" is encountered, the system automatically suspends the process, prompts the operator for "dual confirmation," and enters a security verification phase awaiting card swiping, thereby ensuring safety and compliance.

[0097] The method provided in this disclosure reduces the manual script writing work that originally required several days to minutes of automatic parsing and generation, completely eliminating the "semantic gap" between the document and the execution system, and significantly improving the efficiency of the test preparation phase; it realizes the "executability" and "SOP consistency" of test details, and transforms static documents into dynamic executable criteria and state machines through constraint formalization and script adaptation; at the same time, through human-machine collaboration mode (Assist / Semiauto / Auto) and forced HOLD point mechanism, it ensures that automated execution strictly follows the on-site SOP safety specifications and does not replace the key manual confirmation links; it establishes a credible evidence chain and traceability closed loop throughout the process, solving the trust problem of "black box" execution of automated systems. By providing original document anchors and confidence scores for each generated test criterion, and recording a complete traceability log of "instruction → feedback → personnel confirmation → criterion conclusion" during execution, the traceability and compliance of test results are greatly improved. It supports the continuous evolution and security iteration of test knowledge. Addressing the pain point of frequent changes in test rules, based on version differentiation and impact assessment mechanisms, it can accurately locate affected test items and generate regression lists, ensuring that the test system can safely and cost-effectively follow the rules for incremental evolution.

[0098] Figure 8 This is a schematic diagram of the structure of a test script generation device provided in an embodiment of the present disclosure, such as... Figure 8 As shown, the apparatus of this embodiment may include: The acquisition module 210 is used to acquire a set of test documents to be processed; the set of test documents includes test rules. The text fragment determination module 220 is used to identify the document content corresponding to the test document set, obtain at least one text fragment corresponding to a document element, and determine the source location information of each text fragment in the test document set; The target standard entity determination module 230 is used to determine at least one target standard entity in each text segment based on a pre-built domain knowledge graph; the domain knowledge graph includes multiple standard entities. The structured data generation module 240 is used to generate executable test criteria corresponding to each text segment based on the criteria text in the text segment; and to generate structured data that conforms to a preset output structure based on each target standard entity in the text segment, the executable test criteria, and the source location information. The executable test script determination module 250 is used to obtain executable test scripts suitable for the test platform and the device under test based on the structured data of each text fragment.

[0099] As an optional embodiment, when the structured data generation module generates executable test criteria corresponding to the text fragment based on the criteria text in the text fragment, it is used to: Obtain the criterion text from the text fragment; The criterion text is subjected to intent recognition to obtain the target intent type corresponding to the criterion text; From multiple reference criterion configuration templates, the reference criterion configuration template corresponding to the target intent type is selected as the target criterion configuration template. Based on each target standard entity in the text fragment and the target criterion configuration template, the executable test criterion corresponding to the text fragment is determined.

[0100] As an optional embodiment, when determining at least one target standard entity in the text fragment based on a pre-built domain knowledge graph, the target standard entity determination module is used to: Obtain at least one candidate entity from the text segment and the relationship between two candidate entities in at least one entity pair; From multiple standard entities in the domain knowledge graph, a target standard entity matching each candidate entity is determined.

[0101] As an optional embodiment, the target standard entity determination module, when determining the target standard entity matching each candidate entity from multiple standard entities in the domain knowledge graph, is configured to: Based on the candidate entity and the context information of the text segment in which the candidate entity is located, a target standard entity that matches the candidate entity is determined from multiple standard entities in the domain knowledge graph.

[0102] As an optional embodiment, when the executable test script determination module obtains an executable test script suitable for the test platform and the device under test based on the structured data of each text fragment, it is used to: The structured data of each text fragment is integrated to obtain comprehensive structured data; Obtain test information related to the test platform and the device under test; Based on the test information, the comprehensive structured data is converted into an executable test script suitable for the test platform and the device under test.

[0103] As an optional embodiment, the executable test script includes at least one pause point; the pause point is inserted into the executable test script based on a pause point identifier in the structured data; The pause point identifier is determined based on at least one of the following methods: If a check prompt keyword is detected in a text fragment, a pause point marker is set in the structured data corresponding to the file fragment; If a preset action type appears in the structured data, a pause point marker is set in the structured data; If the score of the executable test criterion in the structured data is less than a preset threshold, a pause point marker is set in the structured data.

[0104] As an optional embodiment, the target standard entity determination module, when obtaining at least one candidate entity in the text fragment and the relationship between two candidate entities in at least one entity pair, is used to: Named entity recognition is performed on the text fragment to obtain at least one candidate entity in the text fragment; Based on the text fragment, the relationships between each candidate entity are extracted to obtain at least one entity pair and the relationship between two candidate entities in each entity pair.

[0105] The apparatus of this disclosure embodiment can execute the method provided in this disclosure embodiment, and its implementation principle is similar, and it has corresponding technical effects. The actions performed by each module in the apparatus of each embodiment of this disclosure correspond to the steps in the method of each embodiment of this disclosure. For a detailed functional description of each module of the apparatus, please refer to the description in the corresponding method shown above, and it will not be repeated here.

[0106] In this disclosure, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0107] This disclosure provides an electronic device including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps of the method provided in any optional embodiment of this disclosure. Compared with the prior art, it can achieve the following: by identifying the document content corresponding to the test document set to be processed, at least one text fragment corresponding to a document element is obtained, and at least one target standard entity in each text fragment is identified, and corresponding executable test criteria are generated. Based on each target standard entity in each text fragment and the corresponding executable test criteria, structured data is generated, and the structured data of each text fragment is converted into an executable test script suitable for the test platform and the device to be tested. This realizes the automatic parsing and structuring of test details, eliminating the need for manual writing of test scripts and improving the efficiency of test script generation.

[0108] In one alternative embodiment, an electronic device is provided, such as Figure 9 As shown, Figure 9 The illustrated electronic device 4000 includes a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of this disclosure.

[0109] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with this disclosure. Processor 4001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.

[0110] Bus 4002 may include a pathway for transmitting information between the aforementioned components. Bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 4002 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 9 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0111] The memory 4003 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium capable of carrying or storing computer programs and capable of being read by a computer, without limitation herein.

[0112] The memory 4003 is used to store computer programs that execute embodiments of the present disclosure, and is controlled by the processor 4001 to execute them. The processor 4001 is used to execute the computer programs stored in the memory 4003 to implement the steps shown in the foregoing method embodiments.

[0113] Among them, electronic devices include, but are not limited to: mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (such as in-vehicle navigation terminals), wearable devices, etc., as well as fixed terminals such as digital TVs, desktop computers, etc.

[0114] This disclosure provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments.

[0115] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments.

[0116] It should be understood that although arrows indicate various operation steps in the flowcharts of the embodiments of this disclosure, the order in which these steps are implemented is not limited to the order indicated by the arrows. Unless explicitly stated herein, in some implementation scenarios of the embodiments of this disclosure, the implementation steps in each flowchart can be executed in other orders as required. Furthermore, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage can also be executed at different times. In scenarios where execution times differ, the execution order of these sub-steps or stages can be flexibly configured as required, and the embodiments of this disclosure do not limit this.

[0117] The above description is only an optional implementation method for some implementation scenarios of this disclosure. It should be noted that for those skilled in the art, other similar implementation methods based on the technical concept of this disclosure without departing from the technical concept of this disclosure also fall within the protection scope of the embodiments of this disclosure.

Claims

1. A method for generating test scripts, characterized in that, include: Retrieve the set of test documents to be processed; The test document set includes test details; The document content corresponding to the test document set is identified to obtain at least one text fragment corresponding to a document element, and the source location information of each text fragment in the test document set is determined. For each text segment, at least one target standard entity is identified in the text segment based on a pre-built domain knowledge graph; the domain knowledge graph includes multiple standard entities. For each text segment, an executable test criterion is generated based on the criterion text in the text segment; and structured data conforming to a preset output structure is generated based on each target standard entity in the text segment, the executable test criterion, and the source location information. Based on the structured data of each text fragment, an executable test script suitable for the test platform and the test device is obtained.

2. The method according to claim 1, wherein generating executable test criteria corresponding to the text segment based on the criteria text in the text segment includes: Obtain the criterion text from the text fragment; The criterion text is subjected to intent recognition to obtain the target intent type corresponding to the criterion text; From multiple reference criterion configuration templates, the reference criterion configuration template corresponding to the target intent type is selected as the target criterion configuration template. Based on each target standard entity in the text fragment and the target criterion configuration template, the executable test criterion corresponding to the text fragment is determined.

3. The method according to claim 1, characterized in that, The process of determining at least one target standard entity in the text fragment based on a pre-built domain knowledge graph includes: Obtain at least one candidate entity from the text segment and the relationship between two candidate entities in at least one entity pair; From multiple standard entities in the domain knowledge graph, a target standard entity matching each candidate entity is determined.

4. The method according to claim 3, characterized in that, The step of determining the target standard entity that matches each candidate entity from multiple standard entities in the domain knowledge graph includes: Based on the candidate entity and the context information of the text segment in which the candidate entity is located, a target standard entity that matches the candidate entity is determined from multiple standard entities in the domain knowledge graph.

5. The method according to claim 1, characterized in that, The process of obtaining an executable test script suitable for the test platform and the test device based on the structured data of each text fragment includes: The structured data of each text fragment is integrated to obtain comprehensive structured data; Obtain test information related to the test platform and the device under test; Based on the test information, the comprehensive structured data is converted into an executable test script suitable for the test platform and the device under test.

6. The method according to claim 5, characterized in that, The executable test script includes at least one pause point; the pause point is inserted into the executable test script based on pause point identifiers in the structured data; The pause point identifier is determined based on at least one of the following methods: If a check prompt keyword is detected in a text fragment, a pause point marker is set in the structured data corresponding to the file fragment; If a preset action type appears in the structured data, a pause point marker is set in the structured data; If the score of the executable test criterion in the structured data is less than a preset threshold, a pause point marker is set in the structured data.

7. The method according to claim 4, characterized in that, The step of obtaining at least one candidate entity in the text segment and the relationship between two candidate entities in at least one entity pair includes: Named entity recognition is performed on the text fragment to obtain at least one candidate entity in the text fragment; Based on the text fragment, the relationships between each candidate entity are extracted to obtain at least one entity pair and the relationship between two candidate entities in each entity pair.

8. A test script generation device, characterized in that, include: The acquisition module is used to acquire the set of test documents to be processed; The test document set includes test details; The text fragment determination module is used to identify the document content corresponding to the test document set, obtain at least one text fragment corresponding to a document element, and determine the source location information of each text fragment in the test document set. The target standard entity determination module is used to determine at least one target standard entity in each text segment based on a pre-built domain knowledge graph; the domain knowledge graph includes multiple standard entities. The structured data generation module is used to generate executable test criteria corresponding to each text segment based on the criteria text in the text segment; and to generate structured data that conforms to a preset output structure based on each target standard entity in the text segment, the executable test criteria, and the source location information. The executable test script determination module is used to obtain executable test scripts suitable for the test platform and the device under test based on the structured data of each text fragment.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method 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 method described in any one of claims 1 to 7.

11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 7.