CN114297052A - Test data generation method and device - Google Patents

Test data generation method and device Download PDF

Info

Publication number
CN114297052A
CN114297052A CN202111519955.4A CN202111519955A CN114297052A CN 114297052 A CN114297052 A CN 114297052A CN 202111519955 A CN202111519955 A CN 202111519955A CN 114297052 A CN114297052 A CN 114297052A
Authority
CN
China
Prior art keywords
data
test data
file
test
current
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.)
Pending
Application number
CN202111519955.4A
Other languages
Chinese (zh)
Inventor
于子益
冯上海
胡宝权
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Kingstar Fintech Co Ltd
Original Assignee
Shanghai Kingstar Fintech Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shanghai Kingstar Fintech Co Ltd filed Critical Shanghai Kingstar Fintech Co Ltd
Priority to CN202111519955.4A priority Critical patent/CN114297052A/en
Publication of CN114297052A publication Critical patent/CN114297052A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The application relates to a test data generation method and device, computer equipment and a storage medium. The method comprises the following steps: the method comprises the steps of obtaining first test data and an initial test data file based on a preset service model, carrying out calculation conversion according to historical transaction information, current test data and the first test data to obtain historical test data and second test data, and storing the first test data, the current test data, the historical test data and the second test data into a data file to be tested to obtain a target test data file. By adopting the method, historical contract data, historical market data and data irrelevant to market and contracts in a historical time period can be obtained, and the data are combined to be used as test data of the transaction system, so that the transaction system can obtain multi-dimensional current test data and historical test data, and the omnibearing dead-angle-free test requirement of the transaction system is met.

Description

Test data generation method and device
Technical Field
The present application relates to the field of finance, and in particular, to a method and an apparatus for generating test data.
Background
In the development process of the distributed transaction system, a large amount of test data is required for the function test, the automation test, the capacity test, the performance test and the like of the distributed transaction system.
In the conventional technology, a futures exchange simulates market data and contract data through a simulation environment to realize distributed transaction system testing. However, the test data acquired in the conventional manner cannot meet the test requirements of the distributed transaction system.
Disclosure of Invention
In view of the above, it is necessary to provide a test data generating method and apparatus.
A method of test data generation, the method comprising:
acquiring first test data and an initial test data file based on a preset service model; the first test data comprises data unrelated to market conditions and contracts;
calculating and converting according to the historical transaction information, the current test data and the first test data to obtain historical test data and second test data; the current test data comprises current contract data, current market data and current dependency data, and the current dependency data comprises current market and contract related data; the historical test data comprises historical contract data and historical market data, and the second test data is data irrelevant to market and contracts in a historical time period;
and storing the first test data, the current test data, the historical test data and the second test data into the initial test data file to obtain a target test data file.
In one embodiment, the obtaining the first test data and the initial test data file based on the preset service model includes:
analyzing the preset service model to obtain a database import file, a database control file and a data file to be tested in the initial test data file; the database import file comprises service field information, and the database control file comprises a field storage rule;
and acquiring the first test data through a preset rule, the database import file and the database control file.
In one embodiment, the method further comprises:
expanding the service field information in the database import file and the field storage rule in the database control message to obtain an expanded database import file and an expanded database control file;
the obtaining the first test data through the preset rule, the database import file and the database control file includes:
and acquiring the first test data through the preset rule, the expanded database import file and the expanded database control file.
In one embodiment, the obtaining the first test data through a preset rule, the database import file, and the database control file includes:
determining the preset rule according to the test requirement;
and screening the first test data from the database file based on the preset rule.
In one embodiment, the method further comprises:
and preprocessing the initial contract data and the initial market data to obtain the current test data.
In one embodiment, the preprocessing the initial contract data and the initial market data to obtain the current test data includes:
denoising the initial contract data and the initial market data to obtain target contract data and target market data, wherein the denoising process comprises removing at least one of invalid data and repeated data;
and classifying the target contract data and the target market data to obtain the current contract data and the current market data.
In one embodiment, the classifying the target contract data to obtain the current contract data includes:
determining futures option contract data from the target contract data according to the type of the service field in the target contract data;
and classifying the futures option contract data according to the type of the futures option contract data to obtain the current contract data.
In one embodiment, the classifying the target market data to obtain the current market data includes:
and screening legal data in a preset time period from the target market data according to a contract list to obtain the current market data.
In one embodiment, the storing the first test data, the current test data, the historical test data, and the second test data in the initial test data file to obtain a target test data file includes:
and storing the first test data, the current test data, the historical test data and the second test data into a data file to be tested through a field storage rule to obtain the target test data file.
In one embodiment, the method further comprises:
and importing the target test data file into a transaction system through the database import file and the database control file so that the transaction system carries out development test according to the target test data file.
A test data generation apparatus, the apparatus comprising:
the test information acquisition module is used for acquiring first test data and an initial test data file based on a preset service model; the first test data comprises data unrelated to market conditions and contracts;
the calculation conversion module is used for performing calculation conversion according to the historical transaction information, the current test data and the first test data to obtain historical test data and second test data; the current test data comprises current contract data, current market data and current dependency data, and the current dependency data comprises current market and contract related data; the historical test data comprises historical contract data and historical market data, and the second test data is data irrelevant to market and contracts in a historical time period;
and the test data storage module is used for storing the first test data, the current test data, the historical test data and the second test data into the initial test data file to obtain a target test data file.
The method comprises the steps of acquiring first test data and an initial test data file based on a preset service model, carrying out calculation conversion according to historical transaction information, current test data and the first test data to obtain historical test data and second test data, and storing the first test data, the current test data, the historical test data and the second test data into the initial test data file to obtain a target test data file; the method can acquire historical contract data, historical market data and data irrelevant to market and contracts in a historical time period, and combines the historical contract data, the historical market data and the data to be used as test data of the transaction system, so that the transaction system can acquire multi-dimensional current test data and historical test data, and the comprehensive dead-angle-free test requirement of the transaction system is met.
Drawings
FIG. 1 is a diagram illustrating an internal structure of a computer device according to an embodiment;
FIG. 2 is a flow diagram illustrating a method for generating test data according to one embodiment;
FIG. 3 is a flow diagram illustrating a method for obtaining first test data and an initial test data file, according to one embodiment;
FIG. 4 is a flowchart illustrating a method for obtaining first test data according to another embodiment;
FIG. 5 is a flowchart illustrating a method for obtaining current test data according to another embodiment;
FIG. 6 is a schematic flow chart diagram illustrating a method for obtaining current contract data in accordance with another embodiment;
FIG. 7 is a block diagram showing the structure of a test data generating apparatus according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The test data generation method provided by the application can be applied to the computer equipment shown in FIG. 1. As shown in fig. 1, the computer apparatus includes a processor, a memory, a network interface, a display screen, and an input device, which are connected through a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing a preset service model and a target test data file. The network interface of the computer device is used for communicating with an external endpoint through a network connection. The computer program is executed by a processor to implement a test data generation method.
Those skilled in the art will appreciate that the architecture shown in fig. 1 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, as shown in fig. 2, a test data generation method is provided, which is described by taking the method as an example applied to the computer device in fig. 1, and includes the following steps:
s100, acquiring first test data and an initial test data file based on a preset service model; the first test data includes data unrelated to market conditions and contracts.
Specifically, the preset service model may be understood as a data model pre-constructed by the transaction system, an information table may be obtained through one preset service model, the information table may include service field information, field storage rules, service field usage scenarios, service field sources, and the like, and the service field information may be database script information. In this embodiment, the computer device may obtain the first test data and the initial test data file based on a plurality of preset service models. The initial test data file may include a plurality of data files, including both real and null data files.
The quotation data can be quotation data of stocks, futures, foreign exchange rates, indexes, funds, bonds (including convertible bonds), equities and options, and the contract data corresponds to the quotation data. The first test data may be data in a customer table, seat table, trade parameter table, etc., and the customer-associated table supports any customer-level extension. In this embodiment, the preset service model is not fixed, and the transaction system may update the preset service model in real time.
S200, calculating and converting according to the historical transaction information, the current test data and the first test data to obtain historical test data and second test data; the current test data comprises current contract data, current market data and current dependency data, and the current dependency data comprises current data related to market and contracts; the historical test data comprises historical contract data and historical market data, and the second test data is data irrelevant to market and contracts in a historical time period.
Specifically, the historical transaction information may be information related to the transaction during a historical time period, such as transaction time, transaction funds, transaction location, and the like. The current test data may be understood as test data of a current transaction day, and the current test data may include contract data and market data of the current transaction day acquired in real time from different financial institutions, and current dependency data acquired through the contract data and market data of the current transaction day. In this embodiment, the computer device may derive six tables, i.e., a transaction fund account table, a customer taken position table, a taken position detail table, a combined taken position summary table, a customer combined taken position detail table, and a single-side benefit table, from a memory table viewing tool of a transaction core of a distributed transaction system of a financial institution, and then perform calculation conversion according to historical transaction information, current test data, and first test data to obtain historical contract data, historical market data, and data unrelated to market and contracts in a historical time period, so as to provide the transaction system with comprehensively guaranteed test data.
It should be noted that, the above-mentioned transaction fund account table may store data such as balance, warranty fee, profit and loss in the investor fund account; the client position taking table can store the transaction position taking summary of the common futures option contract of the investor, including position taking quantity, position taking cost, deposit, settlement price and other data; the details of taking positions of each common futures option contract of the investor, such as the insurance mark, the opening date, the quantity, the bargaining number and other data of each taking position, can be stored in the position taking list; the combined position summary table can store the trade position summary of the investor combined contract, wherein the stored data is similar to the data in the client position table; the client combination position taking list can store the position taking list of each combination contract of the investor, wherein the stored data is similar to the data in the position taking list; the unilateral discount list can store and accelerate and record the unilateral guarantee gold discount calculation process of the current date station, the energy station and the gold station.
Illustratively, in the calculation conversion process, (1) for the transaction fund account table, setting "last settlement fund" as "futures settlement fund", "last occupied fund" as "total amount of current fund", "frozen commission,", "fund difference", "flat profit and loss", and "taken position profit and loss" as 0; (2) for the taken-position summary table and the combined taken-position summary table, the taken-position date of a contract of a certain term exchange is set as the last taken-position date, the taken-position dates of other exchanges are set as the current taken-position dates, the multi-head freezing, the empty-head freezing, the opening freezing amount, the flat-position amount and the like are all set as 0, the taken-position cost is equal to the last settlement price multiplied by the contract multiplier multiplied by the taken-position amount, and the last occupied deposit is set as the occupied deposit; (3) for the position holding statement, setting the trade date as the current trade date, setting the position opening date as the last trade date, setting the position holding profit and loss of the day-to-day staring market, the position holding profit and loss of the stroke-to-stroke hedging market, the position holding amount and the position holding amount as 0, and setting the 'first-to-open first-to-level residual quantity' as the quantity if the contract of other commodity exchanges is formed; (4) for the combined position taking list, setting the 'last position taking' as 'present position taking', and setting other items as the same as the position taking list; (5) for the unilateral preferential list, the 'buying freezing deposit', the 'selling freezing deposit' are set as 0, and the 'freezing deposit collecting direction' is set as 'deposit collecting direction'.
S300, storing the first test data, the current test data, the historical test data and the second test data into an initial test data file to obtain a target test data file.
Specifically, the computer device may store the first test data, the current test data, the historical test data, and the second test data to the initial test data file synchronously or sequentially according to the field storage rule, so as to obtain the target test data file.
In the test data generation method, the computer equipment can obtain first test data and an initial test data file based on a preset service model, carry out calculation conversion according to historical transaction information, current test data and the first test data to obtain historical test data and second test data, and store the first test data, the current test data, the historical test data and the second test data into a data file to be tested to obtain a target test data file; the method can acquire historical contract data, historical market data and data irrelevant to market and contract in a historical time period, and combines the historical contract data, the historical market data and the data to be used as test data of the transaction system, so that the transaction system can acquire multi-dimensional current test data and historical test data to meet the all-dimensional dead-angle-free test requirement of the transaction system, and the test effect of the transaction system is further improved; meanwhile, the method can also continuously acquire correspondingly updated test data according to the updated preset service model, so that the later maintenance test function of the transaction system is facilitated, and the test stability is strong; the method can be realized by a set of computer programs, so that the acquisition speed of the test data is improved.
As an embodiment, as shown in fig. 3, the step of acquiring the first test data and the initial test data file based on the preset service model in S100 may be implemented by the following steps:
s110, analyzing a preset service model to obtain a database import file, a database control file and a data file to be tested in an initial test data file; the database import file comprises service field information, and the database control file comprises field storage rules.
In this embodiment, the computer device may analyze each preset service model through an analysis tool, obtain service field information and a field storage rule included in an information table in each preset service model, and then construct a database import file, a database control file, and a data file to be tested through the service field information and the field storage rule. The above parsing tool may be implemented in python language, which may be an xml. The database import file and the database control file may be real data files, that is, specific data is stored in the files. The service field information may be stored in a database import file, the field storage rule may be stored in a database control file, the data file to be tested may be a null data file with only field headers, and values separated by commas, semicolons, pauses, and other symbols may be stored in the null data file. The database import file and the database control file may respectively include a file supporting the operation of a windows operating system and a file supporting the operation of a linux operating system, and may also include files operated by other operating systems.
It is to be understood that the above-described information tables may be investor information tables, trade fund account tables, combination position summary tables, one-sided coupon tables, and the like. Such as a brokerage code, investor account number, available funds, date traded, settlement number, credit line, pledge amount, and customer number, among others, may be included in the trading funds account table. Taking the information table as an INVESTOR information table as an example, the computer device can obtain a corresponding database import file, a database control file and a data file to be tested, namely a database import file (file name is import.bat) supporting a windows operating system, a database import file (file name is import.sh) supporting a linux operating system, a database control file (file name is investor.ctl) supporting a windows operating system, a database control file (file name is INVESTOR _ linux.ctl) supporting a linux operating system and an empty csv data file (file name is investor.csv). The database import file may include a database import script program.
An example information table that can be stored in each of the database import file supporting the windows operating system and the database import file supporting the linux operating system is shown in table 1.
TABLE 1
Figure BDA0003408357750000081
Wherein sqlldr in table 1 is a name of a database import tool, a first duser in service field information represents a user name, a second duser represents a password, 127.0.0.1:1521/dtpf represents an IP address, a port number/a database instance name, INVESTOR.ctl represents a database control file name, INVESTOR.log represents a log file name.
Meanwhile, an example information table that can be stored in each of the database control file supporting the windows operating system and the database control file supporting the linux operating system is shown in table 2.
TABLE 2
Figure BDA0003408357750000091
It should be noted that, it can be determined by the field storage rule in the database control file that the test data in the data file to be tested needs to be separated by comma separators. The field storage rules may be the field information contained in the tracking null columns in the database control file of table 2.
And S120, importing the file through a preset rule and a database to obtain first test data.
Specifically, the preset rule may be a rule for screening data irrelevant to quotations and contracts specified in real time. The computer equipment can screen the service field information in the database import file through a preset rule, and then sort the screened service field information according to the field storage rule in the database control file to obtain first test data, or the computer equipment can screen the service field information in the database import file through the preset rule and take the screened service field information as the first test data. In this embodiment, the first test data may be simulation data that is independent of market conditions and contracts on the current transaction date.
The test data generation method can analyze the preset service model, obtain the database import file, the database control file and the data file to be tested in the initial test data file, and obtain the first test data through the preset rule and the database import file.
As an embodiment, before the step of S120 is executed, the test data generating method may further include the steps of: and expanding the service field information in the database import file and the field storage rule in the database control message to obtain an expanded database import file and an expanded database control file.
Specifically, the computer device may expand, based on the user order, the relevant service field information according to the service field information in the database import file to obtain the expanded database import file, and may expand, according to the expanded relevant service field information and the field storage rule in the database control file, the field storage rule in the database control file to obtain the expanded database control file. Wherein, the number of the extended field storage rules may be equal to the number of the extended related service field information. In this embodiment, the data size to be expanded may be any size, and is not limited thereto.
Further, the step of obtaining the first test data through the preset rule and the database import file in S120 may include: and importing the file through a preset rule and the expanded database to obtain first test data.
It should be noted that the computer device may screen the field information in the extended database import file according to a preset rule, and then sort the screened field information according to a field storage rule in the extended database control file to obtain the first test data, or the computer device may screen the service field information in the extended database import file according to a preset rule, and use the service field information obtained by screening as the first test data.
According to the embodiment, the full amount of first test data can be acquired by importing the file through the preset rule and the expanded database, so that the finally obtained test data can meet the test requirements of the transaction system to a greater extent.
The test data generation method can expand the service field information in the database import file and the field storage rule in the database control text to obtain an expanded database import file and an expanded database control file, and further process the expanded database import file and the expanded database control file through the preset rule to obtain a relatively whole amount of test data, so that the finally obtained test data can meet the all-around dead-angle-free test requirement of the transaction system to a greater extent, and the test effect of the transaction system is improved; meanwhile, the method can expand the field storage rule in the service field information and the database control message in the database import file based on the user magnitude, so as to obtain large-scale test data, so that the finally obtained test data can meet the manual service test requirements of testers and can meet the requirements of large-data-volume automatic test, capacity test and performance test; in addition, the transaction system realizes development and testing through large-scale test data, can clearly know defects and bottlenecks in the development process of the transaction system, and has great significance for subsequent development and maintenance of the transaction system.
As an embodiment, as shown in fig. 4, the step of obtaining the first test data by importing the file through the preset rule and the database in S120 may be implemented by:
and S121, determining a preset rule according to the test requirement.
Specifically, the first test data stored in the target test data file determined in this embodiment may be understood as a test data table, and the first test data stored in the table is data screened according to a certain rule. According to the actual test requirements of the transaction system, the computer equipment can firstly acquire relevant rule tables such as a corresponding data dictionary, transaction parameters, upper and lower field rules and the like, and then analyze the relevant rule tables to obtain preset rules. However, in this embodiment, the user may manually write a customized preset rule code according to the actual test requirement, so that the computer device obtains the preset rule. The number of preset rules may be greater than or equal to 1.
It should be noted that different test data tables and different service field information in each test data table have different rules. Illustratively, taking the information table in the preset business model as the investor information table as an example, the investor information table may include investor IDs, and the investor IDs may represent client numbers, which may be sufficiently expanded to obtain the advantages of large-scale test data, and the client numbers may be increased or decreased from a certain data to distinguish between IDs of different investors. If the expansibility of the test data is considered, the customer number in the rule defined by the transaction system can be gradually increased in a traversal mode from 10000, 2000000 pieces of target customer data simulated by the transaction system are further obtained, the customer number can also be generated in a character string mode, and the customer number can be set in other modes without limitation. The rate template code (TemplateCode) in the investor information table can be important field information related to the rate and also field information required by the transaction system for testing transaction functions, and as the client number is generated in a traversal mode, the client number can be ranged according to the template number when data in the investor information table are generated, for example, clients of 10000-10999 belong to a template 1, clients of 11000-11999 belong to a template 2 and the like, and meanwhile, the transaction system can fully design test cases according to the rules.
And S122, screening the first test data from the database file based on a preset rule.
It is understood that the computer device may screen the database file for the service field information meeting the preset rule according to the preset rule and serve as the first test data unrelated to the quotation and the contract.
The test data generation method can determine the preset rule according to the test requirement, and screens the first test data from the database file based on the preset rule, and the method can acquire the simulation data of the current transaction date which is irrelevant to the market conditions and the contracts, so that the transaction system can acquire the test data which is irrelevant to the market conditions and the contracts, the test is realized by combining the market conditions data and the contracts data, and the test effect of the transaction system is further improved.
As an embodiment, before the step in S200 is executed, the test data generating method may further include: and preprocessing the initial contract data and the initial market data to obtain current test data.
Specifically, the computer device may obtain the initial contract data and the initial market data from the MongoDB database stored in the local or cloud storage locations of different financial institutions, and further, preprocess the initial contract data and the initial market data to obtain the current test data. The preprocessing can be denoising processing, analysis processing, contrast processing, data operation processing and the like.
The test data generation method can preprocess initial contract data and initial market data acquired in real time to obtain current test data, and then combine the current test data, the first test data, the historical test data and the second test data to be used as final test data, so that the transaction system can acquire multi-dimensional test data meeting the requirements of omnibearing dead-corner-free test, and the test effect of the transaction system is further improved.
As an embodiment, as shown in fig. 5, the step of preprocessing the initial contract data and the initial market data to obtain the current test data may be implemented by the following steps:
s400, denoising the initial contract data and the initial market data to obtain target contract data and target market data, wherein the denoising process comprises removing at least one of invalid data and repeated data.
Specifically, in some scenarios, if invalid data and/or duplicate data exist in the initial contract data and the initial market data, the computer device may perform denoising processing on the acquired initial contract data and the initial market data by using the data analysis library, so as to remove the invalid data and/or the duplicate data in the initial contract data and the initial market data, respectively, to obtain target contract data and target market data. The data analysis library may be python pandas.
It should be noted that, if invalid data exists in the initial contract data and the initial market data, the computer device may perform denoising processing on the initial contract data and the initial market data, remove the invalid data in the initial contract data and the initial market data, use the initial contract data from which the invalid data is removed as target contract data, and use the initial market data from which the invalid data is removed as target market data. If the initial contract data and the initial market data contain repeated data, the computer equipment can perform denoising processing on the initial contract data and the initial market data, remove the repeated data in the initial contract data and the initial market data, use the initial contract data with the repeated data removed as target contract data, and use the initial market data with the repeated data removed as target market data. If invalid data and repeated data exist in the initial contract data and the initial market data, the computer equipment can perform denoising processing on the initial contract data and the initial market data, remove the invalid data and the repeated data in the initial contract data and the initial market data, use the initial contract data with the invalid data and the repeated data removed as target contract data, and use the initial market data with the invalid data and the repeated data removed as target market data.
In addition, if invalid data and/or duplicate data do not exist in the initial contract data and the initial market data, the initial contract data can be directly used as target contract data, and the initial market data can be used as target market data.
And S500, classifying the target contract data and the target market data to obtain the current contract data and the current market data.
Specifically, the computer device may perform arithmetic operation processing on the target contract data and the target market data, and then perform classification processing on the arithmetic operation result to obtain the current contract data and the current market data, or perform screening processing on the target contract data and the target market data, and then perform classification processing on the screening result to obtain the current contract data and the current market data, and of course, may also directly perform classification processing on the target contract data and the target market data to obtain the current contract data and the current market data.
The test data generation method can acquire the current contract data and the current market data, and then combines the current contract data, the current market data, the first test data, the historical test data and the second test data to be used as the final test data, so that the transaction system can acquire the multidimensional test data meeting the requirement of omnibearing dead-corner-free test, and the test effect of the transaction system is further improved.
As an embodiment, as shown in fig. 6, the step of classifying the target contract data in S500 to obtain the current contract data may specifically include:
s510, determining futures option contract data from the target contract data according to the type of the service field in the target contract data.
Illustratively, the computer device performs denoising processing on some initial contract data, removes invalid data and duplicate data in the initial contract data to obtain 99888 entry contract data, and then may divide the target contract data into 9823 futures option contract data and 90065 combination contract data according to the service field type in the target contract data.
S520, classifying the futures option contract data according to the type of the futures option contract data to obtain current contract data.
Continuing with the previous example, the computer device may classify 9823 sets of option contract data according to types of exchange information, varieties, some price information, etc. in the option contract data to obtain data of exchange information, varieties, some price information, etc., and at the same time, the computer device may generate basic data of contract table, variety table, price table, etc. from these data and call these basic data as current contract data.
Meanwhile, the step of classifying the target market data in S500 to obtain the current market data may include: and screening legal data in a preset time period from the target market data according to the contract list to obtain the current market data.
It can be understood that the computer device may screen legal data within a preset time period from the target market data according to a contract table in the current contract data to obtain the current market data. The preset time period may be any time period in one day, and may also be any time period in multiple days, which is not limited in this respect.
Continuing with the previous example, the computer device may obtain, based on a contract table in the current contract data, a piece of legal data marked most recently in each current contract data before three-point closing in the afternoon, screen out a corresponding piece of static market data from the target market data according to the piece of legal data marked most recently in each current contract data, and then analyze each piece of static market data to obtain a series of exchange information, variety information, price information, and the like, and use the information as the current market data. The dependent data in the invention mainly refers to data related to contracts and quotations, and mainly concentrates contract tables, variety tables, tariff tables, quotation tables and the like in the DTP-F, and the specific data tables are as follows:
it should be noted that, the computer device may further obtain, through the obtained current contract data and current market data, data that is strongly related to the contract and the market, that is, current dependency data, where the current dependency data may include a contract table, a variety table, a fee table, a market table, and the like. The information names corresponding to the data included in the current dependent data may be as shown in table 3, but the current dependent data is not limited to the data corresponding to these information names.
TABLE 3
Contract information table Combined contract information table
(Large join) Combined contract priority Deep market
Products (i.e. variety) Client procedure rate
Customer option procedure rates Template procedure rates
Template option procedure rates Company procedure rates
Corporate option procedure rates Customer guaranteed rate
(options) customer deposit rate Template guaranteed rate
(option) template deposit rate Company guaranteed rate
(options) company guaranteed rate Exchange guaranteed rate
Exchange deposit rate Investor's guaranty gold following table
Client position limit meter List of rules for frequently placing orders
Rule detail list for frequently removing list Cost of option trading
The test data generation method can acquire the current contract data, and then combines the current contract data, the current market data, the first test data, the historical test data and the second test data to be used as the final test data, so that the transaction system can acquire the multidimensional test data meeting the requirement of the omnibearing dead-corner-free test, and the test effect of the transaction system is further improved.
As an embodiment, the step of storing the first test data, the current test data, the historical test data, and the second test data in the initial test data file in S300 to obtain the target test data file may include: and storing the first test data, the current test data, the historical test data and the second test data into a data file to be tested through a field storage rule to obtain a target test data file.
Specifically, the field storage rule may be a field information type, a field storage time, and a field storage sequence, but in this embodiment, the field storage rule may be a sequence of field headers.
It can be understood that the computer device may traverse the test data in the first test data, the current test data, the historical test data and the second test data according to the field storage rule in the database control file, and sequentially store the test data in the data file to be tested, so as to obtain a large-scale and multi-dimensional target test data file. In the whole test data generation process, each time one kind of test data is acquired, the kind of test data can be preferentially stored in the data file to be tested until all kinds of test data (namely, the first test data, the current test data, the historical test data and the second test data) are acquired.
Further, after all the steps are performed, the test data generating method may further include: and importing the target test data file into the transaction system through the database import file and the database control file so that the transaction system carries out development test according to the target test data file.
The computer equipment can import the target test data file into a database in the transaction system to be developed through a data import tool in the database import file and by means of the database control file, so that the transaction system can carry out various development tests according to large-scale and multi-dimensional test data in the target test data file. In this embodiment, the data import tool may be sql drs, and the database control file may be an oracle control file.
It should be noted that the development test may be a capacity test, a performance test, a function test, an automation test, and the like.
Meanwhile, the transaction system provides a format for loading imported test data, which is a txt file for distinguishing different field information by using a semicolon delimiter, and in order to simulate the process of data field up and field down, a cx _ Oracle tool is usually used for exporting the test data in a target test data file which is imported into a database before according to a test data export requirement.
According to the embodiment, various development tests can be performed according to large-scale and multi-dimensional test data in the target test data file, so that the test effect of the transaction system is improved.
The test data generation method can obtain large-scale and multi-dimensional test data, and the test data is stored in the data file to be tested according to the field storage rule in the database control file, so that the test data obtained by the transaction system is ensured to be the same as the data in the information table in the preset service model, the data deviation is avoided, meanwhile, the transaction system can obtain a target test data file which meets the test requirement and contains the large-scale and multi-dimensional test data, the development test is further realized through the target test data file, the accuracy of the test result can be greatly improved, in addition, the transaction system realizes the development test through the large-scale test data, the defects and the bottlenecks in the development process of the transaction system can be clearly known, and the subsequent development and maintenance significance of the transaction system is great.
In order to facilitate understanding of those skilled in the art, the test data generation method provided in the present application is described by taking an execution subject as a computer device as an example, and specifically, the method includes:
(1) analyzing a preset service model to obtain a database import file, a database control file and a data file to be tested in an initial test data file; the database import file comprises service field information, and the database control file comprises field storage rules.
(2) And expanding the service field information in the database import file and the field storage rule in the database control message to obtain an expanded database import file and an expanded database control file.
(3) And determining a preset rule according to the test requirement, the expanded database import file and the expanded database control file.
(4) And screening first test data from the expanded database file based on a preset rule, wherein the first test data comprises data irrelevant to quotation and contracts.
(5) And preprocessing the initial contract data and the initial market data to obtain current test data.
(6) And denoising the initial contract data and the initial market data to obtain target contract data and target market data, wherein the denoising process comprises removing at least one of invalid data and repeated data.
(7) Futures option contract data is determined from the target contract data based on the type of the business field in the target contract data.
(8) And screening legal data in a preset time period from the target market data according to the contract list to obtain the current market data.
(9) Calculating and converting according to the historical transaction information, the current test data and the first test data to obtain historical test data and second test data; the current test data comprises current contract data, current market data and current dependency data, and the current dependency data comprises current data related to market and contracts; the historical test data comprises historical contract data and historical market data, and the second test data is data irrelevant to market and contracts in a historical time period.
(10) And storing the first test data, the current test data, the historical test data and the second test data into a data file to be tested through a field storage rule to obtain a target test data file.
(11) And importing the target test data file into the transaction system through the database import file and the database control file so that the transaction system carries out development test according to the target test data file.
For the implementation processes of (1) to (11), reference may be specifically made to the description of the above embodiments, and the implementation principles and technical effects thereof are similar and are not described herein again.
It should be understood that although the various steps in the flow charts of fig. 2-6 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-6 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps.
In one embodiment, as shown in fig. 7, there is provided a test data generation apparatus including: a test information acquisition module 11, a calculation conversion module 12 and a test data storage module 13, wherein:
the test information acquisition module 11 is configured to acquire first test data and an initial test data file based on a preset service model; the first test data includes data unrelated to market conditions and contracts;
the calculation conversion module 12 is used for performing calculation conversion according to the historical transaction information, the current test data and the first test data to obtain historical test data and second test data; the current test data comprises current contract data, current market data and current dependency data, and the current dependency data comprises current data related to market and contracts; the historical test data comprises historical contract data and historical market data, and the second test data is data irrelevant to market and contracts in a historical time period;
and the test data storage module 13 is configured to store the first test data, the current test data, the historical test data, and the second test data in an initial test data file to obtain a target test data file.
The test data generating apparatus provided in this embodiment may implement the method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
In one embodiment, the test information obtaining module 11 includes: analysis unit and first test data acquisition unit, wherein:
the analysis unit is used for analyzing the preset service model to acquire a database import file, a database control file and a data file to be tested in the initial test data file; the database import file comprises service field information, and the database control file comprises a field storage rule;
the first test data acquisition unit is used for acquiring first test data through preset rules and a database import file.
The test data generating apparatus provided in this embodiment may implement the method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
In one embodiment, the test information obtaining module 11 further includes: an extension unit, wherein:
the expansion unit is used for expanding the service field information in the database import file and the field storage rule in the database control message to obtain an expanded database import file and an expanded database control file;
the first test data acquisition unit is specifically configured to acquire first test data through a preset rule and an expanded database import file.
The test data generating apparatus provided in this embodiment may implement the method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
In one embodiment, the first test data acquisition unit includes: a rule determination subunit and a screening subunit, wherein:
the rule determining subunit is used for determining a preset rule according to the test requirement;
and the screening subunit is used for screening the first test data from the database file according to a preset rule.
The test data generating apparatus provided in this embodiment may implement the method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
In one embodiment, the test data generating apparatus further includes: a pre-processing module, wherein:
and the preprocessing module is used for preprocessing the initial contract data and the initial market data to obtain the current test data.
The test data generating apparatus provided in this embodiment may implement the method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
In one embodiment, the pre-processing module comprises: a denoising processing unit and a classification processing unit, wherein:
the de-noising processing unit is used for de-noising the initial contract data and the initial market data to obtain target contract data and target market data, and the de-noising processing comprises removing at least one of invalid data and repeated data;
and the classification processing unit is used for classifying the target contract data and the target market data to obtain the current contract data and the current market data.
The test data generating apparatus provided in this embodiment may implement the method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
In one embodiment, the classification processing unit includes: a first sort processing subunit and a second sort processing subunit, wherein:
a first classification processing subunit, configured to determine futures option contract data from the target contract data according to a type of a service field in the target contract data;
and the second classification processing subunit is used for classifying the futures option contract data according to the type of the futures option contract data to obtain the current contract data.
The test data generating apparatus provided in this embodiment may implement the method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
In one embodiment, the classification processing unit further includes: a third classification processing subunit, wherein:
and the third classification processing subunit is used for screening out legal data in a preset time period from the target market data according to the contract list to obtain the current market data.
The test data generating apparatus provided in this embodiment may implement the method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
In one embodiment, the test data storage module 13 is specifically configured to store the first test data, the current test data, the historical test data, and the second test data in a data file to be tested according to a field storage rule, so as to obtain a target test data file.
The test data generating apparatus provided in this embodiment may implement the method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
In one embodiment, the test data generating apparatus further includes: a file import module, wherein:
and the file import module is used for importing the target test data file into the transaction system through the database import file and the database control file so that the transaction system carries out development test according to the target test data file.
The test data generating apparatus provided in this embodiment may implement the method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
For specific limitations of the test data generation apparatus, reference may be made to the above limitations of the test data generation method, which are not described herein again. The modules in the test data generation device can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring first test data and an initial test data file based on a preset service model; the first test data includes data unrelated to market conditions and contracts;
calculating and converting according to the historical transaction information, the current test data and the first test data to obtain historical test data and second test data; the current test data comprises current contract data, current market data and current dependency data, and the current dependency data comprises current data related to market and contracts; the historical test data comprises historical contract data and historical market data, and the second test data is data irrelevant to market and contracts in a historical time period;
and storing the first test data, the current test data, the historical test data and the second test data into a data file to be tested to obtain a target test data file.
In one embodiment, a storage medium is provided having a computer program stored thereon, the computer program when executed by a processor implementing the steps of:
acquiring first test data and an initial test data file based on a preset service model; the first test data includes data unrelated to market conditions and contracts;
calculating and converting according to the historical transaction information, the current test data and the first test data to obtain historical test data and second test data; the current test data comprises current contract data, current market data and current dependency data, and the current dependency data comprises current data related to market and contracts; the historical test data comprises historical contract data and historical market data, and the second test data is data irrelevant to market and contracts in a historical time period;
and storing the first test data, the current test data, the historical test data and the second test data into a data file to be tested to obtain a target test data file.
In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps of:
acquiring first test data and an initial test data file based on a preset service model; the first test data includes data unrelated to market conditions and contracts;
calculating and converting according to the historical transaction information, the current test data and the first test data to obtain historical test data and second test data; the current test data comprises current contract data, current market data and current dependency data, and the current dependency data comprises current data related to market and contracts; the historical test data comprises historical contract data and historical market data, and the second test data is data irrelevant to market and contracts in a historical time period;
and storing the first test data, the current test data, the historical test data and the second test data into a data file to be tested to obtain a target test data file.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of test data generation, the method comprising:
acquiring first test data and an initial test data file based on a preset service model; the first test data comprises data unrelated to market conditions and contracts;
calculating and converting according to the historical transaction information, the current test data and the first test data to obtain historical test data and second test data; the current test data comprises current contract data, current market data and current dependency data, and the current dependency data comprises current market and contract related data; the historical test data comprises historical contract data and historical market data, and the second test data is data irrelevant to market and contracts in a historical time period;
and storing the first test data, the current test data, the historical test data and the second test data into the initial test data file to obtain a target test data file.
2. The method of claim 1, wherein obtaining the first test data and the initial test data file based on the preset service model comprises:
analyzing the preset service model to obtain a database import file, a database control file and a data file to be tested in the initial test data file; the database import file comprises service field information, and the database control file comprises a field storage rule;
and acquiring the first test data through a preset rule and the database import file.
3. The method of claim 2, further comprising:
expanding the service field information in the database import file and the field storage rule in the database control message to obtain an expanded database import file and an expanded database control file;
the obtaining the first test data through the preset rule, the database import file and the database control file includes:
and acquiring the first test data through the preset rule and the expanded database import file.
4. The method according to claim 2 or 3, wherein the obtaining the first test data through the preset rule and the database import file comprises:
determining the preset rule according to the test requirement;
and screening the first test data from the database file based on the preset rule.
5. The method according to claim 1 or 2, characterized in that the method further comprises:
and preprocessing the initial contract data and the initial market data to obtain the current test data.
6. The method of claim 5, wherein preprocessing the initial contract data and the initial market data to obtain the current test data comprises:
denoising the initial contract data and the initial market data to obtain target contract data and target market data, wherein the denoising process comprises removing at least one of invalid data and repeated data;
and classifying the target contract data and the target market data to obtain the current contract data and the current market data.
7. The method of claim 6, wherein classifying the target contract data to obtain the current contract data comprises:
determining futures option contract data from the target contract data according to the type of the service field in the target contract data;
and classifying the futures option contract data according to the type of the futures option contract data to obtain the current contract data.
8. The method according to claim 6, wherein the classifying the target market data to obtain the current market data comprises:
and screening legal data in a preset time period from the target market data according to a contract list to obtain the current market data.
9. The method of claim 1, wherein storing the first test data, the current test data, the historical test data, and the second test data in the initial test data file to obtain a target test data file comprises:
storing the first test data, the current test data, the historical test data and the second test data into a data file to be tested through a field storage rule to obtain a target test data file;
and preferably, the method further comprises:
and importing the target test data file into a transaction system through the database import file and the database control file so that the transaction system carries out development test according to the target test data file.
10. A test data generation apparatus, characterized in that the apparatus comprises:
the test information acquisition module is used for acquiring first test data and an initial test data file based on a preset service model; the first test data comprises data unrelated to market conditions and contracts;
the calculation conversion module is used for performing calculation conversion according to the historical transaction information, the current test data and the first test data to obtain historical test data and second test data; the current test data comprises current contract data, current market data and current dependency data, and the current dependency data comprises current market and contract related data; the historical test data comprises historical contract data and historical market data, and the second test data is data irrelevant to market and contracts in a historical time period;
and the test data storage module is used for storing the first test data, the current test data, the historical test data and the second test data into the initial test data file to obtain a target test data file.
CN202111519955.4A 2021-12-13 2021-12-13 Test data generation method and device Pending CN114297052A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111519955.4A CN114297052A (en) 2021-12-13 2021-12-13 Test data generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111519955.4A CN114297052A (en) 2021-12-13 2021-12-13 Test data generation method and device

Publications (1)

Publication Number Publication Date
CN114297052A true CN114297052A (en) 2022-04-08

Family

ID=80966831

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111519955.4A Pending CN114297052A (en) 2021-12-13 2021-12-13 Test data generation method and device

Country Status (1)

Country Link
CN (1) CN114297052A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114595159A (en) * 2022-05-10 2022-06-07 太平金融科技服务(上海)有限公司 Test data generation method, device, equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114595159A (en) * 2022-05-10 2022-06-07 太平金融科技服务(上海)有限公司 Test data generation method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US8112340B2 (en) Collateralized debt obligation evaluation system and method
US8768809B1 (en) Methods and systems for managing financial data
US20030014356A1 (en) Method and system for simulating risk factors in parametric models using risk neutral historical bootstrapping
CN106228399A (en) A kind of stock trader's customer risk preference categories method based on big data
US7698196B1 (en) Method and system for modeling and benchmarking private equity and applications of same
US10394700B1 (en) System and method for identifying a subset of total historical users of a data management system to represent a full set of test scenarios based on prehashing of code coverage information
GB2492208A (en) On-line analysis of financial accounting data
CN112182250A (en) Construction method of checking relation knowledge graph, and financial statement checking method and device
JP4443619B2 (en) Method and apparatus for calculating portfolio credit risk
US20090187496A1 (en) Data workbench for accounting data management
CN114297052A (en) Test data generation method and device
US10497065B1 (en) Automatically correcting records
CN116630051A (en) Real-time calculation system, method and equipment for yield curve and bond estimation
US20230186385A1 (en) Computer-implemented system and method of facilitating artificial intelligence based lending strategies and business revenue management
JPH11175602A (en) Credit risk measuring device
Offutt et al. An industrial study of applying input space partitioning to test financial calculation engines
CN112907141A (en) Pressure testing method, device, equipment and storage medium
García-Céspedes et al. Estimating the distribution of total default losses on the Spanish financial system
Waryanto et al. Application Of The Client Server Based Fifo Method In Raw Material Information Systems
Barkhagen et al. Modeling and evaluation of the option book hedging problem using stochastic programming
KR102334923B1 (en) Loan expansion hypothesis testing system using artificial intelligence and method using the same
CN109657897A (en) Mobility notch method of adjustment, device, equipment and storage medium
CN114416805B (en) Data checking method and device, computer equipment and storage medium
CN110413967B (en) Account checking chart generation method, device, computer equipment and storage medium
US20170091793A1 (en) Social media driven evaluation of a product idea

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