Automatic use case data generation method based on keyword-driven
Through the keyword-driven automated use case data generation method, the problem of low data generation efficiency when docking new trading systems is solved, efficient and targeted data generation and generalization capabilities are achieved, and the testing process is simplified.
Patent Information
- Application Number
- CN202410801215.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-06-20
AI Technical Summary
When connecting to a new trading system, existing technology requires manual editing of data cases and related data, resulting in low data generation efficiency.
Adopt a keyword-driven automated use case data generation method to generate initial case data by parsing the transaction system attribute data, fill in the use case description information and pre-data based on the keyword parsing strategy, and combine to generate automated use case data.
It improves the efficiency of data generation, ensures the pertinence of data, improves the generalization ability of automated use case data generation through template matching, and simplifies the testing process.
Smart Images

Figure CN118363874B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of system automated testing, and in particular to a keyword-driven automated use case data generation method. Background Art
[0002] At present, when the docking system docks with a new trading system (such as a securities trading system, etc.), it is necessary to manually edit a new set of data cases for the new business system and edit the corresponding data for the data cases. When the docking system docks with a new trading system, a large amount of data cases and manual processing of related data will be increased, resulting in low efficiency in generating data cases and related data for the new trading system. Summary of the invention
[0003] An embodiment of the present invention provides an automatic use case data generation method based on keyword-driven, aiming to solve the problem in the prior art that when a docking system docks with a new trading system, a new set of data cases and related data are compiled by manual editing, resulting in low efficiency in obtaining data cases and related data for the new trading system.
[0004] In a first aspect, an embodiment of the present invention provides a keyword-driven automatic use case data generation method, which includes:
[0005] In response to a use case data generation instruction, parsing the use case data generation instruction to obtain transaction system attribute data of the transaction system to be tested as target attribute data, and generating initial case data according to the target attribute data;
[0006] Splitting the initial case data to obtain use case description information and pre-data;
[0007] Generating a preset test case template corresponding to the use case description information according to the target attribute data, and generating a table field filling template corresponding to the pre-data according to the target attribute data;
[0008] Perform keyword recognition on the use case description information based on a preset first keyword resolution strategy to obtain a use case recognition result;
[0009] Fill the test case identification result into the preset test case template to obtain an output test case;
[0010] Perform keyword recognition on the front data based on a preset second keyword analysis strategy to obtain a front data recognition result;
[0011] Fill the preceding data recognition result into the table field filling template to obtain SQL data associated with the output use case;
[0012] The output use case and the SQL data constitute automated use case data corresponding to the transaction system to be tested.
[0013] In a second aspect, an embodiment of the present invention further provides a keyword-driven automatic use case data generation device, which includes:
[0014] A generating unit, configured to respond to a use case data generating instruction, parse the use case data generating instruction to obtain transaction system attribute data of the transaction system to be tested as target attribute data, and generate initial case data according to the target attribute data;
[0015] A splitting unit, used to split the initial case data to obtain use case description information and pre-data;
[0016] The generating unit is further configured to generate a preset test case template corresponding to the use case description information according to the target attribute data, and to generate a table field filling template corresponding to the pre-data according to the target attribute data;
[0017] an identification unit, configured to perform keyword identification on the use case description information based on a preset first keyword parsing strategy to obtain a use case identification result;
[0018] A filling unit, used to fill the use case identification result into the preset test case template to obtain an output use case;
[0019] The recognition unit is further configured to perform keyword recognition on the front-end data based on a preset second keyword analysis strategy to obtain a front-end data recognition result;
[0020] The filling unit is further used to fill the preceding data recognition result into the table field filling template to obtain SQL data associated with the output use case;
[0021] A composition unit is used to compose the automated use case data corresponding to the transaction system to be tested from the output use case and the SQL data.
[0022] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0023] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method described in the first aspect above can be implemented.
[0024] The embodiment of the present invention provides a keyword-driven automatic use case data generation method. On the one hand, initial case data is automatically generated according to the transaction system attribute data of different connected transaction systems to be tested, which not only improves the generation efficiency but also ensures the pertinence of the initial case data. On the other hand, the initial case data is split to obtain use case description information and pre-data, and the preset templates are filled based on the keyword parsing strategy to obtain output use cases and SQL data, so as to combine and obtain the automatic use case data corresponding to the transaction system to be tested. Not only the generation efficiency of the use case data is improved, but also the template matching method also improves the generalization ability of the automatic use case data generation method. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] 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.
[0026] Figure 1 A schematic diagram of an application scenario of the keyword-driven automatic use case data generation method provided in an embodiment of the present invention;
[0027] Figure 2 A flowchart of a keyword-driven automatic use case data generation method provided by an embodiment of the present invention;
[0028] Figure 3 A schematic block diagram of a keyword-driven automatic use case data generation device provided by an embodiment of the present invention;
[0029] Figure 4 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0030] 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.
[0031] 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.
[0032] 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.
[0033] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0034] Please also see Figure 1 and Figure 2 , Figure 1 Schematic diagram of a scenario of a keyword-driven automatic use case data generation method according to an embodiment of the present invention. Figure 2 1 is a flowchart of a keyword-driven automatic use case data generation method provided by an embodiment of the present invention. The method is applied to a server 10, and the server 10 can communicate with a user terminal 20. Figure 2 As shown, the method includes the following steps S110-S180.
[0035] S110 , in response to a use case data generation instruction, parsing the use case data generation instruction to obtain transaction system attribute data of the transaction system to be tested as target attribute data, and generating initial case data according to the target attribute data.
[0036] In this embodiment, the technical solution is described with the server as the execution subject, and an automated use case data generation system is deployed in the server. The tester can operate a user terminal (such as a laptop, tablet computer, smart phone, etc.) to log in to the automated use case data generation system, and select to import or edit an initial case data on the user interaction interface of the automated use case data generation system, and click the use case data generation virtual button on the user interaction interface, and then a use case data generation instruction can be generated accordingly. In addition, the server can also obtain the initial case data corresponding to the use case data generation instruction, that is, the initial case data imported or edited on the user interaction interface, and use it as input data to automatically guide the subsequent automated use case data generation.
[0037] In one embodiment, generating initial case data according to the target attribute data includes:
[0038] Determine the current business demand according to the target attribute data; wherein the current business demand includes private demand and general demand;
[0039] Generate private case data according to the private requirements;
[0040] Acquire general case data corresponding to the general requirement from a configuration database, or call a pre-built general case data generation code to generate the general case data according to the general requirement;
[0041] The private case data and the general case data are combined to obtain the initial case data.
[0042] Through the above-mentioned embodiments, it is possible to perform analysis according to corresponding business requirements to generate customized private case data for the current business scenario, and at the same time call historically stored public order status cases (such as several fully executed, partially executed, canceled, etc.), or generate general case data through pre-written code, so as to efficiently obtain the initial case data through data combination.
[0043] In one embodiment, in response to the use case data generation instruction, parsing the use case data generation instruction to obtain transaction system attribute data of the transaction system to be tested as target attribute data, and generating initial case data according to the target attribute data, further comprising:
[0044] Acquire a case data scenario corresponding to the initial case data, and acquire a target case data verification strategy corresponding to the case data scenario from a plurality of preset case data verification strategies;
[0045] Performing data verification on the initial case data based on the target case data verification strategy to obtain a target case data verification result;
[0046] If it is determined that the verification result of the target case data is a verification pass result, a verification pass tag is added to the initial case data.
[0047] The case data scenario is one of the preset case data scenarios included in the preset case data scenario set, and the preset case data scenario set is an expandable case data scenario set.
[0048] In this embodiment, the preset case data scenario set includes the two-way fast trading counter scenario and the spot brokerage fast trading counter scenario as an example. Of course, the specific implementation is not limited to the above two scenarios (such as the proprietary counter scenario, the option counter scenario, etc.), and the preset case data scenarios included in the preset case data scenario set can be expanded based on the actual test case data generation requirements. Among them, the two-way fast trading counter in the two-way fast trading counter scenario is also called the margin trading fast trading system, which is mainly for institutional customers and high-net-worth individual customers, and usually only provides two-way related business transaction functions. In the spot brokerage fast trading counter scenario, the spot brokerage fast trading counter is also called the spot brokerage fast trading system, which is mainly for institutional customers and high-net-worth individual customers, and for stock auction trading, after-hours pricing trading, etc., it usually only provides spot brokerage related transaction functions. In different case data scenarios, there are different requirements for the data format of the initial case data. Moreover, different securities types and securities codes are supported in different case data scenarios. Specifically, for different counters (i.e., the trading system in the case data scenario), the securities code will be selected according to the securities type supported by the counter, and the database table corresponding to the counter will be selected for data generation.
[0049] After this user operation generates a use case data generation instruction and obtains the corresponding initial case data, the server can further obtain the case data scenario corresponding to the initial case data, so as to obtain the target case data verification strategy corresponding to the case data scenario from the multiple preset case data verification strategies stored locally on the server. For example, if the case data scenario is a two-way financing and ultra-fast trading counter scenario, the target case data verification strategy corresponding to the two-way financing and ultra-fast trading counter scenario is obtained in the server, and the data format of the initial case data is verified based on the target case data verification strategy to determine whether the initial case data is case data with the correct format and usable. More specifically, a standard case data in the two-way financing and ultra-fast trading counter scenario can be obtained from the target case data verification strategy, and then the data format of the initial case data and the standard case data can be compared, and finally the target case data verification result can be obtained.
[0050] If the preset case data scenario set needs to be expanded, a new case data scenario needs to be set accordingly, and a case data verification strategy can also be set accordingly for the new case data scenario. It can be seen that since business analysis can be performed based on actual test scenarios to determine the corresponding initial case data, all common test scenarios and some special scenarios can be covered to achieve full coverage in conjunction with business automation testing, ensuring the correctness and stability of the business products obtained after the final test.
[0051] S120: Split the initial case data to obtain use case description information and pre-data.
[0052] In this embodiment, the use case description information in the initial case data includes the market name of the specified market, business type, entrustment type, securities type, order status, etc. (wherein, the use case description information in the initial case data includes at least the keyword of securities type; the order status covers all possible order statuses currently in the securities trading system, and different order statuses fill in the corresponding entrustment quantity). These can be regarded as multiple keywords in the use case description information, and each keyword corresponds to a specific keyword value.
[0053] In this embodiment, the pre-conditions in the initial case data are the conditions that the corresponding user needs to meet before the use case is executed, and are used to convert into data when the test system is running by means of designated components, etc. The pre-conditions corresponding to the pre-conditions in the initial case data (which can also be understood as use case pre-conditions) include funds, positions, financing contracts, permission templates, etc., which can be regarded as multiple keywords in the pre-conditions, and each keyword corresponds to a specific keyword value. Moreover, these keywords and their specific values included in the pre-conditions constitute the conditions that the corresponding user needs to meet before the use case is executed, which can be used to screen the corresponding target users. Among them, the initial case data corresponds to a unique customer number (which can also be understood as a customer number, customer ID, etc.). If other use case data need to be generated based on the initial case data, they also correspond to unique customer numbers respectively. Only when the pre-conditions in a certain use case data recognize the keyword "repeat order", the customer number in the next use case data will be the same as the customer number in the use case data to meet the repeat order condition (repeat order means that a customer number is entrusted again).
[0054] Through the above embodiment, the transaction case (i.e., the initial case data) is decomposed into two parts: the system's pre-data and the request parameters of the API (Application Programming Interface) interface (i.e., the use case description information), so as to assist in the efficient generation of automated use case data.
[0055] S130, generating a preset test case template corresponding to the use case description information according to the target attribute data, and generating a table field filling template corresponding to the pre-data according to the target attribute data.
[0056] In this embodiment, the preset test case template may be in Excel format.
[0057] In this embodiment, generating a table field filling template corresponding to the pre-data according to the target attribute data includes:
[0058] Construct at least one data table according to the target attribute data;
[0059] Combining the at least one data table to obtain the table field filling template;
[0060] The table field filling template includes reserved values marked with table field value blank identifiers, common fields, and fields to be filled marked with user-defined identifiers.
[0061] For example: the data tables may include, but are not limited to, customer information tables (used for transaction judgment, including checking of permissions, fees, funds, and positions), fund tables, counter tables (created in the database after the test system is deployed), and securities tables (referring to the information on the targets that can be traded on the exchange that day, which is also created in the database after the test system is deployed).
[0062] The following counter table constructed for the scenario of ultra-fast margin trading counter is given as an example:
[0063] t_stocks={
[0064] "id":None,
[0065] " account_id ":@ account_id,
[0066] "symbol":None,
[0067] "market_id":@market_id,
[0068] "first_day_pos ":@ first_day_pos,
[0069] "first_day_frozen": 0.00,
[0070] "first_day_available":@ first_day_ available,
[0071] "not_circ_vol": None,
[0072] "pbu id": '@pbuid',
[0073] "prev_share_cost": None,
[0074] "data_status": 1,
[0075] "market_value": 0.00,
[0076] "profit_loss": None,
[0077] "crd_buy_stock_vol": None,
[0078] "crd_sell_occupied_amt": None,
[0079] "add_time":'2022XXXX000000',
[0080] "add_user": "daservice',
[0081] "update_time":'2022 XXXX 000000',
[0082] "update_user":'daservice',
[0083] "temp_frozen": None,
[0084] "share_json": None,
[0085] "fund_id": '@fund_id',
[0086] "branch_id":'@branch_id',
[0087] "today_submitted _gty": None
[0088] }.
[0089] Among them, the counter table can be configured according to the MySQL database table structure of the counter. The field name is consistent with the database table field, and the field value is a fixed value or reserved with @+field name.
[0090] In this embodiment, the preset case data scenario set includes the two-way financing fast trading counter scenario and the spot brokerage fast trading counter scenario as an example (of course, the specific implementation is not limited to the above two scenarios, and the preset case data scenarios included in the preset case data scenario set can be expanded based on the actual test case data generation requirements). For example, table field filling templates are constructed for the two-way financing fast trading counter scenario and the spot brokerage fast trading counter scenario, and these table field filling templates are stored in the server. Once the initial case data is obtained, the corresponding preset case data scenario is determined, and the table field filling template corresponding to the initial case data can be obtained.
[0091] It should be noted that the method of generating the preset test case template is similar to the method of generating the table field filling template, which will not be repeated here.
[0092] S140: Perform keyword recognition on the use case description information based on a preset first keyword resolution strategy to obtain a use case recognition result.
[0093] In one embodiment, the first keyword parsing strategy is a first preset regular expression, and the keyword recognition is performed on the use case description information based on the preset first keyword parsing strategy to obtain the use case recognition result, which includes:
[0094] A first preset regular expression corresponding to the first keyword resolution strategy is obtained, and keyword recognition is performed on the use case description information based on the first preset regular expression to obtain the use case recognition result.
[0095] For example, the use case description information in an initial case data is: XX Exchange, Spot Centralized Trading, Limit Order, Buy, Main Board Stock-Normal, All Transaction Completed. The use case description information is keyword identified through the first keyword parsing strategy, and the obtained use case identification result includes keywords such as market name, business type, order type, securities type, and order status of the specified market, and the specific value of the market name of the specified market is XX Exchange, the specific value of the business type is spot centralized trading, the specific value of the order type is the buy type in the limit order, the specific value of the securities type is the main board stock, and the specific value of the order status is normal trading and all transactions are completed.
[0096] In this embodiment, if the initial case data is input in the form of an EXCEL table, which includes at least two columns of use case description information and pre-data, the specific data in the use case description information column in the initial case data (such as XX Exchange, spot centralized trading, limit order, buy, main board stock-normal, all transactions in one transaction in the above example) is identified by all keywords through a first preset regular expression, and the identification result of each keyword is obtained, thereby forming the use case identification result.
[0097] Of course, the use case description information is not limited to including keywords such as the market name, business type, order type, securities type, order status, etc. of the specified market as listed in the above examples during specific implementation. It may also include custom keywords such as total quantity, total price, total fee, etc. added as needed (i.e., the use case description information has field extensibility) so that the use case description information can adapt to more case data scenarios and is not limited to the margin trading counter scenario and the spot brokerage counter scenario.
[0098] S150, filling the use case identification result into the preset test case template to obtain an output use case.
[0099] In this embodiment, the output use case can be used as a business automation identification parameter or for functional testing.
[0100] In this embodiment, after obtaining the use case description information in the initial case data and performing keyword recognition and analysis to obtain the use case recognition result, it is filled into a preset test case template which is also in the form of an EXCEL table to obtain the output use case.
[0101] Specifically, the step of filling the use case identification result into the preset test case template to obtain an output use case includes:
[0102] Performing interface data conversion on the recognition result of each keyword in the use case recognition result based on a pre-configured interface specification mapping strategy to obtain each field value;
[0103] Construct database query statements;
[0104] Determining a field screening condition according to the target attribute data;
[0105] Adding the field screening condition to the database query statement to obtain a screening statement;
[0106] Based on the filter statement, field values are filtered from each field value and filled into the preset test case template to obtain the output test case.
[0107] Among them, a preset test case template corresponding to the case data scenario corresponding to the initial case data is stored in the server. For example, the case data scenario corresponding to the initial case data is a two-way financing and ultra-fast trading counter scenario, and a preset test case template is set in the server for the two-way financing and ultra-fast trading counter scenario. After determining the preset test case template corresponding to the case data scenario corresponding to the initial case data, the specific value of each keyword in the use case identification result is filled into the corresponding field in the preset test case template to obtain the output use case.
[0108] In this embodiment, still referring to the above example, all keywords are identified for the specific data in the use case description information column in the initial case data through the first preset regular expression to obtain the identification result of each keyword, specifically, the market name of the designated market is specifically taken as XX exchange, the business type is specifically taken as spot centralized trading, the entrustment type is specifically taken as the buy type in the limit entrustment, the securities type is specifically taken as main board stock, and the order status is specifically taken as normal trading and all transactions are completed. Based on the interface specification mapping strategy, XX exchange can be converted to market_id=101, spot centralized trading can be converted to business_type = 1, limit entrustment can be converted to ord_type = 'a', etc. to obtain each field value. After performing the above conversion on the recognition result of each keyword in the use case recognition result, a filtering statement is constructed based on the specified filtering condition (i.e., first construct a basic database query statement, and then add field filtering conditions according to the case needs. For example, first construct an SQL (Structured Query Language) statement to query all securities codes, and then according to the main board A-share securities type in the case description, add the securities type field as the main board A-share filter in the above SQL to obtain the corresponding filtering statement), and based on the filtering statement, filter the field value from each field value and fill it into the preset test case template (for example, if market_id=101 is known, the "market_id":@ market_id" in the preset test case template can be adjusted to " market_id":101, and the filling of other keyword values can also refer to this example), and finally obtain the corresponding output use case.
[0109] The output use cases also follow the following principles: 1) the minimization principle, that is, most conditions are preset in the form of agreed default values; 2) the readability principle of use case writing, that is, the ability to present the test purpose; 3) the portability principle of use case, that is, to reduce quantitative descriptions as much as possible and reduce the correlation with the system under test.
[0110] S160: Perform keyword recognition on the front data based on a preset second keyword resolution strategy to obtain a front data recognition result.
[0111] In one embodiment, the second keyword parsing strategy is a second preset regular expression, and the keyword recognition is performed on the front data based on the preset second keyword parsing strategy to obtain the front data recognition result, including:
[0112] A second preset regular expression corresponding to the second keyword parsing strategy is obtained, and keyword recognition is performed on the front data based on the second preset regular expression to obtain the front data recognition result.
[0113] For example, the pre-data in an initial case data is: ¥50 billion, holding 5,000 shares, with default permission template 1, real-time addition of trading permission XX city-spot centralized trading-securities type is main board stock-securities status is normal-ordinary buy permission. The pre-data is identified by keywords through the second keyword parsing strategy, and the pre-data identification results obtained include the keywords such as funds, positions, permission templates, and financing contracts, and the specific value of funds is 50 billion, the specific value of positions is 5,000 shares, the specific value of permission templates is the default permission template 1, and the specific value of financing contracts is trading permission XX city-spot centralized trading-securities type is main board stock-securities status is normal-ordinary buy permission.
[0114] In this embodiment, if the initial case data is input in the form of an EXCEL table, which includes at least two columns: use case description information and pre-data, the specific data in the pre-data column in the initial case data (such as RMB 50 billion in the above example, 5,000 shares held, default permission template 1, real-time addition of trading permissions XX city-spot centralized trading-securities type is main board stock-securities status is normal-ordinary buying permission) is identified for all keywords through the second preset regular expression, and the identification result of each keyword is obtained, thereby constituting the pre-data identification result.
[0115] Of course, the front-end data is not limited to including keywords such as funds, positions, financing contracts, and permission templates as listed in the above examples during specific implementation. It can also include custom keywords added as needed (i.e., the front-end data has field scalability) so that the front-end data can adapt to more case data scenarios, so that it is not limited to the margin trading counter scenario and the spot brokerage counter scenario.
[0116] S170, filling the preceding data recognition result into the table field filling template to obtain SQL data associated with the output use case.
[0117] In this embodiment, still referring to the above example, the specific data of the column of the front data in the initial case data is identified with all keywords through the second preset regular expression, and the identification result of each keyword is obtained, specifically, the specific value of the funds is 50 billion, the specific value of the position is 5,000 shares, the specific value of the permission template is the default permission template 1, and the specific value of the financing contract is the trading permission XX city-spot centralized trading-the securities type is the main board stock-the securities status is normal-ordinary buying permission. For example, the case data scenario corresponding to the initial case data is the two-way financing fast trading counter scenario, and a table field filling template is set in the server for the two-way financing fast trading counter scenario. After determining the table field filling template corresponding to the case data scenario corresponding to the initial case data, each keyword specific value in the front data identification result is filled into the corresponding position in the table field filling template, thereby obtaining SQL data associated with the output use case.
[0118] Specifically, the step of filling the preceding data recognition result into the table field filling template includes:
[0119] (1) For a reserved value in the table field filling template, corresponding data is obtained from the previous data recognition result to replace the reserved value;
[0120] For example, if "@value" is used as the blank identifier of the table field value, when @ is recognized, the field value marked with @ will be replaced with the extracted keyword;
[0121] (2) For the field to be filled in the table field filling template, obtain a calculation formula corresponding to the field to be filled, obtain corresponding data from the previous data recognition result, substitute it into the calculation formula to calculate and obtain a calculation result, and fill the calculation result into the field to be filled;
[0122] For example, after customizing @total_value and @total_fee, the fields of @total_value and @total_fee are filled after calculation based on the acquired quantity, price, and fee, so as to adapt to more scenarios and reduce manual calculations;
[0123] (3) For the common fields in the table field filling template, the default values of the original fields are used directly without modification to improve generation efficiency.
[0124] In order to more clearly understand the relationship between SQL data and output use cases, a specific example is used below to illustrate. For example, if the output use case also includes a customer number field, the customer number restriction condition included in the SQL data must also be the same as the specific value of the customer number field in the output use case.
[0125] S180: compose automated use case data corresponding to the transaction system to be tested from the output use case and the SQL data.
[0126] In this embodiment, when the initial case data is determined in the server, and the use case description information and the front data are respectively parsed with keywords and filled with templates, the output use case and the SQL data can be obtained respectively, and finally the output use case and the SQL data form the automated use case data corresponding to the transaction system to be tested. The obtained automated use case data can be used as input data of the automated test system, and can also provide an input template for the test to obtain the required customer data, thereby improving the efficiency of obtaining test data or customer data.
[0127] In one embodiment, after the output use case and the SQL data form the automated use case data corresponding to the transaction system to be tested, the method further includes:
[0128] The automated test case data is sent to the automated test system as test system input data to obtain corresponding automated test results.
[0129] In this embodiment, if the scenario where the automated use case data can be used as input data of the automated test system is taken as an example, after the automated use case data is sent to the automated test system as the test system input data, it can be used as the data dependency and case dependency of the automated test. Specifically, multiple test data corresponding to the automated use case data are first obtained, and then the multiple test data are tested based on the automated test system to obtain the corresponding automated test results.
[0130] In this embodiment, after the output use case and the SQL data form the automated use case data corresponding to the transaction system to be tested, the method further includes:
[0131] When receiving an instruction to generate other use case data based on other trading systems, obtaining difference data between the other trading systems and the trading system to be tested, and incrementally updating the automated use case data according to the difference data; and / or
[0132] When the table structure of any data table in the at least one data table changes, the table field filling template is incrementally updated according to the changed data of the any data table.
[0133] In the above embodiment, when adding a new object to be tested, it is only necessary to focus on the personalized differences for test analysis, without the need to repeatedly write general business scenarios and cases. Moreover, when the data generation table structure of the same object to be tested changes, there is no need to update the scenario, only the corresponding template needs to be modified to regenerate the data.
[0134] The automated use case data generation scheme described in this embodiment can automatically extract valid information based on keyword drive, and quickly generate automated use case data in combination with matching and filling of preset test case templates and table field filling templates. It is equivalent to using the same parser to perform parsing operations such as keyword extraction, and different generators to perform data generation operations such as template matching and filling, so as to generate multiple sets of data based on a set of use cases (such as based on a keyword extraction strategy for different trading systems to be tested, and matching and filling based on the templates corresponding to each trading system to be tested, so as to generate automated use case data corresponding to different trading systems to be tested). Moreover, when different systems and docking systems have different data protocol formats, but the test cases in the scenario are the same, that is, the initial case data is the same, whenever you need to dock with one more trading system, you only need to develop one more generator to achieve a one-time migration of all historical cases and generate data into the new system. You no longer need to write a set of cases and make a set of data for each docking of a system as in the traditional solution. Based on this, the test scenario can be decoupled from the data generation process, and you can focus on business scenario analysis in the test analysis stage, and focus on abnormal scenario analysis in the test case stage. The data generation process only needs to perform cross-multiplication exemption matching according to normal and abnormal rules, thereby effectively improving the test efficiency.
[0135] It can be seen that the implementation example of this method can be driven by keywords in the initial case data to automatically and quickly generate test cases and data for corresponding scenarios, which not only provides data and case support for business automation, but also effectively simplifies the testing process.
[0136] It can be seen from the above technical solutions that, on the one hand, the present application automatically generates initial case data according to the transaction system attribute data of different connected transaction systems to be tested, which not only improves the generation efficiency but also ensures the pertinence of the initial case data; on the other hand, the initial case data is split to obtain use case description information and pre-data, and the preset templates are filled in based on the keyword parsing strategy to obtain output use cases and SQL data, so as to combine and obtain the automated use case data corresponding to the transaction system to be tested, which not only improves the generation efficiency of the use case data, but also the template matching method also improves the generalization ability of the automated use case data generation method.
[0137] Figure 3 is a schematic block diagram of a keyword-driven automatic use case data generation device provided by an embodiment of the present invention. Figure 3As shown, corresponding to the above keyword-driven automatic use case data generation method, the present invention also provides a keyword-driven automatic use case data generation device 100. The keyword-driven automatic use case data generation device 100 includes: a generation unit 110, a splitting unit 120, an identification unit 130, a filling unit 140, and a composition unit 150.
[0138] The generating unit 110 is used to respond to the use case data generating instruction, parse the use case data generating instruction to obtain the transaction system attribute data of the transaction system to be tested as the target attribute data, and generate the initial case data according to the target attribute data;
[0139] The splitting unit 120 is used to split the initial case data to obtain use case description information and pre-data;
[0140] The generating unit 110 is further configured to generate a preset test case template corresponding to the use case description information according to the target attribute data, and to generate a table field filling template corresponding to the pre-data according to the target attribute data;
[0141] The identification unit 130 is used to perform keyword identification on the use case description information based on a preset first keyword parsing strategy to obtain a use case identification result;
[0142] The filling unit 140 is used to fill the use case identification result into the preset test case template to obtain an output use case;
[0143] The identification unit 130 is further configured to perform keyword identification on the pre-positioned data based on a preset second keyword analysis strategy to obtain a pre-positioned data identification result;
[0144] The filling unit 140 is further used to fill the preceding data recognition result into the table field filling template to obtain SQL data associated with the output use case;
[0145] The composition unit 150 is used to compose the automation use case data corresponding to the transaction system to be tested from the output use case and the SQL data.
[0146] It can be seen from the above technical solutions that, on the one hand, the present application automatically generates initial case data according to the transaction system attribute data of different connected transaction systems to be tested, which not only improves the generation efficiency but also ensures the pertinence of the initial case data; on the other hand, the initial case data is split to obtain use case description information and pre-data, and the preset templates are filled in based on the keyword parsing strategy to obtain output use cases and SQL data, so as to combine and obtain the automated use case data corresponding to the transaction system to be tested, which not only improves the generation efficiency of the use case data, but also the template matching method also improves the generalization ability of the automated use case data generation method.
[0147] The above-mentioned keyword-driven automatic use case data generation device can be implemented in the form of a computer program. The computer program can be used in Figure 4 Runs on the computer device shown.
[0148] See also Figure 4 , Figure 4 The schematic block diagram of a computer device provided by an embodiment of the present invention is shown in FIG. The computer device integrates any keyword-driven automatic use case data generation device provided by an embodiment of the present invention.
[0149] See also Figure 4 The computer device includes a processor 402 , a memory and a network interface 405 connected via a system bus 401 , wherein the memory may include a storage medium 403 and an internal memory 404 .
[0150] The storage medium 403 may store an operating system 4031 and a computer program 4032. The computer program 4032 includes program instructions, and when the program instructions are executed, the processor 402 may execute the above-mentioned keyword-driven automatic use case data generation method.
[0151] The processor 402 is used to provide computing and control capabilities to support the operation of the entire computer device.
[0152] The internal memory 404 provides an environment for the operation of the computer program 4032 in the storage medium 403. When the computer program 4032 is executed by the processor 402, the processor 402 can execute the above-mentioned keyword-driven automatic use case data generation method.
[0153] The network interface 405 is used to communicate with other devices over the network. Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0154] The processor 402 is used to run a computer program 4032 stored in the memory to implement the keyword-driven automatic use case data generation method as described above.
[0155] It should be understood that in the embodiment of the present invention, the processor 402 may be a central processing unit (CPU), and the processor 402 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0156] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.
[0157] Therefore, the present invention also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the above-mentioned keyword-driven automatic use case data generation method.
[0158] The computer-readable storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.
[0159] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0160] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in 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.
[0161] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0162] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.
[0163] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A keyword-driven automated use case data generation method. It is characterized in that include: In response to a use case data generation instruction, parsing the use case data generation instruction to obtain transaction system attribute data of the transaction system to be tested as target attribute data, and generating initial case data according to the target attribute data; Splitting the initial case data to obtain use case description information and pre-data; Generate a preset test case template corresponding to the use case description information according to the target attribute data, and generate a table field filling template corresponding to the pre-data according to the target attribute data; wherein, generating the table field filling template corresponding to the pre-data according to the target attribute data includes: constructing at least one data table according to the target attribute data; combining the at least one data table to obtain the table field filling template; wherein, the table field filling template includes reserved values marked with table field value blank identifiers, common fields, and fields to be filled marked with custom identifiers; Perform keyword recognition on the use case description information based on a preset first keyword resolution strategy to obtain a use case recognition result; Filling the use case identification result into the preset test case template to obtain an output use case, including: performing interface data conversion on the identification result of each keyword in the use case identification result based on a pre-configured interface specification mapping strategy to obtain each field value; constructing a database query statement; determining a field screening condition according to the target attribute data; adding the field screening condition to the database query statement to obtain a screening statement; based on the screening statement, screening field values from each field value and filling them into the preset test case template to obtain the output use case; Perform keyword recognition on the front data based on a preset second keyword analysis strategy to obtain a front data recognition result; Fill the preceding data recognition result into the table field filling template to obtain SQL data associated with the output use case; wherein, filling the preceding data recognition result into the table field filling template includes: for a reserved value in the table field filling template, obtaining corresponding data from the preceding data recognition result to replace the reserved value; and / or for a field to be filled in the table field filling template, obtaining a calculation formula corresponding to the field to be filled, obtaining corresponding data from the preceding data recognition result and substituting it into the calculation formula to obtain a calculation result, and filling the calculation result into the field to be filled; The output use case and the SQL data constitute automated use case data corresponding to the transaction system to be tested.
2. The method according to claim 1, It is characterized in that After the step of composing the automated use case data corresponding to the transaction system to be tested by using the output use case and the SQL data, the method further includes: The automated test case data is sent to the automated test system as test system input data to obtain corresponding automated test results.
3. The method according to claim 1, It is characterized in that After the step of responding to the use case data generation instruction, parsing the use case data generation instruction to obtain the transaction system attribute data of the transaction system to be tested as the target attribute data, and generating the initial case data according to the target attribute data, the method further includes: Acquire a case data scenario corresponding to the initial case data, and acquire a target case data verification strategy corresponding to the case data scenario from a plurality of preset case data verification strategies; Performing data verification on the initial case data based on the target case data verification strategy to obtain a target case data verification result; If it is determined that the verification result of the target case data is a verification pass result, a verification pass tag is added to the initial case data.
4. The method according to claim 1, It is characterized in that The first keyword parsing strategy is a first preset regular expression; The performing keyword recognition on the use case description information based on the preset first keyword resolution strategy to obtain a use case recognition result includes: A first preset regular expression corresponding to the first keyword resolution strategy is obtained, and keyword recognition is performed on the use case description information based on the first preset regular expression to obtain the use case recognition result.
5. The method according to claim 1, It is characterized in that The second keyword parsing strategy is a second preset regular expression: the keyword recognition is performed on the front data based on the preset second keyword parsing strategy to obtain the front data recognition result, including: A second preset regular expression corresponding to the second keyword parsing strategy is obtained, and keyword recognition is performed on the front data based on the second preset regular expression to obtain the front data recognition result.
6. The method according to claim 1, It is characterized in that The generating initial case data according to the target attribute data comprises: Determine the current business demand according to the target attribute data; wherein the current business demand includes private demand and general demand; Generate private case data according to the private requirements; Acquire general case data corresponding to the general requirement from a configuration database, or call a pre-built general case data generation code to generate the general case data according to the general requirement; The private case data and the general case data are combined to obtain the initial case data.
7. The method according to claim 1, It is characterized in that After the step of composing the automated use case data corresponding to the transaction system to be tested by using the output use case and the SQL data, the method further includes: When receiving an instruction to generate other use case data based on other trading systems, obtaining difference data between the other trading systems and the trading system to be tested, and incrementally updating the automated use case data according to the difference data; and / or When the table structure of any data table in the at least one data table changes, the table field filling template is incrementally updated according to the changed data of the any data table.
