Metadata form testing method and device and electronic equipment
By generating control dependency graphs and test scripts, automated testing of metadata forms is achieved, solving the problems of low efficiency and low coverage in existing technologies and improving testing efficiency and quality.
Patent Information
- Application Number
- CN202510693534.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2025-10-28
AI Technical Summary
Existing technologies rely on human experience for metadata form testing, which is inefficient, has low coverage, and is difficult to adapt to complex application scenarios.
By identifying controls in the metadata form, a control tree and dependency graph are generated. Test scripts are then generated based on the control dependency graph to populate and validate the data, thus achieving automated testing.
It improves the efficiency and quality of metadata form testing and enhances its adaptability to complex application scenarios.
Smart Images

Figure CN120849264A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, and electronic device for testing metadata forms. Background Technology
[0002] In digital systems, metadata forms, as the core carriers of data definition, business rules, and resource allocation, are widely used in key areas such as financial transactions, medical information management, and the Industrial Internet of Things. Their accuracy directly determines data flow efficiency, the correctness of business logic, and the collaborative capabilities between systems. Therefore, how to efficiently test metadata forms is a critical issue that urgently needs to be addressed. Currently, testing metadata forms using traditional tools relies on human experience, resulting in low efficiency, low coverage, poor test quality, and difficulty in adapting to complex application scenarios. Summary of the Invention
[0003] This invention provides a method, apparatus, and electronic device for testing metadata forms, which addresses the shortcomings of existing technologies that use traditional tools to test metadata forms, which rely on human experience, resulting in low efficiency, low coverage, poor test quality, and difficulty in adapting to complex application scenarios.
[0004] This invention provides a method for testing metadata forms, including: Retrieve the metadata form to be tested; Identify all controls in the metadata form, determine the unique identifier and location information of each control, generate a metadata form control tree, and generate a control dependency graph based on the metadata form control tree; Based on the mapping relationship between the metadata form control tree and the database model, and the escaping relationship between the metadata form control values and the database stored values, a logical verification chain is generated; Based on the control dependency graph, a test script is generated. Based on the test script, data is populated into the metadata form. Based on the logical verification chain, the populated metadata form is verified to obtain the test result of the metadata form.
[0005] In some embodiments, generating a test script based on the control dependency graph and populating the metadata form with data based on the test script includes: Based on the control dependency graph, multiple operation paths are determined; Based on the multiple operation paths, generate a test script corresponding to each operation path; Determine the control variables of the metadata form; Based on the control variables of the metadata form, the test dataset of the metadata form is determined, and the test dataset includes test data corresponding to each operation path; Based on the test script corresponding to each operation path, the test data corresponding to each operation path is filled into the metadata form to obtain the filled metadata form. Submit the filled-in metadata form to the database.
[0006] In some embodiments, the control dependency graph is a directed acyclic graph, and determining multiple operation paths based on the control dependency graph includes: Based on the topological sorting algorithm, all controls in the control dependency graph are traversed and topological sorted to obtain the topological sorting result. Based on the topology sorting results, multiple operation paths are determined.
[0007] In some embodiments, determining multiple operation paths based on the control dependency graph includes: Based on the preset priority sorting rules and the control dependency graph, the priority sorting of multiple controls in the metadata form is performed to obtain the priority sorting result of the multiple controls; Based on the priority sorting results of the multiple controls, multiple operation paths are determined; The priority sorting rules include: Operations on controls corresponding to required fields will be executed first. Operations on child controls that depend on operations on the parent control are delayed. Control operations whose execution time exceeds a preset time threshold will be delayed.
[0008] In some embodiments, generating a control dependency graph based on the metadata form control tree includes: Based on the metadata form control tree, determine the event binding relationship and data linkage relationship between multiple controls of the metadata form; The dependencies between the multiple controls are determined based on the event binding relationships and data linkage relationships between them; An initial control dependency graph is generated using the multiple controls as nodes and the dependencies between the multiple controls as directed edges. The initial control dependency graph is optimized to obtain the control dependency graph.
[0009] In some embodiments, optimizing the initial control dependency graph includes: Based on the loop detection algorithm, the initial control dependency graph is detected, and if a loop path is found in the initial control dependency graph, the loop path is decoupled.
[0010] In some embodiments, validating the populated metadata form includes: Verify the matching degree between the fields of the populated metadata form and the expected values; Validate the formulas in the fields of the populated metadata form; Verify the data integrity and logical consistency of the populated metadata form.
[0011] In some embodiments, the method further comprises: Based on the test results of the metadata form, the problems of the metadata form are located and the problem categories of the metadata form are determined; The metadata form is repaired according to the identified problem category.
[0012] The present invention also provides a testing apparatus for metadata forms, comprising: The retrieval unit is used to retrieve the metadata form to be tested; The first generation unit is used to identify all controls in the metadata form, determine the unique identifier and location information of each control, generate a metadata form control tree, and generate a control dependency graph based on the metadata form control tree; The second generation unit is used to generate a logical verification chain based on the mapping relationship between the metadata form control tree and the database model, as well as the escaping relationship between the metadata form control values and the database stored values. The testing unit is used to generate a test script based on the control dependency graph, populate the metadata form with data based on the test script, and verify the populated metadata form based on the logical verification chain to obtain the test result of the metadata form.
[0013] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a method for testing metadata forms as described above.
[0014] The present invention provides a method, apparatus, and electronic device for testing metadata forms. The method involves: acquiring the metadata form to be tested; identifying all controls in the metadata form, determining the unique identifier and location information of each control, generating a metadata form control tree, generating a control dependency graph based on the metadata form control tree; generating a logical verification chain based on the mapping relationship between the metadata form control tree and the database model, as well as the escaping relationship between metadata form control values and database stored values; generating a test script based on the control dependency graph; populating the metadata form with data based on the test script; and verifying the populated metadata form based on the logical verification chain to obtain the test result of the metadata form. This invention can automatically generate test scripts and logical verification chains, achieving automated testing of metadata forms, improving testing efficiency, quality, and coverage, and is suitable for complex application scenarios. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0016] Figure 1 This is one of the flowcharts illustrating the testing method for metadata forms provided in this embodiment of the invention.
[0017] Figure 2 This is the second flowchart illustrating the testing method for metadata forms provided in this embodiment of the invention.
[0018] Figure 3 This is a schematic diagram of the structure of the testing device for metadata forms provided in an embodiment of the present invention.
[0019] Figure 4 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0021] The terms "first," "second," etc., used in this invention are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same class, without limiting the number of objects; for example, the first object can be one or more.
[0022] In the current field of software testing, automated testing of metadata forms still faces three major technical bottlenecks: 1) Control positioning relies on human experience: Traditional XPath / CSS selectors are easily affected by changes in the front-end structure, resulting in fragile scripts and high maintenance costs.
[0023] 2) Data validation is disconnected from business logic: Existing tools focus more on UI operations and lack the ability to automatically verify the consistency of database stored values and calculated fields.
[0024] 3) Low test coverage for multi-control linkage: The dependencies of complex forms (such as drop-down list cascading, dynamic showing and hiding) require a large number of test cases to be written manually, which is inefficient.
[0025] Existing testing frameworks (such as Selenium and Cypress) only solve single-control operation problems and cannot achieve metadata-driven end-to-end verification, resulting in low test script reusability.
[0026] To address this, embodiments of the present invention provide a method, apparatus, and electronic device for testing metadata forms. By identifying all controls in the metadata form, determining the unique identifier and location information of each control, a metadata form control tree is generated. Based on the metadata form control tree, a control dependency graph is generated. Based on the mapping relationship between the metadata form control tree and the database model, and the escaping relationship between metadata form control values and database stored values, a logical verification chain is generated. Based on the control dependency graph, a test script is generated. Based on the test script, data is populated into the metadata form. Based on the logical verification chain, the populated metadata form is verified to obtain the test results of the metadata form. This achieves automated testing of metadata forms, improving testing efficiency, quality, and coverage, and is suitable for complex application scenarios.
[0027] Figure 1 This is one of the flowcharts illustrating a testing method for a metadata form provided in an embodiment of the present invention. Figure 1 As shown, a testing method for a metadata form is provided, including the following steps: step 110, step 120, step 130, and step 140. This method's steps are merely one possible implementation of the present invention.
[0028] Step 110: Obtain the metadata form to be tested.
[0029] Metadata forms are a structured tool used to define, collect, and manage metadata (i.e., data that describes data). Through standardized fields and rules, metadata forms encapsulate scattered metadata information (such as data meaning, source, format, and relationships), providing fundamental support for the readability, maintainability, and reusability of data assets.
[0030] Optionally, the metadata form may include at least: technical metadata, business metadata, management metadata, and relational metadata; technical metadata is used to describe the physical attributes of the data, such as field names, data types, storage locations, and data formats; business metadata is used to define business meanings, such as data tags, business rules, calculation formulas, responsible persons, and usage scenarios; management metadata is used to record management information, such as creation time, update frequency, access permissions, compliance tags, and data lineage; and relational metadata is used to describe data relationships, such as foreign keys between tables, API dependencies, and interaction relationships between upstream and downstream systems.
[0031] Optionally, the metadata form can be exported from the database, automatically generated using a form generator, or manually constructed.
[0032] It should be noted that obtaining the metadata form to be tested is a key preliminary step in the testing process, and the appropriate acquisition method should be selected based on the data source, business scenario, and testing objectives.
[0033] Step 120: Identify all controls in the metadata form, determine the unique identifier and location information of each control, generate a metadata form control tree, and generate a control dependency graph based on the metadata form control tree.
[0034] Controls refer to independent units that carry out data input, display, or logical processing, such as input boxes (text boxes, number boxes), drop-down lists, check boxes, tables, buttons, etc.
[0035] The attributes of a control must include at least: a unique identifier, location information, data type (such as number, string, date), and business rules (such as required fields, format constraints, and calculation logic).
[0036] The location information of a control refers to its hierarchical path in the metadata form.
[0037] Among them, the control tree is a hierarchical representation of the metadata form, reflecting the parent-child relationship and nesting level of controls.
[0038] Among them, the control dependency graph is a directed graph that describes the logical dependencies between controls and is used to analyze data flow and verification order; the control dependency graph uses controls as nodes and the dependencies between controls as edges.
[0039] Optionally, the metadata form control tree is analyzed to determine the dependencies between controls, and a control dependency graph is constructed based on the dependencies between controls (such as numerical dependencies and state dependencies).
[0040] Optionally, dependencies (such as variable references in formulas) can be extracted from the control's business rules.
[0041] Step 130: Generate a logical verification chain based on the mapping relationship between the metadata form control tree and the database model, as well as the escaping relationship between the metadata form control values and the database stored values.
[0042] The database model is an abstract framework that describes the logical structure and data relationships of a database, defining the data storage method, table structure, field types, primary and foreign key constraints, and association relationships.
[0043] Among them, the metadata form control value is the original data value that the user enters or selects through controls in the metadata form, which is usually in the format displayed on the front end (such as string, JSON object).
[0044] Among them, the database stored value is the value that is actually persisted in the database after format conversion, escaping or encoding, and must strictly conform to the type and constraints of the database model.
[0045] Optionally, based on the metadata form control tree, the metadata form controls and the database model are dynamically mapped, and the mapping relationship between the metadata form control tree and the database model is established in real time, specifically including: Map leaf nodes (such as registration time input boxes) in the metadata form control tree to specific fields in the database table; handle the mapping of complex controls (such as table controls) to multiple tables in the database; identify the differences between the value types of front-end controls and the field types of databases.
[0046] Optionally, escaping rules between metadata form control values and database stored values are predefined to determine the escaping relationship between the two.
[0047] The logic validation chain is used to perform basic validation on forms (such as type checking and constraint checking), cross-field logic validation, and reverse validation (i.e., generating control values from database stored values to verify the accuracy of bidirectional conversion).
[0048] Step 140: Based on the control dependency graph, generate a test script; based on the test script, populate the metadata form with data; based on the logical validation chain, validate the populated metadata form to obtain the test results of the metadata form.
[0049] The test script is a set of instructions used to automate the execution of test cases, and includes at least the following: 1) Data population logic: Generate input data (such as normal values, boundary values, and abnormal values) according to the control dependency order; 2) Operation sequence: Simulate user interaction steps (such as focus switching, table row operations, button clicks); 3) Validation rules: Call the logical validation chain to check data consistency (such as field-level constraints and cross-field logic); 4) Assertion conditions: Define the criteria for the test to pass / fail (e.g., the total price must equal the unit price × quantity).
[0050] The test results are structured reports generated after executing the test scripts. The test results include at least: verification conclusions, error details, data snapshots, performance metrics, and remediation suggestions.
[0051] Optionally, based on the control dependency graph, a test script is generated, including the following steps: The topological sorting algorithm is used to traverse the control dependency graph and generate a list of control validation order to ensure that dependencies are validated first. Generate a test dataset and define operation instructions and assertion rules.
[0052] Optionally, test data can be filled into the corresponding controls of the metadata form according to the operation sequence in the test script to handle dynamic interactions.
[0053] Optionally, the logical validation chain can be invoked to compare the database stored value after form submission with the expected value to ensure that the escaping rules are correct and to verify the data status of the associated table; or the stored value can be read from the database, the control value can be generated in reverse, and the consistency with the original input can be checked.
[0054] In this embodiment of the invention, by acquiring the metadata form to be tested, identifying all controls in the metadata form, determining the unique identifier and location information of each control, generating a metadata form control tree, and generating a control dependency graph based on the metadata form control tree; based on the mapping relationship between the metadata form control tree and the database model, and the escaping relationship between the metadata form control values and the database stored values, generating a logical verification chain; based on the control dependency graph, generating a test script; based on the test script, populating the metadata form with data; and based on the logical verification chain, verifying the populated metadata form to obtain the test results of the metadata form, thus realizing automated testing of the metadata form, improving the efficiency, quality, and coverage of testing, and making it suitable for complex application scenarios.
[0055] Figure 2 This is a second flowchart illustrating the testing method for the metadata form provided in this embodiment of the invention. Figure 2 As shown, a testing method for a metadata form is provided, including the following steps: S201, Begin; S202. Obtain the metadata form, identify the controls, and generate the metadata form control tree; Optionally, obtain the metadata form to be tested and identify all controls in the metadata form.
[0056] S203. Construct the control dependency graph; Optionally, a control dependency graph can be constructed based on the metadata form control tree.
[0057] S204. Generate operation paths based on the control dependency graph; S205. Automatically generate data-driven test scripts; Optionally, the test script and test data for each operation path can be determined.
[0058] S206. Automated data population of the metadata form, and trigger submission after population; Optionally, test data can be automatically populated into a metadata form, and the populated metadata form can be submitted to the database for storage.
[0059] S207, Dynamically Mapping Metadata Form Controls and Database Models; Optionally, based on the metadata form control tree, the metadata form controls and the database model are dynamically mapped to determine the mapping relationship between the metadata form controls and the database model in real time; Optionally, the escaping relationship between metadata form control values and database stored values can be determined.
[0060] S208, Generate a logical verification chain; Optionally, a logical verification chain is generated based on the mapping and escaping relationships obtained above.
[0061] S209. Verify data consistency and output test results; S210, End.
[0062] In some embodiments, a test script is generated based on the control dependency graph, and data is populated into the metadata form based on the test script, including: Based on the control dependency graph, multiple operation paths are determined; Generate a test script for each operation path based on multiple operation paths; Determine the control variables for the metadata form; Based on the control variables of the metadata form, determine the test dataset of the metadata form. The test dataset includes the test data corresponding to each operation path. Based on the test script corresponding to each operation path, the test data corresponding to each operation path is filled into the metadata form to obtain the filled metadata form. Submit the filled-in metadata form to the database.
[0063] Optionally, identify the main flow path, branch path, and exception path in the control dependency graph; use graph traversal algorithms (such as depth-first search, DFS) to explore all possible operation sequences.
[0064] Optionally, control operation steps are defined based on the path order, and test data generation strategies are bound according to the path type.
[0065] Optionally, checkpoints can be inserted into the test script to verify the intermediate state after each step of the operation.
[0066] Optionally, control variables include at least input variables, calculated variables, and state variables.
[0067] Optionally, valid data, boundary values, and invalid data are generated for each control variable, cross-control data is bound according to dependencies, conditional data is generated for branch paths, and a test dataset is obtained.
[0068] Optionally, the form submission interface can be called or the "submit" button can be clicked to trigger data entry into the database.
[0069] In this embodiment of the invention, test scripts and test data for multiple operation paths are automatically generated based on the control dependency graph, comprehensively covering a variety of business scenarios, thereby significantly improving test efficiency and coverage; by automatically generating test scripts and automatically filling data based on the test scripts, manual intervention is reduced, thereby improving test efficiency and quality.
[0070] In some embodiments, the control dependency graph is a directed acyclic graph (DAG). Based on the control dependency graph, multiple operation paths are determined, including: Based on the topological sorting algorithm, all controls in the control dependency graph are traversed and topological sorted to obtain the topological sorting result. Based on the topology sorting results, multiple operation paths are determined.
[0071] Optionally, the topological sorting process includes the following steps: In-degree statistics: Count the in-degree of each node in the dependency graph of the control (i.e., the number of predecessor nodes that depend on this node). Queue initialization: Add all nodes with an in-degree of 0 to the queue (such as the root node with no dependencies). Iterative processing: Take out the nodes in the queue one by one, add them to the sorting result, and reduce the in-degree of their adjacent nodes. If the in-degree of an adjacent node becomes 0, add it to the queue. Output: The final result is one or more topologically ordered sequences that satisfy the dependencies. For example: [A, B, C, D] or [C, A, D, B].
[0072] Optionally, the sorting results of different branches of the control dependency graph can be combined into a complete operation path, covering all possible dependency orders.
[0073] Understandably, transforming the control dependency graph into multiple operation paths through topological sorting can ensure strict execution of dependencies, efficiently cover diverse business scenarios, significantly improve test coverage and system reliability, and is suitable for complex application scenarios.
[0074] In some embodiments, multiple operation paths are determined based on the control dependency graph, including: Based on the preset priority sorting rules and control dependency graph, the priority sorting of multiple controls in the metadata form is performed to obtain the priority sorting results of multiple controls; Based on the priority sorting results of multiple controls, multiple operation paths are determined; The priority sorting rules include: Operations on controls corresponding to required fields will be executed first. Operations on child controls that depend on operations on the parent control are delayed. Control operations whose execution time exceeds a preset time threshold will be delayed.
[0075] Optionally, a preset priority sorting rule can be determined based on user input or empirical data.
[0076] Understandably, prioritizing multiple controls in the metadata form using priority sorting rules and determining multiple operation paths based on the sorting results not only ensures that test scripts prioritize covering critical paths and required data, reducing errors caused by missing or incomplete dependencies, but also optimizes the execution order of operations, improves the efficiency and stability of testing, and enhances the ability to verify core business logic.
[0077] In some embodiments, a control dependency graph is generated based on the metadata form control tree, including: Based on the metadata form control tree, determine the event binding relationships and data linkage relationships between multiple controls in the metadata form; Determine the dependencies between multiple controls based on their event binding and data linkage relationships; Generate an initial control dependency graph using multiple controls as nodes and the dependencies between multiple controls as directed edges; The initial control dependency graph is optimized to obtain the control dependency graph.
[0078] Optionally, the event listener configuration (such as onChange, onClick) can be extracted from the node properties of the control tree to identify the source that triggers changes in the state or data of other controls.
[0079] For example, if the onChange event of dropdown list A is bound to the refresh operation of table B, then there is an event dependency between A and B.
[0080] Optionally, the target control ID in the event handling function can be parsed to establish a binding relationship between the event trigger (event source) and the receiver (event target).
[0081] Optionally, identify the dynamic calculation logic from the control properties and extract the referenced control variables; parse the dependent variables in the control's show / hide logic and determine its dependent parent control.
[0082] Optionally, event binding relationships (operation triggering order) and data linkage relationships (value calculation dependencies) can be merged to form a complete dependency chain. For example: Event binding: Modifying control A triggers an update to control B.
[0083] Data linkage: The value of control B depends on the value of control C.
[0084] Merge dependency chains: A→B→C.
[0085] Understandably, by automatically parsing event bindings and data linkage relationships to generate an initial control dependency graph, the implicit logic links in complex forms can be accurately mapped, avoiding omissions and errors caused by manual sorting. By optimizing the initial control dependency graph, the rationality of the test script generation and verification order can be ensured, significantly improving test coverage and execution efficiency, while reducing the risk of verification failure due to missing dependencies or incorrect order.
[0086] In some embodiments, the initial control dependency graph is optimized, including: Based on the loop detection algorithm, the initial control dependency graph is detected, and if a loop path is found in the initial control dependency graph, the loop path is decoupled.
[0087] Understandably, by identifying and decoupling cyclic paths in the initial control dependency graph through the loop detection algorithm, the risk of deadlock and data logic contradictions caused by cyclic dependencies can be effectively eliminated, ensuring the directed acyclicity of the control dependency graph. This provides a reliable foundation for the subsequent generation of topology sorting results, test scripts, and verification chains, thereby improving the stability and data consistency of the testing process and avoiding infinite loops or verification failures.
[0088] In some embodiments, validating the populated metadata form includes: Verify the match between the fields of the populated metadata form and the expected values; Validate the formulas in the fields of the populated metadata form; Verify the data integrity and logical consistency of the populated metadata form.
[0089] Optionally, check the logical order of time-related fields (e.g., start date ≤ end date, order creation time ≤ payment time).
[0090] Optionally, verify the compliance of the business state machine and check the combined condition rules.
[0091] Optionally, if the form submission involves writing to multiple tables, verify the integrity of the transaction (e.g., the order table and the inventory table are updated successfully at the same time or rolled back at the same time).
[0092] Understandably, by automating the verification of field value matching, formula calculation accuracy, and data logic consistency, it is possible to ensure that the metadata form data strictly conforms to business rules and expected design after being filled in, avoiding process interruptions or decision deviations caused by data errors, while significantly reducing the cost of manual verification and improving data credibility and system reliability.
[0093] In some embodiments, the above method further includes: Based on the test results of the metadata forms, the problems in the metadata forms are located and the problem categories are determined. Repair the metadata form according to the issue category.
[0094] Optionally, problem localization methods include: Field-level tracing of discrepancies, marking fields that were not transformed through mapping; Comparison of operation path replay and intermediate state data snapshot; Correlation analysis between database transaction logs and test timestamps.
[0095] Understandably, accurately identifying problem categories through test results and making targeted repairs to metadata forms can quickly eliminate underlying defects in metadata forms and avoid secondary errors caused by blind adjustments. Combined with automated repair suggestions, this can significantly shorten the problem-solving cycle, improve system stability and data consistency, and reduce maintenance costs.
[0096] The following describes the testing apparatus for metadata forms provided in the embodiments of the present invention. The testing apparatus for metadata forms described below can be referred to in correspondence with the testing method for metadata forms described above.
[0097] Figure 3 This is a schematic diagram of the structure of the testing device for the metadata form provided in an embodiment of the present invention, as shown below. Figure 3 As shown, the testing apparatus 300 for the metadata form includes: Unit 310 is used to obtain the metadata form to be tested; The first generation unit 320 is used to identify all controls in the metadata form, determine the unique identifier and location information of each control, generate a metadata form control tree, and generate a control dependency graph based on the metadata form control tree. The second generation unit 330 is used to generate a logical verification chain based on the mapping relationship between the metadata form control tree and the database model, as well as the escaping relationship between the metadata form control values and the database stored values. Test unit 340 is used to generate test scripts based on the control dependency graph, populate the metadata form with data based on the test scripts, and validate the populated metadata form based on the logical validation chain to obtain the test results of the metadata form.
[0098] Optionally, based on the control dependency graph, a test script is generated, and based on the test script, data is populated into the metadata form, including: Based on the control dependency graph, multiple operation paths are determined; Generate a test script for each operation path based on multiple operation paths; Determine the control variables for the metadata form; Based on the control variables of the metadata form, determine the test dataset of the metadata form. The test dataset includes the test data corresponding to each operation path. Based on the test script corresponding to each operation path, the test data corresponding to each operation path is filled into the metadata form to obtain the filled metadata form. Submit the filled-in metadata form to the database.
[0099] Optionally, the control dependency graph is a directed acyclic graph. Based on the control dependency graph, multiple operation paths are determined, including: Based on the topological sorting algorithm, all controls in the control dependency graph are traversed and topological sorted to obtain the topological sorting result. Based on the topology sorting results, multiple operation paths are determined.
[0100] Optionally, based on the control dependency graph, multiple operation paths are determined, including: Based on the preset priority sorting rules and control dependency graph, the priority sorting of multiple controls in the metadata form is performed to obtain the priority sorting results of multiple controls; Based on the priority sorting results of multiple controls, multiple operation paths are determined; The priority sorting rules include: Operations on controls corresponding to required fields will be executed first. Operations on child controls that depend on operations on the parent control are delayed. Control operations whose execution time exceeds a preset time threshold will be delayed.
[0101] Optionally, based on the metadata form control tree, a control dependency graph is generated, including: Based on the metadata form control tree, determine the event binding relationships and data linkage relationships between multiple controls in the metadata form; Determine the dependencies between multiple controls based on their event binding and data linkage relationships; Generate an initial control dependency graph using multiple controls as nodes and the dependencies between multiple controls as directed edges; The initial control dependency graph is optimized to obtain the control dependency graph.
[0102] Optionally, the initial control dependency graph can be optimized, including: Based on the loop detection algorithm, the initial control dependency graph is detected, and if a loop path is found in the initial control dependency graph, the loop path is decoupled.
[0103] Optionally, the populated metadata form is validated, including: Verify the match between the fields of the populated metadata form and the expected values; Validate the formulas in the fields of the populated metadata form; Verify the data integrity and logical consistency of the populated metadata form.
[0104] Optionally, the testing apparatus for the metadata form also includes: The issue localization unit is used to locate issues in the metadata form based on the test results of the metadata form and determine the issue category of the metadata form; The repair unit is used to repair metadata forms based on the issue category.
[0105] It should be noted that the metadata form testing device provided in this embodiment of the invention can implement all the method steps implemented in the above-mentioned metadata form testing method embodiment, and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.
[0106] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention, such as... Figure 4 As shown, the electronic device may include a processor 410, a communications interface 420, a memory 430, and a communication bus 440. The processor 410, communications interface 420, and memory 430 communicate with each other via the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute a testing method for the metadata form. This method includes: identifying all controls in the metadata form, determining the unique identifier and location information of each control, generating a metadata form control tree, generating a control dependency graph based on the metadata form control tree, generating a logical verification chain based on the mapping relationship between the metadata form control tree and the database model, and the escaping relationship between the metadata form control values and the database stored values; generating a test script based on the control dependency graph, filling the metadata form with data based on the test script, and verifying the filled metadata form based on the logical verification chain to obtain the test result of the metadata form.
[0107] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0108] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0109] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence 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 ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for testing metadata forms, characterized in that, include: Retrieve the metadata form to be tested; Identify all controls in the metadata form, determine the unique identifier and location information of each control, generate a metadata form control tree, and generate a control dependency graph based on the metadata form control tree; Based on the mapping relationship between the metadata form control tree and the database model, and the escaping relationship between the metadata form control values and the database stored values, a logical verification chain is generated; Based on the control dependency graph, a test script is generated. Based on the test script, data is populated into the metadata form. Based on the logical verification chain, the populated metadata form is verified to obtain the test result of the metadata form.
2. The testing method for the metadata form according to claim 1, characterized in that, The process of generating a test script based on the control dependency graph, and then populating the metadata form with data based on the test script, includes: Based on the control dependency graph, multiple operation paths are determined; Based on the multiple operation paths, generate a test script corresponding to each operation path; Determine the control variables of the metadata form; Based on the control variables of the metadata form, the test dataset of the metadata form is determined, and the test dataset includes test data corresponding to each operation path; Based on the test script corresponding to each operation path, the test data corresponding to each operation path is filled into the metadata form to obtain the filled metadata form. Submit the filled-in metadata form to the database.
3. The testing method for the metadata form according to claim 2, characterized in that, The control dependency graph is a directed acyclic graph, and the determination of multiple operation paths based on the control dependency graph includes: Based on the topological sorting algorithm, all controls in the control dependency graph are traversed and topological sorted to obtain the topological sorting result. Based on the topology sorting results, multiple operation paths are determined.
4. The testing method for the metadata form according to claim 2, characterized in that, The determination of multiple operation paths based on the control dependency graph includes: Based on the preset priority sorting rules and the control dependency graph, the priority sorting of multiple controls in the metadata form is performed to obtain the priority sorting result of the multiple controls; Based on the priority sorting results of the multiple controls, multiple operation paths are determined; The priority sorting rules include: Operations on controls corresponding to required fields will be executed first. Operations on child controls that depend on operations on the parent control are delayed. Control operations whose execution time exceeds a preset time threshold will be delayed.
5. The testing method for the metadata form according to claim 1, characterized in that, The step of generating a control dependency graph based on the metadata form control tree includes: Based on the metadata form control tree, determine the event binding relationship and data linkage relationship between multiple controls of the metadata form; The dependencies between the multiple controls are determined based on the event binding relationships and data linkage relationships between them; An initial control dependency graph is generated using the multiple controls as nodes and the dependencies between the multiple controls as directed edges. The initial control dependency graph is optimized to obtain the control dependency graph.
6. The testing method for the metadata form according to claim 5, characterized in that, The optimization of the initial control dependency graph includes: Based on the loop detection algorithm, the initial control dependency graph is detected, and if a loop path is found in the initial control dependency graph, the loop path is decoupled.
7. The testing method for the metadata form according to claim 1, characterized in that, The validation of the populated metadata form includes: Verify the matching degree between the fields of the populated metadata form and the expected values; Validate the formulas in the fields of the populated metadata form; Verify the data integrity and logical consistency of the populated metadata form.
8. The method for testing metadata forms according to any one of claims 2-7, characterized in that, The method further includes: Based on the test results of the metadata form, the problems of the metadata form are located and the problem categories of the metadata form are determined; The metadata form is repaired according to the identified problem category.
9. A testing apparatus for metadata forms, characterized in that, include: The retrieval unit is used to retrieve the metadata form to be tested; The first generation unit is used to identify all controls in the metadata form, determine the unique identifier and location information of each control, generate a metadata form control tree, and generate a control dependency graph based on the metadata form control tree; The second generation unit is used to generate a logical verification chain based on the mapping relationship between the metadata form control tree and the database model, as well as the escaping relationship between the metadata form control values and the database stored values. The testing unit is used to generate a test script based on the control dependency graph, populate the metadata form with data based on the test script, and verify the populated metadata form based on the logical verification chain to obtain the test result of the metadata form.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the test method for the metadata form as described in any one of claims 1 to 8.