It is a kind of to generate the method and device of test data, electronic equipment
Technical field
The present invention relates to software testing technology field, in particular to a kind of method and device for generating test data, electronics
Equipment.
Background technique
Software product publication before, need to construct a large amount of test data, for test environment to software product into
Row test, only by test, software product could be issued online.Currently, the process of construction test data is directed not only to inside
The interaction of multiple systems, it is also necessary to be interacted with multiple external affiliated parties, could construct a complete data makes for test
With process is extremely complex.
A associated built-in system of software product has complementary relationship in operation flow, and process is in downstream
System is frequently necessary to the system that process is in upstream and provides test data, and to support the test of down-stream system, up-stream system is also needed
Tester is specially arranged to support construction data.Meanwhile the up-stream system of business datum is generated, testing certain particular demands
When, it is also desirable to prepare more qualified data and is tested accordingly to some service node.With the industry of software product
Business constantly extension, the quantity of affiliated party is also continuing growing, while there are the process of customization in some affiliated parties, further improve
Construct the complexity of test data.Therefore, the complexity for software product construction test data is higher.
Summary of the invention
In order to solve the problems, such as that the complexity for constructing test data present in the relevant technologies is higher, the present invention provides one
Kind generates the method and device of test data, electronic equipment.
First aspect of the embodiment of the present invention discloses a kind of method for generating test data, which comprises
Obtain the first test environment parameter;First test environment parameter includes the first testing requirement parameter and the first industry
Business flow nodes;
First test environment parameter is input to initial script template;
The initial script template is adjusted to first object script according to first test environment parameter;
The first object script the first test database corresponding with first test environment parameter is connected;Its
In, first test database includes the subdata base of each first operation flow node;
The first object script is run, and first test database is called to generate first object test data.
As an alternative embodiment, in first aspect of the embodiment of the present invention, in operation first mesh
Script is marked, and after calling first test database to generate first object test data, the method also includes:
Detection test environment, judges whether the test environment changes;
If so, obtaining the second test environment parameter;Second test environment parameter includes the second testing requirement parameter
With the second operation flow node;
The first object script is adjusted to the second target script according to second test environment parameter;
The second target script the second test database corresponding with second test environment parameter is connected;Its
In, second test database includes the subdata base of each second operation flow node;
The second target script is run, and second test database is called to generate the second target detection data.
As an alternative embodiment, in first aspect of the embodiment of the present invention, it is described according to second test
The first object script is adjusted to the second target script by environmental parameter, comprising:
The first testing requirement parameter and the second testing requirement parameter are compared, identified in operation flow
Key variables;
Determine that egress changes information according to the first operation flow node and the second operation flow node;
The first object script is adjusted to second mesh according to the key variables and node change information
Mark script.
As an alternative embodiment, in first aspect of the embodiment of the present invention, it is described by the second target foot
This second test database corresponding with second test environment parameter is connected, comprising:
Obtain the switching instruction for the connection of switch data library;
The database connection pair of the subdata base of each second operation flow node is created according to the switching instruction
As;
Connection request is sent to the subdata base of each second operation flow node, and passes through each second industry
The database connection object of the subdata base for flow nodes of being engaged in accesses corresponding subdata base, with establish the second target script with
The connection of corresponding second test database of second test environment parameter.
As an alternative embodiment, in first aspect of the embodiment of the present invention, described by the first object
After script the first test database corresponding with first test environment parameter is connected and it is described operation described first
Target script, and before calling first test database to generate first object test data, the method also includes:
Monitoring point is set in each first operation flow node, monitors the son of each first operation flow node
Database;
Data, which are obtained, by the corresponding monitoring point of each first operation flow node generates information;The data
Generating information includes the operation flow node that data generation time point and data generate place.
As an alternative embodiment, in first aspect of the embodiment of the present invention, the operation first object
Script, and first test database is called to generate first object test data, comprising:
Detect user whether input test data;
If so, receiving the test data of user's input;
Determine that the first operation starts in the first operation flow node according to the test data that the user inputs
Node, and determine the end node of the first operation flow node, and by the end section of the first operation flow node
Point is used as the first end of run node;
Based on the first operation start node and the first end of run node, the first object script is run,
And first test database is called to generate the first object test data.
As an alternative embodiment, in first aspect of the embodiment of the present invention, the method also includes:
When detecting the non-input test data of user, the start node of the first operation flow node is navigated to, it will
The start node of the first operation flow node runs the first object script and calls institute as the second operation start node
The corresponding subdata base of the second operation start node is stated to start to generate sub-goal test data;
The instruction that runs abort is detected, where the instruction carrying control first object script termination that runs abort is run
The second end of run node;
When the node of monitoring point feedback instructs the corresponding second end of run node phase with described run abort
When matching, controls the first object script and terminate operation, and the second operation start node and second operation are tied
All sub-goal test datas integration generated between Shu Jiedian obtains the first object test data.
Second aspect of the embodiment of the present invention discloses a kind of device for generating test data, and described device includes:
First acquisition unit, for obtaining the first test environment parameter;First test environment parameter includes the first survey
Try demand parameter and the first operation flow node;
Input unit, for first test environment parameter to be input to initial script template;
The first adjustment unit, for the initial script template to be adjusted to first according to first test environment parameter
Target script;
First connection unit, for surveying the first object script corresponding with first test environment parameter first
Examination database is connected;Wherein, first test database includes the subdata base of each first operation flow node;
First generation unit for running the first object script, and calls first test database to generate the
One target detection data.
The third aspect of the embodiment of the present invention discloses a kind of electronic equipment, and the electronic equipment includes:
Processor;
Memory is stored with computer-readable instruction on the memory, and the computer-readable instruction is by the processing
When device executes, a kind of method for generating test data disclosed in first aspect of the embodiment of the present invention is realized.
Fourth aspect of the embodiment of the present invention discloses a kind of computer readable storage medium, stores computer program, institute
Stating computer program makes computer execute a kind of method for generating test data disclosed in first aspect of the embodiment of the present invention.
The technical solution that the embodiment of the present invention provides can include the following benefits:
A kind of method generating test data provided by the present invention includes the following steps: to obtain the first test environment ginseng
Number, the first test environment parameter include the first testing requirement parameter and the first operation flow node;By the first test environment parameter
It is input to initial script template;Initial script template is adjusted to first object script according to the first test environment parameter;By
One target script the first test database corresponding with the first test environment parameter is connected;Wherein, the first test database packet
Include the subdata base of each first operation flow node;First object script is run, and the first test database is called to generate the
One target detection data.
Under the method, initial script template is adjusted to by target script by the test environment parameter got, by mesh
After marking script test database connection corresponding with test environment parameter, surveyed by being called during target script is run
It tries database and generates target detection data, may be implemented largely to generate test data, no longer need to test by multi-party interactive configurations
Data can reduce the complexity of construction test data.In addition, generating test data by script, time and people can be reduced
Power cost.
It should be understood that the above general description and the following detailed description are merely exemplary, this can not be limited
Invention.
Detailed description of the invention
The drawings herein are incorporated into the specification and forms part of this specification, and shows and meets implementation of the invention
Example, and in specification together principle for explaining the present invention.
Fig. 1 is a kind of structural schematic diagram of device disclosed by the embodiments of the present invention;
Fig. 2 is a kind of flow chart of method for generating test data disclosed by the embodiments of the present invention;
Fig. 3 is the flow chart of another method for generating test data disclosed by the embodiments of the present invention;
Fig. 4 is the flow chart of the method for another generation test data disclosed by the embodiments of the present invention;
Fig. 5 is a kind of structural schematic diagram of device for generating test data disclosed by the embodiments of the present invention;
Fig. 6 is the structural schematic diagram of another device for generating test data disclosed by the embodiments of the present invention;
Fig. 7 is the structural schematic diagram of the device of another generation test data disclosed by the embodiments of the present invention.
Specific embodiment
Here will the description is performed on the exemplary embodiment in detail, the example is illustrated in the accompanying drawings.Following description is related to
When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment
Described in embodiment do not represent all embodiments consistented with the present invention.On the contrary, they be only with it is such as appended
The example of device and method being described in detail in claims, some aspects of the invention are consistent.
Embodiment one
Implementation environment of the invention can be electronic equipment, such as smart phone, tablet computer, desktop computer.
Fig. 1 is a kind of structural schematic diagram of device disclosed by the embodiments of the present invention.Device 100 can be above-mentioned electronics and set
It is standby.As shown in Figure 1, device 100 may include following one or more components: processing component 102, memory 104, power supply module
106, multimedia component 108, audio component 110, sensor module 114 and communication component 116.
The integrated operation of the usual control device 100 of processing component 102, such as with display, telephone call, data communication, phase
Machine operation and the associated operation of record operation etc..Processing component 102 may include one or more processors 118 to execute
Instruction, to complete all or part of the steps of following methods.In addition, processing component 102 may include one or more modules,
For convenient for the interaction between processing component 102 and other assemblies.For example, processing component 102 may include multi-media module, use
In to facilitate the interaction between multimedia component 108 and processing component 102.
Memory 104 is configured as storing various types of data to support the operation in device 100.These data are shown
Example includes the instruction of any application or method for operating on the device 100.Memory 104 can be by any kind of
Volatibility or non-volatile memory device or their combination are realized, such as static random access memory (Static Random
Access Memory, abbreviation SRAM), electrically erasable programmable read-only memory (Electrically Erasable
Programmable Read-Only Memory, abbreviation EEPROM), Erasable Programmable Read Only Memory EPROM (Erasable
Programmable Read Only Memory, abbreviation EPROM), programmable read only memory (Programmable Red-
Only Memory, abbreviation PROM), read-only memory (Read-Only Memory, abbreviation ROM), magnetic memory, flash
Device, disk or CD.It is also stored with one or more modules in memory 104, is configured to for the one or more module
It is executed by the one or more processors 118, to complete all or part of step in method as follows.
Power supply module 106 provides electric power for the various assemblies of device 100.Power supply module 106 may include power management system
System, one or more power supplys and other with for device 100 generate, manage, and distribute the associated component of electric power.
Multimedia component 108 includes the screen of one output interface of offer between device 100 and user.In some realities
It applies in example, screen may include liquid crystal display (Liquid Crystal Display, abbreviation LCD) and touch panel.If
Screen includes touch panel, and screen may be implemented as touch screen, to receive input signal from the user.Touch panel includes
One or more touch sensors are to sense the gesture on touch, slide, and touch panel.Touch sensor can be sensed not only
The boundary of a touch or slide action, but also detect duration and pressure relevant to touch or slide.Screen may be used also
To include display of organic electroluminescence (Organic Light Emitting Display, abbreviation OLED).
Audio component 110 is configured as output and/or input audio signal.For example, audio component 110 includes a Mike
Wind (Microphone, abbreviation MIC), when device 100 is in operation mode, such as call model, logging mode and speech recognition mould
When formula, microphone is configured as receiving external audio signal.The received audio signal can be further stored in memory
104 or via communication component 116 send.In some embodiments, audio component 110 further includes a loudspeaker, for exporting
Audio signal.
Sensor module 114 includes one or more sensors, and the state for providing various aspects for device 100 is commented
Estimate.For example, sensor module 114 can detecte the state that opens/closes of device 100, the relative positioning of component, sensor group
Part 114 can be with the position change of 100 1 components of detection device 100 or device and the temperature change of device 100.Some
In embodiment, which can also include Magnetic Sensor, pressure sensor or temperature sensor.
Communication component 116 is configured to facilitate the communication of wired or wireless way between device 100 and other equipment.Device
100 can access the wireless network based on communication standard, such as WiFi (Wireless-Fidelity, Wireless Fidelity).In the present invention
In embodiment, communication component 116 receives broadcast singal or broadcast correlation from external broadcasting management system via broadcast channel
Information.In embodiments of the present invention, communication component 116 further includes near-field communication (Near Field Communication, abbreviation
NFC) module, for promote short range communication.For example, radio frequency identification (Radio Frequency can be based in NFC module
Identification, abbreviation RFID) technology, Infrared Data Association (Infrared Data Association, abbreviation IrDA)
Technology, ultra wide band (Ultra Wideband, abbreviation UWB) technology, Bluetooth technology and other technologies are realized.
In the exemplary embodiment, device 100 can be by one or more application specific integrated circuit (Application
Specific Integrated Circuit, abbreviation ASIC), it is digital signal processor, digital signal processing appts, programmable
Logical device, field programmable gate array, controller, microcontroller, microprocessor or other electronic components are realized, for executing
Following methods.
Embodiment two
Referring to Fig. 2, Fig. 2 is a kind of flow diagram of method for generating test data disclosed by the embodiments of the present invention.
The method of the generation test data as shown in Figure 2 may comprise steps of:
201, the first test environment parameter is obtained;First test environment parameter includes the first testing requirement parameter and the first industry
Business flow nodes.
In the embodiment of the present invention, tester obtains the first test environment parameter according to current test environmental information,
In, the first testing requirement parameter reflects the current corresponding test condition of test environmental information, and the first operation flow node indicates
Operation flow node involved in test data is generated, start node and end node are included at least.
In the embodiment of the present invention, block management can be carried out to operation flow node, keep each operation flow node
It is logically independent, so that not interfering with another operation flow node when an operation flow node is operated.
202, the first test environment parameter is input to initial script template.
In the embodiment of the present invention, the structure design of initial script template can be compatible with automation and make several platforms, initial script
Template uploads to after automation makes several platforms, the first test environment parameter can be input to initial script template, not needed
Testing tool is installed, the application method for being familiar with testing tool is not needed yet, so that the operation is more convenient.
203, initial script template is adjusted to by first object script according to the first test environment parameter.
In the embodiment of the present invention, the test variable of initial script template can be changed according to the first test environment parameter, with
And the initial associated operation flow node of script template of change, so as to which initial script template is adjusted to first object foot
This, realizes that automation generates test data.
204, first object script the first test database corresponding with the first test environment parameter is connected;Wherein,
First test database includes the subdata base of each first operation flow node.
In the embodiment of the present invention, each operation flow node has a subdata base, may storage in subdata base
There are user information and operation information, the subdata base of first object script and each first operation flow node is established into connection and is closed
After system, first object script can extract data from the subdata base of each first operation flow node, and then guarantee to mention
The integrality for the data got.
As an alternative embodiment, by all operation flows node present in initial script template and system
Subdata base is attached, and when initial script template is adjusted to first object script, is determined according to the first operation flow node
Operation area of the first object script in all operation flow nodes out, and by first object script and the first operation flow section
The corresponding subdata base of point establishes data communication connection.Implement the embodiment, it can be synchronous when obtaining first object script
Subdata base corresponding with the first operation flow node establishes data connection, improves the reliability that data are extracted.
205, first object script is run, and the first test database is called to generate first object test data.
In the embodiment of the present invention, when first object script is run, the first operation flow node can be navigated to and start to save
Point calls the corresponding subdata base of start node to generate test data since start node, when running to end node always
It is out of service, it can will meet the number of test condition between start node and end node (including start node and end node)
According to all extracting, a large amount of test data is generated, first object test data is formed.As it can be seen that using first object script
Make counting and can simplify operating process, while can automatically generate a large amount of test datas, saves the time for generating data
And manpower.
For example, when testing a loan product, it can first obtain this time and test corresponding testing requirement
Related operation flow node is tested in parameter and this time, then by testing requirement parameter and related operation flow node
It is input to the initial script template corresponding with loan product write using Jmeter testing tool, can be obtained target script,
Further target script is connected with the database of related operation flow node, operational objective script, so that it may from each
The database of a operation flow node extracts the target detection data for meeting test condition, and then can automatically generate large batch of
Test data provides data support for the test of loan product, while simplifying and making several operations, and several time and manpower are made in saving.
It, can be by the test environment parameter that gets by initial script template tune as it can be seen that implement method described in Fig. 2
Whole is target script, after by the test database connection corresponding with test environment parameter of target script, by target foot
It calls test database to generate target detection data during this operation, may be implemented largely to generate test data, no longer need to
By multi-party interactive configurations test data, the complexity of construction test data can reduce.
Embodiment three
Referring to Fig. 3, Fig. 3 is the process signal of another method for generating test data disclosed by the embodiments of the present invention
Figure.As shown in figure 3, the method for the generation test data may comprise steps of:
Step 301~step 305;Wherein, it for the description of step 301~step 305, please refers to and is directed in embodiment two
Step 201~step 205 detailed description, the embodiment of the present invention repeat no more.
306, detection test environment judges to test whether environment changes;If so, executing step 307~step
310;If not, terminating this process.
In the embodiment of the present invention, module locating for product test can be navigated to, and determine to survey according to the type of test
Test ring border provides more effective test data to judge to test whether environment changes for product test.
As an alternative embodiment, target script and product in need of test can be attached, when
When detecting the test operation of user in the product, it can detecte out whether test environment changes, when testing environment
When change, target script is adjusted according to the change of test environment, so as to generate the test data for meeting test environment.
307, the second test environment parameter is obtained;Second test environment parameter includes the second testing requirement parameter and the second industry
Business flow nodes.
308, first object script is adjusted to by the second target script according to the second test environment parameter.
As an alternative embodiment, first testing requirement parameter and the second test are needed when executing step 308
It asks parameter to compare, identifies the key variables in operation flow;
Determine that egress changes information according to the first operation flow node and the second operation flow node;
First object script is adjusted to the second target script according to key variables and node change information.
Implement the above method, target script more accurately can be adjusted according to test environment, and then generate and be largely used to
The data of product test.
309, the second target script the second test database corresponding with the second test environment parameter is connected;Wherein,
Second test database includes the subdata base of each second operation flow node.
As an alternative embodiment, obtaining the switching instruction for the connection of switch data library in step 309;
The database connection object of the subdata base of each second operation flow node is created according to switching instruction;
Connection request is sent to the subdata base of each second operation flow node, and passes through each second operation flow section
The database connection object of the subdata base of point accesses corresponding subdata base, to establish the second target script and the second test environment
The connection of corresponding second test database of parameter.
Implement the above method, target script can be attached with the subdata base of corresponding operation flow node, time
All subdata bases are gone through, avoid omitting any one operation flow node.
310, the second target script is run, and the second test database is called to generate the second target detection data.
In the embodiment of the present invention, when testing environment change, different test environment parameters is obtained, then according to the test
Environmental parameter, adjustment target script deacclimatize test environment, and then operational objective script is opened from the test environment parameter is corresponding
Beginning node, which sets out, generates test data, until end node, target script is out of service, in start node and can terminate section
The data for producing a large amount of test environment met after changing between point (including start node and end node), improve to generate and survey
Try the efficiency of data.
It, can be by the test environment parameter that gets by initial script template tune as it can be seen that method described in implementing Fig. 3
Whole is target script, after by the test database connection corresponding with test environment parameter of target script, by target foot
It calls test database to generate target detection data during this operation, may be implemented largely to generate test data, no longer need to
By multi-party interactive configurations test data, the complexity of construction test data can reduce;Additionally it is possible to change in test environment
When change, target script is adjusted according to the test environment parameter of change and improves life so as to generate new target detection data
At the stability of test data.
Example IV
Referring to Fig. 4, Fig. 4 is that another process for generating the method for test data disclosed by the embodiments of the present invention is illustrated
Figure.The method of the generation test data as shown in Figure 4 may comprise steps of:
Step 401~step 404;Wherein, it for the description of step 401~step 404, please refers to and is directed in embodiment three
Step 301~step 304 detailed description, the embodiment of the present invention repeat no more.
405, monitoring point is set in each first operation flow node, monitors the subdata of each first operation flow node
Library.
406, data are obtained by the corresponding monitoring point of each first operation flow node and generates information;Data generate information
Operation flow node where being generated including data generation time point and data.
In the embodiment of the present invention, by can be with real-time tracing data in the monitoring point that each first operation flow node is arranged
The track of generation obtains the operation flow node where the time point and data generation that data generate, being capable of real-time monitoring data
Generation.
407, detection user whether input test data;If so, executing step 408~step 410;If not, executing
Step 411~step 413.
408, the test data of user's input is received.
409, the first operation start node is determined in the first operation flow node according to the test data that user inputs,
And determine the end node of the first operation flow node, and using the end node of the first operation flow node as the first operation
End node.
410, based on the first operation start node and the first end of run node, first object script is run, and calls the
One test database generates first object test data.
In the embodiment of the present invention, start to save by the operation that the test data that user inputs redefines out target script
Point generates data since the operation start node, out of service when running to end of run node, i.e., producible one complete
The data of whole satisfaction test environment.
411, the start node for navigating to the first operation flow node, using the start node of the first operation flow node as
Second operation start node, operation first object script call the corresponding subdata base of the second operation start node to start to generate son
Target detection data.
412, detection runs abort instruction, and the instruction that runs abort carries that control first object script terminates operation place
Two end of run nodes.
413, when monitoring point feedback node with run abort instruct corresponding second end of run node to match when, control
First object script processed terminates operation, and all sons that will be generated between the second operation start node and the second end of run node
Target detection Data Integration obtains first object test data.
In the embodiment of the present invention, after since target script generate data running start node, operator is detected
The instruction that runs abort of member's input, so that it is determined that the end of run node of target script operation out, and detected by monitoring point
The running track of target script terminates to generate data when monitoring point monitors that target script runs to end of run node
Operation can improve the efficiency for generating test data according to the operation of testing requirement real-time control target script.
As an alternative embodiment, after executing step 413, can with the following steps are included:
Whether detection first object test data meets product test demand, if conditions are not met, being to change in test environment
When, first object test data is inputted, the corresponding start node of first object test data is may thereby determine that out and terminates section
Point, operation first object script generate the partial data for meeting product test demand.Implement the embodiment, it can be ensured that generate
Data meet product test demand.
It, can be by the test environment parameter that gets by initial script template tune as it can be seen that implement method described in Fig. 4
Whole is target script, after by the test database connection corresponding with test environment parameter of target script, by target foot
It calls test database to generate target detection data during this operation, may be implemented largely to generate test data, no longer need to
By multi-party interactive configurations test data, the complexity of construction test data can reduce;Additionally it is possible in operation flow section
Point setting test point, obtains the generation information of test data, improves the reliability of Test data generation.
Embodiment five
Referring to Fig. 5, Fig. 5 is a kind of structural schematic diagram of device for generating test data disclosed by the embodiments of the present invention.
As shown in figure 5, the device of the generation test data may include: first acquisition unit 501, input unit 502, the first adjustment list
First 503, first connection unit 504 and the first generation unit 505, wherein
First acquisition unit 501, for obtaining the first test environment parameter;First test environment parameter includes the first test
Demand parameter and the first operation flow node.
In the embodiment of the present invention, tester obtains the first test environment parameter according to current test environmental information,
In, the first testing requirement parameter reflects the current corresponding test condition of test environmental information, and the first operation flow node indicates
Operation flow node involved in test data is generated, start node and end node are included at least.
In the embodiment of the present invention, block management can be carried out to operation flow node, keep each operation flow node
It is logically independent, so that not interfering with another operation flow node when an operation flow node is operated.
Input unit 502, for the first test environment parameter to be input to initial script template.
In the embodiment of the present invention, the structure design of initial script template can be compatible with automation and make several platforms, initial script
Template uploads to after automation makes several platforms, the first test environment parameter can be input to initial script template, not needed
Testing tool is installed, the application method for being familiar with testing tool is not needed yet, so that the operation is more convenient.
The first adjustment unit 503, for initial script template to be adjusted to first object according to the first test environment parameter
Script.
In the embodiment of the present invention, the test variable of initial script template can be changed according to the first test environment parameter, with
And the initial associated operation flow node of script template of change, so as to which initial script template is adjusted to first object foot
This, realizes that automation generates test data.
First connection unit 504, for first object script corresponding with the first test environment parameter first to be tested number
It is connected according to library;Wherein, the first test database includes the subdata base of each first operation flow node.
In the embodiment of the present invention, each operation flow node has a subdata base, may storage in subdata base
There are user information and operation information, the subdata base of first object script and each first operation flow node is established into connection and is closed
After system, first object script can extract data from the subdata base of each first operation flow node, and then guarantee to mention
The integrality for the data got.
As an alternative embodiment, the first connection unit 504, for will exist in initial script template and system
The subdata bases of all operation flow nodes be attached, when initial script template is adjusted to first object script, according to
First operation flow node determines operation area of the first object script in all operation flow nodes, and by first object
Script subdata base corresponding with the first operation flow node establishes data communication connection.Implement the embodiment, can obtain
When obtaining first object script, synchronous subdata base corresponding with the first operation flow node establishes data connection, improves data and mentions
The reliability taken.
First generation unit 505 for running first object script, and calls the first test database to generate first object
Test data.
In the embodiment of the present invention, when first object script is run, the first operation flow node can be navigated to and start to save
Point calls the corresponding subdata base of start node to generate test data since start node, when running to end node always
It is out of service, it can will meet the number of test condition between start node and end node (including start node and end node)
According to all extracting, a large amount of test data is generated, first object test data is formed.As it can be seen that using first object script
Make counting and can simplify operating process, while can automatically generate a large amount of test datas, saves the time for generating data
And manpower.
For example, when testing a loan product, it can first obtain this time and test corresponding testing requirement
Related operation flow node is tested in parameter and this time, then by testing requirement parameter and related operation flow node
It is input to the initial script template corresponding with loan product write using Jmeter testing tool, can be obtained target script,
Further target script is connected with the database of related operation flow node, operational objective script, so that it may from each
The database of a operation flow node extracts the target detection data for meeting test condition, and then can automatically generate large batch of
Test data provides data support for the test of loan product, while simplifying and making several operations, and several time and manpower are made in saving.
As it can be seen that implementing the described device for generating test data of Fig. 5, can be incited somebody to action by the test environment parameter got
Initial script template is adjusted to target script, and target script test database corresponding with test environment parameter is being connected it
Afterwards, it by calling test database to generate target detection data during target script is run, may be implemented largely to generate
Test data no longer needs to the complexity that can reduce construction test data by multi-party interactive configurations test data.
Embodiment six
Referring to Fig. 6, Fig. 6 is the structural representation of another device for generating test data disclosed by the embodiments of the present invention
Figure.The device shown in fig. 6 for generating test data is that the device of generation test data as shown in Figure 5 optimizes.
Compared with the device shown in fig. 5 for generating test data, device shown in fig. 6 can also include: detection unit 506, second
Acquiring unit 507, second adjustment unit 508, the second connection unit 509 and the second generation unit 510, wherein
Detection unit 506 judges to test whether environment changes for detecting test environment.
In the embodiment of the present invention, module locating for product test can be navigated to, and determine to survey according to the type of test
Test ring border provides more effective test data to judge to test whether environment changes for product test.
As an alternative embodiment, detection unit 506, is used for target script and product in need of test
It is attached, when detecting the test operation of user in the product, can detecte out whether test environment changes, work as survey
When test ring border changes, target script is adjusted according to the change of test environment, meets test environment so as to generate
Test data.
Second acquisition unit 507 when changing for testing environment, obtains the second test environment parameter;Second test
Environmental parameter includes the second testing requirement parameter and the second operation flow node;
Second adjustment unit 508, for first object script to be adjusted to the second target according to the second test environment parameter
Script.
As an alternative embodiment, second adjustment unit 508 is used for first according to the second test environment parameter
Target script is adjusted to the mode of the second target script specifically:
Second adjustment unit 508 is identified for comparing the first testing requirement parameter and the second testing requirement parameter
Key variables in operation flow out;Egress change letter is determined according to the first operation flow node and the second operation flow node
Breath;First object script is adjusted to the second target script according to key variables and node change information;It can be more accurately
Target script is adjusted according to test environment, and then generates the data for being largely used to product test.
Second connection unit 509, for the second target script corresponding with the second test environment parameter second to be tested number
It is connected according to library;Wherein, the second test database includes the subdata base of each second operation flow node.
As an alternative embodiment, the second connection unit 509 is used for the second target script and the second test wrapper
The mode that parameter corresponding second test database in border is connected specifically:
Second connection unit 509, for obtaining the switching instruction for being used for the connection of switch data library;According to switching instruction creation
The database connection object of the subdata base of each second operation flow node;To the subdata of each second operation flow node
Library sends connection request, and accesses corresponding son by the database connection object of the subdata base of each second operation flow node
Database, to establish the connection of the second target script the second test database corresponding with the second test environment parameter;It can incite somebody to action
Target script is attached with the subdata base of corresponding operation flow node, traverses all subdata bases, avoids omitting any
One operation flow node.
Second generation unit 510 for running the second target script, and calls the second test database to generate the second target
Test data.
In the embodiment of the present invention, when testing environment change, different test environment parameters is obtained, then according to the test
Environmental parameter, adjustment target script deacclimatize test environment, and then operational objective script is opened from the test environment parameter is corresponding
Beginning node, which sets out, generates test data, until end node, target script is out of service, in start node and can terminate section
The data for producing a large amount of test environment met after changing between point (including start node and end node), improve to generate and survey
Try the efficiency of data.
As it can be seen that implementing the described device for generating test data of Fig. 6, can be incited somebody to action by the test environment parameter got
Initial script template is adjusted to target script, and target script test database corresponding with test environment parameter is being connected it
Afterwards, it by calling test database to generate target detection data during target script is run, may be implemented largely to generate
Test data no longer needs to the complexity that can reduce construction test data by multi-party interactive configurations test data;In addition, also
Target script can be adjusted according to the test environment parameter of change, so as to generate new target when testing environment change
Test data improves the stability for generating test data.
Embodiment seven
Referring to Fig. 7, Fig. 7 is the structural representation of the device of another generation test data disclosed by the embodiments of the present invention
Figure.The device shown in Fig. 7 for generating test data is that the device of generation test data as shown in Figure 6 optimizes.
Compared with the device shown in fig. 6 for generating test data, device shown in Fig. 7 can also include: monitoring unit 511 and the
Three acquiring units 512, wherein
Monitoring unit 511 monitors each first operation flow for monitoring point to be arranged in each first operation flow node
The subdata base of node;
Third acquiring unit 512 is generated for obtaining data by the corresponding monitoring point of each first operation flow node
Information;It includes the operation flow node that data generation time point and data generate place that data, which generate information,.
In the embodiment of the present invention, by can be with real-time tracing data in the monitoring point that each first operation flow node is arranged
The track of generation obtains the operation flow node where the time point and data generation that data generate, being capable of real-time monitoring data
Generation.
As an alternative embodiment, the first generation unit 505 is for running first object script, and calling first
The mode of test database generation first object test data specifically:
First generation unit 505, for detect user whether input test data;If so, receiving the survey of user's input
Try data;The first operation start node is determined in the first operation flow node according to the test data that user inputs, and really
The end node of the first operation flow node is made, and using the end node of the first operation flow node as the first end of run
Node;Based on the first operation start node and the first end of run node, first object script is run, and calls the first test number
First object test data is generated according to library.
In the embodiment of the present invention, start to save by the operation that the test data that user inputs redefines out target script
Point generates data since the operation start node, out of service when running to end of run node, i.e., producible one complete
The data of whole satisfaction test environment.
As another optional embodiment, the first generation unit 505 is for running first object script, and calls the
The mode of one test database generation first object test data specifically:
First generation unit 505, for navigating to the first operation flow section when detecting the non-input test data of user
The start node of point runs first object foot using the start node of the first operation flow node as the second operation start node
This calling second runs the corresponding subdata base of start node and starts to generate sub-goal test data;The instruction that runs abort is detected,
The instruction that runs abort carries the second end of run node where control first object script termination operation;When monitoring point feedback
Node with run abort instruct corresponding second end of run node to match when, control first object script terminate operation, and
All sub-goal test datas integration generated between second operation start node and the second end of run node is obtained first
Target detection data.
In the embodiment of the present invention, after since target script generate data running start node, operator is detected
The instruction that runs abort of member's input, so that it is determined that the end of run node of target script operation out, and detected by monitoring point
The running track of target script terminates to generate data when monitoring point monitors that target script runs to end of run node
Operation can improve the efficiency for generating test data according to the operation of testing requirement real-time control target script.
As an alternative embodiment, whether the first generation unit 505, full for detecting first object test data
Sufficient product test demand, if conditions are not met, first object test data is inputted, so as to true when testing environment is to change
The corresponding start node of first object test data and end node are made, operation first object script generation meets product test
The partial data of demand.Implement the embodiment, it can be ensured that the data of generation meet product test demand.
As it can be seen that implementing the described device for generating test data of Fig. 7, can be incited somebody to action by the test environment parameter got
Initial script template is adjusted to target script, and target script test database corresponding with test environment parameter is being connected it
Afterwards, it by calling test database to generate target detection data during target script is run, may be implemented largely to generate
Test data no longer needs to the complexity that can reduce construction test data by multi-party interactive configurations test data;In addition, also
Test point can be set in operation flow node, obtain the generation information of test data, improve the reliable of Test data generation
Property.
The present invention also provides a kind of electronic equipment, which includes:
Processor;
Memory is stored with computer-readable instruction on the memory, when which is executed by processor,
The method for realizing a kind of generation test data as previously shown.
The electronic equipment can be Fig. 1 shown device 100.
In one exemplary embodiment, the present invention also provides a kind of computer readable storage mediums, are stored thereon with calculating
Machine program, when which is executed by processor, the method for realizing a kind of generation test data as previously shown.
It should be understood that the present invention is not limited to the precise structure already described above and shown in the accompanying drawings, and
And various modifications and change can executed without departing from the scope.The scope of the present invention is limited only by the attached claims.