Test case generation method and device, equipment and storage medium
By selecting a target test case template and inputting test information to generate test cases, the problem of long data testing time and low reusability is solved, achieving efficient generation and transparent test results, and supporting template reuse and real-time status display.
Patent Information
- Application Number
- CN202511114089.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-08
- Publication Date
- 2025-10-24
AI Technical Summary
Data testing is time-consuming and has low reusability. Test results are not transparent, and testers need to write a lot of SQL scripts to confirm correctness. It is impossible to directly reuse test cases with similar functions.
By selecting a target test case template, entering test information in the target test information option interface, and triggering the generation control, test cases are generated. Text, voice, and image input are supported, as well as template mapping, parameter encapsulation, and SQL generation.
It improves the efficiency of test case generation and problem troubleshooting, makes test results transparent, facilitates understanding by different audiences, and supports template reuse and real-time status display.
Smart Images

Figure CN120832306A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of big data testing, and in particular, to a test case generation method and device, equipment and a storage medium. BACKGROUND
[0002] With the digital transformation of enterprises and the popularity of big data technology, data has become a core asset, and data testing is a key link to ensure data quality and support business decisions. Unlike business testing, which can directly operate the interface for testing, data testing requires writing a large number of structured query language (Structured Query Language, SQL for short) scripts to verify the correctness of data logic. Once a problem is found, the correctness of the SQL script written by the tester must first be confirmed. This process not only requires the SQL programming ability of the tester, but also increases the time consumption of testing and problem troubleshooting. SUMMARY
[0003] The embodiments of the present application provide a test case generation method, device, equipment and storage medium, which is used for selecting a target test case template, then inputting test information corresponding to at least one test information option in a target test information option interface corresponding to the target test case template, and generating a test case through a trigger operation on a generation control, so as to improve the efficiency of generating test cases and the efficiency of troubleshooting test cases when problems occur subsequently.
[0004] The first aspect of the present application provides a test case generation method, which can include: in response to a selection operation on a target test case template, displaying a corresponding target test information option interface, the target test information option interface including at least one test information option, the type of the at least one test information option including at least one of a test case table option, a test field option, a filter condition option, an aggregation condition option, a verification information option, and a test case name option; in response to an input operation on test information corresponding to a first target test information option, displaying a target test information interface, the target test information interface including the input test information and a generation control, the first target test information option being a required option in the at least one test information option; in the case where the first target test information option does not include corresponding default test information, the input operation includes a text input operation, a voice input to text recognition operation, or a picture input to text recognition operation; in the case where the first target test information option includes corresponding default test information, the input operation includes a confirmation operation, a modification operation, or a selection operation; in response to a trigger operation on the generation control, a first test case is generated and displayed.
[0005] In the embodiment of the present application, the test case is generated through the selection of the target test case template, the input operation of the test information corresponding to at least one test information option in the target test information option interface corresponding to the target test case template, and the triggering operation of the generation control, so as to improve the efficiency of generating the test case and the efficiency of troubleshooting the test case in subsequent problems.
[0006] In some possible implementation manners of the present application, the method can further include: obtaining a test case table including the first test case through the generation of the test case at least once; and storing the test case table in a database, wherein an access type of the test case table is a public type.
[0007] In the technical solution, the test case table including the first test case is obtained through the generation of the test case at least once, and the test case table is stored in the database, wherein an access type of the test case table is a public type. This facilitates the reuse of the test case by other test users, that is, the calling and execution, and improves the efficiency of executing the test task.
[0008] In some possible implementation manners of the present application, the method further includes: calling and executing a current test case table corresponding to a current test task from the database, generating and displaying a current test report, and the test case table includes the current test case table.
[0009] In the technical solution, the current test report is directly generated through the calling and executing of the current test case table corresponding to the current test task, thereby facilitating the user to understand the test result.
[0010] In some possible implementation manners of the present application, the calling and executing of the current test case table corresponding to the current test task and the generating and displaying of the current test report can include: determining the current test task; calling and executing the current test case table corresponding to the current test task to obtain a test result of each test case in the current test case table; and generating and displaying the current test report according to the test result of each test case in the current test case table.
[0011] In the technical solution, the calling and executing of the current test case table corresponding to the current test task and the generating and displaying of the current test report provide specific implementation manners, and improve the feasibility of the scheme.
[0012] In some possible implementation manners of the present application, the generating and displaying the current test report according to the test results of each test case in the current test case table can comprise: in response to selection of a target indicator, generating and displaying the current test report about the target indicator, the target indicator comprising at least one of a test target achievement, a quality evaluation, a target problem, a test exit criterion achievement, a release suggestion, and a follow-up action suggestion.
[0013] In the technical solution, different target indicators can be selected for different audience users (for example, management, switch personnel, and product personnel) to generate the current test report about the target indicator, so that the audience users can obtain the current test report which is easier to understand.
[0014] In some possible implementation manners of the present application, the method can further comprise: in a case where the current test case table corresponding to the current test task is invoked and executed, displaying an execution status of the current test task.
[0015] In the technical solution, in a case where the current test case table corresponding to the current test task is invoked and executed, the execution status of the current test task is displayed, so that a test user can know the execution status of the test task in real time, and thus can arrange other work subsequently.
[0016] In some possible implementation manners of the present application, the method can further comprise: obtaining historical test cases of different test requirements; and generating and displaying at least one test case template according to the historical test cases of the different test requirements, the at least one test case template comprising the target test case template.
[0017] In the technical solution, the at least one test case template can be generated through the historical test case templates of the different test requirements, so that a test user can select a corresponding target test case template according to different test requirements in subsequent test, and supplement corresponding test information to generate a test case.
[0018] In some possible implementation manners of the present application, the generating and displaying the first test case in response to the triggering operation of the generation control can comprise: in response to the triggering operation of the generation control, converting the test information corresponding to the at least one test information option into at least one test information option corresponding test information in a test statement structure; binding the at least one test information option corresponding test information and the placeholder of the target test case template to obtain encapsulated test data; and generating and displaying the first test case according to the at least one test information option corresponding test information in the test statement structure and the encapsulated test data.
[0019] The first test case is generated through template mapping, parameter packaging, and SQL generation, and the feasibility of the scheme is improved.
[0020] In some possible implementation manners of the present application, the method can further include: in response to a modification operation on the first test case, generating a modified first test case; and synchronizing the modified first test case to the test case table.
[0021] In the technical solution, the first test case generated by selecting a target test case template and then supplementing tests in the target test case template can be modified, and the efficiency of obtaining an accurate first test case is improved.
[0022] In some possible implementation manners of the present application, the method can further include: in response to a deletion operation on the first test case, deleting the first test case.
[0023] In the technical solution, the first test case generated by selecting a target test case template and then supplementing tests in the target test case template can be deleted according to actual needs, to meet different needs of test users.
[0024] The second aspect of the present application provides a test case generation device, which can include:
[0025] The display module is configured to: in response to a selection operation on a target test case template, display a corresponding target test information option interface, the target test information option interface including at least one test information option, the type of the at least one test information option including at least one of a test case table option, a test field option, a filtering condition option, an aggregation condition option, a verification information option, and a test case name option; in response to an input operation on test information corresponding to a first target test information option, display a target test information interface, the target test information interface including the input test information and a generation control, the first target test information option being a required option in the at least one test information option; in a case where the first target test information option does not include corresponding default test information, the input operation including a character input operation, a voice input to character recognition operation, or a picture input to character recognition operation; in a case where the first target test information option includes corresponding default test information, the input operation including a confirmation operation, a modification operation, or a selection operation.
[0026] The generation module is configured to: in response to a trigger operation on the generation control, generate a first test case.
[0027] The display module is further configured to display the first test case.
[0028] In a third aspect, an electronic device is provided, which includes a memory, one or more processors, and a display. The memory and the processors are coupled. The memory is configured to store computer program code including computer instructions. When the processors execute the computer instructions, the electronic device performs the method of any one of the first aspect.
[0029] In a fourth aspect, a chip is provided, which includes a processor and a memory, and a display. The processor can be a logic circuit, an integrated circuit, or a general-purpose processor, etc. The memory stores instructions. The processor can implement the method of the first aspect by reading the software code stored in the memory. The memory can be integrated in the processor or exist independently.
[0030] In a fifth aspect, a chip system is provided, which is applied to an electronic device. The chip system includes one or more interface circuits and one or more processors, and a display. The interface circuits and the processors are interconnected through lines. The interface circuits are configured to receive signals from a memory of the electronic device and send the signals to the processors. The signals include computer instructions stored in the memory. When the processors execute the computer instructions, the electronic device performs the method of any one of the first aspect.
[0031] In a sixth aspect, a computer program product is provided, which includes a computer program (also referred to as code or instructions). When the computer program is run, the computer program causes a computer to perform the method of the first aspect.
[0032] In a seventh aspect, a computer-readable storage medium is provided, which stores a computer program (also referred to as code or instructions). When the computer program is run on a computer, the computer program causes the computer to perform the method of the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments and the prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained from these drawings.
[0034] Figure 1A An example of a data resource service;
[0035] Figure 1BFig. 1 is a schematic diagram of a data processing link;
[0036] Figure 1C Fig. 2 is a schematic diagram of troubleshooting when testing data;
[0037] Figure 2 Fig. 3 is a schematic diagram of an embodiment of a test case generation method in the present application;
[0038] Figure 3A Fig. 4 is a schematic diagram of the electronic device displaying at least one test case template in an embodiment of the present application;
[0039] Figure 3B Fig. 5 is a schematic diagram of the electronic device displaying a test information option interface corresponding to a whole table test template in an embodiment of the present application;
[0040] Figure 3C Fig. 6 is a schematic diagram of the electronic device displaying a test information option interface corresponding to a single table single field test template in an embodiment of the present application;
[0041] Figure 3D Fig. 7 is a schematic diagram of the electronic device displaying a test information option interface corresponding to a single table multiple field test template in an embodiment of the present application;
[0042] Figure 3E Fig. 8 is a schematic diagram of the electronic device displaying a test information option interface corresponding to a multiple table multiple field test template in an embodiment of the present application;
[0043] Figure 4 Fig. 9 is a schematic diagram of a test information interface corresponding to a multiple table multiple field test template in an embodiment of the present application;
[0044] Figure 5 Fig. 10 is a schematic diagram of another embodiment of a test case generation method in the present application;
[0045] Figure 6A Fig. 11 is a schematic diagram of a test requirement of a test case in an embodiment of the present application;
[0046] Figure 6B Fig. 12 is a schematic diagram of test requirements focused on by multiple test case templates in an embodiment of the present application;
[0047] Figure 7 Fig. 13 is a schematic diagram of another embodiment of a test case generation method in the present application;
[0048] Figure 8A Fig. 14 is a related schematic diagram of generating a test case in an embodiment of the present application;
[0049] Figure 8B Fig. 15 is a flowchart of generating a test case in an embodiment of the present application;
[0050] Figure 9A An embodiment of the test case generation device in the embodiments of the present application is shown in the figure;
[0051] Figure 9B Another embodiment of the test case generation device in the embodiments of the present application is shown in the figure;
[0052] Figure 9C Another embodiment of the test case generation device in the embodiments of the present application is shown in the figure;
[0053] Figure 10 An embodiment of the electronic device in the embodiments of the present application is shown in the figure;
[0054] Figure 11 An embodiment of the terminal device in the embodiments of the present application is shown in the figure. DETAILED DESCRIPTION
[0055] The embodiments of the present application provide a test case generation method, which includes the following steps: selecting a target test case template; inputting test information corresponding to at least one test information option in a target test information option interface corresponding to the target test case template; and triggering a generation control to generate a test case. The embodiments of the present application can improve the efficiency of generating test cases and the efficiency of troubleshooting test cases.
[0056] In order to make the personnel in the technical field better understand the present application, the technical solutions in the embodiments of the present application will be described in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all should belong to the scope of protection of the present application.
[0057] Some terms related to the present application will be briefly described as follows:
[0058] Structured Query Language (SQL) is a special-purpose programming language designed for managing and querying relational databases. It is a database query and programming language used for accessing data and querying, updating, and managing relational database systems.
[0059] HIVE, Apache Hive is a data warehouse built on Hadoop (a data-intensive distributed application support) architecture. It can provide data refinement, query and analysis; Hive is a data warehouse tool based on Hadoop, which can map structured data files to a database table and provide simple SQL query functions, which can convert SQL statements into MapReduce (a software architecture proposed by Google for parallel operation of large-scale data sets. The concepts of "Map" and "Reduce" and their main ideas are borrowed from functional programming languages, and features borrowed from vector programming languages) tasks to run.
[0060] The data resource service provides services to users, managers, product operations, advertising customers, algorithm research and development, and analysts in the form of reports, analysis dashboards, management dashboards, core email daily reports, etc. For advertisers, data is an asset, and the quality of data is particularly important in the advertising chain. For example Figure 1A , it is a schematic diagram of a data resource service. In Figure 1A , the advertiser places an advertisement, issues an advertisement, and then other users view the advertisement. The data of other users viewing the advertisement is transmitted back, and then data processing is performed to obtain a data report. The data report can be in the form of a report for the advertiser to view.
[0061] In the data processing process, as shown in Figure 1B , it is a schematic diagram of a data processing link. In Figure 1B , it can be seen that the data processing link has many levels and is deep, and the testing workload is extremely large. In addition, data testing is different from business testing, which can directly operate the interface for testing. Data testing needs to write a large number of SQL scripts, i.e. SQL test cases, to verify the correctness of the data logic, which leads to the following defects:
[0062] (1) Long data testing time: data testing needs to convert test cases into SQL structures for execution. Once a problem is found, the correctness of the SQL script written by the tester must be confirmed first. This process not only requires the SQL programming ability of the tester, but also increases the testing and problem troubleshooting time. As shown in Figure 1C , it is a schematic diagram of troubleshooting during data testing.
[0063] (2) Low test case reuse degree: test cases of test personnel are maintained in documents on their own devices, and similar test cases cannot be directly referenced and reused, and other test personnel need to rewrite test cases.
[0064] (3) Test results are not transparent: Test results of test cases are all in the SQL execution interface, and test results rely on screenshots of testers, and R&D and product personnel cannot directly perceive the authenticity of test data quality.
[0065] In Figure 1B As shown in the figure, several processes related to data processing are described as follows:
[0066] (1) Operational Data Store (ODS): Function: Mirror storage of raw data, preserving the initial state of business system data. Data is usually consistent with the source system and does not undergo deep processing.
[0067] (2) Data Warehouse Detail (DWD) or Data Warehouse Dimensional (DWD): Function: Cleaning, conversion, and standardization (such as de-duplication, standardization of fields) of ODS layer data. Retain detailed data to support business analysis needs.
[0068] (3) Data Warehouse Summary (DWS): Function: Aggregation based on DWD layer data by theme or dimension (such as daily, user, and product aggregation). Reduces redundant calculations and improves query efficiency.
[0069] (4) Topic-Oriented Data Layer (TOPIC) or Topic Data Mart: Function: Lightly aggregated data for specific business themes (such as transactions and user behavior). Typically used in real-time or near-real-time analysis scenarios.
[0070] (5) Dimension Table Layer (DIM): Function: Stores business dimension data (such as time, region, and product classification). Supports correlation analysis and multi-dimensional calculation of indicators.
[0071] (6) Application Data Layer (APP): Function: Data aggregation for end applications (such as reports and Application Programming Interface (API) data). Highly aggregated, directly serving business systems or visualization tools.
[0072] In the embodiment of the present application, the target test case template is selected, then at least one test information corresponding to the test information option in the target test case template corresponding target test information option interface is input, and the test case is generated through the triggering operation of the generation control, so as to improve the efficiency of generating the test case, and the efficiency of troubleshooting the test case in subsequent problems can also be improved.
[0073] The technical scheme of the present application is further described below in the form of an embodiment, as shown in the following Figure 2 The technical scheme of the present application is further described below in the form of an embodiment, as shown in the following
[0074] 201, in response to the selection operation of the target test case template, a corresponding target test information option interface is displayed, the target test information option interface includes at least one test information option, and the type of the at least one test information option includes at least one of test case table option, test field option, filtering condition option, aggregation condition option, verification information option and test case name option.
[0075] For example, the default test information option interface of the default test case template can be directly displayed, and the selection operation of the target test case template can be performed on the default test information option interface to display the corresponding target test information option interface.
[0076] In some possible implementation ways, the method can further include: displaying a template interface, the template interface including at least one test case template, and the at least one test case template including the target test case template.
[0077] For example, the at least one test case template on the template interface is displayed, and the at least one test case template is used for the test user to generate the test case.
[0078] In the technical scheme, the target test case template can be obtained through the selection of the template interface, and the efficiency of generating the test case subsequently can be improved.
[0079] In some possible implementation ways, the display of the template interface can include: displaying a current interface, the current interface including a start test control; and in response to the triggering operation of the start test control, the template interface is displayed.
[0080] For example, if the test user needs to test, a start test control can be included on the current interface, and the test user can trigger the start test control (for example, click, double-click, swipe, etc.). The electronic device directly displays the template interface in response to the trigger operation of the start test control. This start test control can also be understood as a test account that the test user needs to log in. The test user logs in to his own test account, and the electronic device directly displays the template interface in response to the login operation of the test user.
[0081] In the technical solution, the specific implementation of the display template interface is described. The current interface is displayed, and the start test control is included. In response to the trigger operation of the start test control, the template interface is displayed. This provides a basis for generating test cases through test case templates in the future, and improves the feasibility of the scheme.
[0082] For example, at least one test case template is displayed on the template interface of the electronic device. Considering the size of the template interface, at least one test case template is represented by at least one test case template identifier, and the entire test case template is not displayed. The at least one test case template can include at least one of a whole table test template, a single table single field test template, a single table multi-field test template, a multi-table multi-field test template, and a custom test template. Generally, in order to meet different test requirements, the whole table test template, the single table single field test template, the single table multi-field test template, the multi-table multi-field test template, and the custom test template are displayed on the test case template selection interface of the electronic device for the test user to select. As shown in Figure 3A As shown in FIG. 1, the electronic device displays at least one test case template.
[0083] The test user can select a target test case template according to actual needs, and the electronic device displays a target test information option interface corresponding to the target test case template in response to the selection operation of the test user on the target test case template. The target test information option interface includes at least one test information option. The target test case template can be a whole table test template, a single table single field test template, a single table multi-field test template, a multi-table multi-field test template, or a custom test template. As shown in Figure 3B As shown in FIG. 2, the electronic device displays a test information option interface corresponding to the whole table test template. Figure 3B As shown in FIG. 3, the expected value indicates how many rows are expected. The comparison type can include greater than, greater than or equal to, less than, less than or equal to, equal to, and not equal to. As shown in Figure 3C As shown in FIG. 4, the electronic device displays a test information option interface corresponding to the single table single field test template. As shown in Figure 3DAs shown in FIG. 6, the test information option interface corresponds to the single table and single field test template of the electronic device in the embodiment of the present application. Figure 3D As shown in FIG. 7, the aggregate sum is the sum of the test field. As shown in FIG. 8, the aggregate sum is the average of the test field. Figure 3E As shown in FIG. 9, the test information option interface corresponds to the single table and multiple field test template of the electronic device in the embodiment of the present application.
[0084] For example, the following describes different test case templates, as shown below.
[0085] (1) The whole table test template is used for quality evaluation of single table full data.
[0086] Typical scenario: consistency check of data after extract, transform and load (ETL), and table migration verification.
[0087] Core indicators: can include but are not limited to record total fluctuation threshold (±5%), null rate alarm line (<0.1%), data freshness (delay <1h).
[0088] Example: SELECT COUNT(*), SUM(amount) FROM orders WHERE create_date='2023-01-01'.
[0089] (2) Single table and single field test template is used for quality verification of a single field.
[0090] Typical scenario: field format verification, enumeration value check, and null rate statistics. That is, can include but are not limited to numerical field range verification (age BETWEEN 0-120), enumeration field compliance check (status IN('active', 'inactive')), and format consistency verification (regex matching).
[0091] Example: SELECT DISTINCT(status) FROM orders.
[0092] (3) Single table and multiple field test template is used for verification of business logic relationship between multiple fields.
[0093] Typical scenario: cross-verification relationship between amount fields, and pre-post constraint between status and time. Can include but are not limited to logical consistency (order_amount=item_price*quantity), time sequence (start_time<end_time), and business rule (discount_rate and user_level matching).
[0094] Example: SELECT order_id FROM orders WHERE payment_time IS NOT NULL AND status='unpaid'.
[0095] (4) Multi-table multi-field test template, used for cross-table business rule verification.
[0096] Typical scenarios: primary-foreign key consistency, cross-table business state transition, which can include but not limited to foreign key integrity (LEFT JOIN verification), data consistency (SUM comparison), cross-system alignment (MD5 check).
[0097] Example: SELECT o.order_id FROM orders o LEFT JOIN payments p ON o.order_id=p.order_id WHERE o.status='paid' AND p.payment_id IS NULL.
[0098] (5) Custom test template, used for flexible response to special verification needs.
[0099] Typical scenarios: complex business rules, performance test cases.
[0100] Examples: stored procedure calls, nested, complex queries with window functions, user-defined function (UDF) extension interface.
[0101] In some possible implementation manners, the type of the at least one test information option includes at least one of a test case table option, a test field option, a filter condition option, an aggregation condition option, a verification information option, and a test case name option. The at least one test information option is configured to be selected by a user.
[0102] For example, the test case table option can select a specific test case, or can select a test case through a test case table. Each test case table includes at least one test case.
[0103] The test field option can input a test field, and specify a field (such as a form field or a database field) that needs to be verified or operated in the test.
[0104] The filter condition option and the aggregation condition option are used to filter the test range (such as filtering according to an environment or a priority) or aggregate the test result (such as counting a pass rate according to a module). For example, a where condition or a groupBy condition can be input or selected.
[0105] Verification information option, defining expected results or assertion conditions (such as response code, output value, database state, associated key, etc.).
[0106] Test case name option, identifying the unique name or label of the test case for easy management and retrieval. The user can input the case name, etc.
[0107] As shown in Figure 4 , it is a schematic diagram of the test information interface corresponding to the multi-table multi-field test template in the embodiment of the present application.
[0108] In the technical solution, the types of at least one test information option included in the target test information option interface corresponding to the target test case template are exemplarily illustrated, which can include at least one of a test case table option, a test field option, a filtering condition option, an aggregation condition option, a verification information option, and a test case name option, so as to facilitate the test user to fill in the test information corresponding to the test option to generate a test case and improve the feasibility of the scheme.
[0109] In some possible implementation manners, the input types of the at least one test information option can include mandatory items and optional items.
[0110] For example, if the test option is a mandatory item, the test user must perform the input operation of the corresponding test information to perform the generation operation of the generation control in the next step. If the test option is an optional item, the test user can perform the input operation of the corresponding test information or can not perform the input operation of the corresponding test information, which can be determined according to actual needs.
[0111] In the technical solution, the input types of the test options include mandatory items and optional items, so that the test user can perform the input operation of the test information corresponding to the test option through the indication of the mandatory items or the optional items, thereby improving the efficiency of the test user in inputting the test information and improving the efficiency of generating the test case.
[0112] In some possible implementation manners, the test option of the mandatory item can be indicated by a mandatory identification. For example, a “mandatory” field is added in the brackets behind the test option, or an “*” is added behind the test option to indicate the mandatory, or other mandatory identifications can be used for indication, which is not limited specifically herein.
[0113] The test option of the optional item can be indicated by an optional identification. For example, a “mandatory” field is added in the brackets behind the test option, or an “*” is added behind the test option to indicate the mandatory, or other mandatory identifications can be used for indication, which is not limited specifically herein.
[0114] In the technical solution, the input types of the test options include mandatory items and optional items, and the indication of the mandatory items and the optional items is illustrated as an example, so that the test user can input the test information corresponding to the test options through the indication of the mandatory items or the optional items, thereby improving the efficiency of the test user in inputting the test information and improving the efficiency of generating the test cases.
[0115] 202、in response to the input operation of the test information corresponding to the first target test information option, display a target test information interface, the target test information interface including the input test information and a generation control, the first target test information option being a mandatory option in the at least one test information option.
[0116] In the case where the first target test information option does not include corresponding default test information, the input operation includes a text input operation, a voice input to text recognition operation, or a picture input to text recognition operation; in the case where the first target test information option includes corresponding default test information, the input operation includes a confirmation operation, a modification operation, or a selection operation.
[0117] For example, after the electronic device displays the target test information option interface corresponding to the target test case template in response to the selection operation of the target test case template, the target test information option interface includes at least one test information option of test information to be input for the test user to input the corresponding test information, which can be a selection operation, a confirmation operation, a modification operation, a text input operation, a voice input to text recognition operation, or a picture input to text recognition operation, and the specific operation is not limited here. The electronic device displays a target test information interface in response to the input operation of the test information corresponding to the first target test information option in the target test information option interface by the test personnel, the target test information interface displays the test information corresponding to the first target test information option input by the test personnel, and the target test information interface further includes a generation control for the test user to trigger the operation to generate the first test case.
[0118] In the case where the first target test information option does not include corresponding default test information, the user needs to input the corresponding test information in the first target test information option, at this time, the corresponding input operation can be a direct text input operation, a voice input operation, and then the input voice is converted into text, or a picture input operation, and then the input picture is recognized and converted into text; or the input operation includes a voice input operation or a picture input operation, and then the corresponding test information is voice information or picture information.
[0119] In the case that the first target test information option includes corresponding default test information, the user needs to confirm whether the default test information is accurate, if accurate, a confirmation operation can be directly performed; if not accurate, a modification operation can be performed; or the default test information includes several test information options for the user to select the desired test information option.
[0120] In some possible implementation manners, the pattern of the generation control can be a circle, an ellipse, a hexagon, a triangle, a square, etc., and the specific pattern is not limited here. The position of the generation control is at the boundary of the test option information interface, which can be at the upper boundary, the left boundary, the right boundary, or the lower boundary. Generally, considering the usage habits of most test users, the position of the generation control is generally not at the left boundary of the test option information interface.
[0121] In the technical solution, the pattern and position of the generation control included in the test option information interface are described, and the feasibility of the solution is improved.
[0122] In some possible implementation manners, the method can further include: in response to the dragging operation on the generation control, dragging from a first position to a second position.
[0123] In the technical solution, the position of the generation control can also be dragged and adjusted according to the needs of the test user, to meet the usage habits of the test user.
[0124] 203、in response to the triggering operation on the generation control, generating and displaying a first test case.
[0125] For example, after the test user performs the input operation of the test information corresponding to at least one test information option in the target test case template, the electronic device displays a target test information interface, and if the test user inputs all the test information to be filled in, the target test information interface further includes a generation control, and the test user can further perform a triggering operation (such as a clicking, pressing, or sliding operation) on the generation control, to generate and display a first test case after the generation control.
[0126] In some possible implementation manners, the operation of generating and displaying the first test case in response to the triggering operation on the generation control can include: in response to the triggering operation on the generation control, converting the test information corresponding to the at least one test information option into test information corresponding to at least one test information option in a test statement structure; binding the test information corresponding to the at least one test information option to a placeholder of the target test case template to obtain encapsulated test data; and generating and displaying the first test case according to the test information corresponding to the at least one test information option in the test statement structure and the encapsulated test data.
[0127] Exemplarily, in response to the triggering operation on the generation control, the electronic device generates and displays the first test case, which may specifically be performed through steps such as template mapping, parameter packaging, and SQL generation.
[0128] 1. Template Mapping
[0129] Template mapping is the process of converting abstract test requirements into specific test statement structures.
[0130] Implementation process:
[0131] Define template library: Create a template library containing various SQL statement structures.
[0132] Template selection: Select an appropriate template based on test requirements.
[0133] Placeholder identifier: Use specific symbols in the template to mark the part that needs to be replaced (such as {column}, {table}, etc.).
[0134] 2. Parameter Encapsulation
[0135] Parameter encapsulation is the process of binding test data to template placeholders.
[0136] Implementation process:
[0137] Parameter collection: Get parameters from the test data source.
[0138] Parameter verification: Check whether the parameters meet the template requirements.
[0139] Parameter conversion: Convert parameters into a format suitable for SQL statements.
[0140] 3. SQL Generation
[0141] SQL generation is the process of combining templates and encapsulated parameters into a complete SQL statement.
[0142] Implementation process:
[0143] Template filling: Use string formatting or template engines to replace placeholders.
[0144] SQL Beautifier: Formats generated SQL statements to improve readability.
[0145] Safe processing: prevent SQL injection.
[0146] The complete example is as follows:
[0147]
[0148]
[0149] Output result:
[0150]
[0151] In the technical solution, the first test case for the electronic device is described in detail. The first test case can be generated through steps such as template mapping, parameter packaging, and SQL generation, thereby improving the feasibility of the scheme.
[0152] In the embodiment of the present application, in response to the selection operation of the target test case template, the corresponding target test information option interface is displayed, the target test information option interface includes at least one test information option, the type of the at least one test information option includes at least one of test case table option, test field option, filtering condition option, aggregation condition option, verification information option, and test case name option; in response to the input operation of the first target test information option corresponding test information, the target test information interface is displayed, the target test information interface includes the input test information and the generation control, the first target test information option is a mandatory option in the at least one test information option; in the case where the first target test information option does not include the corresponding default test information, the input operation includes text input operation, voice input to text recognition operation, or picture input to text recognition operation; in the case where the first target test information option includes the corresponding default test information, the input operation includes confirmation operation, modification operation, or selection operation; in response to the triggering operation of the generation control, the first test case is generated and displayed. Through the selection of the target test case template, then the input operation of the at least one test information option corresponding test information in the target test case template corresponding target test information option interface, and then the triggering operation of the generation control, the test case is generated, so as to improve the efficiency of generating test case, and also improve the efficiency of subsequent problem troubleshooting test case.
[0153] As shown in Figure 5 another embodiment of the test case generation method in the embodiment of the present application, can include:
[0154] 501, acquire historical test cases of different test requirements.
[0155] For example, the electronic device can collect historical test cases of different test requirements to provide a data basis for subsequent data analysis and abstract at least one test case template.
[0156] 502、generate and display at least one test case template according to the historical test cases of different test requirements, the at least one test case template including the target test case template.
[0157] At least one test case template can include a full table test template, a single table single field test template, a single table multi-field test template, a multi-table multi-field test template, and a custom test template. These test case templates are general test case templates based on historical test cases of different test requirements.
[0158] The test requirements of the test case can include, but are not limited to, basic rules, business logic, and basic function verification. The basic rules can include enumeration correctness and field rationality. The business logic can include data processing and processing logic. The basic function verification can include consistency, accuracy, uniqueness, and digital resource security. As shown in the following figure, it is a schematic diagram of the test requirements of the test case in the embodiment of the present application. The following will be described in detail as follows: Figure 6A
[0159] 1. Basic rule verification
[0160] Objective: Verify whether the system follows the underlying design rules and data type constraints.
[0161] (1) Enumeration correctness. Description: Check if the field value is within the predefined enumeration range. Example 1: The gender field only allows male / female / unknown, and input of other values (such as ABC) should report an error. Example 2: Order status must be pending payment / shipped / completed, and illegal status should be intercepted.
[0162] (2) Field rationality. Description: Verify that the field format, length, type, etc. conform to the business logic. Example: The mobile phone number must be 11 digits and comply with the operator number segment rule.
[0163] 2. Business logic verification
[0164] Objective: Verify that the core business process and data processing meet the business requirements.
[0165] (1) Data processing. Description: Check the accuracy of data storage, transmission, and conversion. Example 1: After the user submits an order, the order data in the database should be consistent with the front end. Example 2: The date format returned by the interface should be unified as YYYY-MM-DD HH:mm:ss.
[0166] (2) Processing logic. Description: Verify the correctness of business rules and state transitions. Example 1: After successful payment, the order status must change from pending payment to paid, and a payment log is generated. Example 2: When the inventory is insufficient, the order request should return an error prompt, and the inventory quantity remains unchanged.
[0167] 3. Basic function verification
[0168] Objective: Ensure the reliability and security of system functions.
[0169] (1) Consistency. Description: Data synchronization between multiple terminals or systems must be consistent. Example: After a user modifies their password on the front end, the database, cache, and third-party services must all be updated synchronously.
[0170] (2) Accuracy. Description: The calculation results or returned data must be accurate. Example: The total order price = unit price × quantity + shipping fee - coupon, which must be accurate to the penny (without rounding errors).
[0171] (3) Uniqueness. Description: Avoid duplicate data or conflicting operations. Example 1: When a user registers, the mobile phone number or email must be globally unique, and duplicate registration should be reported as an error. Example 2: Under concurrent requests, the same order can only be paid once.
[0172] (4) Digital resource security. Description: Functions involving digital resource transmission must be strictly verified. Example: When digital resources are transmitted between different users, they must be consistent with user input and require secondary confirmation (such as SMS verification code).
[0173] According to the historical test cases of different test requirements, at least one test case template is generated and displayed, which can be understood as the process of abstracting historical test cases into general templates, from specific to abstract, from special to general.
[0174] In the historical test case sedimentation stage, commonalities can be extracted from historical test cases. For example, by organizing a large number of historical test cases, analyze which fields appear repeatedly (such as input data, expected results), and which verification logic is frequently used (such as non-empty verification, state transition)? It can also identify reusable patterns, that is, high-frequency repeated patterns, which can include: single-field verification: length, type, enumeration value; multi-field logic: calculation relationship (such as total price = unit price × quantity); cross-table consistency: primary-foreign key association, data synchronization.
[0175] Example evolution:
[0176] Specific use case 1: SELECT * FROM orders WHERE status = 'created' AND create_time > '2023-01-01'
[0177] Specific use case 2: SELECT * FROM users WHERE status = 'active' AND register_time < '2023-06-01'
[0178] Abstract template:SELECT*FROM{table}WHERE status='{status_value}'AND{time_field}{operator}'{time_value}'
[0179] In the abstraction phase, a general test case template can be obtained by extracting common features from historical test cases. First, the test case template structure can be defined, which can include core fields and extended fields, as shown below:
[0180] (1) Core fields (common to all test case templates)
[0181] Field Explanation Example Template Type Whole table / single field / multiple tables, etc. Single table single field Verification target Table name, field name, interface path users.username Precondition Data preparation or system status User has logged in Verification logic SQL / code / rule description SELECT...WHERE Expected result Pass criteria count = 0
[0182] Table 1
[0183] (2) Extended fields (added as needed)
[0184] Thresholds (such as the allowable error range), automated marking, and historical failure records.
[0185] Then, you can design your template type as follows:
[0186] Template Type Applicable scenario Special field Whole table test case template Data migration, full table scan Benchmark table name, data volume comparison SQL Single table single field test case template Field-level rule verification Field name, regular / enumeration rules Single table multiple field test case template Inter-field logical relationship Calculation formula, tolerance range Multiple table multiple field test case template Cross-table consistency Association conditions, JOIN statements Custom test case template Complex logic Freely written SQL
[0187] Table 2
[0188] Parametric design:
[0189]
[0190]
[0191] Layered abstraction: Basic layer: field-level validation (length, type, format); middle layer: record-level validation (business rules); high layer: process-level validation (cross-table business flow).
[0192] Through this sedimentation and abstraction process, test resources will gradually evolve from scattered test cases to a systematic verification knowledge base, and eventually form a test case template system that can quickly respond to new test requirements. Figure 6B The figure shows a schematic diagram of the test requirements focused on by multiple test case templates in the embodiment of the present application.
[0193] 503. In response to a selection operation on a target test case template, a corresponding target test information option interface is displayed, where the target test information option interface includes at least one test information option.
[0194] 504、in response to an input operation of test information corresponding to the at least one test information option, display a target test information interface, the target test information interface comprising a generation control.
[0195] 505、in response to a triggering operation of the generation control, generate and display a first test case.
[0196] It should be noted that steps 503-505 are similar to steps 201-203 in the embodiment shown in Figure 2 The steps 201-203 in the embodiment shown in
[0197] In the embodiment of the present application, the historical test cases of different test requirements are obtained; and at least one test case template is generated and displayed according to the historical test cases of different test requirements, the at least one test case template comprising the target test case template. At least one test case template can be generated through the historical test case templates of different test requirements, so as to be used for subsequent test users to select the corresponding target test case template according to different test requirements, to supplement the corresponding test information, and to generate test cases. In response to a selection operation of the target test case template, a target test information option interface corresponding to the target test case template is displayed, the target test information option interface comprising at least one test information option, and the type of the at least one test information option comprising at least one of a test case table option, a test field option, a filtering condition option, an aggregation condition option, a verification information option, and a test case name option; in response to an input operation of test information corresponding to a first target test information option, a target test information interface is displayed, the target test information interface comprising the input test information and a generation control, the first target test information option being a required option in the at least one test information option; in the case where the first target test information option does not comprise corresponding default test information, the input operation comprises a text input operation, a voice input to text recognition operation, or a picture input to text recognition operation; in the case where the first target test information option comprises corresponding default test information, the input operation comprises a confirmation operation, a modification operation, or a selection operation; in response to a triggering operation of the generation control, a first test case is generated and displayed. Through the selection of the target test case template, the input operation of test information corresponding to the at least one test information option in the target test information option interface corresponding to the target test case template, and the triggering operation of the generation control, the test case is generated, so as to improve the efficiency of generating test cases, and the efficiency of troubleshooting test cases in subsequent problems can also be improved.
[0198] As Figure 7 shown, another embodiment of the test case generation method in the embodiment of the present application can comprise:
[0199] 701. In response to a selection operation on a target test case template, a corresponding target test information option interface is displayed, where the target test information option interface includes at least one test information option.
[0200] 702. In response to an input operation on test information corresponding to the at least one test information option, display a target test information interface, wherein the target test information interface includes a generation control.
[0201] 703. In response to the triggering operation on the generation control, generate and display a first test case.
[0202] It should be noted that steps 701-703 are Figure 2 Steps 201-203 in the illustrated embodiment are similar and will not be described again here.
[0203] 704. Obtain a test case table by generating at least one test case, where the test case table includes the first test case.
[0204] Exemplarily, a test user generates test cases based on test requirements through steps 601-604. Each test requirement corresponds to at least one test case, which can be stored in a test case table. Each test requirement can include one or more test indicators, which in turn generate one or more test cases.
[0205] 705. Store the test case table in a database, where the access type of the test case table is public.
[0206] For example, the test case tables generated by different test users for different test requirements will be stored in the database, and the access type of this test case table is public, that is, this database is open to all testers, and testers can access the test case tables stored in this database. Therefore, when there are the same or similar test requirements, testers can directly reuse the corresponding target test case table in the database, and then modify or not modify the corresponding test cases in the target test case table, execute the corresponding test cases in the target test case list, and thus generate a test report.
[0207] In this technical solution, a test case table is generated by generating at least one test case, the test case table including the first test case. The test case table is stored in a database with a public access type. This facilitates the reuse of the test case by other test users, i.e., calling and executing the test case, thereby improving the efficiency of executing test tasks.
[0208] 706、Call and execute the current test case table corresponding to the current test task from the database, generate and display the current test report.
[0209] In some possible implementation manners, the calling and executing the current test case table corresponding to the current test task from the database, and generating and displaying the current test report can include: determining the current test task; calling and executing the current test case table corresponding to the current test task from the database to obtain the test result of each test case in the current test case table; and generating and displaying the current test report according to the test result of each test case in the current test case table.
[0210] For example, the electronic device first determines the current test task, then calls the current test case table corresponding to the current test task from the database, executes each test case in the current test case table, thereby obtaining the test result of each test case in the current test case table, and finally generates and displays the current test report according to the test result of each test case in the current test case table.
[0211] In the technical solution, the calling and executing the current test case table corresponding to the current test task from the database, and generating and displaying the current test report of the electronic device are provided with specific implementation manners, and the feasibility of the scheme is improved.
[0212] In some possible implementation manners, the generating and displaying the current test report according to the test result of each test case in the current test case table can include: in response to the selection of a target indicator, generating and displaying the current test report about the target indicator, the target indicator including at least one of a test target achievement, a quality evaluation, a target problem, a test exit standard achievement, and a conclusive suggestion.
[0213] For example, the test target achievement indicates whether the test target is achieved or not.
[0214] The quality evaluation is a general evaluation of the quality of the current version (for example, basically stable, with high-risk problems, good quality, etc.). Whether the core function is available and stable. Whether the main business process is smooth.
[0215] The target problem can also be referred to as a key problem or a risk summary. Serious / fatal defects and their impacts are listed. High-priority defects and their impacts that are not repaired are listed. Known limitations, untested items and their potential risks are listed. Other major problems that may affect the release or user experience.
[0216] Test exit criteria achievement: Check each exit criteria defined in the test plan (e.g., zero fatal / serious defects, pass rate >95%, 100% pass for key use cases, etc.) to see if they are met. If not, explain the reasons and impact.
[0217] Clearly present concluding recommendations, including recommendations for issuance and / or recommendations for follow-up actions, as follows:
[0218] Release suggestion: Recommend release; Recommend release after fixing specified defects; Not recommend release (must state the main reason); or, Conditional release (specify the conditions, such as release under monitoring, trial run with specific user groups, etc.).
[0219] Recommended follow-up actions: A list of critical defects that need to be fixed. Recommended modules or functions for enhanced testing. Recommendations for testing areas that are not covered. Recommendations for automated testing and test process improvements. Risks that require attention and their corresponding countermeasures.
[0220] Optionally, the current test report may also include the following attachments: (1) a detailed defect list (or a link to a defect management system); (2) test case execution details (or a link to a test management tool); (3) important test logs, screenshots, screen recordings, and other evidence; (4) performance test report (if conducted separately); (5) security test report (if conducted separately); and (6) environment configuration details.
[0221] The key points presented in the current test report should be clear and concise: avoid being verbose and use charts (such as pie charts, bar charts, and trend charts) to visually display key indicators. Be objective and accurate: base your presentation on facts and data. Highlight the key points: emphasize key findings, risks, and conclusions. Audience: consider the report's intended audience (management, development, product, etc.) and adjust the level of detail and technical depth.
[0222] The metrics you choose for this technical solution depend on the specifics of your project, test objectives, audience, and organizational requirements. However, the core goal remains to accurately communicate product quality status, clearly expose risks, and provide a reliable basis for decision-making, especially release decisions.
[0223] In the current test report, the test results of each test case in the current test case table are uniformly collected and the test report is automatically generated to solve the visual display of quality results.
[0224] The following table describes some of the indicators in the current test report:
[0225] Dimension Indicator example Visualization form Integrity Null rate / duplication rate Ring progress chart Accuracy Number of error records / abnormal value distribution Heat map Consistency Cross-table matching degree Sankey diagram Timeliness Data delay length Line chart
[0226] Table 3
[0227] In some possible implementation manners, the calling and executing the current test case table corresponding to the current test task from the database to obtain the test result of each test case in the current test case table can include: in response to a selection operation of calling a target test case table from the database, executing the target test case table as the current test case table corresponding to the current test task to obtain the test result of each test case in the current test case table.
[0228] For example, the calling and executing the current test case table corresponding to the current test task from the database can be actively selected by the test user according to test requirements. There can be multiple test case tables in the database, each test case table corresponds to different test requirements, and each test requirement can include at least one test index. When the test user selects the target test case list, the corresponding at least one test case list can be displayed on the display interface displaying the target test case list, and each test case list includes at least one test case. The test index corresponding to each test case list is also displayed, so that the test user can quickly and intuitively obtain the test index, and then select the target test case list.
[0229] In the technical solution, the specific implementation manner of calling and executing the current test case table corresponding to the current test task from the database to obtain the test result of each test case in the current test case table is provided. The current test case table corresponding to the current test task can be actively selected by the test user according to test requirements, which improves the accuracy of the current test case table, and then each test case in the current test case table is executed to obtain the test result of each test case in the current test case list.
[0230] In some possible implementation manners, the method further includes: in the case of calling and executing the current test case table corresponding to the current test task, displaying the execution status of the current test task.
[0231] For example, after the current test case table corresponding to the current test task is called, each test case in the current test case table can be directly executed. At this time, the execution status of the current test task can be prompted in the form of a notification or other forms. The execution status of the current test task can include execution end, execution in progress, execution error, and the like.
[0232] In the technical solution, in the case of calling and executing the current test case table corresponding to the current test task, the execution status of the current test task is displayed, which facilitates the test user to know the execution status of the test task in real time, and then arrange subsequent work.
[0233] In some possible implementations, the method may further include: generating a modified first test case in response to a modification operation on the first test case; and synchronizing the modified first test case to the test case table.
[0234] For example, when a test user selects a target test case template and supplements the target test case template with relevant test information to generate a first test case, the first test case will be displayed on the display interface of the electronic device, allowing the test user to check whether the first test case is accurate and whether there are any modifications required. If there are any modifications required, the test user can modify the first test case to obtain a modified first test case. The modified first test case is then synchronously saved in the test case table in the database for subsequent call and execution of test tasks. If there are no modifications required, the first test case is directly saved in the test case table in the database for subsequent call and execution of test tasks.
[0235] In this technical solution, after selecting a target test case template and then supplementing the tests in the target test case template, the generated first test case can also be modified, thereby improving the efficiency of obtaining an accurate first test case.
[0236] In some possible implementations, the method may further include: deleting the first test case in response to a deletion operation on the first test case.
[0237] For example, when the test user generates a first test case by selecting a target test case template and supplementing the relevant test information in the target test case template, the first test case will be displayed on the display interface of the electronic device to facilitate the test user to detect whether the first test case is accurate. If it is inaccurate and a lot of content needs to be modified, it can be deleted, and the target test case template can be selected again, and the relevant test information in the target test case template can be supplemented to generate a second test case. The second test case is saved in the test case table in the database for calling and executing subsequent test tasks.
[0238] In this technical solution, after selecting a target test case template and then supplementing the test in the target test case template, the first test case generated can also be deleted according to actual needs to meet different needs of test users.
[0239] like Figure 8A As shown in FIG, a schematic diagram of generating a test case in an embodiment of the present application is provided. Figure 8AAs shown, it can include a rapid construction module, a test case management module, a test case reuse module, a test task management module and a test report management module.
[0240] The rapid construction module can be used to quickly generate test cases. Specifically, test cases can be generated by selecting a target test case template and supplementing the test information corresponding to the target test case template.
[0241] The test case management module can manage the generated test cases, including storage, update and deletion, etc. The test case management module also includes the management of test case tables, each of which includes at least one test case.
[0242] The test case reuse module can reuse test cases, that is, the same test case table can be called and executed by different testers.
[0243] The test task management module can be used to manage test tasks, including scheduling and executing the test case table corresponding to the test task, collecting execution results, etc.
[0244] The test report management module can analyze, generate and display test results.
[0245] like Figure 8B As shown in FIG, a flow chart of generating a test case in an embodiment of the present application is shown. Figure 8B As shown, the tester can first select the target test case template, namely, the entire table test case template, the single form field test case template, the single table multiple fields test case template, the multiple tables multiple fields test case template, and the custom test case template. After selecting the target test case template, the test information corresponding to the target test case template is supplemented. After supplementation is completed, the template engine is called to generate the test case and store it. The types of test information can include test case table options, test field options, filter condition options, aggregation condition options, verification information options, test case name options, etc.
[0246] With the test case template, test users can select a specific test case template according to their needs, complete the test information, reduce the time for SQL spelling and accuracy verification, and achieve rapid generation of SQL test cases.
[0247] In the embodiment of the present application, in response to the selection operation of the target test case template, a corresponding target test information option interface is displayed, the target test information option interface includes at least one test information option, and the type of the at least one test information option includes at least one of a test case table option, a test field option, a filtering condition option, an aggregation condition option, a verification information option, and a test case name option; in response to an input operation of test information corresponding to a first target test information option, a target test information interface is displayed, the target test information interface includes the input test information and a generation control, and the first target test information option is a required option in the at least one test information option; in the case where the first target test information option does not include corresponding default test information, the input operation includes a character input operation, a voice input to character recognition operation, or a picture input to character recognition operation; in the case where the first target test information option includes corresponding default test information, the input operation includes a confirmation operation, a modification operation, or a selection operation; in response to a trigger operation on the generation control, a first test case is generated and displayed; through generation of at least one test case, a test case table is obtained, the test case table includes the first test case; the test case table is stored in a database, and the access type of the test case table is a public type; a current test case table corresponding to a current test task is called and executed from the database, and a current test report is generated and displayed. Through structuring and depositing test knowledge, standardizing and streamlining test processes, and intelligently analyzing test results, the system realizes the upgrading and transformation of big data testing from a "workshop" mode to an "industrial production" mode. The template design not only solves the problem of immediate efficiency, but also builds a continuously optimized test knowledge base, forming a positive feedback loop that becomes more accurate with use. Moreover, the graphical interaction of test cases, the template of test case writing, the automation of test case execution, and the page of test results can greatly improve the efficiency of case writing. It can also reduce the understanding cost of different roles in the test scene, reduce the cost of case writing and execution, and facilitate the sedimentation of test cases between different scenes. Based on the need to assemble scene backtesting cases for automatic execution, the backtesting efficiency is reduced from hours to minutes.
[0248] It should be noted that the above Figure 5 and Figure 7 The embodiments combined are also within the scope of the present application, and will not be described here. Moreover, the test case generation method provided in the embodiments of the present application can be applied to typical scenarios, which can include but are not limited to the following scenarios:
[0249] (1) Database testing
[0250] Schema verification: whether the field type and constraint (such as NOT NULL) meet the design.
[0251] CRUD operation test: whether the insert, delete, update and query operations affect the data consistency.
[0252] Transaction test: ensure the ACID properties (e.g., a transfer operation is either all successful or all rolled back).
[0253] (2) ETL (Extract, Transform, Load) test
[0254] Data mapping: whether the conversion from source data to target data is correct.
[0255] Data cleaning: whether invalid data (e.g., NULL, duplicate values) is handled correctly.
[0256] Performance test: whether large data ETL is completed within the expected time.
[0257] (3) Big data test
[0258] Hadoop / Spark job: verify the calculation results of MapReduce or Spark SQL.
[0259] Data lake / warehouse: check the data integrity of Hive tables, Parquet files.
[0260] (4) Data security test
[0261] Sensitive data desensitization: whether the ID number is stored in encrypted form.
[0262] Permission control: whether the user can only access authorized data.
[0263] (5) Data visualization test
[0264] Report accuracy: whether the data displayed by the BI tool (e.g., Tableau) is consistent with the source data.
[0265] Real-time dashboard: whether the stream data (e.g., Kafka) is updated in real time and without error.
[0266] The above describes the method for generating test cases provided by the embodiments of the present application. The virtual device and the physical device are described below, respectively. As shown in FIG. 1, it is an embodiment schematic diagram of a test case generation device in the embodiments of the present application, which can include: Figure 9A
[0267] The display module 901 is configured to display a target test information option interface corresponding to the selected target test case template in response to a selection operation on the target test case template, the target test information option interface including at least one test information option, a type of the at least one test information option including at least one of a test case table option, a test field option, a filtering condition option, an aggregation condition option, a verification information option, and a test case name option; display a target test information interface in response to an input operation on first target test information option corresponding test information, the target test information interface including the input test information and a generation control, the first target test information option being a required option in the at least one test information option; in a case where the first target test information option does not include corresponding default test information, the input operation including a character input operation, a voice input to character recognition operation, or a picture input to character recognition operation; in a case where the first target test information option includes corresponding default test information, the input operation including a confirmation operation, a modification operation, or a selection operation.
[0268] The generation module 902 is configured to generate a first test case in response to a trigger operation on the generation control.
[0269] The display module 901 is further configured to display the first test case.
[0270] In some possible implementation manners of the present application, the generation module 902 is further configured to obtain a test case table including the first test case through at least one test case generation, and store the test case table in a database, an access type of the test case table being a public type.
[0271] In some possible implementation manners of the present application, the generation module 902 is further configured to call and execute a current test case table corresponding to a current test task from the database, and generate a current test report, the test case table including the current test case table.
[0272] The display module 901 is further configured to display the current test report.
[0273] In some possible implementation manners of the present application, the generation module 902 is specifically configured to generate and display a current test report about a target index in response to a selection on the target index, the target index including at least one of a test target achievement, a quality evaluation, a target problem, a test exit standard achievement, a release suggestion, and a follow-up action suggestion.
[0274] In some possible implementations of the present application, generation module 902 is specifically used to determine the current test task; call and execute the current test case table corresponding to the current test task from the database to obtain the test results of each test case in the current test case table; and generate a current test report based on the test results of each test case in the current test case table.
[0275] In some possible implementations of the present application, the display module 901 is further configured to display the execution status of the current test task when the current test case table corresponding to the current test task is called and executed.
[0276] In some possible implementations of this application, such as Figure 9B FIG. 1 is a schematic diagram of another embodiment of the test case generation device in the embodiment of the present application. The test case generation device may further include:
[0277] Acquisition module 903, used to acquire historical test cases for different test requirements;
[0278] The generating module 902 is further configured to generate at least one test case template based on the historical test cases with different test requirements, wherein the at least one test case template includes the target test case template;
[0279] The display module 901 is further configured to display at least one test case template.
[0280] In some possible implementations of this application, such as Figure 9C FIG. 1 is a schematic diagram of another embodiment of the test case generation device in the embodiment of the present application. The test case generation device may further include:
[0281] The processing module 904 is configured to, in response to a triggering operation on the generation control, convert the test information corresponding to the at least one test information option into test information corresponding to at least one test information option of a test statement structure; and bind the test information corresponding to the at least one test information option to a placeholder of the target test case template to obtain encapsulated test data.
[0282] The generating module 902 is further configured to generate and display the first test case according to the test information corresponding to the at least one test information option of the test statement structure and the encapsulated test data;
[0283] The display module 901 is further configured to display the first test case.
[0284] In some possible implementations of the present application, the processing module 904 is further configured to respond to a modification operation on the first test case, generate a modified first test case, and synchronize the modified first test case to the test case table.
[0285] In some possible implementations of the present application, the processing module 904 is further configured to delete the first test case in response to a deletion operation on the first test case.
[0286] In some possible implementations of the present application, the display module 901 is configured to display a template interface, where the template interface includes at least one test case template, and the at least one test case template includes the target test case template.
[0287] like Figure 10 As shown, it is a schematic diagram of an embodiment of an electronic device in the embodiment of the present application, which may include Figure 9A 、 Figure 9B or Figure 9C The test case generation device shown.
[0288] In an embodiment of the present application, the electronic device may be a server or a terminal device, wherein the terminal device may be a mobile phone, a tablet computer, a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal device in industrial control, a wireless terminal device in self-driving, a wireless terminal device in remote medical, a wireless terminal device in smart grid, a wireless terminal device in transportation safety, a wireless terminal device in a smart city, or a wireless terminal device in a smart home, etc.
[0289] like Figure 11 FIG. 1 is a schematic diagram of an embodiment of a terminal device in the embodiment of the present application. Figure 11 A detailed introduction to the various components of the mobile phone in the terminal device:
[0290] The RF circuit 1110 can be used for receiving and sending signals in the process of information or communication, in particular, receiving the downlink information from the base station and sending the uplink data to the base station. Generally, the RF circuit 1110 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 1110 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to global system for mobile communication (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), long term evolution (LTE), email, short message service (SMS), etc.
[0291] The memory 1120 can be used to store software programs and modules, and the processor 1180 can execute various functions of the mobile phone and data processing by running the software programs and modules stored in the memory 1120. The memory 1120 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 1120 can include a high-speed random access memory, and can also include a non-volatile memory, for example, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device.
[0292] The input unit 1130 can be used to receive input digital or character information and to generate key signal inputs related to a user setting of the mobile phone and a function control. Specifically, the input unit 1130 can include a touch panel 1131 and other input devices 1132. The touch panel 1131, also called a touch screen, can collect a touch operation (such as an operation of a user using a finger, a stylus, or any suitable object or accessory on or near the touch panel 1131) of the user on or near it and drive a corresponding connection device according to a pre-set program. Optionally, the touch panel 1131 can include two parts, a touch detection device and a touch controller. The touch detection device detects the touch position of the user and detects a signal caused by the touch operation and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch coordinates, and sends it to the processor 1180, and can receive commands from the processor 1180 and execute them. In addition, the touch panel 1131 can be implemented in various types such as a resistive type, a capacitive type, an infrared type, and a surface acoustic wave type. In addition to the touch panel 1131, the input unit 1130 can also include other input devices 1132. Specifically, the other input devices 1132 can include one or more of a physical keyboard, a function key (such as a volume control key, an on / off key, etc.), a trackball, a mouse, a joystick, etc.
[0293] The display unit 1140 can be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 1140 can include a display panel 1141, which can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 1131 can cover the display panel 1141, and when the touch panel 1131 detects a touch operation on or near it, it transmits to the processor 1180 to determine the type of touch event, and then the processor 1180 provides a corresponding visual output on the display panel 1141 according to the type of touch event. Although in the above description, the touch panel 1131 and the display panel 1141 are implemented as two independent components to realize the input and output functions of the mobile phone, in some embodiments, the touch panel 1131 and the display panel 1141 can be integrated to realize the input and output functions of the mobile phone. Figure 11
[0294] The phone can also include at least one sensor 1150, such as an optical sensor, a motion sensor, and other sensors. Specifically, the optical sensor can include an ambient light sensor to adjust the brightness of the display panel 1141 according to the brightness of ambient light, and a proximity sensor to turn off the display panel 1141 and / or the backlight when the phone is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (usually three axes), and when at rest, it can detect the magnitude and direction of gravity, which can be used for applications that identify the phone posture (such as switching between landscape and portrait screens, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometers, taps), and the like. As for other sensors that the phone can also be configured, such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, and the like, they will not be described here.
[0295] The audio circuit 1160, the speaker 1161, and the microphone 1162 can provide an audio interface between the user and the phone. The audio circuit 1160 can convert the received audio data into an electrical signal, transmit it to the speaker 1161, and convert it into a sound signal output by the speaker 1161; on the other hand, the microphone 1162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1160 and converted into audio data, which is then processed by the processor 1180 and transmitted to, for example, another phone via the RF circuit 1110, or output to the memory 1120 for further processing.
[0296] Wi-Fi belongs to a short-range wireless transmission technology. The phone can help users send and receive emails, browse web pages, and access streaming media through the Wi-Fi module 1170, which provides users with wireless broadband Internet access. Although Figure 11 The Wi-Fi module 1170 is shown, but it can be understood that it does not belong to the necessary components of the phone, and can be omitted as needed without changing the essence of the application.
[0297] The processor 1180 is the control center of the phone, which connects all parts of the phone through various interfaces and lines, executes various functions and processes data of the phone by running or executing software programs and / or modules stored in the memory 1120 and calling data stored in the memory 1120, and thus monitors the phone as a whole. Optionally, the processor 1180 can include one or more processing units; preferably, the processor 1180 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 1180.
[0298] The mobile phone further includes a power supply 1190 (such as a battery) for supplying power to various components. Preferably, the power supply is logically connected to the processor 1180 through a power management system, so that the power management system can perform functions such as charge management, discharge management, and power consumption management.
[0299] Although not shown, the mobile phone can also include a camera, a Bluetooth module, and the like, which will not be described here.
[0300] In the embodiments of the present application, the display unit 1140 is configured to display a corresponding target test information option interface in response to a selection operation on a target test case template, the target test information option interface including at least one test information option, the type of the at least one test information option including at least one of a test case table option, a test field option, a filtering condition option, an aggregation condition option, a verification information option, and a test case name option; display a target test information interface in response to an input operation on test information corresponding to a first target test information option, the target test information interface including the input test information and a generation control, the first target test information option being a mandatory option in the at least one test information option; in a case where the first target test information option does not include corresponding default test information, the input operation including a text input operation, a voice input to text recognition operation, or a picture input to text recognition operation; in a case where the first target test information option includes corresponding default test information, the input operation including a confirmation operation, a modification operation, or a selection operation.
[0301] The processor 1180 is configured to generate a first test case in response to a triggering operation on the generation control.
[0302] The display unit 1140 is further configured to display the first test case.
[0303] In some possible implementations of the present application, the processor 1180 is further configured to obtain a test case table including the first test case through generation of at least one test case, and store the test case table in a database, the access type of the test case table being a public type.
[0304] In some possible implementations of the present application, the processor 1180 is further configured to call and execute a current test case table corresponding to a current test task from the database, and generate and display a current test report, the test case table including the current test case table.
[0305] In some possible implementation manners of the present application, the processor 1180 is specifically configured to determine a current test task; call and execute a current test case table corresponding to the current test task from the database to obtain a test result of each test case in the current test case table; and generate a current test report according to the test result of each test case in the current test case table.
[0306] The display unit 1140 is further configured to display the current test report.
[0307] In some possible implementation manners of the present application, the processor 1180 is specifically configured to, in response to selection of a target index, generate and display a current test report about the target index, the target index including at least one of a test target achievement, a quality evaluation, a target problem, a test exit standard achievement, a release suggestion, and a follow-up action suggestion.
[0308] In some possible implementation manners of the present application, the display unit 1140 is further configured to display an execution status of the current test task in a case where the current test case table corresponding to the current test task is called and executed.
[0309] In some possible implementation manners of the present application, the processor 1180 is configured to obtain historical test cases of different test requirements; and generate at least one test case template according to the historical test cases of the different test requirements, the at least one test case template including the target test case template.
[0310] The display unit 1140 is further configured to display the at least one test case template.
[0311] In some possible implementation manners of the present application, the processor 1180 is configured to, in response to a triggering operation of the generation control, convert test information corresponding to at least one test information option into test information corresponding to at least one test information option of a test sentence structure; bind the test information corresponding to at least one test information option and a placeholder of the target test case template to obtain encapsulated test data; and generate and display the first test case according to the test information corresponding to at least one test information option of the test sentence structure and the encapsulated test data.
[0312] The display unit 1140 is further configured to display the first test case.
[0313] In some possible implementation manners of the present application, the processor 1180 is further configured to, in response to a modification operation of the first test case, generate a modified first test case; and synchronize the modified first test case to the test case table.
[0314] In some possible implementation of the present application, the processor 1180 is further configured to delete the first test case in response to the deletion operation on the first test case.
[0315] In some possible implementation of the present application, the display unit 1140 is configured to display a template interface, where the template interface includes at least one test case template, and the at least one test case template includes the target test case template.
[0316] The embodiment of the present application further provides a computer readable storage medium, where the computer readable storage medium stores computer instructions, and when the computer instructions run on an electronic device, the electronic device executes the method embodiment described above.
[0317] The computer readable storage medium described above can adopt any combination of one or more computer readable mediums. The computer readable medium can be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium, for example, can be, but is not limited to, an electrical, a magnetic, an optical, an electromagnetic, an infrared, or a semiconductor system, device or apparatus, or any combination of the above. More specific examples (a non-exhaustive list) of the computer readable storage medium include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read only memory (ROM), an erasable programmable read only memory (EPROM) or a flash memory, an optical fiber, a portable compact disc read only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer readable storage medium can be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus or device.
[0318] The computer readable signal medium can include a data signal propagated in baseband or propagated as a carrier wave in a propagated data signal, where the propagated data signal carries the computer readable program code. The propagated data signal can take many forms, including but not limited to, electro-magnetic, optical, or any suitable combination thereof. The computer readable signal medium can also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate or transport program for use by or in connection with an instruction execution system, apparatus, or device.
[0319] The program code embodied on the computer readable media can be transmitted using any appropriate medium, including but not limited to wireless, wire line, optical fiber cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
[0320] Computer program code for carrying out operations of the present specification can be written in any suitable programming language including object oriented programming languages such as Java, Smalltalk, C++ as well as conventional procedural programming languages such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0321] The embodiments of the present application further provide a computer program product, which, when running on a computer, enables the computer to perform some or all of the steps of the above method embodiments.
[0322] The embodiments of the present application provide a chip system, which includes a processor and can further include a memory, for realizing the functions of the electronic device in the above method. The chip system can be composed of a chip, or can include a chip and other discrete devices.
[0323] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
[0324] In the several embodiments provided by the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are only schematic. The division of the units is only a logical function division. There can be another division manner for actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between the units can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.
[0325] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e., may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0326] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0327] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various program code storage media.
[0328] The above-described embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some technical features; and these modifications or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A test case generation method characterized by, The method comprises: in response to a selection operation on a target test case template, displaying a corresponding target test information option interface, the target test information option interface comprising at least one test information option, the type of the at least one test information option comprising at least one of a test case table option, a test field option, a filter condition option, an aggregation condition option, a verification information option, and a test case name option; in response to an input operation on test information corresponding to a first target test information option, displaying a target test information interface, the target test information interface comprising the input test information and a generation control, the first target test information option being a mandatory option in the at least one test information option; in a case where the first target test information option does not comprise corresponding default test information, the input operation comprising a character input operation, a voice input to character recognition operation, or a picture input to character recognition operation; in a case where the first target test information option comprises corresponding default test information, the input operation comprising a confirmation operation, a modification operation, or a selection operation; in response to a triggering operation on the generation control, generating and displaying a first test case.
2. The method of claim 1, wherein, The method further comprises: obtaining a test case table through generation of at least one test case, the test case table comprising the first test case; storing the test case table in a database, the access type of the test case table being a public type.
3. The method of claim 2, wherein, The method further comprises: calling and executing a current test case table corresponding to a current test task from the database, generating and displaying a current test report, the test case table comprising the current test case table.
4. The method of claim 3, wherein, The calling and executing of the current test case table corresponding to the current test task from the database, and the generating and displaying of the current test report, comprise: determining the current test task; calling and executing the current test case table corresponding to the current test task from the database to obtain test results of each test case in the current test case table; generating and displaying a current test report according to the test results of each test case in the current test case table.
5. The method of claim 4, wherein, The generating and displaying of the current test report according to the test results of each test case in the current test case table, comprise: in response to selection of a target indicator, generating and displaying a current test report about the target indicator, the target indicator comprising at least one of a test target achievement, a quality evaluation, a target problem, a test exit standard achievement, a release suggestion, and a follow-up action suggestion.
6. The method according to claim 4 or 5, characterized in that, The method further comprises: in a case where the current test case table corresponding to the current test task is called and executed, displaying an execution status of the current test task.
7. The method according to any one of claims 1-5, characterized in that, The method further comprises: obtaining historical test cases of different test requirements; generating and displaying at least one test case template according to the historical test cases of the different test requirements, the at least one test case template comprising the target test case template.
8. The method according to any one of claims 1-5, characterized in that, The generating and displaying of the first test case in response to the triggering operation on the generation control, comprise: In response to a triggering operation on the generation control, the at least one test information option corresponding test information is converted into test statement structure test information corresponding to the at least one test information option; The at least one test information option corresponding test information is bound to the placeholder of the target test case template to obtain encapsulated test data; According to the at least one test information option corresponding test information of the test statement structure and the encapsulated test data, the first test case is generated and displayed.
9. The method according to any one of claims 1-5, characterized in that, The method further comprises: In response to a modification operation on the first test case, a modified first test case is generated; The modified first test case is synchronized to the test case table.
10. The method of any one of claims 1-5, wherein, The method further comprises: In response to a deletion operation on the first test case, the first test case is deleted.
11. A test case generation apparatus characterized by comprising: Comprise: The display module is configured to display a corresponding target test information option interface in response to a selection operation on a target test case template, the target test information option interface comprising at least one test information option, the type of the at least one test information option comprising at least one of a test case table option, a test field option, a filter condition option, an aggregation condition option, a verification information option, and a test case name option; In response to an input operation on first target test information option corresponding test information, a target test information interface is displayed, the target test information interface comprising input test information and a generation control, the first target test information option being a required option in the at least one test information option; In the case where the first target test information option does not include corresponding default test information, the input operation comprises a character input operation, a voice input to character recognition operation, or a picture input to character recognition operation; In the case where the first target test information option includes corresponding default test information, the input operation comprises a confirmation operation, a modification operation, or a selection operation; The generation module is configured to generate a first test case in response to a triggering operation on the generation control. The display module is further configured to display the first test case.
12. An electronic device, comprising: Comprise: A memory and a processor, and a display, the memory storing a computer program executable on the processor, and the electronic device implements the method of any one of claims 1-10 when executing the program.
13. A computer readable storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the method of any one of claims 1-10.