Test case derivative methods, devices, media and program products

By structurally processing and analyzing the differences between requirements and test cases, generating test cases using a large language model, and performing multi-dimensional verification, the problem of synchronizing requirement changes across multiple versions was solved. This enabled automated and precise generation of test cases, improving efficiency and accuracy.

CN123068296APending Publication Date: 2026-11-10CONTINENTAL SMART CORE TECH (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611321544.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-27
Publication Date
2026-11-10

AI Technical Summary

Technical Problem

In a rapidly iterative R&D model, how can we accurately synchronize requirement changes to test cases across multiple derivative versions to avoid incomplete test coverage or repeated manual updates, thereby improving the efficiency and accuracy of test case generation?

Method used

By structuring and analyzing the differences between requirements and test cases, modification strategies are determined. Test cases are generated under clear constraints using a large language model. Multi-dimensional verification is combined to ensure the accuracy and controllability of the generated test cases. Audit logs are recorded to trace the modification process.

Benefits of technology

It has achieved automation and precision in test case generation, improved the efficiency and accuracy of adapting test cases from requirement changes, ensured the orderliness and quality of the generation process, and reduced labor costs and complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123068296A_ABST
    Figure CN123068296A_ABST
Patent Text Reader

Abstract

This application relates to the field of software testing technology, specifically to a test case derivation method, device, medium, and program product. The method includes: obtaining a first requirement entity related to a target requirement, and a first test case corresponding to the first requirement entity; performing structured processing on the target requirement to obtain a second requirement entity, wherein the first requirement entity, the second requirement entity, and the first test case all include multiple fields; performing a difference analysis between the second requirement entity and the first requirement entity to determine a modification strategy for the first test case; and modifying the first test case based on the modification strategy to obtain the second test case corresponding to the target requirement. This improves the efficiency of test case generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software testing technology, specifically to a test case derivation method, device, medium, and program product. Background Technology

[0002] In a rapid iteration development model, software or complex products often have multiple versions. Typically, the development team maintains a core "base version" and then develops multiple "derivative versions" with different functionalities based on different customer needs or market positioning. It's common for requirements to change independently or collectively across these versions. Therefore, it's crucial to accurately synchronize any requirement change to the test cases of all affected derivative versions. Improper handling can lead to either incomplete test coverage resulting in missed tests or require testers to perform a large amount of repetitive and error-prone manual updates, becoming a bottleneck that hinders development efficiency and quality.

[0003] Therefore, how to simultaneously ensure the accuracy and efficiency of the derivation method is a technical problem that urgently needs to be solved. Summary of the Invention

[0004] The purpose of this application is to provide a test case generation method, device, medium, and program product to improve the efficiency of test case generation.

[0005] In a first aspect of this application, a test case derivation method is provided, applied to an electronic device. The method includes: obtaining a first requirement entity related to a target requirement and a first test case corresponding to the first requirement entity; performing structured processing on the target requirement to obtain a second requirement entity, wherein the first requirement entity, the second requirement entity, and the first test case all include multiple fields; performing a difference analysis between the second requirement entity and the first requirement entity to determine a modification strategy for the first test case; and modifying the first test case based on the modification strategy to obtain the second test case corresponding to the target requirement.

[0006] This application's embodiments, through structured processing and difference analysis of requirements and test cases, determine a modification strategy for baseline test cases, and guide subsequent modification processes based on this strategy. This replaces the traditional method of manual, item-by-item comparison and subjective decision-making, achieving automation and precision in test case derivation, significantly improving the efficiency and accuracy of the process from requirement changes to test case adaptation.

[0007] In one possible implementation of the first aspect, the requirement fields of both the first requirement entity and the second requirement entity include multiple of the following: requirement identifier, requirement title, requirement description, module, requirement status, requirement version, and requirement verification method; the fields of the first test case include: a set of test steps and a set of associated requirement identifiers: the set of test steps includes at least one test step, and each test step includes an operation description field and an expected result field; the set of associated requirement identifiers is used to indicate the requirement entity associated with the first test case.

[0008] In one possible implementation of the first aspect, a difference analysis is performed between the second requirement entity and the first requirement entity to determine the modification strategy for the first test case, including: performing a field-level comparison between the first requirement entity and the second requirement entity to determine the requirement differences; and determining the modification strategy corresponding to the test step based on the requirement differences and the set of associated requirement identifiers of the first test case; wherein the modification strategy includes at least one of the following: reuse, deletion, rewriting, and addition.

[0009] This application's embodiments, through fine-grained field-level comparisons of requirement entities, can accurately capture specific change points in requirements. Combined with the correlation between test cases and requirements, it can effectively link requirement differences to specific test steps and assign appropriate modification strategies (reuse, deletion, rewriting, addition), providing a basis for targeted modification at the step level.

[0010] In one possible implementation of the first aspect, based on the requirement difference and the set of associated requirement identifiers of the first test case, the modification strategy corresponding to the test step is determined, including: if the test step is applicable under the target requirement and is not affected by the requirement difference, then its modification strategy is determined to be reuse; if the test step is applicable under the target requirement and is affected by the requirement difference, then its modification strategy is determined to be rewriting; if the test step is not applicable under the target requirement, then its modification strategy is determined to be deletion.

[0011] In this embodiment of the application, the above-described judgment logic can distinguish different states of test steps and automatically assign appropriate modification strategies. This maximizes the reuse of steps that can still be used, rewrites steps that need adjustment in a targeted manner, and promptly cleans up completely invalid steps. Thus, while ensuring the quality of new test cases, it achieves efficient and orderly utilization and updating of baseline test assets.

[0012] In one possible implementation of the first aspect, the modification strategy corresponding to the test step is determined based on the requirement difference and the set of associated requirement identifiers of the first test case. The modification strategy also includes: if the requirement difference indicates that the target requirement includes a new test scenario, the modification strategy corresponding to the test step used to test the new test scenario is determined to be "add". The new test scenario is a scenario that cannot be tested by the set of test steps of the first test case.

[0013] In this embodiment, by identifying new test scenarios in the requirements and automatically triggering the "add" strategy, it is possible to ensure that test coverage for new product functions or features is not overlooked. This enables the completeness of the test case set to expand synchronously and automatically as requirements evolve, compensating for test blind spots that may result from simply relying on modifying existing test cases.

[0014] In one possible implementation of the first aspect, the first test case is modified based on the modification strategy to obtain the second test case corresponding to the target requirement. This includes: inputting the first requirement entity, the second requirement entity, the requirement difference, the first test case, and the modification strategy into the first model to obtain the test case content output by the first model; verifying the test case content; and obtaining the second test case in response to the verification passing.

[0015] In this embodiment, by introducing a first model (such as a large language model) and providing it with structured contextual information (including requirements, differences, baseline use cases, and explicit modification strategies), content generation and adaptation can be performed automatically. Combined with subsequent verification, the reliability of the output results is ensured while utilizing the model, significantly improving the automation level and efficiency of the modification execution process.

[0016] In one possible implementation of the first aspect, the verification includes at least one of the following: a generation scope verification, used to constrain that the generated or rewritten content in the test case content shall not exceed the part that needs to be modified; a decision consistency verification, used to constrain that the test case content conforms to the modification strategy; and a traceability verification, used to constrain that the test case content contains a modification basis description that can be traced back to the difference in requirements.

[0017] In this embodiment, by implementing multi-dimensional verification rules, the output of the first model can be effectively controlled. Generation range verification prevents the spread of irrelevant content, decision consistency verification ensures that generation actions conform to predetermined strategies, and traceability verification guarantees that modifications have a clear basis. These verifications work together to enhance the controllability, reliability, and interpretability of the entire automated generation process.

[0018] In one possible implementation of the first aspect, the method further includes: storing an audit log corresponding to the second test case; wherein the audit log includes at least one of the following: the identifier of the first test case, the identifier of the second test case, the modification strategy, and the working log of the first model.

[0019] In this embodiment of the application, by storing audit logs containing key process information, the entire derivation process of test cases (including baseline sources, adopted strategies, model working records, etc.) can be completely recorded and retained. This provides a reliable data foundation for result traceability, problem investigation, process auditing, and quality assessment, enhancing the standardization and transparency of the process.

[0020] In one possible implementation of the first aspect, the method further includes: when the first requirement entity or the first test case changes, detecting whether there is a conflict between the change and the second test case; if there is a conflict, based on the first test case, the content of the change, and the second test case, calling the first model to obtain modification suggestions for the first test case and the second test case.

[0021] This application's embodiments, by establishing a conflict detection and intelligent arbitration mechanism, can effectively handle potential conflicts between baseline assets and already generated branch use cases during subsequent evolution. Utilizing a first model for semantic-level analysis and providing modification suggestions, it offers intelligent support for human decision-making, reducing the complexity and manual costs of branch synchronization and merging during parallel maintenance of multiple versions in large-scale product lines.

[0022] In a second aspect of this application, an electronic device is provided, including a processor, a memory, and a communication interface. The memory is used to store instructions, and the processor is used to call and execute the instructions to implement the methods described in the first aspect and any possible implementation thereof.

[0023] In a third aspect of this application, a computer-readable medium is provided, on which instructions are stored, which, when executed on an electronic device, cause the electronic device to perform the methods of the first aspect and any possible implementation thereof.

[0024] In a fourth aspect of this application, a computer program product is provided, the program product including computer instructions, which, when executed by an electronic device, cause the electronic device to perform the method of the first aspect and any possible implementation thereof.

[0025] The beneficial effects of the second to fourth aspects mentioned above can be found in the description of the first aspect and any possible implementation of the first aspect, and will not be repeated here. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the accompanying drawings are described below.

[0027] Figure 1 According to some embodiments of this application, a flowchart of a test case derivation method is shown;

[0028] Figure 2According to some embodiments of this application, a flowchart of a second test case generation method is shown;

[0029] Figure 3 According to some embodiments of this application, a schematic diagram of the structure of an electronic device is shown;

[0030] Figure 4 According to some embodiments of this application, a block diagram of a system-on-a-chip is shown. Detailed Implementation

[0031] The illustrative embodiments of this application include, but are not limited to, a test case derivation method, device, medium, and program product.

[0032] As market competition intensifies and user demands diversify, product development models have evolved from a single main line to a model that rapidly derives multiple functional variations or customized versions (i.e., "branches") based on the same technical baseline. Under this model, frequent and differentiated changes in requirements have led to a surge in the workload of maintaining the test case library. The testing team needs to maintain a set of test cases for each branch that both matches the branch's requirements and reuses baseline test assets as much as possible. Traditional manual methods are extremely labor-intensive, error-prone, and difficult to trace.

[0033] Currently, the common solutions in the industry mainly fall into the following three categories, but each of them has significant drawbacks.

[0034] The first approach is replication plus manual maintenance. This approach involves creating a complete copy of the baseline test case library as the branch test case library, and all subsequent modifications and additions to test cases for branch requirements are done manually by testers.

[0035] In this type of solution, requirements and use cases are typically associated only with identifiers (IDs) at a coarse-grained level, making it impossible to automatically analyze which specific use cases and test steps are affected by requirement changes. In multi-branch scenarios, the workload of manual comparison, analysis, and modification increases exponentially, resulting in high maintenance costs and difficulty in ensuring consistency of test logic across different branches. The entire process lacks automation capabilities and is inefficient.

[0036] The second approach is a full regeneration approach based on a large language model. This approach inputs the entire branch requirement document into the large language model (LLM) and instructs the model to directly generate a complete set of test cases.

[0037] In this type of approach, the LLM generation process lacks clear boundaries, easily generating "illusionary" content unrelated to current requirement changes or omitting important scenarios. Newly generated test cases are disconnected from existing baseline test cases, resulting in the inability to inherit valuable assets such as historical test execution records, defect correlations, and review logs, thus disrupting the continuity of test assets. Furthermore, the generation process is like a "black box," making it impossible to trace why a particular test step was generated, lacking a basis for decision-making.

[0038] The third approach is a text-based diffing solution based on version control systems. This approach utilizes distributed version control systems such as Git to manage test case documents, and performs version management and branch merging by comparing differences between lines of text.

[0039] In this type of solution, comparing differences between plain text lines fails to grasp the business semantics of test steps. For example, changing a parameter from "60" to "80" only identifies character changes; it cannot understand that this is a change in the "battery capacity" parameter, let alone associate it with the specific test step affected. Furthermore, this type of solution cannot establish a mapping from structured requirement changes to test case step-level changes, still requiring manual interpretation. When merging conflicts, it only resolves them based on line-by-line text, failing to provide intelligent arbitration at the business semantic level.

[0040] In summary, existing technical solutions generally suffer from drawbacks such as crude positioning, lack of decision-making, insufficient control, and difficulty in maintenance. These solutions either rely entirely on manual labor, resulting in low efficiency, or employ automation methods but sacrifice accuracy and controllability. In other words, existing technical solutions cannot simultaneously guarantee the accuracy and efficiency of test case derivation methods.

[0041] To address the aforementioned technical issues, this application provides a test case derivation method. By structuring requirements and test cases, it identifies and analyzes changes, and based on this analysis, decides on differentiated modification strategies for baseline test cases. Finally, guided by this strategy, it generates branch test cases that meet new requirements while maximizing the reuse of historical assets.

[0042] Thus, through structured processing and difference analysis, the impact of requirement changes on test case modifications is automatically and accurately mapped. This fundamentally changes the traditional model of manual comparison and subjective judgment, enabling rapid and objective identification of the scope of modifications requiring attention, significantly improving the efficiency and accuracy of initial analysis. Secondly, by determining the modification strategy, it is possible to distinguish which content can be directly reused, which needs to be adapted and rewritten, and which is no longer applicable. This makes subsequent modification actions (whether manual or automated) clear in their objectives, avoiding blind modifications or ineffective work, further improving efficiency, and ensuring the orderly development of the process and the quality of the results.

[0043] It is understood that the test case derivation method provided in this application can be applied to electronic devices, meaning that the execution subject of each step of this method is an electronic device. For the sake of simplicity, the execution subject of each step will not be described again below when introducing the steps of this method.

[0044] This application does not limit the type of electronic device, which may include, but is not limited to, mobile phones, wearable devices (such as smartwatches), tablets, desktops, laptops, handheld computers, notebook computers, ultra-mobile personal computers (UMPCs), netbooks, as well as cellular phones, personal digital assistants (PDAs), augmented reality (AR) / virtual reality (VR) devices, etc. The embodiments of this application do not impose any restrictions on the specific type of electronic device.

[0045] To more clearly illustrate the technical solutions provided in the embodiments of this application, the technical solutions of this application will be described below in conjunction with the accompanying drawings.

[0046] Figure 1 A flowchart illustrating a test case derivation method is shown according to an embodiment of this application. Figure 1 As shown, the test case derivation method may include the following steps S101 to S103:

[0047] S101: Obtain the first requirement entity related to the target requirement, and the first test case corresponding to the first requirement entity, and perform structured processing on the target requirement to obtain the second requirement entity. The first requirement entity, the second requirement entity, and the first test case all include multiple fields.

[0048] In this embodiment, the first requirement entity refers to a structured requirement data object associated with the baseline product version. The second requirement entity refers to the corresponding data object formed after the new requirement or branch requirement to be implemented (i.e., the "target requirement") has undergone structured processing. "Structured processing" of the target requirement means parsing it from a natural language document or other form and filling it into a predefined data structure (i.e., an "entity").

[0049] In some embodiments of this application, the requirement fields of both the first requirement entity and the second requirement entity include multiple fields from the following: requirement identifier (req_id), requirement title (title), requirement description (description), module (module), requirement status (status), requirement version (version), and requirement verification method (verification_method). These fields are the basic units used for subsequent "field-level comparisons".

[0050] For example, a baseline requirement entity (first requirement entity) describing the requirements of a "battery system" might be represented in the following JSON format:

[0051] {

[0052] "req_id":"REQ-2024-BAT-001",

[0053] "title": "Basic Vehicle Range Requirements"

[0054] "Description": "Under standard operating conditions, the vehicle equipped with a 60kWh battery pack should have a range of no less than 400 kilometers."

[0055] “module”: “Powertrain / Battery”

[0056] "status": "Approved"

[0057] "version": "1.0",

[0058] “verification_method”: “test”

[0059] };

[0060] The derived needs (target needs) for the high-end model, after structured processing, might result in the following second demand entity:

[0061] {

[0062] "req_id":"REQ-2024-BAT-001-H",

[0063] "title": "Range requirements for high-spec vehicles"

[0064] "Description": "Under standard operating conditions, the vehicle, equipped with an 80kWh battery pack, should have a range of no less than 550 kilometers."

[0065] “module”: “Powertrain / Battery”

[0066] “status”: “draft”,

[0067] "version": "1.0",

[0068] “verification_method”: “test”

[0069] }

[0070] This structured representation allows for precise comparison of identical fields (such as description and implicit battery capacity parameters) between two entities, thereby identifying specific differences in requirements.

[0071] It should be noted that the above list of fields is only a representative example, and this application is not limited to it. Any set of fields that can structurally represent the attributes of requirements and be used for difference comparison is within the scope of protection of this application.

[0072] In this embodiment of the application, the first test case refers to an existing baseline test case corresponding to the first requirement entity (baseline requirement), which also exists in the form of a structured data object.

[0073] In some embodiments of this application, the core fields of the first test case may include a set of test steps and a set of associated requirement identifiers.

[0074] A set of test steps consists of one or more test steps. Each test step is an independent unit of content and includes at least an operation description field (step) and an expected result field (expected). For example, the steps of a "range test case" might include: [{"step":"fully charge the vehicle", "expected":"battery level 100%"}, {"step":"confirm battery capacity configuration as 60kWh", "expected":"system displays battery capacity 60kWh"}, ...].

[0075] The associated requirement identifier set is used to indicate the requirement entities associated with the first test case. For example, the associated requirement identifier set (requirement_ids) stores the identifiers (such as req_id) of one or more requirement entities verified by this test case. It establishes a traceable association between the test case and the requirement, and is a key index for subsequent screening of candidate test cases.

[0076] In some embodiments of this application, the fields of the first test case may also include test case identifier (case_id), test case title (case_title), precondition (precondition), priority (priority), etc., to improve the management attributes of the test case. This application does not impose any restrictions on this.

[0077] For example, a "battery life test case" (first test case) that verifies the baseline requirements mentioned above might be represented as follows:

[0078] {

[0079] "case_id":"TC-POW-BAT-001",

[0080] "case_title": "Basic Vehicle Range Test"

[0081] "precondition": "Vehicle under standard load, ambient temperature 25°C."

[0082] “requirement_ids”:[“REQ-2024-BAT-001”], / / Associated with the baseline requirements mentioned above

[0083] "priority": "high"

[0084] “steps”:[

[0085] {

[0086] “step_id”:1,

[0087] "step": "Connect the vehicle to the charging device and fully charge it."

[0088] "expected": "The vehicle's dashboard displays 100% battery level."

[0089] },

[0090] {

[0091] “step_id”: 2,

[0092] "Step": "Confirm the battery capacity configuration is 60kWh in the central control screen settings".

[0093] "expected": The system information page displays the battery capacity as 60kWh.

[0094] },

[0095] {

[0096] “step_id”:3,

[0097] "step": "Execute the NEDC cycle on the standard test track".

[0098] "expected": "The vehicle can complete the cycle test normally."

[0099] },

[0100] {

[0101] “step_id”:4,

[0102] "step": "Record the remaining battery range after the test ends".

[0103] "expected": "The dashboard displays a remaining driving range of ≥400 kilometers".

[0104] } ]

[0106] }

[0107] Each object in the `steps` array is an independently addressable and processable "step unit," and the `step_id` or array index can be used for precise location. The `requirement_ids` field explicitly establishes the association between this use case and requirement REQ-2024-BAT-001.

[0108] Structured processing of target requirements can be achieved by configuring data parsing templates, extracting key information using natural language processing (NLP) models, or directly connecting to existing structured requirements management and test management tools.

[0109] S102: Perform a difference analysis between the second requirement entity and the first requirement entity to determine the modification strategy for the first test case.

[0110] In some embodiments of this application, difference analysis may be a field-level comparison of two structured demand entities (a second demand entity and a first demand entity). For example, comparing the textual differences between the demand descriptions of the first demand entity and the demand descriptions of the second demand entity, or identifying changes in the parameters of the first demand entity from "60kWh" to the parameters of the second demand entity from "80kWh".

[0111] The result of the above difference analysis may be one or more requirement difference records. Each record may contain changed fields, old values, new values, change types (such as "parameter update", "added field", "deleted content"), etc.

[0112] For example, a demand difference record could be: {"diff_id":"D001","field":"description","old_value":"60kWh…400km","new_value":"80kWh…550km","type":"Parameter Update"}

[0113] Where "diff_id" is the demand difference number, "field" is the scope of the demand difference, "old_value" is the value in the first demand entity, "new_value" is the value in the second demand entity, and "type" is the type of demand difference.

[0114] In some embodiments of this application, all potentially affected candidate test cases can be quickly screened by matching the first test case-associated requirement identifier set with the requirement identifiers involved in the determined "requirement differences". Then, modification strategies corresponding to the test steps are determined from these candidate test cases. These modification strategies may include at least one of the following: reuse, deletion, rewriting, and addition.

[0115] For each candidate test case, this application does not simply mark it as needing modification, but rather analyzes its set of test steps in depth, mapping the "requirement differences" obtained in the previous step to one or more specific test steps.

[0116] This mapping process, known as "step-level impact localization," can be implemented using various techniques. For example, keyword matching can be used: for parameter changes such as "battery capacity changes from 60kWh to 80kWh," the affected step can be located by directly searching for "60kWh" in the description text of the test step. Semantic similarity calculation can also be used: leveraging a lightweight natural language processing model, the semantic relevance between the requirement difference description (e.g., "adding 360-degree surround view function") and the descriptions of each test step can be calculated to locate the semantically affected step. After localization, information such as the index of the affected step, associated requirement difference fields, and change type can be output.

[0117] Based on the results of the positioning based on the above differences in requirements, a clear modification strategy label is assigned to each test step.

[0118] In some embodiments of this application, after candidate test cases are determined based on requirement differences and the set of associated requirement identifiers of the first test case, determining the modification strategy corresponding to the test steps (i.e., the test steps in the candidate test cases) may include:

[0119] If the testing steps are applicable under the target requirements and are not affected by differences in requirements, then the modification strategy is determined to be reuse.

[0120] In the embodiments of this application, for test steps that are not affected by differences in demand, such as the step of "fully charging the vehicle" in the range test, the operation itself remains unchanged regardless of changes in battery capacity, so its modification strategy is determined to be reuse.

[0121] If the test steps are applicable under the target requirements but are affected by differences in requirements, then the modification strategy is determined to be rewriting.

[0122] In this application embodiment, the test steps are affected by differences in demand, but their core operating logic still applies under the target demand, and only the parameters, conditions, or expected results need to be updated. For example, in the battery life test, the step of "confirming the battery capacity configuration is 60kWh" remains unchanged after the battery capacity is changed to 80kWh, but the parameter values ​​need to be updated. Therefore, the modification strategy is determined to be rewriting.

[0123] If the test steps are not applicable to the target requirements, the modification strategy is to delete them.

[0124] In this embodiment, the test steps are those that are no longer applicable under the target requirements. For example, if a function is completely removed in a branch requirement, then the dedicated test steps for verifying that function are no longer applicable, so the modification strategy is to delete them.

[0125] In some embodiments of this application, determining the modification strategy corresponding to the test step based on the requirement difference and the set of associated requirement identifiers of the first test case may further include: if the requirement difference indicates that the target requirement includes a new test scenario, determining the modification strategy corresponding to the test step used to test the new test scenario as adding; wherein, the new test scenario is a scenario that cannot be tested by the set of test steps of the first test case.

[0126] This strategy targets entirely new test scenarios introduced in the target requirements, scenarios for which there are no corresponding or similar verification contents in the entire set of test steps in the baseline test cases. For example, the high-end version adds a "360-degree surround view function," and there are no steps in the baseline test cases to verify this function. Therefore, it is necessary to generate completely new test steps from scratch for this "new test scenario," hence the modification strategy is determined to be addition.

[0127] For example, the above step-level modification strategy mapping can be represented as: {"case_id":"TC-POW-BAT-001","step_mappings":[{"step_id":1,"strategy":"reuse"},{"step_id":2,"strategy":"rewrite","diff_id":"D001"},{"step_id":3,"strategy":"reuse"},{"step_id":4,"strategy":"rewrite","diff_id":"D001"}]}.

[0128] This application's embodiments implement step-level impact localization and modification decisions. It can automatically and accurately solve the two problems: "Which use case and which step was affected by the requirement change?" and "How should this step be handled?" This changes the crude mode of manual comparison and guesswork based on experience.

[0129] S103: Based on the modification strategy, modify the first test case to obtain the second test case corresponding to the target requirement.

[0130] Figure 2 A flowchart illustrating a second test case generation method is shown according to an embodiment of this application. Figure 2 As shown, based on the modification strategy, the first test case is modified to obtain the second test case corresponding to the target requirement, which may include the following steps S1031 to S1033:

[0131] S1031: Input the first requirement entity, the second requirement entity, the requirement difference, the first test case, and the modification strategy into the first model to obtain the test case content output by the first model.

[0132] In the embodiments of this application, the first model may refer to a large language model or other artificial intelligence model with text generation and understanding capabilities. This application provides the first model with highly structured inputs rich in contextual constraints, including: baseline requirements (e.g., a first requirement entity), branch requirements (e.g., a second requirement entity), a specific list of requirement differences, baseline test cases to be modified, and step-level modification strategy instructions.

[0133] In this embodiment, the task of the first model is to generate content under the constraints of a predetermined strategy. For steps marked "reuse," the first model should guide the direct inheritance of the test step. For steps marked "rewrite," the first model generates a new, adapted description based on the baseline content. For example, "confirm battery capacity is 60kWh" is rewritten as "confirm battery capacity is 80kWh." For scenarios marked "add," the first model generates a new test step from scratch based on the branch requirement context.

[0134] Unlike existing technologies that require models to rewrite entire use cases without constraints, the first model in this application (such as a large language model) operates under the constraints of the aforementioned structured difference analysis, step-level impact localization, and explicit modification strategies, acting as a "constrained arbitrator." Its input includes not only requirements and use case content but also explicit modification instructions (e.g., instructing to "rewrite" step 2 and "generate" a new step for the added functionality). The model's output can be in a structured format, including, for example, an analysis summary, changes summary, and a sequence of step operations. Each operation in the step operation sequence can further include fields such as strategy type (e.g., "reuse," "rewrite," "add new generation"), target step index, new operation description, new expected result, and reason for modification. This structured output makes the generated actions and their basis clear and traceable.

[0135] For example, the structured output / instruction generated by the first model above can be represented as: {"operations":[{"strategy_type":"rewrite","target_index":2,"new_step":"confirm battery capacity configuration as 80kWh","new_expected":"system information page displays battery capacity: 80kWh","reason":"adapt to demand difference D001"},...]}.

[0136] This embodiment of the application constrains the first model by providing structured decision-making criteria, thus achieving controllable AI model-assisted generation. The first model operates within clearly defined boundaries, effectively avoiding problems such as generating irrelevant "illusionary" content, disrupting the original use case structure, or severing historical lineage, enabling the AI ​​model generation capability to be safely and effectively applied to engineering practice.

[0137] S1032: Verify the content of the test cases.

[0138] In this embodiment of the application, a series of deterministic rules are used to ensure that the output of the first model does not "go out of bounds".

[0139] In some embodiments of this application, the verification includes at least one of the following:

[0140] The generation scope check is used to constrain the content generated or modified in the test case to not exceed the part that needs to be modified. In other words, it checks whether the generated content exceeds the authorized modification scope determined by the step-level impact location, and prevents the model from generating out-of-bounds output.

[0141] Decision consistency checks are used to ensure that test case content conforms to modification strategies. For example, it checks whether steps marked "reused" have been incorrectly rewritten or deleted, and whether steps marked "rewritten" have been completely regenerated, losing the basis of the baseline content.

[0142] Traceability verification is used to ensure that test cases include explanations of modifications that can be traced back to the differences in requirements. For example, it checks whether steps for "rewriting" or "adding / generating" provide corresponding requirement difference identifiers as evidence, ensuring that every modification can be traced back to the specific point of requirement change.

[0143] If any of the above checks fails, the model can be retried or transferred to a manual review process, thereby transforming the probabilistic model output into a controllable result that conforms to deterministic rules.

[0144] In this embodiment of the application, the verification can be implemented through procedural methods such as string matching, rule logic judgment, key information extraction and comparison.

[0145] By introducing the above verification mechanism, the reliability, controllability, and auditability of the entire test case derivation process are greatly enhanced.

[0146] S1033: In response to the successful verification, the second test case is obtained.

[0147] In this embodiment, only test cases that pass all validations will be ultimately adopted as formal second test cases (i.e., test cases for the target requirements). If validation fails, model retry, alarms, or manual review processes may be triggered.

[0148] In some embodiments of this application, the method may further include storing audit logs corresponding to the second test case. The audit logs include at least one of the following: an identifier for the first test case, an identifier for the second test case, a modification strategy, and a working log for the first model.

[0149] More specifically, the audit log can record the following representative information: baseline case ID (base_case_id), generated branch case ID (generated_case_id), the modification strategy type used (strategy_type), and the specific step operation sequence (step_operations, recording which steps were reused, which were rewritten, and which were newly generated). The working log of the first model may include the analysis summary of the artificial intelligence model (ai_analysis), model version (ai_model_version), and human confirmation status (human_confirmed), etc., and this application does not impose specific restrictions on this.

[0150] In this embodiment, the audit log records not only the generation result of the second test case (such as the identifiers of the first and second test cases), but also the generation process of the second test case. By persistently saving this process information, not only is the generation process auditable and rollbackable, but more importantly, through fields such as "base_case_id" and "generated_case_id," a clear and traceable lineage relationship is established between the generated second test case (branch test case) and the original first test case (baseline test case), thereby protecting the historical continuity of test assets. This makes every derivative operation traceable, auditable, and rollbackable, meeting the management requirements of a high-quality R&D process. This application does not impose specific limitations on the content included in the audit log.

[0151] In some embodiments of this application, the above method may further include: when the first requirement entity or the first test case changes, detecting whether there is a conflict between the change and the second test case; if there is a conflict, based on the first test case, the changed content of the change, and the second test case, calling the first model to obtain modification suggestions for the first test case and the second test case.

[0152] When the first requirement entity (baseline requirement) or the first test case (baseline test case) undergoes new changes in subsequent versions, the system can automatically detect whether there is a conflict between this baseline change and the already generated second test case (branch test case). The core of this process is to determine whether there is any overlap between the set of steps affected by the baseline change and the set of steps modified when generating the branch test case. If there is no overlap, the process can be automatically merged, and the baseline update can be synchronized to the branch. If there is an overlap, it indicates a semantic conflict. In cases of conflict, the old version of the baseline test case, the new version of the baseline test case, and the current branch version can be obtained. Using these three as input, the first model is called again to perform a semantic-level three-way merging analysis. The model then provides merging suggestions (e.g., suggesting adopting the branch version's modifications, adopting the new baseline version's modifications, or performing step-level fusion). Finally, the model's merging suggestions can be manually confirmed to resolve the conflict.

[0153] In this way, the complex synchronization problem in the long-term parallel evolution of multiple branches is solved, the difficulty and cost of manual merging are reduced, and this method is applicable not only to the initial creation of branches, but also to the synchronization and maintenance of multiple versions in the long-term evolution of product lines.

[0154] In some embodiments of this application, the method described above may further include dynamically calculating the set of valid test cases for each branch. From the perspective of branch testing, it is not necessary to store a complete independent test case library for each branch. Instead, the complete and valid test case set for the current branch can be dynamically calculated and presented by combining "the parts marked as reused in the baseline test cases (first test cases)," "the content generated after rewriting for branch requirements," and "the content newly generated for the branch." This approach greatly reduces storage redundancy in multi-branch scenarios and always maintains a clear inheritance relationship between branch test cases and baseline test cases.

[0155] In some embodiments, this application also provides a readable storage medium storing a program or instructions that, when executed on an electronic device, cause the electronic device to perform the test case derivation method described in the above embodiments.

[0156] In some embodiments, this application also provides a program product, including: a program or instructions that, when run on an electronic device, cause the electronic device to execute the test case derivation method described in the above embodiments.

[0157] In some embodiments, this application also provides an electronic device, which includes: one or more processors; one or more memories; the one or more memories storing one or more programs, which, when executed by one or more processors, cause the electronic device to perform the test case derivation method described in the above embodiments.

[0158] Now for reference Figure 3 The diagram shows a block diagram of an electronic device 1300 according to some embodiments of this application. The electronic device 1300 may include one or more first processors 1301 coupled to a controller hub 1303. In at least one embodiment, the controller hub 1303 communicates with the first processor 1301 via a multi-branch bus such as a Front Side Bus (FSB) or a point-to-point interface such as a Quick Path Interconnect (QPI). The first processor 1301 executes instructions controlling general-type data processing operations. In one embodiment, the controller hub 1303 includes, but is not limited to, a Graphics & Memory Controller Hub (GMCH) (not shown) and an Input / Output Hub (IOH) (which may be on a separate chip) (not shown), wherein the GMCH includes memory and a graphics controller and is coupled to the IOH.

[0159] Electronic device 1300 may also include a first coprocessor 1302 and a memory 1304 coupled to a controller hub 1303. Alternatively, one or both of the memory and GMCH may be integrated within the processor (as described in this application), with memory 1304 and the first coprocessor 1302 directly coupled to the first processor 1301 and the controller hub 1303, which is located on a single chip with IOH.

[0160] Memory 1304 may be, for example, Dynamic Random Access Memory (DRAM), Phase Change Memory (PCM), or a combination of both. Memory 1304 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. The computer-readable storage medium stores instructions, specifically, temporary and permanent copies of those instructions. These instructions may include: instructions that, when executed by at least one processor, cause electronic device 1300 to implement the test case derivation method provided in the embodiments of this application. When the instructions are executed on a computer, they cause the computer to perform the test case derivation method provided in the embodiments of this application.

[0161] In one embodiment, the first coprocessor 1302 is a dedicated processor, such as, for example, a high-throughput many integrated core (MIC) processor, a network or communication processor, a compression engine, a graphics processor, general-purpose computing on graphics processing units (GPGPU), or an embedded processor, etc. Optional properties of the first coprocessor 1302 are indicated by dashed lines. Figure 3 middle.

[0162] In one embodiment, electronic device 1300 may further include a Network Interface Controller (NIC) 1306. The network interface 1306 may include a transceiver for providing a radio interface for electronic device 1300 to communicate with any other suitable device, such as a front-end module, antenna, etc. In various embodiments, the network interface 1306 may be integrated with other components of electronic device 1300. The network interface 1306 can implement the functions of the communication unit in the above embodiments.

[0163] Electronic device 1300 may further include input / output (I / O) device 1305. Input / output device 1305 may include: a user interface designed to enable a user to interact with electronic device 1300; a peripheral component interface designed to enable peripheral components to interact with electronic device 1300; and / or sensors designed to determine environmental conditions and / or location information related to electronic device 1300.

[0164] It is worth noting that, Figure 3 This is merely an example. That is, although... Figure 3 The electronic device 1300 is shown to include multiple devices such as a first processor 1301, a controller hub 1303, and a memory 1304. However, in actual applications, devices using the methods of this application may include only a portion of the devices in the electronic device 1300. For example, it may include only the first processor 1301 and the network interface 1306. Figure 3 Devices with optional properties are shown with dashed lines.

[0165] Now for reference Figure 4 The diagram shown is a block diagram of a System-on-Chip (SoC) 1400 according to some embodiments of this application. Figure 4 In the diagram, the dashed box is an optional feature for more advanced SoCs. Figure 4In the SoC 1400, there are: an interconnect unit 1450 coupled to a second processor 1410; a system proxy unit 1480; a bus controller unit 1490; an integrated memory controller unit 1440; a group or one or more second coprocessors 1420, which may include integrated graphics logic, an image processor, an audio processor, and a video processor; and a static random access memory (SRAM) unit, i.e. Figure 4 The SRAM cell 1430 shown is a Direct Memory Access (DMA) cell, that is... Figure 4 The DMA unit 1460 shown is illustrated. In one embodiment, the second coprocessor 1420 includes a dedicated processor, such as, for example, a network or communication processor, a compression engine, general-purpose computing on graphics processing units (GPGPU), a high-throughput MIC processor, or an embedded processor.

[0166] SRAM cell 1430 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. The computer-readable storage medium stores instructions, specifically, temporary and permanent copies of the instructions. The instructions may include: instructions that, when executed by at least one processor, cause the SoC to implement the test case derivation method disclosed in embodiments of this application. When the instructions are executed on a computer, they cause the computer to perform the test case derivation method disclosed in embodiments of this application.

[0167] It is understood that, as used herein, the term “module” may refer to or include, or be part of, an application-specific integrated circuit (ASIC), electronic circuitry, a processor (shared, dedicated, or grouped) and / or memory that executes one or more software or firmware programs, combinational logic circuitry, and / or other suitable hardware components that provide the described functionality.

[0168] It is understood that in the various embodiments of this application, the processor may be a microprocessor, a digital signal processor, a microcontroller, etc., and / or any combination thereof. According to another aspect, the processor may be a single-core processor, a multi-core processor, etc., and / or any combination thereof.

[0169] The embodiments disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0170] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.

[0171] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0172] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, CD-ROMs, magneto-optical disks, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other forms of propagated signals. Therefore, machine-readable media includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.

[0173] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, the inclusion of structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.

[0174] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.

[0175] It should be noted that in the examples and description of this application, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0176] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art will understand that various changes in form and detail may be made thereto without departing from the scope of this application.

Claims

1. A test case derivation method, applied to electronic devices, characterized in that, The method includes: Obtain a first requirement entity related to the target requirement and a first test case corresponding to the first requirement entity, and perform structured processing on the target requirement to obtain a second requirement entity, wherein the first requirement entity, the second requirement entity, and the first test case all include multiple fields; By performing a difference analysis between the second requirement entity and the first requirement entity, a modification strategy for the first test case is determined. Based on the modification strategy, the first test case is modified to obtain the second test case corresponding to the target requirement.

2. The method according to claim 1, characterized in that, The requirement fields of both the first requirement entity and the second requirement entity include multiple of the following: requirement identifier, requirement title, requirement description, module, requirement status, requirement version, and requirement verification method; The fields of the first test case include: a set of test steps and a set of associated requirement identifiers. The set of test steps includes at least one test step, and each test step includes an operation description field and an expected result field. The set of associated requirement identifiers is used to indicate the requirement entity associated with the first test case.

3. The method according to claim 2, characterized in that, The step of performing a difference analysis between the second requirement entity and the first requirement entity to determine the modification strategy for the first test case includes: Perform a field-level comparison between the first requirement entity and the second requirement entity to determine the requirement differences; Based on the aforementioned requirement differences and the set of associated requirement identifiers for the first test case, the modification strategy corresponding to the test step is determined. The modification strategy includes at least one of the following: reuse, deletion, rewriting, and addition.

4. The method according to claim 3, characterized in that, The step of determining the modification strategy corresponding to the test step based on the requirement difference and the set of associated requirement identifiers of the first test case includes: If the test steps are applicable under the target requirements and are not affected by the differences in requirements, then the modification strategy is determined to be reuse. If the test steps are applicable under the target requirements and are affected by the differences in requirements, then the modification strategy is determined to be rewriting. If the test steps are not applicable under the target requirements, the modification strategy is determined to be deletion.

5. The method according to claim 4, characterized in that, The step of determining the modification strategy corresponding to the test step based on the requirement difference and the set of associated requirement identifiers of the first test case further includes: If the difference in requirements indicates that the target requirements include new test scenarios, the modification strategy corresponding to the test steps used to test the new test scenarios is determined to be "add". The newly added test scenario refers to a scenario that cannot be tested by the test step set of the first test case.

6. The method according to claim 3, characterized in that, The modification of the first test case based on the modification strategy to obtain the second test case corresponding to the target requirement includes: Input the first requirement entity, the second requirement entity, the requirement difference, the first test case, and the modification strategy into the first model to obtain the test case content output by the first model; The content of the test cases is validated; Upon successful verification, the second test case is obtained.

7. The method according to claim 6, characterized in that, The verification includes at least one of the following: A range check is generated to constrain the content of the test cases from being generated or modified beyond the part that needs to be modified. Decision consistency verification is used to ensure that the content of the test cases conforms to the modification strategy. Traceability verification is used to ensure that the test case content includes a modification basis description that can be traced back to the difference in requirements.

8. The method according to claim 6, characterized in that, The method further includes: Store the audit logs corresponding to the second test case; The audit log includes at least one of the following: the identifier of the first test case, the identifier of the second test case, the modification strategy, and the working log of the first model.

9. The method according to claim 8, characterized in that, The method further includes: When the first requirement entity or the first test case changes, it is checked whether the change conflicts with the second test case; If a conflict exists, based on the first test case, the changes made, and the second test case, the first model is invoked to obtain modification suggestions for the first and second test cases.

10. An electronic device, comprising a processor, a memory, and a communication interface, characterized in that, The memory is used to store instructions, and the processor is used to call and execute the instructions to implement the method as described in any one of claims 1 to 9.

11. A computer-readable medium, characterized in that, The readable medium stores instructions that, when executed on an electronic device, cause the electronic device to perform the method of any one of claims 1 to 9.

12. A computer program product, characterized in that, The program product includes computer instructions that, when executed by an electronic device, perform the method of any one of claims 1 to 9.