CN118363874B - Keyword-driven automatic use case data generation method - Google Patents
Keyword-driven automatic use case data generation method Download PDFInfo
- Publication number
- CN118363874B CN118363874B CN202410801215.7A CN202410801215A CN118363874B CN 118363874 B CN118363874 B CN 118363874B CN 202410801215 A CN202410801215 A CN 202410801215A CN 118363874 B CN118363874 B CN 118363874B
- Authority
- CN
- China
- Prior art keywords
- data
- case
- case data
- keyword
- preset
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3696—Methods or tools to render software testable
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/189—Automatic justification
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
On one hand, initial case data is automatically generated according to the attribute data of the transaction systems of different docked transaction systems to be tested, so that the generation efficiency is improved, and the pertinence of the initial case data is ensured; on the other hand, the initial case data is split to obtain case description information and front data, and preset templates are filled to obtain output cases and SQL data based on a keyword analysis strategy respectively, so that automatic case data corresponding to a transaction system to be tested are obtained through combination, the generation efficiency of the case data is improved, and the generalization capability of an automatic case data generation mode is improved in a template matching mode.
Description
Technical Field
The invention relates to the technical field of automatic testing of systems, in particular to an automatic case data generation method based on keyword driving.
Background
At present, when a new transaction system (such as a securities transaction system) is docked by the docking system, a new set of data cases needs to be written by adopting a manual editing mode aiming at the new business system, and corresponding data is edited aiming at the data cases. When the docking system docks with a new transaction system every time, the manual processing amount of a large number of data cases and related data is correspondingly increased, so that the generation efficiency of the data cases and related data for the new transaction system is low.
Disclosure of Invention
The embodiment of the invention provides an automatic use case data generation method based on keyword driving, which aims to solve the problem that in the prior art, when a new transaction system is docked every time, a new set of data cases and related data are written in a manual editing mode, so that the acquisition efficiency of the data cases and related data for the new transaction system is low.
In a first aspect, an embodiment of the present invention provides a keyword-driven automatic use case data generating method, including:
Responding to a case data generation instruction, analyzing the case data generation instruction to obtain transaction system attribute data of a to-be-tested transaction system as target attribute data, and generating initial case data according to the target attribute data;
Splitting the initial case data to obtain case description information and preposed data;
generating a preset test case template corresponding to the case description information according to the target attribute data, and generating a table field filling template corresponding to the preposed data according to the target attribute data;
performing keyword recognition on the use case description information based on a preset first keyword analysis strategy to obtain a use case recognition result;
filling the case identification result into the preset test case template to obtain an output case;
performing keyword recognition on the prepositive data based on a preset second keyword analysis strategy to obtain a prepositive data recognition result;
Filling the preposed data identification result into the table field filling template to obtain SQL data associated with the output use case;
And the output use case and the SQL data form automation use case data corresponding to the transaction system to be tested.
In a second aspect, an embodiment of the present invention further provides an automated case data generating device based on keyword driving, including:
The generating unit is used for responding to the case data generating instruction, analyzing the case data generating 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;
the splitting unit is used for splitting the initial case data to obtain case description information and preposed data;
The generating unit is further used for generating a preset test case template corresponding to the case description information according to the target attribute data and generating a table field filling template corresponding to the preposed data according to the target attribute data;
the identification unit is used for carrying out keyword identification on the use case description information based on a preset first keyword analysis strategy to obtain a use case identification result;
the filling unit is used for filling the case identification result into the preset test case template to obtain an output case;
The identification unit is further used for carrying out keyword identification on the preposed data based on a preset second keyword analysis strategy to obtain a preposed data identification result;
The filling unit is further configured to fill the preamble data identification result into the table field filling template to obtain SQL data associated with the output use case;
And the composition unit is used for composing the automation case data corresponding to the transaction system to be tested by the output case and the SQL data.
In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the method described in the first aspect when executing the computer program.
In a fourth aspect, embodiments of the present invention also provide a computer readable storage medium storing a computer program comprising program instructions which, when executed by a processor, implement the method of the first aspect.
The embodiment of the invention provides an automatic case data generation method based on keyword driving, which on one hand, automatically generates initial case data according to the attribute data of the transaction systems of different docked transaction systems to be tested, thereby improving the generation efficiency and ensuring the pertinence of the initial case data; on the other hand, the initial case data is split to obtain case description information and front data, and preset templates are filled to obtain output cases and SQL data based on a keyword analysis strategy respectively, so that automatic case data corresponding to a transaction system to be tested are obtained through combination, the generation efficiency of the case data is improved, and the generalization capability of an automatic case data generation mode is improved in a template matching mode.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of an application scenario of an automated case data generating method based on keyword driving according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of an automated case data generation method based on keyword driving according to an embodiment of the present invention;
FIG. 3 is a schematic block diagram of an automated case data generating device based on keyword driving according to an embodiment of the present invention;
Fig. 4 is a schematic block diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the terms "comprises" and "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic view of a scenario of an automated case data generating method based on keyword driving according to an embodiment of the present invention, and fig. 2 is a schematic flow chart of an automated case data generating method based on keyword driving according to 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. As shown in fig. 2, the method includes the following steps S110 to S180.
S110, responding to a case data generation instruction, analyzing the case data generation instruction to obtain transaction system attribute data of a to-be-tested transaction system as target attribute data, and generating initial case data according to the target attribute data.
In this embodiment, a server is used as an execution main body to describe a technical scheme, an automatic case data generating system is deployed in the server, a tester can operate a user terminal (such as a notebook computer, a tablet computer, a smart phone and the like) to log in the automatic case data generating system, select to import or edit an initial case data on a user interaction interface of the automatic case data generating system, click a case data generating virtual button on the user interaction interface, and then can generate a case data generating instruction corresponding to the case data. In addition, the server can also acquire initial case data corresponding to the case data generation instruction, namely, one initial case data is imported or edited on the user interaction interface, and the initial case data is used as input data to automatically guide the generation of subsequent automatic case data.
In an embodiment, the generating initial case data according to the target attribute data includes:
Determining the current service demand according to the target attribute data; wherein the current business requirements include private requirements and general requirements;
generating private case data according to the private demand;
Acquiring general case data corresponding to the general requirements from a configuration database, or calling a pre-constructed general case data generation code to generate the general case data according to the general requirements;
and combining the private case data with the general case data to obtain the initial case data.
Through the embodiment, the customized private case data under the current business scene can be generated by analyzing according to the corresponding business demands, and meanwhile, the public order state cases (such as all deals, part deals, cancelled and the like) stored in the history are called, or the universal case data is generated through the pre-written codes, so that the initial case data can be obtained through data combination efficiently.
In an embodiment, after the responding to the case data generating instruction and analyzing the case data generating 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:
acquiring a case data scene corresponding to the initial case data, and acquiring a target case data verification strategy corresponding to the case data scene from a plurality of preset case data verification strategies;
Performing data verification on the initial case data based on the target case data verification policy to obtain a target case data verification result;
If the target case data verification result is determined to be a verification passing result, adding a verification passing label to the initial case data.
The case data scene is one of a plurality of preset case data scenes included in a preset case data scene set, and the preset case data scene set is an extensible case data scene set.
In this embodiment, taking the example that the preset case data scene set includes a two-melt extremely-fast trading desk scene and a spot-size extremely-fast trading desk scene as an example, the specific implementation is not limited to the two scenes (for example, a self-service counter scene, an option counter scene, etc.) and the preset case data scene included in the requirement expansion preset case data scene set may be generated based on actual test case data. The two-thawing extremely-fast transaction counter in the two-thawing extremely-fast transaction counter scene is also called a financing and coupon extremely-fast transaction system, and mainly aims at institution clients and high-net-value individual clients, and generally only provides two-thawing related business transaction functions. The spot-broker fast trading counter in the spot-broker fast trading counter scenario is also called a spot-broker fast trading system, and is mainly oriented to institution customers and high-equity individual customers, and generally provides only spot-broker related trading functions for stock bid trading, post-inventory pricing trading, and the like. Under different case data scenarios, there are different requirements for the data format of the initial case data. In addition, different securities types and security codes are supported under different case data scenes, specifically, for different counters (namely, trading systems under case data scenes), the security codes are selected according to the securities types supported by the counter, and database tables corresponding to the counter are selected for data generation.
After the user operation generates the use case data generation instruction and obtains the corresponding initial case data, the server can further obtain the case data scene corresponding to the initial case data, so as to obtain the target case data verification strategy corresponding to the case data scene from a plurality of preset case data verification strategies stored locally in the server. For example, if the case data scene is a two-fuse and high-speed transaction counter scene, a target case data verification policy corresponding to the two-fuse and high-speed transaction counter scene is obtained in the server, and the data format of the initial case data is verified based on the target case data verification policy, so as to determine whether the initial case data is correctly formatted and available case data. More specifically, the standard case data of the two-melt extremely-fast transaction counter scene can be obtained from the target case data verification policy, then the initial case data and the standard case data are subjected to data format comparison, and finally the target case data verification result is obtained.
If the preset case data scene set needs to be expanded, a new case data scene needs to be set correspondingly, and a case data verification policy can be set correspondingly for the new case data scene. Therefore, because business analysis can be performed based on actual test scenes to determine corresponding initial case data, all common test scenes and some special scenes can be covered, so that full coverage is realized by matching with business automation tests, and the correctness and stability of a business product obtained by finally completing the tests are ensured.
S120, splitting the initial case data to obtain case description information and front data.
In this embodiment, the case description information in the initial case data includes a market name, a service type, a commission type, a securities type, an order status, etc. of the designated market (wherein the case description information in the initial case data includes at least a keyword of a securities type; the order status covers all possible order statuses in the current securities trading system disk, and different order statuses fill corresponding commission amounts), which can be regarded as a plurality of keywords in the case description information, and each keyword corresponds to a specific keyword value.
In this embodiment, the pre-condition (also may be understood as a use case pre-condition) corresponding to the pre-data in the initial case data includes funds, a holding bin, a financing contract, a permission template, and the like, which may be regarded as a plurality of keywords in the pre-data, and each keyword corresponds to a specific keyword value. And the keywords and the specific values thereof included in the preposed data form conditions which are needed by the corresponding user before the use case is executed, and can be used for screening the corresponding target user. Wherein the initial case data corresponds to a unique customer number (also known as a customer number, customer ID, etc.). If other case data are required to be generated based on the initial case data and respectively correspond to the unique client numbers, the client number in the next case data is identical with the client number in the case data only when the front data in one case data identifies the keyword of repeated ordering, so as to meet the repeated ordering condition (repeated ordering refers to re-consignment of one client number).
Through the above embodiment, the transaction case (i.e. the initial case data) is decomposed into two parts, namely, the front data of the system and the request parameters (i.e. the case description information) of the API (Application Programming Interface ) interface, so as to assist in efficiently generating the automation case data.
S130, generating a preset test case template corresponding to the case description information according to the target attribute data, and generating a table field filling template corresponding to the front data according to the target attribute data.
In this embodiment, the preset test case template may be in an excel format.
In this embodiment, the generating a table field filling template corresponding to the preamble 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;
the table field filling template comprises a reserved value marked by a table field value blank identifier, a general field and a field to be filled marked by a user-defined identifier.
For example: the data table may include, but is not limited to, customer information table (for performing transaction judgment, including checking authority, cost, funds, and holding), fund table, counter table (created in database after the deployment of test system), securities table (which refers to the target information that can be traded in the day of trade, and also created in database after the deployment of test system), etc.
The following counter table constructed for the two-melt extremely-fast transaction counter scene is further exemplified:
t_stocks={
"id":None,
" account_id ":@ account_id,
" symbol":None,
" market_id ":@ market_id,
"first_day_pos ":@ first_day_pos,
"first_day_frozen ":0.00,
"first_day_available":@ first_day_ available,
"not_circ_vol": None,
"pbu id": '@pbuid',
"prev_share_cost": None,
"data _status": 1,
"market_value": 0.00,
"profit_loss": None,
"crd_buy_stock_vol": None,
"crd_sell_occupied_amt": None,
"add_time":'2022XXXX000000',
"add_user": "daservice',
"update_time":'2022 XXXX 000000',
"update_user":'daservice',
"temp_frozen": None,
"share_json": None,
"fund_id": '@fund_id',
"branch_id":'@branch_id',
"today_submitted _gty": None
}。
the counter table can be configured according to a mysql database table structure of the counter, the field names are consistent with the database table fields, and the field values are fixed values or reserved with @ + field names.
In this embodiment, taking the example that the preset case data scene set includes two quick trading counter scenes and a spot-broker quick trading counter scene (of course, the implementation is not limited to the two scenes, and the preset case data scene included in the preset case data scene set can be expanded based on the actual test case data generation requirement), for example, table field filling templates are respectively constructed for the two quick trading counter scenes and the spot-broker quick trading counter scene, and these table field filling templates are stored in the server. Once the initial case data is acquired, the table field filling template corresponding to the initial case data can be acquired after the corresponding preset case data scene is determined.
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, and is not described herein.
And S140, carrying out keyword recognition on the use case description information based on a preset first keyword analysis strategy to obtain a use case recognition result.
In an embodiment, the first keyword analysis policy is a first preset regular expression, and the performing keyword recognition on the use case description information based on the preset first keyword analysis policy, to obtain a use case recognition result includes:
And acquiring a first preset regular expression corresponding to the first keyword analysis strategy, and carrying out keyword recognition on the use case description information based on the first preset regular expression to obtain the use case recognition result.
For example, the case description information in one initial case data is: XX exchange, spot transaction, limit commission, buying, main board stock-normal, and complete transaction. And carrying out keyword recognition on the use case description information through the first keyword analysis strategy, wherein the obtained use case recognition result comprises keywords such as market names, service types, consignment types, securities types and order states of appointed markets, wherein the market names of the appointed markets are specifically valued as XX exchanges, the service types are specifically valued as spot-concentrated exchanges, the consignment types are specifically valued as purchase types in the price limiting consignment, the securities types are specifically valued as main board stocks, the order states are specifically valued as normal exchanges, and all the trades are completed.
In this embodiment, if the initial case data is input in the form of an EXCEL table, where the initial case data includes at least two columns of case description information and pre-data, the specific data (such as XX exchange, spot-concentrated exchange, price limiting delegation, purchase, main board stock-normal, and all deals) in the column of case description information in the initial case data is identified by a first preset regular expression, and an identification result of each keyword is obtained, so as to form the case identification result.
Of course, the use case description information is not limited to keywords including market names, service types, commission types, securities types, order states, etc. of the designated markets as listed in the above examples, and may further include adding custom keywords such as total number, total price, total fee, etc. according to the requirements (i.e. the use case description information has field extensibility), so that the use case description information can adapt to more case data scenarios, so that it is not limited to two-melt and spot-broker quick counter scenarios.
S150, filling the case identification result into the preset test case template to obtain an output case.
In this embodiment, the output use case may be used as a service automation identification parameter or in performing a functional test.
In this embodiment, after obtaining the case description information in the initial case data and performing keyword recognition and analysis to obtain a case recognition result, the case recognition result is filled into a preset test case template in the form of an EXCEL table, so as to obtain the output case.
Specifically, the filling the case recognition result into the preset test case template to obtain an output case includes:
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 field screening conditions according to the target attribute data;
Adding the field screening conditions to the database query statement to obtain a screening statement;
and screening the field values from each field value based on the screening statement, filling the field values into the preset test case template, and obtaining the output case.
The method comprises the steps of storing a preset test case template corresponding to a case data scene corresponding to initial case data in a server, wherein the case data scene corresponding to the initial case data is a two-melt extremely-fast transaction counter scene, setting the preset test case template for the two-melt extremely-fast transaction counter scene in the server, and filling specific values of each keyword in a case recognition result into corresponding fields in the preset test case template after the preset test case template corresponding to the case data scene corresponding to the initial case data is determined, so that the output case is obtained.
In this embodiment, still referring to the above example, the specific data in the column of use case description information in the initial case data is identified by the first preset regular expression to obtain an identification result of each keyword, specifically, the market name specific value of the designated market is XX exchange, the service type specific value is spot centralized exchange, the commission type specific value is the purchase type in the limit commission, the stock type specific value is main board stock, the order state specific value is normal exchange, and one complete transaction is performed, and then based on the interface specification mapping policy, the XX exchange can be converted into mark_id=101, the spot centralized exchange is converted into business_type=1, the limit commission is converted into ord_type= 'a', and so on to obtain each field value. After the above conversion is performed on the identification result of each keyword in the case identification result, a screening statement is built based on a specified screening condition (that is, a basic database query statement is built firstly, then field screening conditions are added according to case needs, for example, an SQL (Structured Query Language, structured query language) statement for querying all security codes is built firstly, then according to the type of the main board A stock in the case description, a corresponding screening statement is obtained after the screening of the security type field which is the main board A stock is added in the SQL, the screening field value is filled into a preset test case template based on the screening statement (for example, if the mark_id=101 is known, the mark_id in the preset test case template can be correspondingly adjusted to be the mark_id, and filling of other keyword values can refer to the example), and a corresponding output use case is finally obtained.
The output use case obtained also follows the following principle: 1) The minimization principle is that most conditions are preset in a default value appointment mode; 2) The use case is written with a readability principle, namely, the purpose of testing can be presented; 3) The use case portability principle is that quantitative description is reduced as much as possible, and the relevance between the use case portability principle and a tested system is reduced.
And S160, carrying out keyword recognition on the preposed data based on a preset second keyword analysis strategy to obtain a preposed data recognition result.
In an embodiment, the second keyword analysis policy is a second preset regular expression, and the performing keyword recognition on the preamble data based on the preset second keyword analysis policy to obtain a preamble data recognition result includes:
And acquiring a second preset regular expression corresponding to the second keyword analysis strategy, and carrying out keyword recognition on the preposed data based on the second preset regular expression to obtain a preposed data recognition result.
For example, the preamble data in one initial case data is: 500 hundred million, 5000 shares are held in a warehouse, and a default authority template 1 is provided, wherein the trade authority XX market-spot centralized trade-stock type is the main board stock-stock state is the normal-common buying authority. And carrying out keyword recognition on the prepositive data through the second keyword analysis strategy, wherein the obtained prepositive data recognition result comprises keywords such as funds, holding bins, authority templates and financing contracts, the specific value of the funds is 500 hundred million, the specific value of the holding bins is 5000 strands, the specific value of the authority templates is a default authority template 1, the specific value of the financing contracts is trading authority XX market-spot centralized trading-stock type is main board stock-stock state and normal-ordinary buying authority.
In this embodiment, if the initial case data is input in the form of an EXCEL table, where at least two columns of use case description information and pre-set data are included, then the specific data (500 million in the above example, 5000 shares in the holding bin, with a default authority template 1, and real-time adding the trade authority XX market-spot centralized trade-stock type is that the main board stock-stock state is normal-ordinary buying authority) in the column of pre-set data in the initial case data is identified by the second preset regular expression, and an identification result of each keyword is obtained, thereby forming the pre-set data identification result.
Of course, the pre-data is not limited to the keywords including funds, holding warehouse, financing contract, authority template and the like listed in the above examples, and may also include adding custom keywords according to the requirement (i.e. the pre-data has field expandability), so that the pre-data can adapt to more cases data scenes, and is not limited to two-melt and spot-broker quick trading counter scenes.
And S170, filling the preamble data identification result into the table field filling template to obtain SQL data associated with the output use case.
In this embodiment, still referring to the above example, the specific data of the list of the preamble data in the initial case data is identified by the second preset regular expression to obtain the identification result of each keyword, specifically, the specific value of funds is 500 hundred million, the specific value of holding warehouse is 5000, the specific value of authority template is default authority template 1, the specific value of financing contract is trade authority XX city-spot centralized trade-stock type is main board stock-stock state is normal-ordinary buying authority. For example, the case data scene corresponding to the initial case data is a two-melt and extremely-fast transaction counter scene, a table field filling template is set in the server for the two-melt and extremely-fast transaction counter scene, and after the table field filling template corresponding to the case data scene corresponding to the initial case data is determined, each keyword specific value in the pre-data identification result is filled to a corresponding position in the table field filling template, so that SQL data related to the output use case is obtained.
Specifically, the filling the preamble data recognition result into the table field filling template includes:
(1) For the reserved value in the table field filling template, acquiring corresponding data from the preposed data identification result to replace the reserved value;
For example: taking "@ value" as a blank identifier of the table field value, and when the @ is identified, replacing the field value of the @ mark with the extracted keyword;
(2) Obtaining a calculation formula corresponding to the field to be filled in the table field filling template, obtaining corresponding data from the preposed data identification result, substituting the corresponding data into the calculation formula to calculate to obtain a calculation result, and filling the calculation result into the field to be filled;
For example: after self-defining the fields of the @ total_value and the @ total_fee, the fields of the @ total_value and the @ total_fee are filled after calculation according to the acquired quantity, price, cost and the like, so that more scenes are adapted, and manual calculation is reduced;
(3) And for the general fields in the table field filling template, directly using the default values of the original fields without modification so as to improve the generation efficiency.
In order to more clearly understand the association between the SQL data and the output case, a specific example will be described below. For example, the output use case further includes a client number field, and the client number limitation condition included in the SQL data needs to be the same as the specific value of the client number field in the output use case.
S180, forming automation case data corresponding to the transaction system to be tested by the output case and the SQL data.
In this embodiment, after the initial case data is determined in the server, and keyword analysis and template filling are performed on the case description information and the pre-data, the output case and the SQL data are obtained respectively, and finally, the output case and the SQL data form automation case data corresponding to the transaction system to be tested. The obtained automation case data can be used as input data of an automation test system, and can also provide an input template for testing to obtain required customer data, so that the efficiency of testing data or obtaining the customer data is improved.
In an embodiment, after the output case and the SQL data form automation case data corresponding to the transaction system to be tested, the method further includes:
and sending the automation case data to an automation test system as test system input data to obtain a corresponding automation test result.
In this embodiment, if a scenario in which the automation case data can be used as input data of the automation test system is taken as an example, the automation case data can be used as data dependency and case dependency of the automation test after being sent to the automation test system as the test system input data. Specifically, a plurality of test data corresponding to the automation case data are acquired first, and then the plurality of test data are tested based on the automation test system, so that corresponding automation test results are obtained.
In this embodiment, after the output use case and the SQL data form automation use case data corresponding to the to-be-tested transaction system, the method further includes:
When receiving other use case data generation instructions based on other transaction systems, acquiring difference data of the other transaction systems and the transaction system to be tested, and incrementally updating the automatic use case data according to the difference data; and/or
And when the table structure of any data table in the at least one data table is changed, performing incremental updating on the table field filling template according to the change data of the any data table.
In the above embodiment, when the measured object is newly added, only the emphasis is placed on the personalized difference point to perform test analysis, and the universal service scene and case do not need to be repeatedly written, and when the data generation table structure of the same measured object changes, the scene does not need to be updated, and only the corresponding template needs to be modified to regenerate the data.
The automatic case data generation scheme in this embodiment can automatically extract effective information based on keyword driving, and quickly generate automatic case data by combining the matching filling of the preset test case template and the table field filling template, which is equivalent to executing analysis operations such as keyword extraction and the like by the same analyzer, and executing data generation operations such as template matching filling and the like by different generators so as to generate multiple sets of data based on one set of cases (for example, based on one keyword extraction strategy for different transaction systems to be tested, and based on templates corresponding to each transaction system to be tested, matching filling is performed to generate automatic case data corresponding to different transaction systems to be tested). When different systems and docking systems are different in data protocol format, but when the test cases are one set in the scene, namely the initial case data are the same, each time when a plurality of docking and one transaction systems are needed, only one generator is needed to be developed, all migration of the history cases can be realized, the data are generated into a new system, one set of cases and one set of data are not needed to be written for each docking and one set of systems in the traditional scheme, based on the data, the test scene and the data generation process can be decoupled, the effort can be concentrated on the analysis of the business scene in the test analysis stage, and the effort is concentrated on the analysis of the abnormal scene in the test case stage, and the data generation process only needs to carry out cross-over-exemption matching according to the normal and abnormal rules, so that the test efficiency is effectively improved.
Therefore, the embodiment of the method can automatically and quickly generate the test cases and data of the corresponding scene by driving the keywords in the initial case data, thereby not only providing data and case support for service automation, but also effectively simplifying the test flow.
According to the technical scheme, on one hand, according to the docked transaction system attribute data of different transaction systems to be tested, initial case data are automatically generated, so that the generation efficiency is improved, and the pertinence of the initial case data is ensured; on the other hand, the initial case data is split to obtain case description information and front data, and preset templates are filled to obtain output cases and SQL data based on a keyword analysis strategy respectively, so that automatic case data corresponding to a transaction system to be tested are obtained through combination, the generation efficiency of the case data is improved, and the generalization capability of an automatic case data generation mode is improved in a template matching mode.
Fig. 3 is a schematic block diagram of an automated case data generating apparatus based on keyword driving according to an embodiment of the present invention. As shown in fig. 3, in correspondence to the above method for generating automation case data based on the keyword driving, the present invention further provides an apparatus 100 for generating automation case data based on the keyword driving. The keyword-driven automation case data generating apparatus 100 includes: a generating unit 110, a splitting unit 120, an identifying unit 130, a filling unit 140, and a composing unit 150.
The generating unit 110 is configured to respond to a case data generating instruction, parse the case data generating instruction to obtain transaction system attribute data of a to-be-tested transaction system as target attribute data, and generate initial case data according to the target attribute data;
The splitting unit 120 is configured to split the initial case data to obtain case description information and preamble data;
The generating unit 110 is further configured to generate a preset test case template corresponding to the case description information according to the target attribute data, and generate a table field filling template corresponding to the preamble data according to the target attribute data;
The identifying unit 130 is configured to identify keywords of the use case description information based on a preset first keyword resolution policy, so as to obtain a use case identification result;
the filling unit 140 is configured to fill the case identification result into the preset test case template to obtain an output case;
The identifying unit 130 is further configured to identify keywords of the preamble data based on a preset second keyword resolution policy, so as to obtain a preamble data identification result;
the filling unit 140 is further configured to fill the preamble data identification result into the table field filling template to obtain SQL data associated with the output use case;
The composition unit 150 is configured to compose automation case data corresponding to the transaction system to be tested from the output case and the SQL data.
According to the technical scheme, on one hand, according to the docked transaction system attribute data of different transaction systems to be tested, initial case data are automatically generated, so that the generation efficiency is improved, and the pertinence of the initial case data is ensured; on the other hand, the initial case data is split to obtain case description information and front data, and preset templates are filled to obtain output cases and SQL data based on a keyword analysis strategy respectively, so that automatic case data corresponding to a transaction system to be tested are obtained through combination, the generation efficiency of the case data is improved, and the generalization capability of an automatic case data generation mode is improved in a template matching mode.
The above-described keyword-driven automated case data generating apparatus may be implemented in the form of a computer program that can be run on a computer device as shown in fig. 4.
Referring to fig. 4, fig. 4 is a schematic block diagram of a computer device according to an embodiment of the present invention. The computer equipment integrates any automatic case data generating device based on keyword driving provided by the embodiment of the invention.
With reference to fig. 4, the computer device includes a processor 402, a memory, and a network interface 405, which are connected by a system bus 401, wherein the memory may include a storage medium 403 and an internal memory 404.
The storage medium 403 may store an operating system 4031 and a computer program 4032. The computer program 4032 includes program instructions that, when executed, cause the processor 402 to perform the keyword-driven automated case data generation method described above.
The processor 402 is used to provide computing and control capabilities to support the operation of the overall computer device.
The internal memory 404 provides an environment for the execution of the computer program 4032 in the storage medium 403, which computer program 4032, when executed by the processor 402, causes the processor 402 to perform the keyword-driven automated case data generation method described above.
The network interface 405 is used for network communication with other devices. It will be appreciated by persons skilled in the art that the architecture shown in fig. 4 is merely a block diagram of some of the architecture relevant to the present inventive arrangements and is not limiting as to the computer device to which the present inventive arrangements are applicable, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
Wherein the processor 402 is configured to run a computer program 4032 stored in a memory to implement the keyword-driven automated case data generation method as described above.
It should be appreciated that in embodiments of the present invention, the Processor 402 may be a central processing unit (Central Processing Unit, CPU), the Processor 402 may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processors, DSPs), application SPECIFIC INTEGRATED Circuits (ASICs), off-the-shelf Programmable gate arrays (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. Wherein the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Those skilled in the art will appreciate that all or part of the flow in a method embodying the above described embodiments may be accomplished by computer programs instructing the relevant hardware. The computer program comprises 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 flow steps of the embodiments of the method described above.
Accordingly, 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. The program instructions, when executed by the processor, cause the processor to perform the keyword-driven method for generating automation case data as described above.
The computer readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, etc. which may store the program code.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be combined, divided and deleted according to actual needs. In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The integrated unit may be stored in a storage medium if implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention is essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a terminal, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention.
While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.
Claims (7)
1. An automated case data generation method based on keyword driving is characterized by comprising the following steps:
Responding to a case data generation instruction, analyzing the case data generation instruction to obtain transaction system attribute data of a to-be-tested transaction system as target attribute data, and generating initial case data according to the target attribute data;
Splitting the initial case data to obtain case description information and preposed data;
Generating a preset test case template corresponding to the case description information according to the target attribute data, and generating a table field filling template corresponding to the preposed data according to the target attribute data; the generating a table field filling template corresponding to the pre-data according to the target attribute data comprises the following steps: 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; the table field filling template comprises a reserved value marked by a table field value blank identifier, a general field and a field to be filled marked by a user-defined identifier;
performing keyword recognition on the use case description information based on a preset first keyword analysis strategy to obtain a use case recognition result;
Filling the case recognition result into the preset test case template to obtain an output case, wherein the method comprises the following steps: 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 field screening conditions according to the target attribute data; adding the field screening conditions to the database query statement to obtain a screening statement; screening the field values from each field value based on the screening statement, filling the field values into the preset test case template, and obtaining the output case;
performing keyword recognition on the prepositive data based on a preset second keyword analysis strategy to obtain a prepositive data recognition result;
Filling the preposed data identification result into the table field filling template to obtain SQL data associated with the output use case; wherein the filling the preamble data recognition result into the table field filling template includes: for the reserved value in the table field filling template, acquiring corresponding data from the preposed data identification result to replace the reserved value; and/or for the field to be filled in the table field filling template, acquiring a calculation formula corresponding to the field to be filled, acquiring corresponding data from the preposed data identification result, substituting the corresponding data into the calculation formula to calculate to obtain a calculation result, and filling the calculation result into the field to be filled;
And the output use case and the SQL data form automation use case data corresponding to the transaction system to be tested.
2. The method of claim 1, wherein after the step of composing automation use case data corresponding to the transaction system under test from the output use case and the SQL data, the method further comprises:
and sending the automation case data to an automation test system as test system input data to obtain a corresponding automation test result.
3. The method according to claim 1, wherein after the step of responding to the use case data generation instruction, parsing the use case data generation instruction to obtain transaction system attribute data of a transaction system to be tested as target attribute data, and generating initial case data according to the target attribute data, the method further comprises:
acquiring a case data scene corresponding to the initial case data, and acquiring a target case data verification strategy corresponding to the case data scene from a plurality of preset case data verification strategies;
Performing data verification on the initial case data based on the target case data verification policy to obtain a target case data verification result;
If the target case data verification result is determined to be a verification passing result, adding a verification passing label to the initial case data.
4. The method of claim 1, wherein the first keyword resolution strategy is a first preset regular expression; the keyword recognition is performed on the use case description information based on a preset first keyword analysis strategy to obtain a use case recognition result, which comprises the following steps:
And acquiring a first preset regular expression corresponding to the first keyword analysis strategy, and carrying out keyword recognition on the use case description information based on the first preset regular expression to obtain the use case recognition result.
5. The method of claim 1, wherein the second keyword resolution policy is a second preset regular expression: the keyword recognition is performed on the pre-data based on a preset second keyword analysis strategy to obtain a pre-data recognition result, which comprises the following steps:
And acquiring a second preset regular expression corresponding to the second keyword analysis strategy, and carrying out keyword recognition on the preposed data based on the second preset regular expression to obtain a preposed data recognition result.
6. The method of claim 1, wherein the generating initial case data from the target attribute data comprises:
Determining the current service demand according to the target attribute data; wherein the current business requirements include private requirements and general requirements;
generating private case data according to the private demand;
Acquiring general case data corresponding to the general requirements from a configuration database, or calling a pre-constructed general case data generation code to generate the general case data according to the general requirements;
and combining the private case data with the general case data to obtain the initial case data.
7. The method of claim 1, wherein after the step of composing automation use case data corresponding to the transaction system under test from the output use case and the SQL data, the method further comprises:
When receiving other use case data generation instructions based on other transaction systems, acquiring difference data of the other transaction systems and the transaction system to be tested, and incrementally updating the automatic use case data according to the difference data; and/or
And when the table structure of any data table in the at least one data table is changed, performing incremental updating on the table field filling template according to the change data of the any data table.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410801215.7A CN118363874B (en) | 2024-06-20 | 2024-06-20 | Keyword-driven automatic use case data generation method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410801215.7A CN118363874B (en) | 2024-06-20 | 2024-06-20 | Keyword-driven automatic use case data generation method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN118363874A CN118363874A (en) | 2024-07-19 |
| CN118363874B true CN118363874B (en) | 2024-09-03 |
Family
ID=91878688
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410801215.7A Active CN118363874B (en) | 2024-06-20 | 2024-06-20 | Keyword-driven automatic use case data generation method |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN118363874B (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119759943B (en) * | 2025-03-07 | 2025-08-12 | 天津南大通用数据技术股份有限公司 | A method for generating structured simulation data of database |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115729817A (en) * | 2022-11-21 | 2023-03-03 | 四川众信佳科技发展有限公司 | Method and device for generating and optimizing test case library, electronic equipment and storage medium |
| CN115964307A (en) * | 2023-03-16 | 2023-04-14 | 深圳华锐分布式技术股份有限公司 | Transaction data automatic testing method, device, equipment and medium |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108399130A (en) * | 2018-02-28 | 2018-08-14 | 平安科技(深圳)有限公司 | Method, device and equipment for automatically generating test case and readable storage medium |
| CN116431482A (en) * | 2023-03-28 | 2023-07-14 | 中信建投证券股份有限公司 | Method, device, equipment and storage medium for generating securities test cases |
-
2024
- 2024-06-20 CN CN202410801215.7A patent/CN118363874B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115729817A (en) * | 2022-11-21 | 2023-03-03 | 四川众信佳科技发展有限公司 | Method and device for generating and optimizing test case library, electronic equipment and storage medium |
| CN115964307A (en) * | 2023-03-16 | 2023-04-14 | 深圳华锐分布式技术股份有限公司 | Transaction data automatic testing method, device, equipment and medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN118363874A (en) | 2024-07-19 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US20180308162A1 (en) | Apparatus, Methods and Articles of Manufacture for Constructing and Executing Computerized Transaction Processes and Programs | |
| US8874479B2 (en) | Systems and methods for testing a financial trading system | |
| US7711626B2 (en) | Systems, methods, and computer program products for adjusting the assets of an investment account | |
| US20020046146A1 (en) | Apparatus, methods and articles of manufacture for constructing and executing computerized transaction processes and programs | |
| US20020184133A1 (en) | Method and system for verifying the integrity of data in a data warehouse and applying warehoused data to a plurality of predefined analysis models | |
| US9170821B1 (en) | Automating workflow validation | |
| HUT74896A (en) | Computerized stock exchange trading system | |
| CN118363874B (en) | Keyword-driven automatic use case data generation method | |
| CN112102099B (en) | Policy data processing method and device, electronic equipment and storage medium | |
| CN110764999A (en) | Automatic testing method and device, computer device and storage medium | |
| CN112286790A (en) | Full link test method, device, equipment and storage medium | |
| CN110781235A (en) | Big data based purchase data processing method and device, terminal and storage medium | |
| JP2017146814A (en) | Notarial deed will creation support tool | |
| RU2678164C2 (en) | System and method for determining tradable value | |
| JP7144945B2 (en) | Sales forecast simulation device, sales forecast simulation method and sales forecast simulation program | |
| CN114254022B (en) | RPA and AI-based flow task processing method, device, system and server | |
| US11200102B1 (en) | System for tracking transaction data across applications | |
| NO332053B1 (en) | Control system for managing complex facilities that accommodate multiple simultaneous processes. | |
| JP2005293044A (en) | Test data generation method and system | |
| US20030018451A1 (en) | System, method and computer program product for rating enterprise metrics | |
| CN114003494A (en) | Automatic test method and device for data model and electronic equipment | |
| CN113205421A (en) | Accounting method and device for financial products | |
| CN112347178A (en) | Data docking method and device based on human-computer interaction behavior, terminal and server | |
| CN119473910A (en) | A method, device, equipment and storage medium for generating test data | |
| CN115796597A (en) | Risk pressure testing system, method and equipment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |