CN110334006A - Test method, device, computer installation and storage medium - Google Patents
Test method, device, computer installation and storage medium Download PDFInfo
- Publication number
- CN110334006A CN110334006A CN201910442269.8A CN201910442269A CN110334006A CN 110334006 A CN110334006 A CN 110334006A CN 201910442269 A CN201910442269 A CN 201910442269A CN 110334006 A CN110334006 A CN 110334006A
- Authority
- CN
- China
- Prior art keywords
- credit card
- card information
- batch
- test
- program
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3692—Test management for test results analysis
Abstract
The present invention provides a kind of test method, comprising: receives test instruction, obtains batch credit card information;The batch credit card information is sent to program to be tested in the form of message queue, the program to be tested is quantified based on behaviour in service of the batch credit card information to the credit card that the batch credit card information includes;Obtain the outcome variable that the program to be tested is returned based on batch credit card information operation;Acquisition handles the default of batch credit card information by the program to be tested and asserts;By the outcome variable be input to it is described it is default assert, by the outcome variable with it is described it is default assert in expected results matched, obtain the result preset and asserted.The invention also discloses a kind of test device, computer installation and computer readable storage mediums.The present invention can rapidly test the program for handling credit card information.
Description
Technical field
The present invention relates to the field of test technology more particularly to a kind of test method, device, computer installation and storage to be situated between
Matter.
Background technique
In the use process of credit card, credit card information can be generated, these credit card informations can react credit card
Behaviour in service is usually handled credit card information by the program (such as credit card air control system) write in advance, to obtain
The behaviour in service of credit card, if the program run-time error will obtain the behaviour in service of credit card mistake, therefore, it is necessary to such
The program of processing credit card information is tested.
It needs to test credit card information in this test process and is sent to the program, however existing independent interface
Testing tool (such as Jmeter, Fiddle, SoapUI, robotframework, SocketTool) is embedded in browser
In with testing tool existing for card format (such as HttpRequester, httptool, poster, RESTClient,
Postman, HHTP Analyzer) can not all batch data transmission be carried out to this kind of credit card information, needless to say rapidly lead to
Test credit card information is crossed to verify the class method.
Summary of the invention
In view of the foregoing, it is necessary to a kind of test method, device, computer installation and storage medium are provided, it can be fast
Fastly the program of processing credit card information is tested.
The present invention provides a kind of test method, which comprises
Test instruction is received, batch credit card information is obtained;
The batch credit card information is sent to program to be tested, the program base to be tested in the form of message queue
Quantify in behaviour in service of the batch credit card information to the credit card that the batch credit card information includes;
Obtain the outcome variable that the program to be tested is returned based on batch credit card information operation;
Acquisition handles the default of batch credit card information by the program to be tested and asserts;
By the outcome variable be input to it is described it is default assert, by the outcome variable and it is described preset assert in it is pre-
Phase result is matched, and the default result asserted is obtained.
In the optional implementation of the present invention, the acquisition batch credit card information includes:
Show that default credit card data, the default credit card data include the number of multiple credit card fields in user interface
According to;
Obtain the credit card field to be modified in the multiple credit card field;
Receive the modification instruction that user carries out operation triggering in the user interface, modification instruction include to it is described to
Modify the modification mode of the corresponding data of credit card field;
The corresponding data of credit card field to be modified described in default credit card data are carried out according to modification instruction
Modification determines that the modified default credit card data are the batch credit card information.
In the optional implementation of the present invention, the method also includes:
Obtain preset test precondition and/or test postcondition;
It is preposition according to the test before receiving the test instruction or before obtaining the batch credit card information
Condition executes test pre action, and the test pre action includes clearing up invalid test data;
After obtaining the default result asserted, test post action, institute are executed according to the test postcondition
Stating test post action includes being removed from the cache the batch credit card information.
In the optional implementation of the present invention, it is described the batch credit card information is sent in the form of message queue it is to be measured
Trying program includes:
Obtain the transmission condition for sending the credit card information;
The batch credit card information is sent in the form of message queue according to the transmission condition described to be tested
Program.
In alternative embodiment of the present invention, the transmission condition includes quantity forwarded and/or transmission times, described according to institute
It states transmission condition the batch credit card information is sent to the program to be tested in the form of message queue and include:
Judge whether the transmission times is greater than twice;
If the transmission times is greater than twice, the time interval sent every time is obtained;
The batch credit card information is sent in the form of message queue according to the time interval described to be tested
Program.
In alternative embodiment of the present invention, it is described by the batch credit card information be sent in the form of message queue to
Test program includes:
The batch credit card information is sent to data system, so that the test program is obtained from the data system
The batch credit card information.
In alternative embodiment of the present invention, the method also includes:
By the batch credit card information persistence into presetting database.
The present invention also provides a kind of test device, described device includes:
First obtains module, for receiving test instruction, obtains batch credit card information;
Sending module, for the batch credit card information to be sent to program to be tested, institute in the form of message queue
State the behaviour in service for the credit card that program to be tested includes to the batch credit card information based on the batch credit card information
Quantified;
Second obtains module, the knot returned for obtaining the program to be tested based on batch credit card information operation
Fruit variable;
Third obtains module, handles the default disconnected of the batch credit card information by the program to be tested for obtaining
Speech;
Matching module, for by the outcome variable be input to it is described it is default assert, by the outcome variable with it is described
The expected results preset in asserting are matched, and the default result asserted is obtained.
In alternative embodiment of the present invention, the first acquisition module obtains batch credit card information and includes:
Show that default credit card data, the default credit card data include the number of multiple credit card fields in user interface
According to;
Obtain the credit card field to be modified in the multiple credit card field;
Receive the modification instruction that user carries out operation triggering in the user interface, modification instruction include to it is described to
Modify the modification mode of the corresponding data of credit card field;
The corresponding data of credit card field to be modified described in default credit card data are carried out according to modification instruction
Modification determines that the modified default credit card data are the batch credit card information.
In alternative embodiment of the present invention, described device further includes operation module, is used for:
Obtain preset test precondition and/or test postcondition;
It is preposition according to the test before receiving the test instruction or before obtaining the batch credit card information
Condition executes test pre action, and the test pre action includes clearing up invalid test data;
After obtaining the default result asserted, test post action, institute are executed according to the test postcondition
Stating test post action includes being removed from the cache the batch credit card information.
In alternative embodiment of the present invention, the sending module is specifically used for:
Obtain the transmission condition for sending the credit card information;
The batch credit card information is sent in the form of message queue according to the transmission condition described to be tested
Program.
In alternative embodiment of the present invention, the transmission condition includes quantity forwarded and/or transmission times, described according to institute
It states transmission condition the batch credit card information is sent to the program to be tested in the form of message queue and include:
Judge whether the transmission times is greater than twice;
If the transmission times is greater than twice, the time interval sent every time is obtained;
The batch credit card information is sent in the form of message queue according to the time interval described to be tested
Program.
In alternative embodiment of the present invention, the sending module is specifically used for:
The batch credit card information is sent to data system, so that the test program is obtained from the data system
The batch credit card information.
In alternative embodiment of the present invention, described device further include:
Persistence module is used for the batch credit card information persistence into presetting database.
The present invention also provides a kind of computer installation, the computer installation includes memory and processor, the storage
Device is for storing at least one instruction, and the processor is for executing at least one described instruction to realize institute in any embodiment
The test method stated.
The present invention also provides a kind of computer readable storage medium, the computer-readable recording medium storage has at least one
A instruction, at least one described instruction realize test method described in any embodiment when being executed by processor.
Found out by above technical scheme, the present invention receives test instruction, obtains batch credit card information;The batch is believed
Program to be tested is sent in the form of message queue with card data, the program to be tested is based on the batch credit card information
The behaviour in service for the credit card that the batch credit card information includes is quantified;The program to be tested is obtained based on described
The outcome variable that the operation of batch credit card information returns;It obtains and the batch credit card information is handled by the program to be tested
Default assert;By the outcome variable be input to it is described it is default assert, by the outcome variable and described default assert
Expected results matched, obtain the default result asserted.So as to Batch sending credit card information, and it is based on criticizing
Whether the operation that the credit card information of amount verifies program to be tested is correct, realizes rapidly to the program of processing credit card information
The purpose tested.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis
The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of flow chart of test method provided in an embodiment of the present invention;
Fig. 2 is a kind of functional block diagram of test device provided in an embodiment of the present invention;
Fig. 3 is the structural schematic diagram of the computer installation for the preferred embodiment that the present invention realizes test method.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, with reference to the accompanying drawing and specific real
Applying mode, the present invention is described in further detail.
As shown in FIG. 1, FIG. 1 is a kind of flow charts of test method provided in an embodiment of the present invention.According to different requirements,
The sequence of step can change in the flow chart, and certain steps can be omitted.
S11 receives test instruction, obtains batch credit card information.
In the present embodiment, the test instruction is the instruction tested the program of processing credit card information.
The batch credit card information is a plurality of credit card information, wherein every credit card information may include credit card
Number, cardholder information, customer ID, client's mailbox, exchange hour, one or more credit card fields such as transaction amount (i.e. with letter
With the related field of card) data.
In the present embodiment, a certain credit card information can for a certain credit card transaction data or nontransaction data.Specifically
, transaction data is generated data in the case where being traded by credit card and (such as consuming, refund);Nontransaction data
It is generated data in the case where not traded by credit card.
For example, the data for generation of being consumed or refunded by credit card are transaction data, the information of credit card (is such as gone back
Money day, gone out bill, do not go out bill) inquired, be arranged caused by data be nontransaction data.
The batch credit card information is that test data is used to test the program of processing credit card information.One kind can
It selects in embodiment, the batch credit card information is pre-set default credit card data.
Optionally, in an alternative embodiment of the invention, the acquisition batch credit card information includes:
Show that default credit card data, the default credit card data include the number of multiple credit card fields in user interface
According to;
Obtain the credit card field to be modified in the multiple credit card field;
Receive the modification instruction that user carries out operation triggering in the user interface, modification instruction include to it is described to
Modify the modification mode of the corresponding data of credit card field;
The corresponding data of credit card field to be modified described in default credit card data are carried out according to modification instruction
Modification determines that the modified default credit card data are the batch credit card information.
In the present embodiment, the user interface is the display screen of electronic equipment, for example, in the web page in display screen
Show default credit card data, which is at least two credit card informations.
The credit card field to be modified can for default credit card field to be modified or user choose it is to be repaired
Change credit card field.
For example, credit card field to be modified is credit card number, customer ID, cardholder information.
In the present embodiment, user can be the data filling side of selection field to be modified in the operation that user interface carries out
Formula (for example, being sequentially by the data filling mode of credit card number).
Through this embodiment, family can be used and be quickly created batch credit card information in the user interface.
The batch credit card information is sent to program to be tested, the journey to be tested by S12 in the form of message queue
Sequence is quantified based on behaviour in service of the batch credit card information to the credit card that the batch credit card information includes.
In the present embodiment, program to be tested is to handle the program of credit card information, specifically, program to be tested is to be based on
Batch credit card information carries out operation and processing, and according to the operation to batch credit card information and handles output operation result
Program.
For example, the program to be tested can be the transaction total amount for calculating same credit card in batch credit card information;
Or the program to be tested can be the transaction total degree for calculating same credit card in batch credit card information;Or it is described to
Test program can be the inquiry times for calculating and carrying out inquiry operation in batch credit card information to certain credit card.
The message queue (message queue, MQ) is a kind of communication mechanism of striding course, by using message team
Column, can be requested with asynchronous process, to alleviate system pressure.
In the present embodiment, batch credit card information is stored in message queue, is carried out not in the form of message queue
Credit card information is carried out bulk transfer to realize by the communication between homologous ray.
Optionally, in an alternative embodiment of the invention, it is described by the batch credit card information in the form of message queue
Being sent to program to be tested includes:
The batch credit card information is sent to data system, so that the test program is obtained from the data system
The batch credit card information.
In the present embodiment, the data system is the system for storing credit card information.
In the present embodiment, after batch credit card information is sent to data system, program (such as credit card wind to be tested
Control system) from data system acquisition batch credit card information, and based on the batch credit card information operation got.
Through this embodiment, credit card information can be all stored in a data center, facilitate preservation and the pipe of data
Reason.
Optionally, in an alternative embodiment of the invention, it is described by the batch credit card information in the form of message queue
Being sent to program to be tested includes:
Obtain the transmission condition for sending the credit card information;
The batch credit card information is sent in the form of message queue according to the transmission condition described to be tested
Program.
In the present embodiment, the transmission condition can be preset.
For example, the condition of transmission is sending time, the condition that sends is sequence etc..
In an alternative embodiment of the invention, the transmission condition can be determined according to the quantity of batch credit card information.
Through this embodiment, it can control the mode of batch credit card information transmission.
Optionally, in an alternative embodiment of the invention, the transmission condition includes quantity forwarded and/or transmission times, institute
It states and the batch credit card information is sent to by the program bag to be tested in the form of message queue according to the transmission condition
It includes:
Judge whether the transmission times is greater than twice;
If the transmission times is greater than twice, the time interval sent every time is obtained;
The batch credit card information is sent in the form of message queue according to the time interval described to be tested
Program.
In the present embodiment, the batch credit card information can be sent in batches, and every batch of sends several credit card informations.
For example, batch credit card information includes 100 credit card informations, transmission times is 5 times, and quantity forwarded is 20,
Then when sending, 5 transmissions of the batch credit card information point send 20 credit card informations every time.
In the present embodiment, the time interval of the data transmission is preset, for example, being set in advance as 5s, then
After getting the time interval sent every time, a plurality of credit card information is sent according to quantity forwarded at interval of 5s.
In the present embodiment, the credit card information for test can be sent in batches, and data is avoided once to be transmitted across make more
At have little time processing and queue blocking, also avoid data from once sending very few limitation system resource, by being sent according to data
Time interval carry out data transmission, improve the fluency of test process controllability and test.
S13 obtains the outcome variable that the program to be tested is returned based on batch credit card information operation.
The outcome variable is the result that the program to be tested is returned based on the operation of batch credit card information.
For example, outcome variable is that the holder of a certain credit number logs in the number for card of making a credit inquiry;Alternatively, outcome variable
For the transaction total amount of a certain credit card within a preset time;Alternatively, outcome variable is that a certain credit card is handed within a preset time
It is easily more than the number of preset cost.
S14, acquisition handle the default of batch credit card information by the program to be tested and assert.
Assert embodied in the form of Boolean expression.In the present embodiment, it is described it is default be asserted as it is pre-set assert,
I.e. pre-set Boolean expression.
Such as: Assert.AreEqual (Program.Add (a, b), 40), expression assert that the value of a and the value of b are transmitted to
Result obtained in method Add (int num1, num2) is 40, i.e., equal with " 40 " that pre-suppose that in expression formula are asserted.?
It is not as a result 40 if the value of a and the value of b are transmitted to after method Add, then the result asserted is false when practical execution;
If the value of a and the value of b are transmitted to after method Add, result 40, then the result asserted is true.
Specifically, in the present embodiment, it is default assert be according to the function of program to be tested and batch credit card information into
Row setting, by asserting whether can verify execution of the program to be tested based on batch credit card information wrong.
For example, default be asserted as assuming that the consumption total amount of a certain credit card in batch credit card information is more than 5000 yuan
Transaction count is 3 times.
S15, by the outcome variable be input to it is described it is default assert, by the outcome variable and described default assert
Expected results matched, obtain the default result asserted.
In the present embodiment, the default result asserted is false either true, if the default result asserted is true, table
The logic of bright program to be tested does not have mistake;If the default result asserted is false, show program to be tested is logically present mistake
Accidentally.
For example, default be asserted as assuming that the consumption total amount of a certain credit card in batch credit card information is more than 5000 yuan
Transaction count is 3 times, wherein 3 be the expected results asserted, then outcome variable is to be tested based on the operation of batch credit card information
It is that program obtains as a result, the result match with the expected results asserted if the result is 3, the result asserted of determination is true, table
Bright program to be tested, which calculates when the amount of money is more than 5000 former transaction count, does not have mistake;If based on batch credit card information operation to
The result that test program obtains is not 3, for example, 2, then the result is mismatched with the expected results asserted, determines the result asserted
For false, show that there are mistakes when the program calculating amount of money to be tested is more than 5000 former transaction count.
Optionally, in an alternative embodiment of the invention, the method also includes:
By the batch credit card information persistence into presetting database.
In a kind of optional embodiment, after getting batch credit card information, and batch credit card information is sent
Before by batch credit card information persistence into presetting database.
In an alternative embodiment, after sending batch credit card information extremely by batch credit card information persistence
In presetting database.
It include saving batch credit card information by batch credit card information persistence to presetting database in the present embodiment
To presetting database.Meanwhile persistence further includes other operations relevant with database, can be visited by persistence with encapsulation of data
It asks details, provides the api function of object-oriented for major part service logic, and batch credit card information is multiplexed,
The batch credit card information being persisted in database can be accessed by accessing the api function of data.
Optionally, in an alternative embodiment of the invention, the method also includes:
Obtain preset test precondition and/or test postcondition;
It is preposition according to the test before receiving the test instruction or before obtaining the batch credit card information
Condition executes test pre action, and the test pre action includes clearing up invalid test data;
After obtaining the default result asserted, test post action, institute are executed according to the test postcondition
Stating test post action includes being removed from the cache the batch credit card information.
In an alternative embodiment, it obtains preset test precondition and/or test postcondition includes: to obtain to use
The test precondition and/or test postcondition that family is arranged on webpage.In this embodiment, the test precondition can
To be that user is arranged on web page.
In the present embodiment, will clear up invalid test data before test can make not will receive invalid data when test
Interference, spatial cache can be cleared up by being removed from the cache batch credit card information after a test, when so that testing next time
The influence of previous secondary test data is not will receive.
Through this embodiment, quickly the relevant item of test can be configured before test and after test
With automatically process, improve testing efficiency.
A kind of test method provided by the invention receives test instruction, obtains batch credit card information;The batch is believed
Program to be tested is sent in the form of message queue with card data, the program to be tested is based on the batch credit card information
The behaviour in service for the credit card that the batch credit card information includes is quantified;The program to be tested is obtained based on described
The outcome variable that the operation of batch credit card information returns;It obtains and the batch credit card information is handled by the program to be tested
Default assert;By the outcome variable be input to it is described it is default assert, by the outcome variable and described default assert
Expected results matched, obtain the default result asserted.So as to Batch sending credit card information, and it is based on criticizing
Whether the operation that the credit card information of amount verifies program to be tested is correct, realizes rapidly to the program of processing credit card information
The purpose tested.
As shown in Fig. 2, Fig. 2 is a kind of functional block diagram of test device provided in an embodiment of the present invention.The test dress
It sets and obtains module 210 including first, sending module 220, second obtains module 230, third obtains module 240 and matching module
250.The so-called module of the present invention, which refers to, a kind of performed by processor and can complete a series of meters of fixed function
Calculation machine program segment, is stored in the memory of computer equipment.It in the present embodiment, will be subsequent about the function of each module
Embodiment in be described in detail.
First obtains module 210, for receiving test instruction, obtains batch credit card information.
In the present embodiment, the test instruction is the instruction tested the program of processing credit card information.
The batch credit card information is a plurality of credit card information, wherein every credit card information may include credit card
Number, cardholder information, customer ID, client's mailbox, exchange hour, one or more credit card fields such as transaction amount (i.e. with letter
With the related field of card) data.
In the present embodiment, a certain credit card information can for a certain credit card transaction data or nontransaction data.Specifically
, transaction data is generated data in the case where being traded by credit card and (such as consuming, refund);Nontransaction data
It is generated data in the case where not traded by credit card.
For example, the data for generation of being consumed or refunded by credit card are transaction data, the information of credit card (is such as gone back
Money day, gone out bill, do not go out bill) inquired, be arranged caused by data be nontransaction data.
The batch credit card information is that test data is used to test the program of processing credit card information.One kind can
It selects in embodiment, the batch credit card information is pre-set default credit card data.
Optionally, in an alternative embodiment of the invention, described first the acquisition batch credit card information packet of module 210 is obtained
It includes:
Show that default credit card data, the default credit card data include the number of multiple credit card fields in user interface
According to;
Obtain the credit card field to be modified in the multiple credit card field;
Receive the modification instruction that user carries out operation triggering in the user interface, modification instruction include to it is described to
Modify the modification mode of the corresponding data of credit card field;
The corresponding data of credit card field to be modified described in default credit card data are carried out according to modification instruction
Modification determines that the modified default credit card data are the batch credit card information.
In the present embodiment, the user interface is the display screen of electronic equipment, for example, in the web page in display screen
Show default credit card data, which is at least two credit card informations.
The credit card field to be modified can for default credit card field to be modified or user choose it is to be repaired
Change credit card field.
For example, credit card field to be modified is credit card number, customer ID, cardholder information.
In the present embodiment, user can be the data filling side of selection field to be modified in the operation that user interface carries out
Formula (for example, being sequentially by the data filling mode of credit card number).
Through this embodiment, family can be used and be quickly created batch credit card information in the user interface.
Sending module 220, for the batch credit card information to be sent to program to be tested in the form of message queue,
The use shape for the credit card that the program to be tested includes to the batch credit card information based on the batch credit card information
Condition is quantified.
In the present embodiment, program to be tested is to handle the program of credit card information, specifically, program to be tested is to be based on
Batch credit card information carries out operation and processing, and according to the operation to batch credit card information and handles output operation result
Program.
For example, the program to be tested can be the transaction total amount for calculating same credit card in batch credit card information;
Or the program to be tested can be the transaction total degree for calculating same credit card in batch credit card information;Or it is described to
Test program can be the inquiry times for calculating and carrying out inquiry operation in batch credit card information to certain credit card.
The message queue (message queue, MQ) is a kind of communication mechanism of striding course, by using message team
Column, can be requested with asynchronous process, to alleviate system pressure.
In the present embodiment, batch credit card information is stored in message queue, is carried out not in the form of message queue
Credit card information is carried out bulk transfer to realize by the communication between homologous ray.
Optionally, in an alternative embodiment of the invention, the sending module 220 is specifically used for:
The batch credit card information is sent to data system, so that the test program is obtained from the data system
The batch credit card information.
In the present embodiment, the data system is the system for storing credit card information.
In the present embodiment, after batch credit card information is sent to data system, program (such as credit card wind to be tested
Control system) from data system acquisition batch credit card information, and based on the batch credit card information operation got.
Through this embodiment, credit card information can be all stored in a data center, facilitate preservation and the pipe of data
Reason.
Optionally, in an alternative embodiment of the invention, the sending module 220 is specifically used for:
Obtain the transmission condition for sending the credit card information;
The batch credit card information is sent in the form of message queue according to the transmission condition described to be tested
Program.
In the present embodiment, the transmission condition can be preset.
For example, the condition of transmission is sending time, the condition that sends is sequence etc..
In an alternative embodiment of the invention, the transmission condition can be determined according to the quantity of batch credit card information.
Through this embodiment, it can control the mode of batch credit card information transmission.
Optionally, in an alternative embodiment of the invention, the transmission condition includes quantity forwarded and/or transmission times, institute
It states and the batch credit card information is sent to by the program bag to be tested in the form of message queue according to the transmission condition
It includes:
Judge whether the transmission times is greater than twice;
If the transmission times is greater than twice, the time interval sent every time is obtained;
The batch credit card information is sent in the form of message queue according to the time interval described to be tested
Program.
In the present embodiment, the batch credit card information can be sent in batches, and every batch of sends several credit card informations.
For example, batch credit card information includes 100 credit card informations, transmission times is 5 times, and quantity forwarded is 20,
Then when sending, 5 transmissions of the batch credit card information point send 20 credit card informations every time.
In the present embodiment, the time interval of the data transmission is preset, for example, being set in advance as 5s, then
After getting the time interval sent every time, a plurality of credit card information is sent according to quantity forwarded at interval of 5s.
In the present embodiment, the credit card information for test can be sent in batches, and data is avoided once to be transmitted across make more
At have little time processing and queue blocking, also avoid data from once sending very few limitation system resource, by being sent according to data
Time interval carry out data transmission, improve the fluency of test process controllability and test.
Second obtains module 230, is based on batch credit card information operation return for obtaining the program to be tested
Outcome variable.
The outcome variable is the result that the program to be tested is returned based on the operation of batch credit card information.
For example, outcome variable is that the holder of a certain credit number logs in the number for card of making a credit inquiry;Alternatively, outcome variable
For the transaction total amount of a certain credit card within a preset time;Alternatively, outcome variable is that a certain credit card is handed within a preset time
It is easily more than the number of preset cost.
Third obtains module 240, handles the pre- of the batch credit card information by the program to be tested for obtaining
If asserting.
Assert embodied in the form of Boolean expression.In the present embodiment, it is described it is default be asserted as it is pre-set assert,
I.e. pre-set Boolean expression.
Such as: Assert.AreEqual (Program.Add (a, b), 40), expression assert that the value of a and the value of b are transmitted to
Result obtained in method Add (int num1, num2) is 40, i.e., equal with " 40 " that pre-suppose that in expression formula are asserted.?
It is not as a result 40 if the value of a and the value of b are transmitted to after method Add, then the result asserted is false when practical execution;
If the value of a and the value of b are transmitted to after method Add, result 40, then the result asserted is true.
Specifically, in the present embodiment, it is default assert be according to the function of program to be tested and batch credit card information into
Row setting, by asserting whether can verify execution of the program to be tested based on batch credit card information wrong.
For example, default be asserted as assuming that the consumption total amount of a certain credit card in batch credit card information is more than 5000 yuan
Transaction count is 3 times.
Matching module 250 asserts for the outcome variable to be input to described preset, passes through the outcome variable and institute
The expected results stated in default assert are matched, and the default result asserted is obtained.
In the present embodiment, the default result asserted is false either true, if the default result asserted is true, table
The logic of bright program to be tested does not have mistake;If the default result asserted is false, show program to be tested is logically present mistake
Accidentally.
For example, default be asserted as assuming that the consumption total amount of a certain credit card in batch credit card information is more than 5000 yuan
Transaction count is 3 times, wherein 3 be the expected results asserted, then outcome variable is to be tested based on the operation of batch credit card information
It is that program obtains as a result, the result match with the expected results asserted if the result is 3, the result asserted of determination is true, table
Bright program to be tested, which calculates when the amount of money is more than 5000 former transaction count, does not have mistake;If based on batch credit card information operation to
The result that test program obtains is not 3, for example, 2, then the result is mismatched with the expected results asserted, determines the result asserted
For false, show that there are mistakes when the program calculating amount of money to be tested is more than 5000 former transaction count.
Optionally, in an alternative embodiment of the invention, described device further include:
Persistence module is used for the batch credit card information persistence into presetting database.
In a kind of optional embodiment, after getting batch credit card information, and batch credit card information is sent
Before by batch credit card information persistence into presetting database.
In an alternative embodiment, after sending batch credit card information extremely by batch credit card information persistence
In presetting database.
It include saving batch credit card information by batch credit card information persistence to presetting database in the present embodiment
To presetting database.Meanwhile persistence further includes other operations relevant with database, can be visited by persistence with encapsulation of data
It asks details, provides the api function of object-oriented for major part service logic, and batch credit card information is multiplexed,
The batch credit card information being persisted in database can be accessed by accessing the api function of data.
Optionally, in an alternative embodiment of the invention, described device further includes operation module, is used for:
Obtain preset test precondition and/or test postcondition;
It is preposition according to the test before receiving the test instruction or before obtaining the batch credit card information
Condition executes test pre action, and the test pre action includes clearing up invalid test data;
After obtaining the default result asserted, test post action, institute are executed according to the test postcondition
Stating test post action includes being removed from the cache the batch credit card information.
In an alternative embodiment, it obtains preset test precondition and/or test postcondition includes: to obtain to use
The test precondition and/or test postcondition that family is arranged on webpage.In this embodiment, the test precondition can
To be that user is arranged on web page.
In the present embodiment, will clear up invalid test data before test can make not will receive invalid data when test
Interference, spatial cache can be cleared up by being removed from the cache batch credit card information after a test, when so that testing next time
The influence of previous secondary test data is not will receive.
Through this embodiment, quickly the relevant item of test can be configured before test and after test
With automatically process, improve testing efficiency.
A kind of test device provided by the invention obtains module by first and receives test instruction, obtains batch credit card
Data;The batch credit card information is sent to program to be tested by sending module in the form of message queue, described to be tested
Program is quantified based on behaviour in service of the batch credit card information to the credit card that the batch credit card information includes;
Second acquisition module obtains the outcome variable that the program to be tested is returned based on batch credit card information operation;Third obtains
The acquisition of modulus block handles the default of batch credit card information by the program to be tested and asserts;Matching module is by the knot
Fruit variable be input to it is described it is default assert, preset the expected results in asserting with described by the outcome variable and matched,
Obtain the default result asserted.Credit card information verifying so as to Batch sending credit card information, and based on batch
Whether the operation of program to be tested is correct, realizes the purpose rapidly tested the program of processing credit card information.
The above-mentioned integrated unit realized in the form of software function module, can store and computer-readable deposit at one
In storage media.Above-mentioned software function module is stored in a storage medium, including some instructions are used so that a computer
It is each that equipment (can be personal computer, server or the network equipment etc.) or processor (processor) execute the present invention
The part steps of embodiment the method.
As shown in figure 3, Fig. 3 is the structural representation of the computer installation for the preferred embodiment that the present invention realizes test method
Figure.The computer installation includes at least one sending device 31, at least one processor 32, at least one processor 33, extremely
A few reception device 34 and at least one communication bus.Wherein, the communication bus is for realizing between these components
Connection communication.
The computer installation be it is a kind of can according to the instruction for being previously set or store, it is automatic carry out numerical value calculate with/
Or the equipment of information processing, hardware include but is not limited to microprocessor, specific integrated circuit (Application Specific
Integrated Circuit, ASIC), programmable gate array (Field-Programmable Gate Array, FPGA), number
Word processing device (Digital Signal Processor, DSP), embedded device etc..The computer installation may also include net
Network equipment and/or user equipment.Wherein, the network equipment includes but is not limited to single network server, multiple network services
The server group of device composition or being made of a large amount of hosts or network server based on cloud computing (Cloud Computing)
Cloud, wherein cloud computing is one kind of distributed computing, a super virtual meter consisting of a loosely coupled set of computers
Calculation machine.
The computer installation may be, but not limited to, any one and can be set with user by keyboard, touch tablet or acoustic control
The modes such as standby carry out the electronic product of human-computer interaction, for example, the terminals such as tablet computer, smart phone, monitoring device.
Network locating for the computer installation includes, but are not limited to internet, wide area network, Metropolitan Area Network (MAN), local area network, virtual
Dedicated network (Virtual Private Network, VPN) etc..
Wherein, the reception device 34 and the sending device 31 can be wired sending port, or wirelessly set
It is standby, for example including antenna assembly, for carrying out data communication with other equipment.
The memory 32 is for storing program code.The memory 32, which can be, does not have physical form in integrated circuit
The circuit with store function, such as RAM (Random-Access Memory, random access memory), FIFO (First In
First Out, push-up storage) etc..Alternatively, the memory 32 is also possible to the memory with physical form, such as
Memory bar, TF card (Trans-flash Card), smart media card (smart media card), safe digital card (secure
Digital card), storage facilities such as flash memory cards (flash card) etc..
The processor 33 may include one or more microprocessor, digital processing unit.The processor 33 is adjustable
With the program code stored in memory 32 to execute relevant function.For example, modules described in Fig. 2 are stored in institute
The program code in memory 32 is stated, and as performed by the processor 33, to realize a kind of test method.The processor 33
Also known as central processing unit (CPU, Central Processing Unit), is one piece of ultra-large integrated circuit, is operation core
The heart (Core) and control core (Control Unit).
In several embodiments provided by the present invention, it should be understood that disclosed system, device and method can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the module
It divides, only a kind of logical function partition, there may be another division manner in actual implementation.
The module as illustrated by the separation member may or may not be physically separated, aobvious as module
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.Some or all of the modules therein can be selected to realize the mesh of this embodiment scheme according to the actual needs
's.
It, can also be in addition, each functional module in each embodiment of the present invention can integrate in one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of hardware adds software function module.
It is obvious to a person skilled in the art that invention is not limited to the details of the above exemplary embodiments, Er Qie
In the case where without departing substantially from spirit or essential attributes of the invention, the present invention can be realized in other specific forms.Therefore, no matter
From the point of view of which point, the present embodiments are to be considered as illustrative and not restrictive, and the scope of the present invention is by appended power
Benefit requires rather than above description limits, it is intended that all by what is fallen within the meaning and scope of the equivalent elements of the claims
Variation is included in the present invention.Any attached associated diagram label in claim should not be considered as right involved in limitation to want
It asks.Furthermore, it is to be understood that one word of " comprising " does not exclude other units or steps, odd number is not excluded for plural number.It is stated in system claims
Multiple units or device can also be implemented through software or hardware by a unit or device.Second equal words are used to table
Show title, and does not indicate any particular order.
Finally it should be noted that the above examples are only used to illustrate the technical scheme of the present invention and are not limiting, although reference
Preferred embodiment describes the invention in detail, those skilled in the art should understand that, it can be to of the invention
Technical solution is modified or equivalent replacement, without departing from the spirit and scope of the technical solution of the present invention.
Claims (10)
1. a kind of test method, which is characterized in that the described method includes:
Test instruction is received, batch credit card information is obtained;
The batch credit card information is sent to program to be tested in the form of message queue, the program to be tested is based on institute
Batch credit card information is stated to quantify the behaviour in service for the credit card that the batch credit card information includes;
Obtain the outcome variable that the program to be tested is returned based on batch credit card information operation;
Acquisition handles the default of batch credit card information by the program to be tested and asserts;
The outcome variable is input to described preset to assert, the expected knot in asserting is preset with described by the outcome variable
Fruit is matched, and the default result asserted is obtained.
2. the method as described in claim 1, which is characterized in that the acquisition batch credit card information includes:
Show that default credit card data, the default credit card data include the data of multiple credit card fields in user interface;
Obtain the credit card field to be modified in the multiple credit card field;
The modification instruction that user carries out operation triggering in the user interface is received, the modification instruction is comprising to described to be modified
The modification mode of the corresponding data of credit card field;
It is modified according to modification instruction to the corresponding data of credit card field to be modified described in default credit card data,
Determine that the modified default credit card data are the batch credit card information.
3. the method as described in claim 1, which is characterized in that the method also includes:
Obtain preset test precondition and/or test postcondition;
Before receiving the test instruction or before obtaining the batch credit card information, according to the test precondition
Test pre action is executed, the test pre action includes clearing up invalid test data;
After obtaining the default result asserted, test post action, the survey are executed according to the test postcondition
Examination post action includes being removed from the cache the batch credit card information.
4. the method as described in claim 1, which is characterized in that it is described by the batch credit card information with the shape of message queue
Formula is sent to program to be tested
Obtain the transmission condition for sending the credit card information;
The batch credit card information is sent to the program to be tested in the form of message queue according to the transmission condition.
5. method as claimed in claim 4, which is characterized in that the transmission condition includes quantity forwarded and/or transmission times,
It is described that the batch credit card information is sent to by the program to be tested in the form of message queue according to the transmission condition
Include:
Judge whether the transmission times is greater than twice;
If the transmission times is greater than twice, the time interval sent every time is obtained;
The batch credit card information is sent to the program to be tested in the form of message queue according to the time interval.
6. the method as described in claim 1, which is characterized in that it is described by the batch credit card information with the shape of message queue
Formula is sent to program to be tested
The batch credit card information is sent to data system, so that the test program is from described in data system acquisition
Batch credit card information.
7. such as method described in any one of claims 1 to 6, which is characterized in that the method also includes:
By the batch credit card information persistence into presetting database.
8. a kind of test device, which is characterized in that described device includes:
First obtains module, for receiving test instruction, obtains batch credit card information;
Sending module, for the batch credit card information to be sent to program to be tested in the form of message queue, it is described to
Test program is carried out based on behaviour in service of the batch credit card information to the credit card that the batch credit card information includes
Quantization;
Second obtains module, becomes for obtaining the result that the program to be tested is returned based on batch credit card information operation
Amount;
Third obtains module, handles the default of batch credit card information for obtaining by the program to be tested and asserts;
Matching module is asserted for the outcome variable to be input to described preset, and is preset by the outcome variable with described
Expected results in asserting are matched, and the default result asserted is obtained.
9. a kind of computer installation, which is characterized in that the computer installation includes memory and processor, and the memory is used
In storing at least one instruction, the processor is for executing at least one described instruction to realize as appointed in claim 1 to 7
Test method described in one.
10. a kind of computer readable storage medium, is stored thereon with computer instruction, it is characterised in that: the computer instruction
The test method as described in any one of claims 1 to 7 is realized when being executed by processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910442269.8A CN110334006A (en) | 2019-05-24 | 2019-05-24 | Test method, device, computer installation and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910442269.8A CN110334006A (en) | 2019-05-24 | 2019-05-24 | Test method, device, computer installation and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110334006A true CN110334006A (en) | 2019-10-15 |
Family
ID=68139091
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910442269.8A Pending CN110334006A (en) | 2019-05-24 | 2019-05-24 | Test method, device, computer installation and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110334006A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101221503A (en) * | 2008-02-01 | 2008-07-16 | 中国建设银行股份有限公司 | Software testing method and device |
CN104458261A (en) * | 2014-11-06 | 2015-03-25 | 上海汽车集团股份有限公司 | Multi-interface engine measurement and control system data queue processing method |
US20150294735A1 (en) * | 2014-04-11 | 2015-10-15 | Seagate Technology Llc | Unit testing of data storage devices at a data center |
CN106649082A (en) * | 2016-09-05 | 2017-05-10 | 中国银行股份有限公司 | Test data generation method and apparatus |
CN109670952A (en) * | 2018-12-12 | 2019-04-23 | 中国对外经济贸易信托有限公司 | One kind, which is withheld, pays transaction platform |
-
2019
- 2019-05-24 CN CN201910442269.8A patent/CN110334006A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101221503A (en) * | 2008-02-01 | 2008-07-16 | 中国建设银行股份有限公司 | Software testing method and device |
US20150294735A1 (en) * | 2014-04-11 | 2015-10-15 | Seagate Technology Llc | Unit testing of data storage devices at a data center |
CN104458261A (en) * | 2014-11-06 | 2015-03-25 | 上海汽车集团股份有限公司 | Multi-interface engine measurement and control system data queue processing method |
CN106649082A (en) * | 2016-09-05 | 2017-05-10 | 中国银行股份有限公司 | Test data generation method and apparatus |
CN109670952A (en) * | 2018-12-12 | 2019-04-23 | 中国对外经济贸易信托有限公司 | One kind, which is withheld, pays transaction platform |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104993946B (en) | Appraisal procedure, the device and system of gray scale publication | |
US8359580B2 (en) | System and method for tracking testing of software modification projects | |
US20180068246A1 (en) | Reciprocal models for resource allocation | |
US20140164364A1 (en) | System and method for event-driven prioritization | |
CN110310170A (en) | Order processing method, apparatus, electronic equipment and storage medium | |
CN110097170A (en) | Information pushes object prediction model acquisition methods, terminal and storage medium | |
CN105740434B (en) | Network information methods of marking and device | |
CN107784579A (en) | Accreditation method, apparatus, storage medium and computer equipment | |
CN110084690A (en) | Data processing method, device, computer installation and storage medium | |
CN109814958A (en) | Management state display methods, device, computer installation and storage medium | |
CN109032598A (en) | A kind of dynamic creation method and device of transaction flow | |
CN115357629A (en) | Processing method, system, electronic device and storage medium for financial data stream | |
US20090169008A1 (en) | System and method for tracking testing of software modification projects from a wireless mobile device | |
CN112579691B (en) | Data processing method and device supporting large-screen display | |
CN110232107A (en) | A kind of product data acquisition methods | |
CN110334006A (en) | Test method, device, computer installation and storage medium | |
CN111159355A (en) | Customer complaint order processing method and device | |
CN107025227A (en) | User is to the determination of the familiarity of product, information sifting, processing method and processing device | |
CN108805541B (en) | Payment method and system, and storage medium | |
CN114936160A (en) | Method and device for analyzing test requirement range of product | |
CN113657817B (en) | Transaction processing method and device, electronic equipment and readable storage medium | |
CN109214911A (en) | The treating method and apparatus of bill reconciliation exception | |
CN110472190A (en) | The method and apparatus for filling ordered sequence | |
CN114676359A (en) | Form display method and device, computer equipment and storage medium | |
US20060036771A1 (en) | Information processing capability transaction apparatus and method thereof |
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 |