An interface automatic testing method and device, electronic equipment and storage medium

By acquiring tenant interface features and risk profiles, constructing structured test scenario prompt templates, and using a large language model to generate adaptive positioning strategies, the adaptability and efficiency issues of interface automation testing in multi-tenant SaaS systems are solved, achieving efficient test case generation and resource optimization.

CN123138102APending Publication Date: 2026-11-20BEIJING BAIJU YIXING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611105483.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-23
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

In multi-tenant SaaS systems, existing automated interface testing solutions are difficult to adapt to tenant-specific interface features. The generated test scenarios are prone to deviating from actual business logic, element location has a high failure rate, and test resources are not allocated reasonably, resulting in low generation efficiency and limited coverage.

Method used

By obtaining the target tenant's interface feature vector and business risk configuration file, the risk priority of the business module is calculated, a structured test scenario prompt template is constructed, a set of test scenarios is generated using a large language model, and semantic parsing and step decomposition are performed to generate an adaptive positioning strategy and execute test cases according to risk priority.

Benefits of technology

It improves the adaptability and efficiency of interface test case generation, reduces the probability of element location failure, optimizes the input-output value of test resources, and ensures that high-risk modules are verified first.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123138102A_ABST
    Figure CN123138102A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of user interface testing, and discloses an interface automation testing method and device, electronic equipment and a storage medium. The method comprises the following steps: acquiring an interface feature vector of a target tenant, a business risk configuration file and historical defect data of each module; calculating the risk priority score of each business module based on the above data; combining the business rules and the tenant interface feature vector to construct a structured test scene prompt template; inputting the template into a pre-trained large model to generate a test scene set; performing semantic analysis and step decomposition on each test scene to obtain an operation step sequence; generating an adaptive positioning strategy for the interface elements of each step based on the tenant interface feature vector; combining the corresponding positioning strategies according to the step sequence to generate interface test cases for each scene; executing the test cases of the corresponding modules in turn from high to low according to the risk priority to obtain an execution result. The application realizes interface test case automation generation and testing in a multi-tenant scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of user interface testing technology, and more specifically to an automated interface testing method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the widespread adoption of multi-tenant SaaS systems, significant differences exist in the business configurations and interface customization levels among different tenants, placing higher demands on the adaptability and efficiency of automated interface testing. Traditional interface test cases primarily rely on manual analysis of business processes, design of test scenarios, and writing of automated execution scripts. This not only results in low generation efficiency but also limits scenario coverage to the experience of testers, making it difficult to fully cover boundary conditions and abnormal branches. Existing test generation solutions based on large language models often employ generic prompt logic and fixed element location strategies, failing to adapt to tenant-specific interface features and business attributes. The generated test scenarios are prone to deviating from actual business logic and interface form, leading to a high probability of element location failure. Furthermore, test execution often proceeds in a fixed sequence, without allocating test resources based on the degree of business risk, thus failing to fully meet the differentiated testing needs in multi-tenant scenarios.

[0003] Therefore, there is a need for an automated interface testing method that can improve the adaptability and efficiency of interface test case generation in multi-tenant differentiated scenarios, while ensuring the resource value of test execution and reducing the output of invalid scenarios. Summary of the Invention

[0004] This invention provides an automated interface testing method, apparatus, electronic device, and storage medium to solve the technical problems of insufficient adaptability of automated interface testing in existing multi-tenant scenarios, low scene generation efficiency, poor element positioning stability, and unreasonable allocation of test resources.

[0005] In a first aspect, the present invention provides an automated interface testing method, the method comprising: The process involves: acquiring the target tenant's interface feature vector, business risk configuration file, and historical defect data for each business module; calculating the risk priority score for each business module based on the business risk configuration file and historical defect data; constructing a structured test scenario prompt template by combining the business rules of the business modules and the target tenant's interface feature vector; inputting the structured test scenario prompt template into a pre-trained large language model to generate a test scenario set, which includes multiple test scenarios; performing semantic parsing and step decomposition on each test scenario to obtain the operation step sequence for each test scenario; generating corresponding adaptive positioning strategies for each interface element in each operation step based on the target tenant's interface feature vector; combining the adaptive positioning strategies corresponding to each interface element according to the test step sequence of each test scenario to generate interface test cases for each test scenario; and testing the interface test cases of the corresponding business modules in descending order of risk priority score to obtain the execution results.

[0006] The interface automation testing method provided by this invention first acquires the target tenant's interface feature vector, business risk configuration file, and historical defect data, providing tenant-specific basic data support for the entire testing process and preventing general testing schemes from deviating from the tenant's actual business and interface attributes. Based on this, the risk priority score of each business module is calculated, transforming abstract business risks into quantifiable and ranking criteria. Furthermore, a structured test scenario prompt template is constructed by combining business rules and tenant interface features, constraining the generation direction from both business compliance and interface adaptation dimensions, thus preventing the large language model from producing ineffective test scenarios that are detached from reality. The prompt template is input into a pre-trained large language model to generate a set of test scenarios. Leveraging the model's logical reasoning and scenario expansion capabilities, multi-dimensional test scenarios are generated in batches, replacing the traditional method of manually designing scenarios and significantly improving scenario generation efficiency and coverage. Then, semantic parsing and step decomposition are performed on each test scenario to obtain a sequence of operation steps, transforming unstructured natural language scenarios into structured atomic operation processes. Based on the tenant's interface feature vector, an adaptive positioning strategy for each interface element is further generated, allowing the positioning capability to adapt to the differences in interface structure among different tenants, reducing the probability of element positioning failure under customized interfaces, and improving the running stability of test scripts. By combining the sequence of operation steps with the corresponding positioning strategy, complete interface test cases can be generated, achieving a fully automated conversion from natural language scenarios to executable automated test cases. Finally, tests are executed sequentially from high to low risk priority scores, ensuring that high-risk business modules are verified first, thereby improving the return on investment of testing resources.

[0007] In one optional implementation, based on the business risk profile and historical defect data, a risk priority score for each business module is calculated, including: Based on historical defect data, calculate the defect frequency coefficient and average severity coefficient for each business module; multiply the defect frequency coefficient and average severity coefficient to obtain the historical defect risk coefficient for the corresponding business module; extract the business importance score, code change information, and target tenant risk parameters for each business module from the business risk configuration file, including tenant compliance level and business activity; calculate the code change risk coefficient based on the code change information of each business module, and calculate the tenant-specific risk coefficient based on the target tenant's risk parameters; and perform a weighted sum of the historical defect risk coefficient, business importance score, code change risk coefficient, and tenant-specific risk coefficient to obtain the risk priority score for each business module.

[0008] The interface automation testing method provided by this invention calculates the defect frequency coefficient and average severity coefficient of each business module from historical defect data, which can accurately distinguish business modules with different defect characteristics and avoid judgment bias caused by single-dimensional assessment. Multiplying the two types of coefficients yields the historical defect risk coefficient of the corresponding business module, which can comprehensively reflect the probability of occurrence and overall impact of historical defects. Furthermore, the business importance score, code change information, and risk parameters of the target tenant are extracted from the business risk configuration file for each business module, simultaneously covering three different dimensions of assessment factors: module business value, code change status, and tenant global risk attributes, achieving comprehensive coverage of risk assessment dimensions and avoiding one-sided assessment results. Based on the extracted information, the code change risk coefficient and tenant-specific risk coefficient are calculated respectively, transforming non-numerical configuration information into quantitative indicators with the same dimensions as the historical risk coefficient. Finally, the four types of risk factors are weighted and summed to obtain the risk priority score of each business module. The integrated multi-dimensional risk information outputs a comprehensive result that can be directly compared and ranked horizontally, providing a clear and implementable quantitative decision-making standard for subsequent test resource allocation and execution order scheduling.

[0009] In one optional implementation, a structured test scenario prompt template is constructed by combining the business rules of the current business module and the interface feature vector of the target tenant, including: Obtain the business rules corresponding to the current business module, and the interface constraints corresponding to the interface feature vector of the target tenant; based on the business rules and interface constraints, configure the system role definition, business test context, interface constraints and output format specifications in sequence according to the preset structured prompt framework, and generate a structured test scenario prompt template adapted to the current business module.

[0010] The interface automation testing method provided by this invention first extracts business rules and interface constraints, clarifies the business boundaries and interface adaptation requirements of scenario generation, and avoids generating invalid scenarios that are out of touch with reality from the source; then, it configures role definitions, business contexts, interface constraints and output specifications in sequence according to a preset structured framework, and generates prompt templates that are adapted to the current business module. This standardizes the input format of the large language model and ensures the business compliance, interface adaptability and structural uniformity of the output scenario, which facilitates automatic parsing and processing in subsequent processes.

[0011] In one optional implementation, semantic parsing and step decomposition are performed on each test scenario in the test scenario set to obtain a sequence of operation steps, including: Semantic parsing is performed on each test scenario to obtain the corresponding business action nodes, status verification nodes, and business flow logic; the business action nodes are broken down into several sub-operation items; all sub-operation items are verified, and the verified sub-operation items are concatenated according to the business execution sequence to obtain the operation step sequence.

[0012] The interface automation testing method provided by this invention first performs semantic parsing on each test scenario, extracting business action nodes, state verification nodes, and business flow logic. This transforms the unstructured natural language scenarios output by the large model into a structured set of logical nodes, clearly distinguishing between operational behaviors and result verification stages, while also clarifying the execution dependencies between nodes. Next, coarse-grained business action nodes are broken down into independent sub-operation items, refining complex semantic business actions into atomic operation units of single, single interaction, avoiding the problem of complex actions not being able to directly match element location. Finally, the validity of all sub-operation items is verified, eliminating logical contradictions and invalid content without operational objects. Then, the sub-operation items are sorted and assembled according to the actual business execution sequence, ultimately obtaining a logically coherent and rigorously ordered sequence of operation steps. This ensures the compliance and executability of the operation process and provides a standardized process foundation for assembling complete automated test cases.

[0013] In one optional implementation, based on the target tenant's interface feature vector, an adaptive positioning strategy is generated for each interface element in each operation step, including: From the interface feature vector of the target tenant, extract the interface structure feature parameters of each interface element. The interface structure feature parameters include identifier integrity parameters, structural stability parameters, attribute richness parameters, and dynamic characteristic parameters. Based on the interface structure feature parameters, generate multiple candidate positioning strategies for the interface elements. The candidate positioning strategies include ID positioning, CSS selector positioning, visual positioning, and semantic positioning. Calculate the fit score of each candidate positioning strategy and sort the candidate positioning strategies in descending order of fit score to obtain a positioning strategy sequence. Select a preset number of positioning strategies from the positioning strategy sequence to generate an adaptive positioning strategy for the interface elements.

[0014] The automated interface testing method provided by this invention first extracts four types of interface structural feature parameters from the tenant interface feature vector, transforming the element's identification characteristics, structural stability, attribute richness, and dynamic characteristics into quantifiable positioning evaluation criteria, thus avoiding the problem of insufficient adaptability of general positioning methods. Based on this, candidate positioning strategies covering multiple technical routes including DOM attributes, visual, and semantics are generated, covering various scenarios from conventional stable interfaces to highly customized interfaces, avoiding the scenario limitations of a single positioning method. Furthermore, the adaptability scores of each candidate strategy are calculated and ranked, and the optimal positioning priority is matched to each element based on interface features, prioritizing the strategy with the strongest stability and highest execution efficiency, balancing positioning accuracy and test execution efficiency. Finally, a preset number of strategies are selected sequentially to form an adaptive positioning strategy, creating a fault-tolerant positioning mechanism that combines a primary strategy with multiple backups. When the interface undergoes minor changes, the backup strategy can be automatically switched without manual modification of the test script, effectively improving the robustness of the positioning scheme in multi-tenant scenarios and reducing the maintenance cost of the test script.

[0015] In one optional implementation, the execution result includes the distribution of failure scenarios and uncovered business branches. After obtaining the execution structure, the method further includes: Based on the execution results, adjust the test scenario prompt template and the sampling strategy of the large language model; input the adjusted structured test scenario prompt template into the large language model, and regenerate the optimized interface test cases.

[0016] The automated interface testing method provided by this invention, based on the distribution of failure scenarios and uncovered business branches in the test execution results, can reversely locate the coverage gaps and adaptation defects generated in the current test scenario. It can then specifically adjust the constraint rules of the test scenario prompt template and the sampling strategy of the large language model. This not only fills in missing business processes and boundary scenarios and fills the coverage gaps of the original tests, but also corrects the deviation direction of scenario generation and reduces the probability of generating subsequent failure scenarios. The adjusted prompt template is then input into the large language model to regenerate optimized interface test cases, achieving a complete self-optimization closed loop. This allows the coverage and execution stability of test cases to continuously improve iteratively with operation.

[0017] Secondly, the present invention provides an automated interface testing device, the device comprising: The data acquisition module is used to acquire the target tenant's interface feature vector, business risk configuration file, and historical defect data corresponding to each business module. The risk priority scoring calculation module is used to calculate the risk priority score of each business module based on the business risk configuration file and historical defect data. The prompt word template building module is used to combine the business rules of the business module and the interface feature vector of the target tenant to build a structured test scenario prompt template; The test scenario generation module is used to input the structured test scenario prompt template into the pre-trained large language model to generate a set of test scenarios, which includes multiple test scenarios. The test scenario decomposition module is used to perform semantic parsing and step decomposition on each test scenario to obtain the operation step sequence of each test scenario. The positioning strategy generation module is used to generate corresponding adaptive positioning strategies for each interface element in each operation step based on the interface feature vector of the target tenant. The test case generation module is used to combine the adaptive positioning strategies corresponding to each interface element according to the test step sequence of each test scenario, and generate interface test cases corresponding to each test scenario. The UI testing module is used to test the UI test cases of the corresponding business modules in descending order of risk priority scores, and obtain the execution results.

[0018] Thirdly, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the interface automation testing method of the first aspect or any corresponding embodiment described above.

[0019] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the interface automation testing method described in the first aspect or any corresponding embodiment thereof.

[0020] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the interface automation testing method described in the first aspect or any corresponding embodiment thereof. Attached Figure Description

[0021] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0022] Figure 1 This is a schematic diagram of an application scenario according to an embodiment of the present invention; Figure 2 This is a flowchart illustrating an automated interface testing method according to an embodiment of the present invention; Figure 3 This is a schematic diagram of a prompt word template according to an embodiment of the present invention; Figure 4 This is a structural block diagram of an automated interface testing device according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0024] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.

[0025] As an optional application scenario of this invention, considering the specific application environment architecture or specific hardware architecture upon which the execution of the interface automation testing method depends, the specific application environment architecture or specific hardware architecture is described here. For example... Figure 1 As shown, the architecture system may include at least one terminal device and at least one server. Figure 1 The system is illustrated in the example, which includes a computer 101, a mobile terminal 102, and a server 103, and terminal devices such as the computer 101 and the mobile terminal 102 are connected to the server 103 through a network 110.

[0026] Specifically, the terminal device can be a smartphone, tablet, laptop, PDA, desktop computer, game console, smart TV, smart wearable device, in-vehicle terminal, VR (Virtual Reality) device, AR (Augmented Reality) device, etc. Server 103 can be a standalone physical server, a server cluster, a distributed system, or a cloud server providing cloud services. Network 110 can be a wired or wireless network, examples of which include, but are not limited to, the Internet, corporate intranet, local area network, wide area network, mobile communication network, and combinations thereof.

[0027] According to an embodiment of the present invention, an embodiment of an automated interface testing method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0028] This embodiment provides an automated interface testing method, which can be used on the aforementioned mobile terminals, such as mobile phones and tablets. Figure 2 This is a flowchart of an automated interface testing method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps: Step S201: Obtain the target tenant's interface feature vector, business risk configuration file, and historical defect data corresponding to each business module.

[0029] In one optional embodiment, the interface feature vector is structured quantitative data obtained by extracting features from the target tenant's software interface, used to characterize the unique attributes and structural features of the tenant's interface. The business risk configuration file is configuration data that records the tenant's business attributes, the location and changes of each business module, used to reflect the differences in business risks among different tenants. Historical defect data is defect data recorded by each business module during past testing and deployment, used to reflect the historical quality level of the module.

[0030] Specifically, a dual-channel parallel acquisition strategy is adopted. The first channel is the visual channel, which uses an automated screenshot tool to capture full-screen screenshots of key pages of the target tenant, and inputs them into a computer vision model to extract visual features such as color distribution, component outlines, and layout grids. The second channel is the structural channel, which uses an automated browser driver to obtain the complete HTML source code of the page and uses a DOM parser to traverse and generate a structured DOM tree. The two channels run independently, and finally the visual feature vector and the structural feature vector are concatenated into a unified interface feature vector for the target tenant.

[0031] Step S202: Calculate the risk priority score for each business module based on the business risk configuration file and historical defect data.

[0032] In one optional embodiment, the test risk of each business module is quantified and transformed based on the tenant's business risk configuration and historical defect data, and the abstract business importance and historical quality performance are transformed into risk priority scores for each business module.

[0033] Step S203: Combine the business rules of the business module with the interface feature vector of the target tenant to construct a structured test scenario prompt template.

[0034] In one optional embodiment, business rules are the definition of rules such as the operation process, verification logic, and business boundaries corresponding to the business module, which are business constraints that the test scenario must follow. The structured test scenario prompt template is a standardized prompt text organized according to a fixed framework, used to clarify the requirements, constraints, and output format of test generation to the large language model.

[0035] Specifically, the rule constraints of business modules are structurally integrated with the interface characteristics of tenants and encapsulated into a standardized prompt framework that conforms to the input specifications of large language models. This framework constrains the generation direction of large models from two dimensions: business compliance and interface adaptability, avoiding invalid test scenarios where the generation of large models deviates from actual business logic or does not conform to the form of tenant interfaces.

[0036] Step S204: Input the structured test scenario prompt template into the pre-trained large language model to generate a test scenario set, which includes multiple test scenarios.

[0037] In one optional embodiment, the pre-trained large language model is an AI model that has been pre-trained on a large-scale corpus and has the ability to understand natural language, make logical reasoning and generate content, and can output text content that meets the requirements based on instructions.

[0038] Specifically, leveraging the business logic understanding and scenario expansion capabilities of the large language model, and using structured prompt templates as input constraints, multiple sets of test scenarios are automatically generated in batches.

[0039] Step S205: Semantic parsing and step decomposition are performed on each test scenario to obtain the operation step sequence of each test scenario.

[0040] In one optional embodiment, the unstructured natural language test scenario output by the large model is decomposed into ordered, executable atomic operation steps through semantic understanding, transforming the descriptive scenario text into a structured operation process.

[0041] Step S206: Based on the interface feature vector of the target tenant, generate corresponding adaptive positioning strategies for each interface element in each operation step.

[0042] In one optional embodiment, interface elements are interactive or verifiable interface components on the software interface, such as buttons, input boxes, and prompt text, and are the specific objects of the test operation. The adaptive positioning strategy is an element positioning scheme that automatically adapts to interface characteristics and has fault tolerance capabilities, used to accurately locate target interface elements during test execution.

[0043] Specifically, based on the target tenant's interface feature data, a suitable positioning method is matched for each interface element to be operated, so that the element positioning capability is adapted to the tenant's exclusive interface structure characteristics.

[0044] Step S207: According to the test step sequence of each test scenario, combine the adaptive positioning strategies corresponding to each interface element to generate interface test cases corresponding to each test scenario.

[0045] In one optional embodiment, the operation process corresponding to each test scenario is integrated with the element location strategy of each step in the process, and the process logic and location capability are assembled into a complete executable test case.

[0046] Step S208: Test the interface test cases of the corresponding business modules in order of risk priority scores from high to low, and obtain the execution results.

[0047] In one optional embodiment, test cases for each business module are scheduled and executed in descending order of risk priority, allowing high-risk business modules to complete testing and verification first, ensuring that defects in core business can be discovered and fixed as early as possible.

[0048] The automated interface testing method provided in this embodiment first acquires the target tenant's interface feature vector, business risk configuration file, and historical defect data, providing tenant-specific basic data support for the entire testing process and preventing general testing schemes from deviating from the tenant's actual business and interface attributes. Based on this, the risk priority score of each business module is calculated, transforming abstract business risks into quantifiable ranking criteria. Furthermore, a structured test scenario prompt template is constructed by combining business rules and tenant interface features, constraining the generation direction from both business compliance and interface adaptation dimensions, thus preventing the large language model from producing ineffective test scenarios that are detached from reality. The prompt template is input into a pre-trained large language model to generate a set of test scenarios. Leveraging the model's logical reasoning and scenario expansion capabilities, multi-dimensional test scenarios are generated in batches, replacing the traditional method of manually designing scenarios and significantly improving scenario generation efficiency and coverage. Then, semantic parsing and step decomposition are performed on each test scenario to obtain a sequence of operation steps, transforming unstructured natural language scenarios into structured atomic operation processes. Based on the tenant's interface feature vector, an adaptive positioning strategy for each interface element is further generated, allowing the positioning capability to adapt to the differences in interface structure among different tenants, reducing the probability of element positioning failure under customized interfaces, and improving the running stability of test scripts. By combining the sequence of operation steps with the corresponding positioning strategy, complete interface test cases can be generated, achieving a fully automated conversion from natural language scenarios to executable automated test cases. Finally, tests are executed sequentially from high to low risk priority scores, ensuring that high-risk business modules are verified first, thereby improving the return on investment of testing resources.

[0049] In some optional implementations, step S202 specifically includes: Step a1: Calculate the defect frequency coefficient and average severity coefficient for each business module based on historical defect data.

[0050] In one optional embodiment, the defect frequency coefficient refers to the ratio of the number of defects found in the past N tests of the business module to the total number of tests; the average severity coefficient is a standardized value used to quantify the average impact of historical defects of the business module. The more severe the business and compliance impact caused by the defect, the higher the coefficient. For example, urgent = 1.0, severe = 0.8, moderate = 0.5, and minor = 0.2. Step a2: Multiply the defect frequency coefficient by the average severity coefficient to obtain the historical defect risk coefficient of the corresponding business module.

[0051] In one optional embodiment, the historical defect risk coefficient is used as a comprehensive quantitative value that reflects the probability and impact of historical defects in a business module. The higher the value, the greater the test risk at the historical level of the module.

[0052] Step a3: Extract the business importance score, code change information, and risk parameters of the target tenant for each business module from the business risk configuration file. The risk parameters include the tenant compliance level and business activity level.

[0053] In one optional embodiment, the business importance score is used to quantify the core importance of a business module within the tenant's business system; a higher score indicates greater business losses due to module failure. Code change information records data on the scope and frequency of code modifications to the corresponding business modules, used to assess the probability of code changes introducing new defects. Tenant risk parameters are fundamental indicators characterizing the overall business risk attributes of the target tenant, including two core dimensions: the stringency of compliance requirements and the scale of business operations.

[0054] Step a4: Calculate the code change risk coefficient based on the code change information of each business module, and calculate the tenant-specific risk coefficient based on the risk parameters of the target tenant.

[0055] In one optional embodiment, a code change risk coefficient is calculated based on the code change information of each business module, such as the ratio of the number of modified files to the total number of files, or the ratio of the number of changed lines of code to the total number of lines of code. Tenant-specific risk coefficient = 0.4 Compliance level +0.3 Tenant activity +0.3 Customization complexity. The compliance level can be set to strict regulation = 1.0, normal = 0.5, and tenant activity = min(daily average order volume / 10000, 1.0). Customization complexity can be obtained by calculating and normalizing the ratio of the number of differentiated business processes to the number of rules for the tenant.

[0056] Step a5 involves weighting and summing the historical defect risk coefficient, business importance score, code change risk coefficient, and tenant-specific risk coefficient to obtain the risk priority score for each business module.

[0057] In one optional embodiment, the influence weight of the four risk dimensions is allocated by preset weights, and the risk factors of four different dimensions, namely historical quality, business value, code changes and tenant attributes, are integrated to output a risk priority score that can be directly sorted and compared for each business module.

[0058] The interface automation testing method provided in this embodiment calculates the defect frequency coefficient and average severity coefficient of each business module from historical defect data. This accurately distinguishes business modules with different defect characteristics, avoiding judgment bias caused by single-dimensional assessment. Multiplying the two types of coefficients yields the historical defect risk coefficient of the corresponding business module, which comprehensively reflects the probability of occurrence and overall impact of historical defects. Furthermore, it extracts the business importance score, code change information, and target tenant risk parameters of each business module from the business risk configuration file, simultaneously covering three different dimensions of assessment factors: module business value, code change status, and tenant global risk attributes. This achieves comprehensive coverage of risk assessment dimensions and avoids one-sided assessment results. Based on the extracted information, it calculates the code change risk coefficient and tenant-specific risk coefficient, transforming non-numerical configuration information into quantitative indicators with the same dimensions as the historical risk coefficient. Finally, it performs a weighted summation of the four types of risk factors to obtain the risk priority score of each business module. By integrating multi-dimensional risk information, it outputs a comprehensive result that can be directly compared and ranked horizontally, providing a clear and implementable quantitative decision-making standard for subsequent test resource allocation and execution order scheduling.

[0059] In some optional implementations, step S203 specifically includes: Step b1: Obtain the business rules corresponding to the current business module and the interface constraints corresponding to the interface feature vector of the target tenant.

[0060] In one optional embodiment, business rules are normative contents such as business process logic, operation verification rules, and business boundary conditions corresponding to the current business module, and are business guidelines that must be followed in the test scenario.

[0061] Interface constraints are conditions extracted from the interface feature vector of the target tenant that limit the interaction form of the test scenario. They are used to constrain the operation methods and element forms in the scenario to match the interface characteristics of the tenant.

[0062] Step b2: Based on business rules and interface constraints, and following the preset structured prompt framework, configure system role definitions, business test contexts, interface constraints, and output format specifications in sequence to generate a structured test scenario prompt template adapted to the current business module.

[0063] In one optional embodiment, business rules, interface constraints, and other materials are systematically populated into the corresponding functional modules. By defining roles to unify the model's output perspective, conveying the test background and objectives through business context, limiting the interactive adaptability of the scenario through interface constraints, and standardizing the output structure through output format specifications, a clearly defined and structurally standardized prompt template is ultimately generated. See the appendix for a schematic diagram of the prompt template. Figure 3 .

[0064] The interface automation testing method provided in this embodiment first extracts business rules and interface constraints, clarifies the business boundaries and interface adaptation requirements of scenario generation, and avoids generating invalid scenarios that are out of touch with reality from the source; then, it configures role definitions, business contexts, interface constraints and output specifications in sequence according to a preset structured framework, and generates prompt templates that are adapted to the current business module. This standardizes the input format of the large language model and ensures the business compliance, interface adaptability and structural uniformity of the output scenario, which facilitates automatic parsing and processing in subsequent processes.

[0065] In some optional implementations, step S205 specifically includes: Step c1 involves semantic parsing of each test scenario to obtain the corresponding business action nodes, status verification nodes, and business flow logic.

[0066] In one optional embodiment, semantic parsing technology is used to separate two types of core nodes, namely action nodes and verification nodes, from the unstructured natural language scene text output by the large language model. At the same time, the flow rules between nodes are clarified, and the descriptive scene text is transformed into a structured set of nodes and logical relationships.

[0067] Step c2 breaks down the business action node into several sub-operation items.

[0068] In one optional embodiment, the business actions described in natural language are usually complex semantics. For example, completing the login corresponds to multiple actions such as entering an account, entering a password, and clicking login. After being broken down into atomic operation items, each operation item corresponds to a single sub-operation item only once.

[0069] Step c3: Verify all sub-operation items, and concatenate the verified sub-operation items according to the business execution sequence to obtain the operation step sequence.

[0070] In one optional embodiment, the validity of the sub-operation items is first verified, and invalid items with no operation object or logical contradictions are eliminated. Then, the valid sub-operation items are sorted and concatenated according to the execution order of the actual business to obtain the operation step sequence.

[0071] The interface automation testing method provided in this embodiment first performs semantic parsing on each test scenario, extracting business action nodes, state verification nodes, and business flow logic. This transforms the unstructured natural language scenarios output by the large model into a structured set of logical nodes, clearly distinguishing between operational behaviors and result verification stages, while also clarifying the execution dependencies between nodes. Next, coarse-grained business action nodes are broken down into independent sub-operation items, refining complex semantic business actions into atomic operation units of single, single interaction, avoiding the problem of complex actions not being able to directly match element location. Finally, the validity of all sub-operation items is verified, eliminating logical contradictions and invalid content without operational objects. Then, the sub-operation items are sorted and assembled according to the actual business execution sequence, ultimately obtaining a logically coherent and rigorously ordered sequence of operation steps. This ensures the compliance and executability of the operation process and provides a standardized process foundation for assembling complete automated test cases.

[0072] In some optional implementations, step S206 specifically includes: Step d1: Extract the interface structure feature parameters of each interface element from the interface feature vector of the target tenant.

[0073] In one optional embodiment, the interface structure feature parameters include identifier integrity parameters, structural stability parameters, attribute richness parameters, and dynamic characteristic parameters.

[0074] Among them, the interface structure feature parameters are a set of quantitative indicators extracted from the interface feature vector to describe the page DOM structure and element attribute characteristics, directly determining the applicability of various positioning technologies. The identifier integrity parameter is a quantitative indicator measuring whether interface elements possess unique and stable exclusive identifier attributes; the more unique and stable the identifier, the higher the parameter value. The structural stability parameter is a quantitative indicator measuring whether the page DOM hierarchy and the relative positions of elements are not easily changed; the more fixed the page structure, the higher the parameter value. The attribute richness parameter is a quantitative indicator measuring the number and distinguishability of feature attributes (such as class names, names, and text tags) that can be used for positioning of interface elements; the more distinguishable attributes, the higher the parameter value. The dynamic characteristic parameter is a quantitative indicator measuring whether the attributes and positions of interface elements dynamically change with business scenarios; the more frequently the elements change, the higher the parameter value.

[0075] Step d2: Generate multiple candidate positioning strategies for interface elements based on the interface structure feature parameters.

[0076] In one optional embodiment, candidate positioning strategies include ID positioning, CSS selector positioning, visual positioning, and semantic positioning. ID positioning is a positioning scheme that matches target elements based on their unique ID attribute. It boasts high efficiency and accuracy, relying on elements possessing stable and unique identifiers. CSS selector positioning is a positioning scheme that matches target elements based on their style class names, attribute characteristics, and hierarchical relationships. It offers strong adaptability and relies on a stable DOM structure. Visual positioning is a positioning scheme that identifies target elements based on image features from screenshots. It does not depend on the page's DOM code and is adaptable to custom interfaces without a standard structure. Semantic positioning is a positioning scheme that identifies target elements based on the business function meaning and textual semantics of their elements. It does not depend on specific attributes or positions and is adaptable to scenarios with significant differences in interface layout.

[0077] Specifically, the system pre-builds generation logic for four types of strategies: ID positioning, CSS selector positioning, visual positioning, and semantic positioning. For a single interface element, it first extracts its interface structure feature parameters, then adapts the generation conditions of each strategy to generate specific positioning expressions or matching rules. For example, when the identifier is complete, it extracts the element's unique ID to generate ID positioning rules; when the structure and attribute features are rich, it generates CSS selector positioning rules based on DOM hierarchy and element attributes. Simultaneously, it generates visual feature matching templates and business semantic positioning rules for the element, and finally summarizes them to obtain multiple candidate positioning strategies for the element.

[0078] Step d3: Calculate the fitness score of each candidate positioning strategy, and sort the candidate positioning strategies in descending order of fitness score to obtain the positioning strategy sequence.

[0079] In one optional embodiment, different positioning strategies have different requirements for interface features. For example, ID positioning works best on interfaces with high identifier integrity, while visual positioning is more suitable for dynamic interfaces with poor structural stability. Based on the extracted interface structural feature parameters, the applicability of each candidate positioning strategy is quantified and scored, and then priority is determined according to the degree of fit.

[0080] Step d4: Select a preset number of positioning strategies from the positioning strategy sequence in order to generate an adaptive positioning strategy for the interface elements.

[0081] In one optional embodiment, in a multi-tenant scenario, the interface structure may change with version iterations and business customization adjustments, and a single priority strategy may fail. Therefore, a positioning chain combining a primary positioning strategy and multi-level backup positioning strategies is constructed for each interface element as its adaptive positioning strategy.

[0082] The automated interface testing method provided in this embodiment first extracts four types of interface structural feature parameters from the tenant interface feature vector, transforming the element's identification characteristics, structural stability, attribute richness, and dynamic characteristics into quantifiable positioning evaluation criteria, avoiding the problem of insufficient adaptability of general positioning methods. Based on this, candidate positioning strategies covering multiple technical routes including DOM attributes, visual, and semantics are generated, covering various scenarios from conventional stable interfaces to highly customized interfaces, avoiding the scenario limitations of a single positioning method. Furthermore, the adaptability score of each candidate strategy is calculated and ranked, and the optimal positioning priority is matched for each element based on interface features, prioritizing the strategy with the strongest stability and highest execution efficiency, balancing positioning accuracy and test execution efficiency. Finally, a preset number of strategies are selected sequentially to form an adaptive positioning strategy, creating a fault-tolerant positioning mechanism that combines a primary strategy with multiple backups. When the interface undergoes minor changes, backup strategies can be automatically switched without manual modification of the test script, effectively improving the robustness of the positioning scheme in multi-tenant scenarios and reducing the maintenance cost of the test script.

[0083] In some optional implementations, the execution results include the distribution of failure scenarios and uncovered business branches. After obtaining the execution structure, the method further includes: Step e1: Based on the execution results, adjust the test scenario prompt template and the sampling strategy of the large language model.

[0084] In one optional embodiment, for uncovered business branches, the corresponding business coverage requirements and boundary constraints are added to the prompt template to guide the large model to complete the missing scenario types; for the problem of concentrated failure scenarios, the scenario generation rules of the prompt template and the sampling parameters of the large model are adjusted to correct the deviation direction of scenario generation.

[0085] Step e2: Input the adjusted structured test scenario prompt template into the large language model and regenerate the optimized interface test cases.

[0086] In one optional embodiment, the original entire process of scene generation, step breakdown, element location, and test case assembly is retained, and only the prompt template and sampling strategy are updated for iteration to obtain optimized interface test cases.

[0087] The interface automation testing method provided in this embodiment, relying on the distribution of failure scenarios and uncovered business branches in the test execution results, can reversely locate the coverage gaps and adaptation defects generated in the current test scenario. It can then specifically adjust the constraint rules of the test scenario prompt template and the sampling strategy of the large language model. This not only fills in missing business processes and boundary scenarios and fills the coverage gaps of the original tests, but also corrects the deviation direction of scenario generation and reduces the probability of generating subsequent failure scenarios. The adjusted prompt template is then input into the large language model to regenerate optimized interface test cases, thus achieving a complete self-optimization closed loop. This allows the coverage and execution stability of test cases to continuously improve iteratively with operation.

[0088] This embodiment also provides an automated interface testing device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0089] This embodiment provides an automated interface testing device, such as... Figure 4 As shown, it includes: The data acquisition module 301 is used to acquire the target tenant's interface feature vector, business risk configuration file, and historical defect data corresponding to each business module.

[0090] The risk priority scoring calculation module 302 is used to calculate the risk priority score of each business module based on the business risk configuration file and historical defect data.

[0091] The prompt word template construction module 303 is used to construct a structured test scenario prompt template by combining the business rules of the business module and the interface feature vector of the target tenant.

[0092] The test scenario generation module 304 is used to input the structured test scenario prompt template into the pre-trained large language model to generate a test scenario set, which includes multiple test scenarios.

[0093] The test scenario decomposition module 305 is used to perform semantic parsing and step decomposition on each test scenario to obtain the operation step sequence of each test scenario.

[0094] The positioning strategy generation module 306 is used to generate corresponding adaptive positioning strategies for each interface element in each operation step based on the interface feature vector of the target tenant.

[0095] The test case generation module 307 is used to combine the adaptive positioning strategies corresponding to each interface element according to the test step sequence of each test scenario, and generate interface test cases corresponding to each test scenario.

[0096] The interface testing module 308 is used to test the interface test cases of the corresponding business modules in order of risk priority scores from high to low, and obtain the execution results.

[0097] The interface automated testing apparatus provided in this embodiment of the invention can execute the interface automated testing method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the various modules and units described above are the same as in the corresponding embodiments described above, and will not be repeated here.

[0098] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.

[0099] The following is a detailed reference. Figure 5 This diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 401, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 402 or a program loaded from memory 408 into random access memory (RAM) 403. The RAM 403 also stores various programs and data required for the operation of the electronic device. The processor 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0100] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.

[0101] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 409, or installed from a memory 408, or installed from a ROM 402. When the computer program is executed by the processor 401, it performs the functions defined in the interface automation testing method of the embodiments of the present invention.

[0102] Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of the present invention.

[0103] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the interface automation testing method shown in the above embodiments is implemented.

[0104] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0105] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A method for automated interface testing, characterized in that, The method includes: Obtain the target tenant's interface feature vector, business risk configuration file, and historical defect data corresponding to each business module; Based on the aforementioned business risk configuration file and historical defect data, calculate the risk priority score for each business module; By combining the business rules of the business modules and the interface feature vectors of the target tenant, a structured test scenario prompt template is constructed. The structured test scenario prompt template is input into a pre-trained large language model to generate a test scenario set, which includes multiple test scenarios. Semantic parsing and step decomposition were performed on each test scenario to obtain the sequence of operation steps for each test scenario. Based on the interface feature vector of the target tenant, an adaptive positioning strategy is generated for each interface element in each operation step. According to the test step sequence of each test scenario, the adaptive positioning strategies corresponding to each interface element are combined to generate interface test cases corresponding to each test scenario. The interface test cases of the corresponding business modules are tested in descending order of risk priority scores to obtain the execution results.

2. The method according to claim 1, characterized in that, Based on the aforementioned business risk configuration file and historical defect data, a risk priority score is calculated for each business module, including: Based on the historical defect data, calculate the defect frequency coefficient and average severity coefficient for each business module; Multiplying the defect frequency coefficient by the average severity coefficient yields the historical defect risk coefficient for the corresponding business module. From the business risk configuration file, extract the business importance score, code change information, and risk parameters of the target tenant corresponding to each business module. The risk parameters include the tenant compliance level and business activity. Calculate the code change risk coefficient based on the code change information of each business module, and calculate the tenant-specific risk coefficient based on the risk parameters of the target tenant; The risk priority score for each business module is obtained by weighting and summing the historical defect risk coefficient, business importance score, code change risk coefficient and tenant-specific risk coefficient.

3. The method according to claim 1, characterized in that, Based on the business rules of the current business module and the interface feature vector of the target tenant, a structured test scenario prompt template is constructed, including: Obtain the business rules corresponding to the current business module, and the interface constraints corresponding to the interface feature vector of the target tenant; Based on the aforementioned business rules and interface constraints, and following the preset structured prompt framework, the system role definition, business test context, interface constraints, and output format specifications are configured sequentially to generate a structured test scenario prompt template adapted to the current business module.

4. The method according to claim 1, characterized in that, Semantic parsing and step decomposition are performed on each test scenario in the test scenario set to obtain a sequence of operation steps, including: Semantic parsing is performed on each test scenario to obtain the corresponding business action nodes, status verification nodes, and business flow logic. The business action node is broken down into several sub-operation items; Verify all sub-operation items, and concatenate the verified sub-operation items according to the business execution sequence to obtain the operation step sequence.

5. The method according to claim 1, characterized in that, The step of generating corresponding adaptive positioning strategies for each interface element in each operation step based on the interface feature vector of the target tenant includes: From the interface feature vector of the target tenant, extract the interface structure feature parameters of each interface element. The interface structure feature parameters include identifier integrity parameters, structural stability parameters, attribute richness parameters and dynamic characteristic parameters. Based on the interface structure feature parameters, multiple candidate positioning strategies are generated for interface elements, including ID positioning, CSS selector positioning, visual positioning, and semantic positioning. Calculate the fitness score of each candidate positioning strategy, and sort the candidate positioning strategies in descending order of fitness score to obtain the positioning strategy sequence. A preset number of positioning strategies are selected sequentially from the positioning strategy sequence to generate an adaptive positioning strategy for interface elements.

6. The method according to claim 1, characterized in that, The execution results include the distribution of failure scenarios and uncovered business branches. After obtaining the execution structure, the method further includes: Based on the execution results, adjust the test scenario prompt template and the sampling strategy of the large language model; Input the adjusted structured test scenario prompt template into the large language model to regenerate the optimized interface test cases.

7. An automated interface testing device, characterized in that, The device includes: The data acquisition module is used to acquire the target tenant's interface feature vector, business risk configuration file, and historical defect data corresponding to each business module. The risk priority scoring calculation module is used to calculate the risk priority score of each business module based on the business risk configuration file and historical defect data. The prompt word template construction module is used to construct a structured test scenario prompt template by combining the business rules of the business module and the interface feature vector of the target tenant; The test scenario generation module is used to input the structured test scenario prompt template into a pre-trained large language model to generate a test scenario set, which includes multiple test scenarios. The test scenario decomposition module is used to perform semantic parsing and step decomposition on each test scenario to obtain the operation step sequence of each test scenario. The positioning strategy generation module is used to generate corresponding adaptive positioning strategies for each interface element in each operation step based on the interface feature vector of the target tenant. The test case generation module is used to combine the adaptive positioning strategies corresponding to each interface element according to the test step sequence of each test scenario, and generate interface test cases corresponding to each test scenario. The interface testing module is used to test the interface test cases of the corresponding business modules in descending order of risk priority scores, and obtain the execution results.

8. An electronic device, characterized in that, include: A memory and a processor are interconnected, the memory stores computer instructions, and the processor executes the interface automation testing method according to any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to execute the interface automation testing method according to any one of claims 1 to 6.

10. A computer program product, characterized in that, Includes computer instructions for causing a computer to execute the interface automation testing method according to any one of claims 1 to 6.