Automatically generate order use case method, device and related media based on field configuration
Through the automatic order generation use case method based on field configuration, database query statements are dynamically generated, which solves the problems of inefficiency and high error rate caused by manual entry of interface parameters, and achieves the efficiency and accuracy of automated testing.
Patent Information
- Application Number
- CN202410133833.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-31
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-01-31
AI Technical Summary
In modern automated testing systems, the interface parameters of trading orders need to be manually entered and maintained, resulting in inefficient work efficiency and high error rates. Especially when the basic transaction data is changed or new securities varieties are added, the interface parameters need to be manually updated, which adds the Workload and prone to omissions or errors.
Using the automatic order generation use case method based on field configuration, the field value is configured through the code value configuration table, the code value is combined using the full dual algorithm to generate strings, and the mapping relationship between interface fields and table fields is configured to dynamically generate database query statements to realize Automatic generation of order use cases.
It improves work efficiency, reduces error rate, can update interface parameters in a timely manner, simplifies the testing process, reduces operational complexity, and supports flexible adjustment of basic data to adapt to new needs or data changes.
Smart Images

Figure CN117873898B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of testing technology, and in particular to a method, device and related media for automatically generating order use cases based on field configuration. Background Art
[0002] In modern automated testing systems, especially in the field of trading system testing, the interface parameters of trading orders usually need to be manually entered and maintained. This method is widely used in a variety of scenarios, including but not limited to securities trading, financial services, and other systems closely related to trading. However, this traditional manual processing method has two disadvantages: the first disadvantage is the high maintenance workload. When the basic trading data changes or new securities need to be added, all relevant interface parameters need to be manually updated, which increases the workload, thereby affecting the timeliness of the test and resulting in low work efficiency; the second disadvantage is that it is prone to errors. Since it relies entirely on manual entry, this method is prone to maintenance omissions and errors. For example, when updating or adding new securities, some key parameters may be missed or parameter values may be entered incorrectly. Summary of the invention
[0003] The embodiments of the present invention provide a method, device and related media for automatically generating order use cases based on field configuration, aiming to solve the problem of low work efficiency and high error rate caused by manual entry of order interface parameters in the prior art.
[0004] In a first aspect, an embodiment of the present invention provides a method for automatically generating an order use case based on field configuration, comprising:
[0005] Configuring the field value of each field in the code value configuration table; wherein the configuration field of the code value configuration table includes a table name, a field name and a code value, and the field value of the code value includes at least one numbered value;
[0006] Combining and configuring the field values of the code values based on the full dual algorithm according to the group sequence number dimension to obtain multiple code value combinations;
[0007] The code value combinations are stored in a string format to obtain corresponding strings;
[0008] Configure the interface fields of the order and the mapping relationship between the interface fields and the table fields to obtain an interface configuration table;
[0009] Dynamically generate a database query statement based on the code value configuration table, character string and interface configuration table;
[0010] Execute the database query statement to obtain the query result, and output the order use case according to the query result.
[0011] In a second aspect, an embodiment of the present invention provides a device for automatically generating an order use case based on field configuration, comprising:
[0012] A data definition unit, configured to configure the field value of each field in the code value configuration table; wherein the configuration field of the code value configuration table includes a table name, a field name and a code value, and the field value of the code value includes at least one numbered value;
[0013] A data combination unit, used for combining and configuring the field values of the code values based on a full dual algorithm to obtain a plurality of code value combinations;
[0014] A data storage unit, used to store each code value combination in the form of a character string to obtain a corresponding character string;
[0015] A data mapping unit, used to configure the interface fields of the order and the mapping relationship between the interface fields and the table fields, to obtain an interface configuration table;
[0016] A data generation unit, used to dynamically generate a database query statement based on the code value configuration table, the character string and the interface configuration table;
[0017] The data output unit is used to execute the database query statement to obtain the query result, and output the order use case according to the query result.
[0018] In a third aspect, an embodiment of the present invention provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for automatically generating order use cases based on field configuration according to the first aspect when executing the computer program.
[0019] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the method for automatically generating order use cases based on field configuration according to the first aspect is implemented.
[0020] The embodiment of the present invention provides a method, device and related medium for automatically generating order use cases based on field configuration, the method comprising configuring the field values of each field in a code value configuration table; wherein the configuration fields of the code value configuration table include table name, field name and code value; combining and configuring the field values of the code value based on the full dual algorithm to obtain multiple code value combinations; saving each code value combination in the form of a string to obtain a corresponding string; configuring the interface field of the order and the mapping relationship between the interface field and the table field to obtain an interface configuration table; dynamically generating a database query statement based on the code value configuration table, the string and the interface configuration table; executing the database query statement to obtain the query result, and outputting the order use case according to the query result. The present invention utilizes the code value configuration table, the string and the interface configuration table to generate a database query statement in real time, so that the interface parameter content can be updated in time, which greatly improves the work efficiency and reduces the error rate.
[0021] The embodiment of the present invention also provides an apparatus, computer device and storage medium for automatically generating order use cases based on field configuration, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0023] Figure 1 A flowchart of a method for automatically generating an order use case based on field configuration provided by an embodiment of the present invention;
[0024] Figure 2 Schematic diagram of a code value configuration table provided in an embodiment of the present invention Figure 1 ;
[0025] Figure 3 Schematic diagram of code value combination provided by the embodiment of the present invention Figure 1 ;
[0026] Figure 4 Schematic diagram of a code value configuration table provided in an embodiment of the present invention Figure 2 ;
[0027] Figure 5 Schematic diagram of code value combination provided by the embodiment of the present invention Figure 2 ;
[0028] Figure 6 Schematic diagram of code value combination provided by the embodiment of the present invention Figure 3 ;
[0029] Figure 7A schematic diagram of an interface configuration table provided in an embodiment of the present invention;
[0030] Figure 8 Order transaction process provided by the embodiment of the present invention Figure 1 ;
[0031] Fig. 9 Order transaction process provided by the embodiment of the present invention Figure 2 ;
[0032] Fig.10 A schematic block diagram of a device for automatically generating an order use case based on field configuration provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0034] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0035] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0036] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0037] See below Figure 1 , Figure 1 A flowchart of a method for automatically generating an order use case based on field configuration provided in an embodiment of the present invention specifically includes steps S101 to S106.
[0038] S101, configuring the field value of each field in the code value configuration table; wherein the configuration field of the code value configuration table includes a table name, a field name and a code value, and the field value of the code value includes at least one numbered value;
[0039] S102, combining and configuring the field values of the code values based on the full dual algorithm according to the group sequence number dimension to obtain multiple code value combinations;
[0040] S103, saving each code value combination in the form of a character string to obtain a corresponding character string;
[0041] S104, configuring the interface fields of the order and the mapping relationship between the interface fields and the table fields to obtain an interface configuration table;
[0042] S105, dynamically generating a database query statement based on the code value configuration table, the character string and the interface configuration table;
[0043] S106: Execute the database query statement to obtain a query result, and output an order use case according to the query result.
[0044] Combination Figure 2 As shown, in step S101, the code value configuration table [tconfig] is used to store the parameter values required in the test process. The configuration fields in the code value configuration table include table name, field name and code value. The table name is the name of the database table storing related data, the field name is the name of a specific column in the table, and the code value is a parameter value preset for a specific test scenario. Each code value corresponds to a field name and is used to specify the value of the field in a specific test case. The field value of the code value includes at least one numbered value, that is, the field value of each code value can have multiple preset values, and each preset value has a corresponding number.
[0045] The first row in the code value configuration table is the field row, and the remaining rows are the field value rows for each group. These groups can be the same or different.
[0046] The field value corresponding to the table name field can be: stockinfo, etc.; the field value corresponding to the field name field can be: market, board, stocktype, ordertype and side, etc. These field values can be collectively referred to as parameters in the following text. The field value corresponding to the code value field can be: XX, main board, small and medium board, GEM, stock, treasury bond, limit price, market price, buy, sell, etc. The fields in the code value configuration table also include: group sequence number, group name, field sequence number, whether to automatically combine and transaction interface sequence number. The field value corresponding to the group sequence number field can be: 1, 2... and other sequence numbers. The field value corresponding to the group name field can be: XX securities trading, etc. The field sequence number can be: 1, 2, 3, 4, 5, etc. Whether to automatically combine can be: Y and N. The transaction interface sequence number can be: 1001, etc.
[0047] Combination Figures 3 to 6As shown, in step S102, the full dual algorithm is a method for permuting and combining code values, which ensures the comprehensiveness and efficiency of test cases by combining different code values. In the present invention, the full dual algorithm combines the field values in the code value configuration table, and the field values represent different test conditions, such as different input data, configuration options or environment settings. Through the full dual algorithm, multiple different code value combinations can be generated, each code value combination represents a specific test scenario, covering the possibility of different parameter combinations. These code value combinations are used to construct test cases, each of which has specific parameter settings to verify the performance of the system under different conditions. Using the full dual algorithm can ensure that the test covers possible parameter combinations, while reducing the need for invalid or repeated tests. Through this systematic approach, the quality and efficiency of the test can be significantly improved.
[0048] Furthermore, code values can be added or reduced in the code value configuration table according to needs, such as Figure 2 The field names "market", "board", "stocktype", "ordertype", etc. in the table all have corresponding code values; the code value corresponding to "XX" can be set in "market", the code value corresponding to "main board", "small and medium-sized board", and "GEM" can be set in "board", the code value corresponding to "stock", "government bonds", and "enterprise bonds" can be set in "stocktype", and the code value corresponding to "limit price", "market price", and "ordertype" can be set in "ordertype". Finally, by combining these code values, we can get Figure 3 The combined results are shown. For example, Figure 3 The code value combination of the first row is "1-1-1-1", which represents the combination of "XX Exchange-Main Board-Stock-Limit Price". Figure 3 The code value combination in the second row is "1-1-2-2", which represents the combination of "XX Exchange-Main Board-Treasury Bond-Market Price". And so on, the third and fourth rows until the end of the number of rows can all be deduced using this method. In this way, using the full dual algorithm to combine code values can greatly save the time used for testing, and there is no need to test all code value combinations. For example, Figure 2 The full coverage configuration of the code value in the code value configuration table requires the generation of 1*3*2*2=12 use cases. Using the full dual algorithm, only 6 use cases need to be generated to cover the pairing of all code values.
[0049] In addition, the field value of the code value can be updated in real time in the code value configuration table. The updating methods include adding, deleting or replacing. For example, when a code value corresponding to "corporate bond" is added to "stocktype" in the code value configuration table, the following can be obtained: Figure 4 The new code value configuration table shown in FIG. 1 can be used to combine code values according to the new code value configuration table to obtain the following: Figure 5 The combined result shown is Figure 5 The code value corresponding to "corporate bonds" has been added and the code value combination is re-made. Figure 5 The interpretation of the combined results of each row can be referred to Figure 3 Through the above method, it is more convenient to adjust the basic data according to the needs, without solidifying the test data, making the order case generation process more flexible.
[0050] Furthermore, the field value of "Whether to automatically combine" in the code value configuration table indicates whether it should be automatically combined with the code values of other fields through the full-dual algorithm. When the value of the "Whether to automatically combine" field in the code value configuration table is "N", it means that the field will not be included in the automatic full-dual combination process. When the value of the "Whether to automatically combine" field in the code value configuration table is "N", this field will be independently fully combined. When the value of the "Whether to automatically combine" field in the code value configuration table is "Y", this field will not be independently fully combined. "Full combination" means that every possible code value of the field will be additionally combined with the full-dual combination results of other fields to ensure that every code value of the field can be fully tested in the combination. For example Figure 6 As shown in , a field named "side" whose value does not participate in the automatic combination of the full-dual algorithm, then on the basis of generating the full-dual combination, the system will additionally combine each code value of the "side" field with these combination results to form a new code value combination.
[0051] In step S103, the system combines the code values (actually the field values of the code values) of each parameter defined in the code value configuration table through the full duality algorithm. This process ensures that the code value of each parameter is combined with the code value of other parameters at least once to form the basis of multiple test cases. The generated code value combination will be saved in the memory in the form of a JSON string. JSON (JavaScript Object Notation) is a lightweight data exchange format that is easy for humans to read and write, and is also easy for machines to parse and generate. The JSON string contains a specific group_id, which corresponds to the group sequence number in the code value configuration table and is used to identify and reference each unique code value combination. Then, these JSON-formatted code value combinations will be converted into string form for easy transmission or storage. The string storage indicates that these code value combinations can be used to construct dynamic SQL queries, or can be serialized and deserialized when necessary for use by other systems or test links. The group_id and related code values in each JSON string will be used to dynamically construct SQL query statements, which will be used to retrieve corresponding test data from the database in subsequent steps.
[0052] In one embodiment, the step S103 includes:
[0053] Using the field names in the code value configuration table as code value fields, matching the field values of the code values in each code value combination with the corresponding code value fields, and obtaining a code value combination table;
[0054] Combine the field values of each row of code values in the code value combination table with the corresponding code value fields in pairs to obtain the combined data of each row of code values;
[0055] The group sequence number identifier is extracted from the code value configuration table and added to the combined data of each row to obtain a corresponding character string.
[0056] In this embodiment, first, the system extracts field names from the code value configuration table. These field names will be used as code value fields and are the basis for test data combination. For each group of code values in the code value configuration table, the system matches its field values with the corresponding code value fields to generate a code value combination table. Next, the system combines each row of code value field values in the code value combination table with the corresponding code value fields in pairs to ensure that each parameter value is combined with other parameter values at least once, meeting the requirements of the full dual algorithm, thereby generating combined data for each row of code values. The generated combined data is for testing different parameter configurations and scenarios. Then, the system extracts the group sequence number identifier from the code value configuration table and adds this identifier to the combined data of each row in order to maintain and track the identity of each group of data and ensure that they can be correctly referenced and processed. Finally, the combination of the combined data of each row and the group sequence number is converted into a string, which can be used to identify test cases or inserted into SQL statements for database operations. For example, an example of a string is as follows:
[0057] "group_id":1,"c_market_no":"1","c_stock_type":"1","c_stock_property":"0","orderty pe":"1","saide":"1".
[0058] In the above string, "group_id":1 means the group number is 1, "c_market_no":"1" means the corresponding code value field value is 1, "c_stock_property":"0" means the corresponding code value field value is 0, "c_stock_type":"1" means the corresponding code value field value is 1, "ordertype":"1" means the corresponding code value field value is 1, and "saide":"1" means the corresponding code value field value is 1.
[0059] Combination Figure 7As shown, in step S104, first, all fields involved in the trading interface need to be configured in the interface configuration table [ttradeapi]. These fields are the input data expected by the trading interface and are essential for executing trading operations. The configuration work involves defining the name, data type, whether it is required, default value and other attributes of each interface field. Next, the configuration work needs to define the mapping relationship between the interface fields and the database table fields. The mapping relationship specifies how the interface fields correspond to the actual table fields in the database. Through the above configuration, the system generates an interface configuration table. This table not only contains the field information of the trading interface, but also contains the mapping relationship between these fields and the database table fields.
[0060] In step S105, using the above two configuration tables and string information, the system will generate database query statements, which are used to retrieve specific data sets from the test database, and these data sets will be used to verify the test case. The generation of database query statements is dynamic, that is, it will change according to the requirements of the current test case.
[0061] In one embodiment, the step S105 includes:
[0062] Acquire a backfill field according to the interface configuration table;
[0063] Obtain table names and field names respectively according to the code value configuration table;
[0064] The field name is matched with the character string to obtain a matching result, and the backfill field, table name and matching result are combined into the database query statement according to a template.
[0065] In this embodiment, first, according to the interface configuration table [ttradeapi], the fields that need to be queried from the database and backfilled into the test case are determined. These backfilled fields are data points that need to be verified when executing the test (such as an example of a backfilled field: vc_inter_code.en_yesterday_close_price.l_buy_unit). Then, the code value configuration table [tconfig] is used to obtain the relevant table name and field name. This information defines the table and field to be retrieved by the database query. Next, the code value contained in the string is matched with the field name in the code value configuration table to obtain the specific value corresponding to each field. Finally, the backfilled field, table name and matching result are combined and assembled into a complete SQL query statement according to a given template format. This template usually follows SQL syntax, for example: "Select [backfilled field] from [table name] where [field name] = [matching result]". An example of the SQL query statement in this embodiment is as follows: select vc_inter_code, en_yesterday_close_price, l_buy_unit from tstockinfo where c_market_no='1'and c_stock_type='1'and c_stock_property='0'.
[0066] In step S106, the system executes a database query using the previously assembled SQL query statement. This query uses the defined parameters and code values to retrieve records that meet the conditions in the database. After the query is executed, the system collects the returned data, which is the query result, containing the information necessary to execute the test case, such as transaction quantity, price, transaction type, etc. Based on the query results, the system constructs specific order use cases. This step involves mapping the data in the query results to a predetermined test case template. These order use cases contain all the necessary transaction parameters and are ready to be sent to the trading system to be tested in the form of actual transaction requests. The complete order use case will be output for subsequent test steps. The output is to save the test case in a file, send it to a queue for use by the test engine, or directly trigger the actual transaction operation for testing.
[0067] In one embodiment, the step S106 includes:
[0068] Execute the database query statement and determine whether the query result is empty. If the query result is empty, write the corresponding code value combination into the no-match data file; if the query result is not empty, determine whether the query result contains multiple results;
[0069] If the query result includes one result, the query result is directly output; if the query result includes multiple results, the first result is taken and used as the query result.
[0070] In this embodiment, the test system executes a previously constructed SQL query statement, which is based on the code value combination generated from the configuration table and is intended to retrieve data corresponding to these combinations from the database. The system first checks whether the query result is empty, which is a key judgment point because an empty result indicates that the current code value combination has no corresponding data in the database. If the query result is empty, this means that this particular code value combination has not found a matching record in the database. In this case, the code value combination is regarded as a scenario that cannot generate a valid test case. For an empty query result, the system can write the corresponding code value combination into a specific file, which is called a "no matching data file". This is done to facilitate subsequent analysis and to see which specific test scenarios cannot be covered. If the query result is not empty, the system will further determine whether the query returns a single or multiple results. If there is only one result, the system directly outputs it as a query result. If there are multiple results, the system will only take the first result and regard it as a query result. For non-empty query results (whether a single one or the first one taken from multiple results), the system will fill the query result back into the code value JSON string in key-value pair format.
[0071] An example of a corresponding string is:
[0072] "group_id":1,"c_market_no":"1","c_stock_type":"1","c_stock_property":"0","orderty pe":"1","saide":"1";
[0073] The key-value pairs are as follows:
[0074] "vc_inter_code":"600590","en_yesterday_close_price":6.52000000,"":100.0000.
[0075] Finally, the example obtained by backfilling the above key-value pairs into a string is as follows:
[0076] "group_id":1,"c_market_no":"1","c_stock_type":"1","c_stock_property":"0","or dertype":"1","saide":"1";
[0077] "vc_inter_code":"600590","en_yesterday_close_price":6.52000000,"":100.0000.
[0078] These test cases can then be used to execute subsequent test steps.
[0079] In one embodiment, the step S106 further includes:
[0080] Extracting the query value of each backfill field from the query result;
[0081] Fill each backfill field and the corresponding query value into the string in the format of a key-value pair to obtain an initial order use case;
[0082] The initial order use case is mapped and converted based on the interface configuration table to generate the order use case consistent with the interface field.
[0083] In this embodiment, from the result set obtained from the executed SQL query statement, the system first needs to extract the query value of each backfill field. These field values correspond to specific data points that need to be verified in the test case. The values of the backfill fields are based on the previous query results, and these values reflect the actual data in the database. Next, the system fills these backfill fields and their corresponding query values into a string in the format of key-value pairs. This string is a data structure in JSON format. This process forms an initial order use case. The initial order use case contains the necessary test data, but at this time these data do not completely correspond to the fields of the transaction interface. Since the field names of the interface are inconsistent with the field names of the database table, the initial order use case needs to be mapped and converted according to the interface configuration table. The mapping conversion process involves adjusting the field names and formats in the initial order use case to be consistent with the field names and formats expected by the transaction interface. After the mapping conversion, the system generates final order use cases that are consistent with the fields of the transaction interface, which can now be directly used to test the transaction interface.
[0084] For example, the corresponding string in this embodiment is as follows:
[0085] {"group_id":1,"c_market_no":"1","c_stock_type":"1","c_stock_property":"0","ordert ype":"1","saide":"1","vc_report_code":"600590","en_yesterday_close_price":6.52000000,"1_buyunit":100.0000}, by comparing Figure 7 The interface configuration table can be changed to:
[0086] {"group_id":1,"c_market_no":"1","c_stock_type":"1","o_stock_property":"0","ordertype":"1","saide":"1","c_stock_code":"600590","n_price":6.52000000,"n_qty":100.0000).
[0087] That is, replace "vc_report_code" with "c_stock_code", "en_yesterday_close_price" with "n_price", and "1_buyunit" with "n_qty".
[0088] Combination Figure 8 and Fig. 9 As shown, in one embodiment, after step S106, the method further includes:
[0089] The order use case is written into the transaction interface according to the interface configuration table, and a transaction request is sent to the transaction engine, and the entrustment status is sent to the matching system; the transaction engine receives the transaction request, verifies it and generates an entrustment message, and sends the entrustment message to the matching system; and the matching system receives the sent entrustment status, processes it in combination with the entrustment message, returns a confirmation message and a transaction message to the transaction engine, and the transaction engine returns the transaction information according to the confirmation message and the transaction message.
[0090] In this embodiment, the data of the order use case is filled into the transaction interface using the interface configuration table to generate transaction requests, which reflect different entrustment states, such as failure, entrustment, transaction, partial transaction, and order cancellation. These transaction requests are then sent to the transaction engine, and each use case is executed 5 times in a loop according to different entrustment states to ensure the comprehensiveness of the test. After receiving the transaction request, the transaction engine verifies the funds and securities. After the verification passes, the transaction engine generates a commission message. This commission message contains detailed information about the transaction, such as the specific parameters of the order, and is then sent to the simulation matching system. The simulation matching system receives the commission message sent by the transaction engine. At the same time, the automation platform sends the corresponding entrustment status to the simulation matching system. The simulation matching system processes the received entrustment status and entrustment message and generates a confirmation message and a transaction message. This confirmation message and transaction message reflect the processing results of the transaction, including whether the transaction is completed, the transaction quantity, and other information. The confirmation message and transaction message are returned from the simulation matching system to the transaction engine. The transaction engine updates the transaction information according to the transaction message, including the available status and available quantity of funds and securities. The trading engine returns this transaction information to the automation platform, which then evaluates the execution results of the transaction request.
[0091] In one embodiment, when the transaction engine verifies and generates a delegation message after receiving the transaction request, it specifically performs: using the delegation quantity and delegation price of the order to calculate the delegation amount; using the delegation amount and the rate of the order to calculate the delegation fee; determining whether the sum of the delegation amount and the delegation fee is greater than or equal to the available funds, if not, the verification fails; if so, the verification passes.
[0092] In this embodiment, first, it is necessary to ensure that the funds for the buy order are sufficient, which involves calculating the entrustment amount (entrustment quantity multiplied by the entrustment price) and the entrustment fee (entrustment amount multiplied by the fee rate), so that it can be determined whether the available funds in the fund account are sufficient to cover the entrustment amount plus the entrustment fee. By calling the fund interface, check whether the available funds of the current account are greater than or equal to the entrustment amount plus the entrustment fee. If the available funds are not enough to cover these fees, the system will call the fund adjustment interface to increase the available funds in the account. The automation platform generates a buy order and sends the order to the trading engine. After receiving the transaction request, the trading engine performs the following steps to verify the order: calculate the entrustment amount (entrustment quantity multiplied by the entrustment price) and the entrustment fee (entrustment amount multiplied by the fee rate). Determine whether the sum of the entrustment amount and the entrustment fee is greater than or equal to the available funds of the account. If the funds are insufficient, the verification fails; if the funds are sufficient, the verification passes, and the engine sends the order to the simulated matching platform. After receiving the order from the trading engine, the simulated matching platform processes the order and returns a confirmation message and a transaction message. The trading engine receives the confirmation message and the transaction message from the simulated matching platform, and deducts the available funds of the account and increases the position accordingly. Then, the trading engine feeds back the transaction information to the automated platform. Based on the information returned by the trading engine, the automated platform verifies whether the funds and positions meet the expected status after the transaction is executed.
[0093] In summary, the present invention can automatically generate a combination of test cases according to custom rules, and can automatically create multiple different test scenarios based on pre-set code value maintenance rules without manually writing each case. This method simplifies the user's operation during the test process. Since the test cases are automatically generated, the user does not need to manually maintain or create test data, which significantly reduces the complexity of the operation. The generation of automated cases greatly improves the efficiency of the test process. Users do not need to spend time and energy to write and manage test cases, which makes the system easier to operate and manage. The present invention also supports flexible replacement of basic data without relying on solidified test data, which provides higher adaptability and enables the test to quickly adapt to new requirements or data changes. In general, the present invention improves the efficiency and accuracy of testing in an automated and intelligent manner, and solves many pain points in traditional testing methods, such as the cumbersomeness of manual case writing, the solidification limitations of test data, and the complexity of result verification. By automatically generating cases, flexibly processing data, and intelligently verifying test results, the present invention provides an efficient, flexible and intelligent solution for automated testing.
[0094] Combination Fig.10 As shown, Fig.10 A schematic block diagram of a device for automatically generating an order case based on field configuration provided by an embodiment of the present invention, the device 1000 for automatically generating an order case based on field configuration includes:
[0095] The data definition unit 1001 is used to configure the field value of each field in the code value configuration table; wherein the configuration field of the code value configuration table includes a table name, a field name and a code value, and the field value of the code value includes at least one numbered value;
[0096] A data combination unit 1002 is used to combine and configure the field values of the code values based on the full dual algorithm according to the group sequence number dimension to obtain multiple code value combinations;
[0097] The data storage unit 1003 is used to store each code value combination in the form of a character string to obtain a corresponding character string;
[0098] The data mapping unit 1004 is used to configure the interface fields of the order and the mapping relationship between the interface fields and the table fields to obtain an interface configuration table;
[0099] A data generation unit 1005, configured to dynamically generate a database query statement based on the code value configuration table, the character string and the interface configuration table;
[0100] The data output unit 1006 is used to execute the database query statement to obtain the query result, and output the order use case according to the database query result.
[0101] In this embodiment, the data definition unit 1001 configures the field value of each field in the code value configuration table; wherein the configuration field of the code value configuration table includes a table name, a field name and a code value, and the field value of the code value includes at least one numbered value; the data combination unit 1002 combines and configures the field values of the code value according to the group sequence number dimension based on the full dual algorithm to obtain multiple code value combinations; the data storage unit 1003 saves each code value combination in the form of a string to obtain a corresponding string; the data mapping unit 1004 configures the interface field of the order and the mapping relationship between the interface field and the table field to obtain an interface configuration table; the data generation unit 1005 dynamically generates a database query statement based on the code value configuration table, the string and the interface configuration table; the data output unit 1006 executes the database query statement to obtain a query result, and outputs an order use case according to the database query result.
[0102] In one embodiment, the data storage unit 1003 includes:
[0103] A matching unit, configured to use the field names in the code value configuration table as code value fields, match the field values of the code values in each code value combination with the corresponding code value fields, and obtain a code value combination table;
[0104] A combining unit, used for combining the field values of each row of code values in the code value combination table with the corresponding code value fields in pairs to obtain combined data of each row of code values;
[0105] The extraction unit is used to extract the group sequence number identifier from the code value configuration table and add it to the combined data of each row to obtain a corresponding character string.
[0106] In one embodiment, the data generating unit 1005 includes:
[0107] A field unit, used to obtain a backfill field according to the interface configuration table;
[0108] A table name unit, used to obtain a table name and a field name respectively according to the code value configuration table;
[0109] The synthesis unit is used to match the field name with the character string to obtain a matching result, and combine the backfill field, table name and matching result into the database query statement according to a template.
[0110] In one embodiment, the data output unit 1006 includes:
[0111] A judgment unit, used to execute the database query statement and judge whether the query result is empty, if the query result is empty, write the corresponding code value combination into the no-match data file; if the query result is not empty, judge whether the query result contains multiple results;
[0112] An output unit is used to directly output the query result if the query result includes one result; if the query result includes multiple results, take the first result and use it as the query result.
[0113] In one embodiment, the data output unit 1006 further includes:
[0114] A query unit, used to extract the query value of each backfill field from the query result;
[0115] A backfill unit, used to backfill each backfill field and the corresponding query value into the string in the format of a key-value pair to obtain an initial output unit for an initial order use case;
[0116] A mapping unit is used to perform mapping conversion on the initial order use case based on the interface configuration table to generate the order use case consistent with the interface field.
[0117] In one embodiment, after the data output unit 1006, it includes:
[0118] A writing unit is used to write the order use case into the transaction interface according to the interface configuration table, send a transaction request to the transaction engine, and send the entrustment status to the matching system; enable the transaction engine to generate an entrustment message after verifying the transaction request, and send the entrustment message to the matching system; and enable the matching system to receive the sent entrustment status, process it in combination with the entrustment message, return a confirmation message and a transaction message to the transaction engine, and enable the transaction engine to return the transaction information according to the confirmation message and the transaction message.
[0119] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.
[0120] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0121] The embodiment of the present invention also provides a computer device, which may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps provided in the above embodiment may be implemented. Of course, the computer device may also include various network interfaces, power supplies and other components.
[0122] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of this application.
[0123] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A method for automatically generating order use cases based on field configuration, characterized in that: include: Configuring the field value of each field in the code value configuration table; wherein the configuration field of the code value configuration table includes a table name, a field name and a code value, and the field value of the code value includes at least one numbered value; Combining and configuring the field values of the code values based on the full dual algorithm according to the group sequence number dimension to obtain multiple code value combinations; The code value combinations are stored in a string format to obtain corresponding strings; Configure the interface fields of the order and the mapping relationship between the interface fields and the table fields to obtain an interface configuration table; Dynamically generate a database query statement based on the code value configuration table, character string and interface configuration table; Execute the database query statement to obtain the query result, and output the order use case according to the query result; The method of dynamically generating a database query statement based on the code value configuration table, the character string and the interface configuration table includes: obtaining a backfill field according to the interface configuration table; obtaining a table name and a field name according to the code value configuration table; matching the field name with the character string to obtain a matching result, and combining the backfill field, the table name and the matching result into the database query statement according to a template; The outputting of the order use case according to the query result includes: extracting the query value of each backfill field from the query result; backfilling each backfill field and the corresponding query value into the string in the format of a key-value pair to obtain an initial order use case; mapping and converting the initial order use case based on the interface configuration table to generate the order use case consistent with the interface field.
2. The method for automatically generating an order use case based on field configuration according to claim 1 is characterized in that: The code value combinations are saved in the form of a character string to obtain a corresponding character string, including: Using the field names in the code value configuration table as code value fields, matching the field values of the code values in each code value combination with the corresponding code value fields, and obtaining a code value combination table; Combine the field values of each row of code values in the code value combination table with the corresponding code value fields in pairs to obtain the combined data of each row of code values; The group sequence number identifier is extracted from the code value configuration table and added to the combined data of each row to obtain a corresponding character string.
3. The method for automatically generating order use cases based on field configuration according to claim 1 is characterized in that: The executing the database query statement to obtain the query result includes: Execute the database query statement and determine whether the query result is empty. If the query result is empty, write the corresponding code value combination into the no-match data file; if the query result is not empty, determine whether the query result contains multiple results; If the query result includes one result, the query result is directly output; if the query result includes multiple results, the first result is taken and used as the query result.
4. The method for automatically generating order use cases based on field configuration according to claim 1 is characterized in that: After outputting the order use case according to the query result, the method further includes: The order use case is written into the transaction interface according to the interface configuration table, and a transaction request is sent to the transaction engine, and the entrustment status is sent to the matching system; the transaction engine receives the transaction request, verifies it and generates an entrustment message, and sends the entrustment message to the matching system; and the matching system receives the sent entrustment status, processes it in combination with the entrustment message, returns a confirmation message and a transaction message to the transaction engine, and the transaction engine returns the transaction information according to the confirmation message and the transaction message.
5. The method for automatically generating order use cases based on field configuration according to claim 4 is characterized in that: When the transaction engine verifies and generates the entrustment message after receiving the transaction request, it specifically executes: using the entrustment quantity and entrustment price of the order to calculate the entrustment amount; using the entrustment amount and the rate of the order to calculate the entrustment fee; judging whether the sum of the entrustment amount and the entrustment fee is greater than or equal to the available funds, if not, the verification fails; if so, the verification passes.
6. A device for automatically generating order use cases based on field configuration, characterized in that: include: A data definition unit, configured to configure the field value of each field in the code value configuration table; wherein the configuration field of the code value configuration table includes a table name, a field name and a code value, and the field value of the code value includes at least one numbered value; A data combination unit, used for combining and configuring the field values of the code values based on a full dual algorithm to obtain a plurality of code value combinations; A data storage unit, used to store each code value combination in the form of a character string to obtain a corresponding character string; A data mapping unit, used to configure the interface fields of the order and the mapping relationship between the interface fields and the table fields, to obtain an interface configuration table; A data generation unit, used to dynamically generate a database query statement based on the code value configuration table, the character string and the interface configuration table; A data output unit, used to execute the database query statement to obtain a query result, and output an order use case according to the query result; The data generation unit includes: obtaining a backfill field according to the interface configuration table; obtaining a table name and a field name according to the code value configuration table; matching the field name with the string to obtain a matching result, and combining the backfill field, the table name, and the matching result into the database query statement according to a template; The data output unit includes: extracting the query value of each backfill field from the query result; backfilling each backfill field and the corresponding query value into the string in the format of a key-value pair to obtain an initial order use case; mapping and converting the initial order use case based on the interface configuration table to generate the order use case consistent with the interface field.
7. A computer device, characterized in that: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the method for automatically generating order use cases based on field configuration as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the automatic order generation use case based on field configuration as described in any one of claims 1 to 5 is implemented.
