Test case generation method and device, computer device and storage medium
By using large target models to generate test cases in the financial testing field, the high technical threshold and difficulty in involving business personnel of existing tools have been solved, and efficient and accurate test case generation and flexible testing processes have been achieved.
Patent Information
- Application Number
- CN202411577237.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2044-11-05
AI Technical Summary
Existing automated testing tools and BDD tools in the financial testing field have high technical barriers and are difficult for business personnel to participate in, resulting in low efficiency in test case generation.
By receiving user-inputted business scenario descriptions, semantic analysis is performed using the target large model to generate key information, which is then mapped to a preset structure in the target format. Information integration and optimization are then performed to generate test cases that conform to the target testing tool.
It has achieved automated test case generation, which has improved generation efficiency and accuracy, lowered the technical threshold, enabled business personnel without technical backgrounds to participate in test case writing, and enhanced the compliance and flexibility of test cases.
Smart Images

Figure CN119645833B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence development and the field of financial technology, and in particular relates to a test case generation method and device, a computer device and a storage medium. BACKGROUND
[0002] In the field of financial testing, with the continuous development of technology and the increasing complexity of business requirements, automated testing has become an important means to ensure the quality and stability of financial software. At present, there are various automated testing tools and platforms on the market, such as Selenium, Appium and Cypress, etc., which have realized the automation of testing to a certain extent and greatly improved the testing efficiency. However, existing automated testing tools mostly rely on manual writing of test scripts. Testers not only need to have high programming skills, but also need to have a deep understanding and skilled mastery of the testing tools used. This dependence on technical ability limits the testing work to a certain extent by the skill level of the personnel, making it difficult to quickly adapt to rapidly changing business requirements.
[0003] At present, although the BDD (Behavior-Driven Development) methodology has been widely adopted and executable BDD test case writing has been realized through tools such as Cucumber, it still faces technical obstacles and communication barriers in actual application. The core idea of BDD is to describe business requirements in natural language and convert them into executable test cases, thereby enhancing the communication efficiency between developers, testers and business personnel. However, although existing BDD tools support writing test cases in natural language, writing these test cases still requires a certain understanding of DSL (Domain Specific Language) such as Gherkin. This technical requirement limits the participation of non-technical business personnel, making it difficult for them to directly participate in the writing of test cases and fully express their understanding of business requirements.
[0004] Therefore, existing automated testing tools and platforms still have significant deficiencies in supporting financial business testing. On the one hand, the technical threshold is high and testers need to have high professional skills; on the other hand, the application of BDD tools is also limited by the technical requirements of DSL, making it difficult for business personnel to directly participate in the writing of test cases, thereby causing low efficiency in generating test cases. SUMMARY
[0005] The purpose of the embodiments of the present application is to propose a test case generation method and device, a computer device and a storage medium to solve the technical problem of low efficiency in generating test cases in the existing financial business testing process.
[0006] To solve the above technical problems, the embodiment of the present application provides a test case generation method, which adopts the technical scheme as follows:
[0007] Receiving service scenario description information input by a user;
[0008] Inputting the service scenario description information into a preset target large model, performing semantic analysis on the service scenario description information by the target large model, and obtaining corresponding key information; wherein the number of the key information includes multiple;
[0009] Obtaining a target format corresponding to a target test tool;
[0010] Mapping each of the key information into a corresponding preset structure based on the target format, and obtaining a corresponding plurality of information structures;
[0011] Performing information integration processing on all the information structures, and obtaining a corresponding initial test case;
[0012] Performing optimization processing on the initial test case based on a preset optimization strategy, and obtaining a corresponding target test case;
[0013] Sending the target test case to the user.
[0014] Further, the step of performing optimization processing on the initial test case based on a preset optimization strategy, and obtaining a corresponding target test case, specifically includes:
[0015] Performing specification matching processing on the initial test case, and obtaining a corresponding first test case;
[0016] Performing syntax optimization processing on the first test case, and obtaining a corresponding second test case;
[0017] Performing format adjustment processing on the second test case, and obtaining a corresponding third test case;
[0018] Taking the third test case as the target test case.
[0019] Further, the step of sending the target test case to the user specifically includes:
[0020] Obtaining a target output format;
[0021] Performing format conversion processing on the target test case based on the target output format, and obtaining a converted first target test case;
[0022] Obtaining a preset data pushing mode;
[0023] Based on the data push method, the first target test case is sent to the user.
[0024] Furthermore, after the step of optimizing the initial test cases based on a preset optimization strategy to obtain the corresponding target test cases, the method further includes:
[0025] Invoke the preset adjustment tools;
[0026] Based on the adjustment tool, specified market feedback data corresponding to the target test case is obtained from a preset market data source;
[0027] The specified market feedback data is filtered to obtain the corresponding specified relevant data;
[0028] Based on the specified relevant data, the target test case is adjusted to obtain the adjusted second target test case.
[0029] The second target test case is then validated.
[0030] If the second target test case passes verification, the target test case is updated based on the second target test case.
[0031] Furthermore, after the step of optimizing the initial test cases based on a preset optimization strategy to obtain the corresponding target test cases, the method further includes:
[0032] Call the pre-built test environment;
[0033] Invoke the preset test execution engine;
[0034] In the test environment, the target test cases are tested based on the test execution engine, and test-related data are collected during the test process.
[0035] The test-related data is analyzed and processed to obtain the corresponding data analysis results;
[0036] Based on the data analysis results, a target test report corresponding to the target test cases is generated.
[0037] Furthermore, after the step of performing test processing on the target test case based on the test execution engine in the test environment and collecting test-related data during the test process, the method further includes:
[0038] Invoke the preset monitoring tools;
[0039] The monitoring tool collects performance metrics during the testing process corresponding to the target test cases;
[0040] analyze the performance indicators to obtain a corresponding performance analysis result;
[0041] based on the performance analysis result, perform corresponding adjustment processing on the test strategy of the target test case.
[0042] Further, after the step of performing optimization processing on the initial test case based on a preset optimization strategy to obtain a corresponding target test case, the method further includes:
[0043] obtaining a specified storage strategy corresponding to the target test case;
[0044] determining a specified storage medium corresponding to the target test case;
[0045] performing storage processing on the target test case based on the specified storage strategy and the specified storage medium.
[0046] To solve the above technical problems, the embodiments of the present application also provide a test case generation device, which adopts the following technical solutions:
[0047] a receiving module configured to receive service scenario description information input by a user;
[0048] a first analysis module configured to input the service scenario description information into a preset target large model, perform semantic analysis on the service scenario description information by using the target large model, and obtain corresponding key information; wherein the number of the key information includes multiple;
[0049] a first obtaining module configured to obtain a target format corresponding to a target test tool;
[0050] a mapping module configured to map each of the key information into a corresponding preset structure based on the target format, and obtain a corresponding plurality of information structures;
[0051] an integration module configured to perform information integration processing on all the information structures, and obtain a corresponding initial test case;
[0052] an optimization module configured to perform optimization processing on the initial test case based on a preset optimization strategy, and obtain a corresponding target test case;
[0053] a sending module configured to send the target test case to the user.
[0054] To solve the above technical problems, the embodiments of the present application also provide a computer device, which adopts the following technical solutions:
[0055] receive service scenario description information input by a user;
[0056] input the business scenario description information into a preset target large model, perform semantic analysis on the business scenario description information by using the target large model, and obtain corresponding key information; wherein the number of the key information includes multiple;
[0057] obtain a target format corresponding to a target test tool;
[0058] map each of the key information into a corresponding preset structure based on the target format, and obtain a plurality of information structures;
[0059] perform information integration processing on all the information structures, and obtain a corresponding initial test case;
[0060] perform optimization processing on the initial test case based on a preset optimization strategy, and obtain a corresponding target test case;
[0061] send the target test case to the user.
[0062] To solve the above technical problems, the embodiment of the present application also provides a computer readable storage medium, which adopts the technical scheme as follows:
[0063] receive business scenario description information input by a user;
[0064] input the business scenario description information into a preset target large model, perform semantic analysis on the business scenario description information by using the target large model, and obtain corresponding key information; wherein the number of the key information includes multiple;
[0065] obtain a target format corresponding to a target test tool;
[0066] map each of the key information into a corresponding preset structure based on the target format, and obtain a plurality of information structures;
[0067] perform information integration processing on all the information structures, and obtain a corresponding initial test case;
[0068] perform optimization processing on the initial test case based on a preset optimization strategy, and obtain a corresponding target test case;
[0069] send the target test case to the user.
[0070] Compared with the prior art, the embodiment of the present application has the following beneficial effects:
[0071] The application first receives the service scenario description information input by the user; then inputs the service scenario description information into a preset target large model, performs semantic analysis on the service scenario description information through the target large model, and obtains corresponding key information; wherein the number of key information includes multiple; then obtains a target format corresponding to a target test tool; subsequently, based on the target format, each key information is respectively mapped into a corresponding preset structure to obtain a plurality of corresponding information structures; and all information structures are integrated and processed to obtain a corresponding initial test case; further, based on a preset optimization strategy, the initial test case is optimized to obtain a corresponding target test case; finally, the target test case is sent to the user. After receiving the service scenario description information input by the user, the application can automatically convert the service scenario description information into an initial test case based on the target format corresponding to the target test tool based on the use of the target large model, thereby improving the generation efficiency and intelligence of the test case. In addition, the initial test case is optimized based on the optimization strategy to obtain the corresponding target test case, thereby further improving the accuracy and compliance of the target test case. BRIEF DESCRIPTION OF DRAWINGS
[0072] In order to more clearly illustrate the schemes in the application, the drawings needed in the description of the embodiments of the application will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0073] Figure 1 is an exemplary system architecture diagram to which the application can be applied;
[0074] Figure 2 Flow chart of one embodiment of the test case generation method according to the application;
[0075] Figure 3 is a structural schematic diagram of one embodiment of the test case generation device according to the application;
[0076] Figure 4 is a structural schematic diagram of one embodiment of the computer device according to the application. DETAILED DESCRIPTION
[0077] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terms used in the specification are intended to describe the particular embodiments and are not intended to limit the application; the terms "include" and "have" and their any variations used in the specification and the claims and the above description of drawings are intended to cover the non-exclusive inclusion; the terms "first", "second" and the like used in the specification and the claims and the above description of drawings are intended to distinguish different objects, not to describe a particular order.
[0078] Reference herein to "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive or alternative embodiments. It is expressly understood that the embodiments described herein are combinable with each other.
[0079] In order to make the person skilled in the art better understand the scheme of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings below.
[0080] As shown in Figure 1 The system architecture 100 can include a terminal device 101, a network 102 and a server 103, and the terminal device 101 can be a notebook computer 1011, a tablet computer 1012 or a mobile phone 1013. The network 102 is a medium for providing a communication link between the terminal device 101 and the server 103. The network 102 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0081] The user can use the terminal device 101 to interact with the server 103 through the network 102 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0082] The terminal device 101 can be various electronic devices with a display screen and supporting web browsing, in addition to the notebook computer 1011, the tablet computer 1012 or the mobile phone 1013, the terminal device 101 can also be an electronic book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer and a desktop computer, etc.
[0083] The server 103 can be a server providing various services, for example, a background server providing support for a page displayed on the terminal device 101.
[0084] It should be noted that the test case generation method provided by the embodiments of the present application is generally executed by a server / terminal device, and accordingly, the test case generation apparatus is generally arranged in the server / terminal device.
[0085] It should be understood that, Figure 1 The number of terminal devices, networks and servers in
[0086] With reference to Figure 2 , a flow chart of one embodiment of the test case generation method according to the present application is shown. The order of the steps in the flow chart can be changed according to different needs, and some steps can be omitted. The test case generation method provided by the embodiments of the present application can be applied to any scenario requiring test case generation, and thus the test case generation method can be applied to products in these scenarios, for example, test case generation in the financial insurance field. The test case generation method includes the following steps:
[0087] Step S201, receiving service scenario description information input by a user.
[0088] In the present embodiment, the test case generation method is run on an electronic device (for example Figure 1The server / terminal device shown) can obtain the service scenario description information through a wired connection or a wireless connection. It should be noted that the wireless connection can include, but is not limited to, 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other now known or future developed wireless connection methods. The execution subject of the present application can be a use case generation system with a target large model, or simply a system. The user can input the service scenario description information corresponding to the test case to be generated in the front-end interface of the system by using natural language, for example, "buy a fund in a specified application, the amount is 10000 yuan, select the stable risk level, and confirm the transaction."
[0089] In step S202, the service scenario description information is input into a preset target large model, and the target large model is used to perform semantic analysis on the service scenario description information to obtain corresponding key information. The number of key information includes multiple.
[0090] In this embodiment, the model selection of the target large model is not specifically limited and can be selected according to actual needs, for example, a GPT model can be used. After inputting the service scenario description information into the target large model, the target large model will use natural language processing technology (such as word segmentation, part-of-speech tagging, named entity recognition, etc.) to analyze the input service scenario description information and identify key information points, such as application name (specified application), operation type (buy fund), involved amount (10000 yuan), risk level (stable type), and transaction confirmation.
[0091] In step S203, a target format corresponding to a target test tool is obtained.
[0092] In this embodiment, the target test tool is a Cucumber test tool. The target format refers to the BDD format (Given-When-Then) of the Cucumber test tool.
[0093] In step S204, each key information is mapped into a corresponding preset structure based on the target format to obtain a plurality of information structures.
[0094] In this embodiment, the target large model maps the extracted key information into the corresponding preset structure according to the BDD format (Given-When-Then) of Cucumber. The above-mentioned preset structure can at least include Given structure, When structure and Then structure. Specifically, the Given part: the target large model generates a Given sentence (Given information structure) according to the preconditions of the business scenario, such as the user login state, account balance, etc. For example, “the user has logged in to the specified application, and the account balance is greater than 10,000 yuan”. The When part: the target large model generates a When sentence (When information structure) according to the user's operation behavior, such as selecting a fund, inputting an amount, selecting a risk level, etc. For example, “the user selects to purchase a fund, inputs a purchase amount of 10,000 yuan, selects a risk level of stable type, and clicks to confirm the transaction”. The Then part: the AI large model generates a Then sentence (Then information structure) according to the expected business result, such as purchase success, account balance change, fund addition to the investment portfolio, etc. For example, “the system should display purchase success, the account balance should be reduced by 10,000 yuan, and the user's investment portfolio should contain the fund”.
[0095] In step S205, information integration processing is performed on all the information structures to obtain corresponding initial test cases.
[0096] In this embodiment, by integrating the information contained in all information structures together, for example, integrating the information of the three parts of Given, When and Then together, a complete initial test case can be formed.
[0097] In step S206, the initial test case is optimized based on a preset optimization strategy to obtain a corresponding target test case.
[0098] In this embodiment, the specific implementation process of optimizing the initial test case based on the preset optimization strategy to obtain the corresponding target test case will be further described in detail in the subsequent specific embodiments, and will not be described here.
[0099] In step S207, the target test case is sent to the user.
[0100] In this embodiment, the specific implementation process of sending the target test case to the user will be further described in detail in the subsequent specific embodiments, and will not be described here.
[0101] The application first receives the service scenario description information input by the user; then inputs the service scenario description information into a preset target large model, performs semantic analysis on the service scenario description information through the target large model, and obtains corresponding key information; wherein the number of key information includes multiple; then obtains a target format corresponding to a target test tool; subsequently, based on the target format, each key information is mapped into a corresponding preset structure to obtain a corresponding plurality of information structures; and all information structures are integrated and processed to obtain a corresponding initial test case; further, based on a preset optimization strategy, the initial test case is optimized to obtain a corresponding target test case; finally, the target test case is sent to the user. After receiving the service scenario description information input by the user, the application can automatically convert the service scenario description information into an initial test case based on the target format corresponding to the target test tool through the use of the target large model, improving the generation efficiency and intelligence of the test case. In addition, the initial test case is optimized based on the optimization strategy to obtain the corresponding target test case, further improving the accuracy and compliance of the target test case.
[0102] In some optional implementations, step S206 includes the following steps:
[0103] The initial test case is subjected to specification matching processing to obtain a corresponding first test case.
[0104] In this embodiment, the initial test case generated can be adjusted in format according to the specifications and requirements of the target test tool to conform to the specifications of the target test tool, thereby obtaining a corresponding first test case.
[0105] The first test case is subjected to syntax optimization processing to obtain a corresponding second test case.
[0106] In this embodiment, the syntax of the first test case is optimized to make it more consistent with the expression habits of natural language. Specifically, it can include adjusting sentence structure, correcting spelling errors, replacing synonyms, etc., to improve the readability and usability of the test case.
[0107] The second test case is subjected to format adjustment processing to obtain a corresponding third test case.
[0108] In this embodiment, the second test case is subjected to format verification to ensure that it conforms to the format requirements of the target test tool. If format errors or non-compliance with specifications are found in the second test case, further correction or user modification will be prompted to obtain a modified third test case.
[0109] The third test case is taken as the target test case.
[0110] The initial test case is subjected to specification matching processing to obtain a corresponding first test case. The first test case is subjected to syntax optimization processing to obtain a corresponding second test case. The second test case is subjected to format adjustment processing to obtain a corresponding third test case. The third test case is taken as the target test case. The initial test case is subjected to specification matching processing, syntax optimization processing and format adjustment processing, so that the optimization processing of the initial test case can be intelligently and efficiently completed, and the target test case conforming to the format specification of the target test tool is generated, thereby effectively improving the normativity and accuracy of the generated target test case.
[0111] In some optional implementation manners of the embodiment, step S207 includes the following steps:
[0112] The target output format is obtained.
[0113] In the embodiment, the selection of the target output format is not specifically limited, and different output formats can be selected according to actual user demand or project requirements, for example, Markdown, a Word document, an Excel table or the like can be selected as the output format.
[0114] The target test case is subjected to format conversion processing based on the target output format to obtain a converted first target test case.
[0115] In the embodiment, the target test case is converted into the target output format to obtain the converted first target test case.
[0116] A preset data pushing manner is obtained.
[0117] In the embodiment, the selection of the data pushing manner is not specifically limited, for example, an interface display, information pushing, short message sending or the like can be adopted.
[0118] The first target test case is sent to the user based on the data pushing manner.
[0119] In the embodiment, the data pushing manner can be adopted to send the first target test case to the user.
[0120] The application obtains a target output format, then performs format conversion processing on the target test case based on the target output format to obtain a converted first target test case, then obtains a preset data pushing manner, and subsequently sends the first target test case to the user based on the data pushing manner. After the target test case corresponding to the business scenario description information is generated based on the use of the target large model, the target test case is intelligently subjected to format conversion processing based on the use of the target output format to obtain the converted first target test case, and then the first target test case is sent to the user based on the preset data pushing manner, so that the user can conveniently use and read, and the use experience of the user is improved.
[0121] In some optional implementations, after step S206, the electronic device described above can further perform the following steps:
[0122] A preset adjustment tool is called.
[0123] In this embodiment, the adjustment tool can be specifically an adjustment tool based on ReAct technology. The rapid changes in the financial market require real-time response from the test tool. The adjustment tool based on ReAct technology enables the system to adjust according to real-time feedback during the test process. For example, if the market data changes during the execution of the "fund purchase" test, causing the original purchase strategy to be no longer applicable, the adjustment tool based on ReAct technology will automatically generate new test cases to adjust the purchase amount or fund selection, ensuring that the test cases always conform to the actual business logic. This dynamic adjustment capability makes the test process more flexible and can cope with complex and changing financial market environments.
[0124] Based on the adjustment tool, specified market feedback data corresponding to the target test case is obtained from a preset market data source.
[0125] In this embodiment, the market data source can include a financial transaction platform, a market intelligence service, a sales system, etc.
[0126] The specified market feedback data is filtered to obtain corresponding specified related data.
[0127] In this embodiment, the specified market feedback data can be parsed and filtered to extract key data essential for test case adjustment, such as fund price changes, sales status changes, etc.
[0128] Based on the specified related data, the target test case is adjusted to obtain an adjusted second target test case.
[0129] In the embodiment, the target test case is adjusted by specifying the relevant data, such as changing the purchase amount, selecting an alternative fund, etc., to ensure that the test case always conforms to the actual business logic, thereby obtaining the adjusted second target test case.
[0130] In addition, since the original test case cannot be executed due to market changes, the adjustment tool generates a new test case to ensure the comprehensiveness and accuracy of the test.
[0131] The second target test case is verified.
[0132] In the embodiment, after obtaining the second target test case, the second target test case is further verified to ensure that it is logically correct, executable, and meets expectations.
[0133] If the second target test case passes the verification, the target test case is updated based on the second target test case.
[0134] In the embodiment, after the second target test case passes the verification, the second target test case is added to the test case library and replaces the original target test case for subsequent testing.
[0135] The application calls a preset adjustment tool, obtains specified market feedback data corresponding to the target test case from a preset market data source based on the adjustment tool, filters the specified market feedback data to obtain corresponding specified relevant data, adjusts the target test case based on the specified relevant data to obtain an adjusted second target test case, subsequently verifies the second target test case, and if the second target test case passes the verification, updates the target test case based on the second target test case. The application obtains specified market feedback data corresponding to the target test case from a market data source by calling an adjustment tool, filters the specified market feedback data to obtain specified relevant data, adjusts the target test case based on the specified relevant data to obtain an adjusted second target test case, and subsequently updates the target test case based on the second target test case if the second target test case passes the verification. The application can dynamically adjust and real-time optimize the test case based on the use of the adjustment tool, effectively ensures that the test case always conforms to market changes and business logic, thereby improving the accuracy and comprehensiveness of the test.
[0136] In some optional implementations, after step S206, the above-mentioned electronic device can further perform the following steps:
[0137] A test environment previously built is called.
[0138] In this embodiment, a test environment corresponding to the target test cases is pre-configured according to actual testing needs, including the required test server, database, network configuration, etc. Agent-based monitoring tools can be used to monitor and manage these resources, ensuring their availability and stable performance during testing.
[0139] During test execution, agent-based monitoring tools act as intelligent agents, dynamically monitoring and managing the test process. These tools not only automatically allocate test resources but also adjust test strategies based on the real-time environment. For example, in a "fund purchase" scenario, the agent monitors real-time changes in market data and adjusts test data or regenerates test steps accordingly to ensure accurate test results. Furthermore, the monitoring tools can automatically adjust resource allocation based on system load to ensure efficient test execution.
[0140] Invoke the preset test execution engine.
[0141] In this embodiment, the test execution engine is a pre-built engine responsible for automatically executing tests according to the steps and conditions defined in the test cases.
[0142] In the test environment, the target test cases are tested based on the test execution engine, and test-related data is collected during the test process.
[0143] In this embodiment, during the testing process of the target test case by the test execution engine, all relevant data are collected, including the execution results of the test steps, system logs, exception information, etc.
[0144] The test-related data is analyzed and processed to obtain the corresponding data analysis results.
[0145] In this embodiment, successful and failed steps can be identified by parsing the collected test-related data. For failed steps, the reasons for failure are further analyzed, such as input errors, system defects, and insufficient resources, and then the corresponding data analysis results are integrated.
[0146] Based on the data analysis results, a target test report corresponding to the target test cases is generated.
[0147] In the embodiment, the generated data analysis result can be filled into a pre-constructed test report template to obtain a target test report corresponding to the target test case. The filling process involves operations such as data filtering, sorting, and summarizing to ensure that the report content is accurate and easy to understand. In addition, the test report template is pre-designed, including the structure, content, and style of the report. The template test report can be customized according to user needs and project characteristics.
[0148] The application calls a pre-built test environment, then calls a preset test execution engine, then performs test processing on the target test case in the test environment based on the test execution engine, collects test-related data in the test process, subsequently analyzes and processes the test-related data to obtain corresponding data analysis results, and finally generates a target test report corresponding to the target test case based on the data analysis results. The application performs test processing on the target test case in the pre-built test environment based on the use of the test execution engine, collects test-related data in the test process, then analyzes and processes the test-related data to obtain corresponding data analysis results, and automatically generates a target test report corresponding to the target test case based on the data analysis results, thereby intelligently realizing the automation and intelligentization of test execution and result analysis for the target test case, effectively improving test efficiency and quality, and providing strong support for project decision-making.
[0149] In some optional implementation manners of the embodiment, after the step of performing test processing on the target test case in the test environment based on the test execution engine and collecting test-related data in the test process, the electronic device can further perform the following steps:
[0150] Calling a preset monitoring tool.
[0151] In the embodiment, the monitoring tool can be a tool with a monitoring function based on Agent technology.
[0152] Collecting performance indicators in the test process corresponding to the target test case based on the monitoring tool.
[0153] In the embodiment, the monitoring tool collects key performance indicators (KPIs) such as page loading speed, network delay, and server response time in the test process of using the test execution engine to perform test processing on the target test case.
[0154] Analyzing and processing the performance indicators to obtain corresponding performance analysis results.
[0155] In the embodiment, the collected performance indicators can be analyzed and processed by using statistical analysis and machine learning techniques to evaluate performance bottlenecks and potential problems in the test process, and to identify abnormal behavior or performance degradation trends, and then the corresponding performance analysis results are integrated.
[0156] Based on the performance analysis results, the test strategy of the target test case is adjusted correspondingly.
[0157] In the embodiment, the performance analysis results can be used to develop corresponding adjustment strategies to deal with performance problems or resource bottlenecks. The adjustment strategy may include adjusting the waiting time, increasing the number of retries, changing the number of concurrent users, etc. Then the adjustment strategy is automatically executed to adjust the test strategy of the target test case. For example, if the page loading speed is slow, the monitoring tool will increase the waiting time or adjust the network configuration to reduce the delay. The effect of the adjusted monitoring strategy is evaluated to determine whether the performance has improved. In addition, if the adjustment is effective, the current strategy is maintained; if the effect is not good, the monitoring tool will try other strategies or make further adjustments. In addition, the monitoring tool can also collect feedback data during the adjustment of the test strategy of the target test case, which can be used to optimize future resource allocation and monitoring strategies.
[0158] The application calls a preset monitoring tool, collects performance indicators in the test process corresponding to the target test case based on the monitoring tool, analyzes and processes the performance indicators to obtain corresponding performance analysis results, and adjusts the test strategy of the target test case based on the performance analysis results. In the test process of testing the target test case based on the test execution engine, the performance indicators in the test process corresponding to the target test case are collected based on the use of the monitoring tool, and the performance indicators are analyzed and processed to obtain performance analysis results, and then the test strategy of the target test case is automatically adjusted based on the obtained performance analysis results, so that intelligent management and resource optimization can be realized in the test process of the target test case, and efficient execution of the test process and rational use of resources are effectively ensured.
[0159] In some optional implementation manners of the embodiment, after step S206, the electronic device can further perform the following steps:
[0160] Obtain a specified storage strategy corresponding to the target test case.
[0161] In the embodiment, the specified storage strategy can use a loop coverage or a timing backup strategy to ensure that the specified storage strategy will not be lost due to insufficient storage space.
[0162] determine a specified storage medium corresponding to the target test case.
[0163] In the embodiment, the selection of the specified storage medium is not specifically limited, for example, can include a local database, a file system, a cloud server, a blockchain, etc.
[0164] store the target test case based on the specified storage strategy and the specified storage medium.
[0165] In the embodiment, the target test case can be stored in the specified storage medium in a storage manner of the specified storage strategy.
[0166] The application obtains the specified storage strategy corresponding to the target test case, then determines the specified storage medium corresponding to the target test case, and subsequently stores the target test case based on the specified storage strategy and the specified storage medium. After automatically generating the target test case, the application intelligently obtains the specified storage strategy corresponding to the target test case, determines the specified storage medium corresponding to the target test case, and then stores the target test case based on the specified storage strategy and the specified storage medium, so as to ensure the data security of the target test case and ensure that the target test case will not be lost due to insufficient storage space, effectively improving the storage intelligence of the target test case.
[0167] In some optional implementation manners, the obtained user information seeks user consent and meets the requirements of relevant laws and relevant policies.
[0168] In addition, the non-company software tools or components appearing in the embodiments of the application are only examples and do not represent actual use.
[0169] In addition, the application combines AI large models, agents and ReAct technologies to provide an intelligent and dynamically adaptive financial business UI automation testing scheme. It not only solves the deficiencies of the prior art in handling complex financial scenarios, but also reduces technical barriers, improves testing efficiency and flexibility, provides strong technical support for the testing work of the financial industry, and brings the following benefits:
[0170] 1) Reduce technical barriers and improve collaboration efficiency: traditional BDD tools require users to have certain programming skills. The application generates natural language BDD test cases through AI large models, significantly reducing technical barriers, so that non-technical business personnel can directly participate in the writing and auditing of test cases. This way not only improves the collaboration efficiency within the team, but also ensures that the test cases are highly consistent with the actual business requirements, reducing errors caused by poor communication.
[0171] 2) Enhancing the intelligence and flexibility of testing: By introducing Agent technology, the resource management and strategy adjustment in the testing process have been intelligently improved. Agents not only can automatically allocate and adjust testing resources, but also can make dynamic responses according to real-time environment. This is particularly important in the financial field, because the rapid changes in the market require testing tools to adjust the testing content in a timely manner to reflect the actual situation. For complex financial business scenarios, the intelligent management of Agents ensures the efficiency and flexibility of the testing process.
[0172] 3) Dynamically responding to financial market changes: The financial market changes rapidly, and traditional testing tools often struggle to adapt to real-time data changes. The ReAct technology in the invention enables the system to adjust during testing based on real-time feedback. For example, in the testing scenario of fund purchases, ReAct can automatically adjust the testing steps based on changes in the fund market, ensuring that the test cases are always effective and accurate. This dynamic adjustment capability enables the testing system to adapt to the rapid changes in the financial market, ensuring the reliability and consistency of the test results.
[0173] 4) Enhancing the comprehensiveness and business consistency of testing: By deeply integrating financial business logic and AI large model generated test cases, the comprehensiveness and business consistency of testing are ensured. In the testing scenario of fund purchases, the system can automatically generate test cases covering various business processes and adjust in real time according to market changes. This high level of business consistency ensures that the test results can truly reflect the business process, helping to discover potential risks and system vulnerabilities.
[0174] 5) Improving testing efficiency and shortening development cycle: Traditional testing processes often require a lot of time to write, adjust and execute test cases, while the invention significantly improves testing efficiency through automated generation and intelligent management. In the financial industry, time is money, and by shortening the testing cycle and improving test coverage, the invention can help financial institutions bring products to market faster while ensuring product quality and compliance.
[0175] In summary, the application in the field of financial testing not only solves the shortcomings of existing technology, but also significantly improves the efficiency, flexibility and accuracy of testing through intelligence, dynamic adjustment and automated generation. This innovative solution provides a powerful and efficient testing tool for financial institutions, better responding to complex business scenarios and rapidly changing market demands.
[0176] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution, and the execution order of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the invention.
[0177] It is emphasized that, in order to further ensure the privacy and security of the above-mentioned target test cases, the above-mentioned target test cases can also be stored in a node of a block chain.
[0178] The block chain referred to in the present application is a new application mode of distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm and other computer technologies. The block chain is essentially a decentralized database, which is a series of data blocks associated using cryptographic methods, each data block containing a batch of network transaction information for verifying the validity (anti-fake) of the information and generating the next block. The block chain can include a block chain underlying platform, a platform product service layer, and an application service layer.
[0179] The embodiments of the present application can acquire and process related data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the use of digital computers or digital computer-controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. Theory, method, technology and application system.
[0180] The artificial intelligence basic technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. Artificial intelligence software technology mainly includes computer vision technology, robot technology, biometric technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc. Several major directions.
[0181] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by computer readable instructions instructing related hardware, and the computer readable instructions can be stored in a computer readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments of each method. Among them, the storage medium can be a magnetic disc, an optical disc, a read-only memory (ROM) and other non-volatile storage media, or a random access memory (RAM) and the like.
[0182] It should be understood that although each step in the flowchart of the accompanying drawings is shown in sequence according to the direction of the arrow, these steps are not necessarily executed in sequence according to the direction of the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and they can be executed in other sequences. Moreover, at least part of the steps in the flowchart of the accompanying drawings can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence is not necessarily sequential, but can be alternately executed with at least part of other steps or sub-steps or stages of other steps.
[0183] Further referring to Figure 3 , as an implementation of the method shown in the above Figure 2 , the present application provides an embodiment of a test case generation device, which corresponds to the method embodiment shown in Figure 2 , and the device can be specifically applied to various electronic devices.
[0184] As shown in Figure 3 , the test case generation device 300 described in the embodiment includes a receiving module 301, a first analysis module 302, a first acquisition module 303, a mapping module 304, an integration module 305, an optimization module 306, and a sending module 307. Among them:
[0185] The receiving module 301 is configured to receive the service scenario description information input by the user.
[0186] The first analysis module 302 is configured to input the service scenario description information into a preset target large model, perform semantic analysis on the service scenario description information through the target large model, and obtain corresponding key information; wherein the number of key information includes multiple.
[0187] The first acquisition module 303 is configured to acquire a target format corresponding to a target test tool.
[0188] The mapping module 304 is configured to map each of the key information into a corresponding preset structure based on the target format, and obtain a plurality of information structures.
[0189] The integration module 305 is configured to perform information integration processing on all the information structures, and obtain a corresponding initial test case.
[0190] The optimization module 306 is configured to perform optimization processing on the initial test case based on a preset optimization strategy, and obtain a corresponding target test case.
[0191] The sending module 307 is configured to send the target test case to the user.
[0192] In the embodiment, the operations of the modules or units described above are respectively used to perform the steps of the test case generation method of the foregoing embodiments, and will not be described here again.
[0193] In some optional implementations of the embodiment, the optimization module 306 includes:
[0194] a first processing submodule, configured to perform specification matching processing on the initial test case to obtain a corresponding first test case;
[0195] a second processing submodule, configured to perform syntax optimization processing on the first test case to obtain a corresponding second test case;
[0196] a third processing submodule, configured to perform format adjustment processing on the second test case to obtain a corresponding third test case;
[0197] a determination submodule, configured to determine the third test case as the target test case.
[0198] In the embodiment, the operations of the modules or units described above are respectively used to perform the steps of the test case generation method of the foregoing embodiments, and will not be described here again.
[0199] In some optional implementations of the embodiment, the sending module 307 includes:
[0200] a first obtaining submodule, configured to obtain a target output format;
[0201] a conversion submodule, configured to perform format conversion processing on the target test case based on the target output format to obtain a converted first target test case;
[0202] a second obtaining submodule, configured to obtain a preset data pushing manner;
[0203] a sending submodule, configured to send the first target test case to the user based on the data pushing manner.
[0204] In the embodiment, the operations of the modules or units described above are respectively used to perform the steps of the test case generation method of the foregoing embodiments, and will not be described here again.
[0205] In some optional implementations of the embodiment, the test case generation apparatus further includes:
[0206] a first calling module, configured to call a preset adjustment tool;
[0207] The second obtaining module is configured to obtain specified market feedback data corresponding to the target test case from a preset market data source based on the adjustment tool.
[0208] The filtering module is configured to perform filtering processing on the specified market feedback data to obtain corresponding specified related data.
[0209] The first adjustment module is configured to perform adjustment processing on the target test case based on the specified related data to obtain a second target test case after adjustment.
[0210] The verification module is configured to perform verification processing on the second target test case.
[0211] The updating module is configured to perform updating processing on the target test case based on the second target test case if the second target test case passes the verification.
[0212] In the embodiment, the above modules or units are respectively used for performing operations corresponding to steps of the test case generation method of the foregoing embodiments, and thus will not be described here again.
[0213] In some optional implementations of the embodiment, the test case generation apparatus further includes:
[0214] The second calling module is configured to call a pre-built test environment.
[0215] The third calling module is configured to call a preset test execution engine.
[0216] The test module is configured to perform test processing on the target test case based on the test execution engine in the test environment, and collect test related data in a test process.
[0217] The second analysis module is configured to perform analysis processing on the test related data to obtain a corresponding data analysis result.
[0218] The generation module is configured to generate a target test report corresponding to the target test case based on the data analysis result.
[0219] In the embodiment, the above modules or units are respectively used for performing operations corresponding to steps of the test case generation method of the foregoing embodiments, and thus will not be described here again.
[0220] In some optional implementations of the embodiment, the test case generation apparatus further includes:
[0221] The fourth calling module is configured to call a preset monitoring tool.
[0222] The collection module is configured to collect a performance index in a test process corresponding to the target test case based on the monitoring tool.
[0223] The third analysis module is configured to analyze the performance index to obtain a corresponding performance analysis result.
[0224] The second adjustment module is configured to perform corresponding adjustment processing on a test strategy of the target test case based on the performance analysis result.
[0225] In the embodiment, the above modules or units are respectively used for performing operations corresponding to the steps of the test case generation method of the foregoing embodiments, and thus will not be described here.
[0226] In some optional implementations of the embodiment, the test case generation apparatus further includes:
[0227] The third acquisition module is configured to acquire a specified storage strategy corresponding to the target test case.
[0228] The determination module is configured to determine a specified storage medium corresponding to the target test case.
[0229] The storage module is configured to perform storage processing on the target test case based on the specified storage strategy and the specified storage medium.
[0230] In the embodiment, the above modules or units are respectively used for performing operations corresponding to the steps of the test case generation method of the foregoing embodiments, and thus will not be described here.
[0231] To solve the above technical problem, the embodiment of the present application further provides a computer device. For details, please refer to Figure 4 , Figure 4 The basic structure block diagram of the computer device of the embodiment is shown in the following figure.
[0232] The computer device 4 includes a memory 41, a processor 42, and a network interface 43, which are communicatively connected via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure, but it should be understood that not all of the shown components are required to be implemented, and more or fewer components can be alternatively implemented. Among them, those skilled in the art can understand that the computer device herein is a device capable of automatically performing numerical calculation and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0233] The computer device can be a desktop computer, a notebook computer, a palm computer, a cloud server, and the like. The computer device can interact with the user through a keyboard, a mouse, a remote controller, a touchpad, a voice control device, and the like.
[0234] The memory 41 includes at least one type of readable storage medium, including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, and the like. Of course, the memory 41 can also include both the internal storage unit and the external storage device of the computer device 4. In the present embodiment, the memory 41 is generally used to store an operating system and various application software installed in the computer device 4, such as computer readable instructions of the test case generation method, and the like. In addition, the memory 41 can also be used to temporarily store various data that have been output or will be output.
[0235] The processor 42 may, in some embodiments, be a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 42 is generally used to control the overall operation of the computer device 4. In the present embodiment, the processor 42 is configured to execute computer-readable instructions stored in the memory 41 or to process data, such as computer-readable instructions of the test case generation method.
[0236] The network interface 43 may include a wireless network interface or a wired network interface, and is generally used to establish a communication connection between the computer device 4 and other electronic devices.
[0237] The present application also provides another embodiment, i.e., a computer-readable storage medium storing computer-readable instructions executable by at least one processor to cause the at least one processor to perform the steps of the test case generation method as described above.
[0238] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software and a necessary general hardware platform, and of course, can also be implemented by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) and includes a number of instructions for causing a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device) to perform the methods described in the various embodiments of the present application.
[0239] Obviously, the above-described embodiments are only some embodiments of the present application, rather than all embodiments, and the drawings show the preferred embodiments of the present application, but do not limit the patent scope of the present application. The present application can be implemented in many different forms, and conversely, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent replacements to some technical features. Any equivalent structure made by using the contents of the specification and drawings, directly or indirectly applied to other related technical fields, is also within the scope of the patent protection of the present application.
Claims
1. A method for generating test cases, characterized by, The method comprises the following steps: receiving user input business scenario description information; inputting the business scenario description information into a preset target large model, performing semantic analysis on the business scenario description information by the target large model, and obtaining corresponding key information; wherein the number of key information includes multiple; obtaining a target format corresponding to a target test tool; wherein the target test tool is a Cucumber test tool, and the target format is a BDD format of the Cucumber test tool; mapping each key information to a corresponding preset structure based on the target format to obtain a corresponding plurality of information structures; wherein the preset structure includes Given structure, When structure, and Then structure; performing information integration processing on all information structures to obtain a corresponding initial test case; optimizing the initial test case based on a preset optimization strategy to obtain a corresponding target test case; sending the target test case to the user; wherein the step of optimizing the initial test case based on the preset optimization strategy to obtain the corresponding target test case specifically comprises: performing standard matching processing on the initial test case to obtain a corresponding first test case; performing syntax optimization processing on the first test case to obtain a corresponding second test case; performing format adjustment processing on the second test case to obtain a corresponding third test case; taking the third test case as the target test case; wherein after the step of optimizing the initial test case based on the preset optimization strategy to obtain the corresponding target test case, further comprising: calling a preset adjustment tool; the adjustment tool is an adjustment tool based on ReAct technology; based on the adjustment tool, obtaining specified market feedback data corresponding to the target test case from a preset market data source; the market data source includes a financial transaction platform, a market intelligence service, and a sales system; filtering the specified market feedback data to obtain corresponding specified related data; the specified related data is key data critical to test case adjustment, including fund price changes and sales state change data; based on the specified related data, adjusting the target test case to ensure that the target test case always conforms to the actual business logic, and obtaining an adjusted second target test case; verifying the second target test case; if the second target test case passes the verification, updating the target test case based on the second target test case.
2. The test case generation method of claim 1, wherein, The step of sending the target test case to the user specifically comprises: obtaining a target output format; based on the target output format, performing format conversion processing on the target test case to obtain a converted first target test case; obtaining a preset data pushing method; based on the data pushing method, sending the first target test case to the user.
3. The test case generation method of claim 1, wherein, after the step of optimizing the initial test case based on the preset optimization strategy to obtain the corresponding target test case, further comprising: Call the pre-built test environment; Call the preset test execution engine; In the test environment, based on the test execution engine, the target test case is tested and processed, and the test related data in the test process is collected; The test related data is analyzed and processed to obtain the corresponding data analysis result; Based on the data analysis result, a target test report corresponding to the target test case is generated.
4. The test case generation method of claim 3, wherein, After the step of testing and processing the target test case based on the test execution engine in the test environment and collecting test related data in the test process, the following steps are further included: Call the preset monitoring tool; Based on the monitoring tool, the performance indicators in the test process corresponding to the target test case are collected; The performance indicators are analyzed and processed to obtain the corresponding performance analysis result; Based on the performance analysis result, the test strategy of the target test case is adjusted and processed.
5. The method of claim 1, wherein, After the step of optimizing the initial test case based on the preset optimization strategy to obtain the corresponding target test case, the following steps are further included: Obtain the specified storage strategy corresponding to the target test case; Determine the specified storage medium corresponding to the target test case; Based on the specified storage strategy and the specified storage medium, the target test case is stored.
6. An apparatus for generating test cases, characterized by: Comprise: The receiving module is used for receiving the business scenario description information input by the user; The first analysis module is used for inputting the business scenario description information into a preset target large model, and performing semantic analysis on the business scenario description information through the target large model to obtain corresponding key information; wherein the number of key information includes multiple; The first acquisition module is used for acquiring a target format corresponding to a target test tool; wherein the target test tool is a Cucumber test tool, and the target format is a BDD format of the Cucumber test tool; The mapping module is used for mapping each key information to a corresponding preset structure based on the target format to obtain a corresponding plurality of information structures; wherein the preset structure includes Given structure, When structure and Then structure; The integration module is used for performing information integration processing on all information structures to obtain a corresponding initial test case; The optimization module is used for optimizing the initial test case based on a preset optimization strategy to obtain a corresponding target test case; The sending module is used for sending the target test case to the user; The optimization module comprises: The first processing submodule is used for performing specification matching processing on the initial test case to obtain a corresponding first test case; The second processing submodule is used for performing syntax optimization processing on the first test case to obtain a corresponding second test case; The third processing submodule is used for performing format adjustment processing on the second test case to obtain a corresponding third test case; The determination submodule is used for taking the third test case as the target test case; The test case generation device further comprises: The first calling module is configured to call a preset adjustment tool; the adjustment tool is an adjustment tool based on ReAct technology; The second obtaining module is configured to obtain specified market feedback data corresponding to the target test case from a preset market data source based on the adjustment tool; the market data source includes a financial transaction platform, a market intelligence service, and a sales system; The filtering module is configured to perform filtering processing on the specified market feedback data to obtain corresponding specified related data; the specified related data is key data that is crucial for adjusting the test case, including fund price changes and sales state change data; The first adjustment module is configured to perform adjustment processing on the target test case based on the specified related data to ensure that the target test case always conforms to actual business logic, and obtain a second target test case after adjustment; The verification module is configured to perform verification processing on the second target test case; The updating module is configured to perform updating processing on the target test case based on the second target test case if the second target test case passes the verification.
7. A computer device, characterized by The computer readable storage medium has computer readable instructions stored thereon, and the computer readable instructions are executed by the processor to implement the steps of the test case generation method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium has computer readable instructions stored thereon, and the computer readable instructions are executed by the processor to implement the steps of the test case generation method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Automatic test case generation device based on large language model
CN117806980A
Program automatic testing method, device, storage medium and electronic equipment
CN118069509A