CN101937387A - Method and system for generating test parameters - Google Patents

Method and system for generating test parameters Download PDF

Info

Publication number
CN101937387A
CN101937387A CN2009101513121A CN200910151312A CN101937387A CN 101937387 A CN101937387 A CN 101937387A CN 2009101513121 A CN2009101513121 A CN 2009101513121A CN 200910151312 A CN200910151312 A CN 200910151312A CN 101937387 A CN101937387 A CN 101937387A
Authority
CN
China
Prior art keywords
parameter
array
shared drive
mutex
queue
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.)
Granted
Application number
CN2009101513121A
Other languages
Chinese (zh)
Other versions
CN101937387B (en
Inventor
陈泳
袁立宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN200910151312.1A priority Critical patent/CN101937387B/en
Publication of CN101937387A publication Critical patent/CN101937387A/en
Application granted granted Critical
Publication of CN101937387B publication Critical patent/CN101937387B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method and a system for generating test parameters, and the method comprises the following steps: setting a shared memory for users in a unified manner; reading all parameters from a data file, loading into the shared memory; and leading each user to read the parameters in the shared memory as the test parameters in a sequential but not repeated manner through the mutex technology when in need of carrying out random selection treatment. The method for generating the test parameters can realize the properties of uniqueness, mutex, randomness and the like of parameter values under the multi-process and multi-threading concurrent environment and solve the problems of locking and sharing resources.

Description

A kind of generation method and system of test parameter
Technical field
The present invention relates to computing power test and Performance Evaluation technology, be meant a kind of generation method and system of unique and mutually-exclusive argument especially.
Background technology
Software performance test more and more comes into one's own at present, and how the traffic pressure of simulating in the performance test is pressed close to the software actual loading as much as possible and satisfied the service logic of software, is that the tester need pay close attention to and difficult place of realizing.
One of most important work is exactly to need the parameter that constantly changes in the test code of design cycle operation in the software performance test performance history, and for example service handling, searching key word, phone are supplemented with money etc.Existing Business Performance testing tool all parameter function as one of critical function, comprise HP LoadRunner (be called for short LR), Rational Performance Tester (being called for short RPT), generally can provide built-in date/parameter functions such as Virtual User ID/ iterations, and provide the User Defined parameter of load document mode, the value strategy of file load parameter comprise the order, at random, unique, can satisfy general performance test parametrization requirement substantially.
Yet for needing that long-play, parameter quantity required are big, concurrent user number big and the applicable cases of special data requirements such as uniqueness, alternative, randomness is arranged, still there is defective in present commercial performance testing software on parameter function.Supplemental characteristic section (block) size that unique parameter function (unique) of LR will specify each concurrent user to distribute in advance, can't adapt to long-time test iterations condition of unknown, in the ever-increasing test scene of concurrent user (pressure test), also the generation systems mistake causes whole test scene to stop easily.The value mode of RPT file load type parameter then has only the order value a kind of.
The requirement of the uniqueness of parameter and randomness usually is to satisfy simultaneously in addition, the value of parameter normally at random in the software actual motion, the randomness of parameter value plays a crucial role to the quality of software performance test, because the pressure that the sequential access of data and random access produce software systems has the difference of the order of magnitude.Present testing tool all fails to provide the uniqueness that satisfies parameter value simultaneously and the function of randomness.
In the performance test of telesoftware system, the parameter that usually needs uniqueness, alternative to use, for example the phone of telecommunication business system is opened function, and choosing of number needs to guarantee uniqueness, can not open operation to same number repetition.When in the telecommunication production environment, doing performance test, managed restriction can only be carried out the test of recycle design to the sample object of short run, some business is for example supplemented with money operation, a user is being supplemented with money still uncompleted the time, do not allow this user is sent charging request once more, promptly except the uniqueness demand that got parms, the use of parameter also had the alternative demand.
Therefore the performance test to telesoftware system etc. all needs to use concurrent mode to send service request, and uniqueness, randomness, the alternative of parameter need realize in the environment of multi-process, multithreading under the concurrent mode.
Summary of the invention
In view of this, the objective of the invention is to propose a kind of performance test parameter and generate method and system, solve the problem of parameter uniqueness, alternative under present testing tool based on shared drive and mutex technology.
Generation method based on above-mentioned purpose a kind of test parameter provided by the invention comprises:
For test parameter is provided with unified shared drive;
From data file, read whole parameters, be loaded into shared drive;
If need randomly draw processing, each user carries out order but unduplicated reading by mutex MUTEX technology to the parameter in the shared drive, as test parameter.
Optionally, this method is described to read whole parameters from data file, further comprises after being loaded into shared drive: by shuffling algorithm described whole stochastic parameters are broken up.
Optionally, the described shuffling algorithm of this method comprises:
(1) whole parameter group are become array, it is 0 that current array index is set;
(2) generate the adaptation random number of the array of length greatly, it is surplus to use the array length that is loaded into shared drive to get, and is used for array index of picked at random in this array;
(3) array index of current array index and the picked at random array item value of doing exchange pointed;
(4) current array index moves one backward, repeats (2)-(3) operation, and array is the most last until moving to, the end of shuffling.
Optionally, described each concurrent user of this method carries out order by the mutex technology to the parameter in the shared drive but the unduplicated process that reads comprises:
Compose to output parameter by API as subscript shared array element pointed the currency of specific unique parameter and with currency;
B, the currency of specific unique parameter is increased progressively 1.
Optionally, this method is carried out order by mutex MUTEX technology to the parameter in the shared drive each user but also comprised after unduplicated the reading: application of advanced goes out FIFO and the circulation formation algorithm of turning back earlier on the optional value array of parameter, being kept in the formation in the operation parameter value, the back dequeue of finishing using.
Optionally, this method described on the optional value array of parameter application of advanced go out FIFO and the circulation formation algorithm of turning back earlier, being kept in the formation in the operation parameter value, the back dequeue step of finishing using comprises:
A, the data array that parameter is pointed to ought be the formation of fifo fifo, and it is initial that queue heads and rear of queue initial position are array;
B, when parameter acquiring method is called, return the value that rear of queue points to, rear of queue adds one, and when rear of queue moves to array when last, it is initial to array to turn back;
C, when the parameter method for releasing is called, the value that discharges is composed the array position of pointing to queue heads, queue heads adds one;
D, if rear of queue is turned back and is increased progressively the back and arrive queue heads, then current whole supplemental characteristics all are used and do not discharge, follow-up parameter is used and is called and will be in waiting status, till the parameter method for releasing is called.
Optionally, the described whole parameters of this method are preserved with the array mode.
Based on above-mentioned purpose, the present invention also provides a kind of generation system of test parameter based on the above method, comprising:
The shared drive that is used for the storage and uniform test parameter;
Data-reading unit is used for reading whole parameters from data file, is loaded into shared drive;
The test parameter generation unit is used for by mutex MUTEX technology the parameter of shared drive being carried out order but unduplicated reading, and sends to each concurrent user as test parameter.
Optionally, this system also comprises the stochastic parameter processing unit, is used for the whole parameters that are loaded into shared drive are broken up at random by shuffling algorithm.
Optionally, this system also comprises mutual exclusion and circular treatment unit, be used on the optional value array of parameter application of advanced and go out FIFO and the circulation formation algorithm of turning back earlier, and being kept in the formation in the operation parameter value, the back dequeue of finishing using.
From above as can be seen, test parameter provided by the invention generates method and system, under multi-process, multi-thread concurrent environment, realize unique, the mutual exclusion of parameter value, wait characteristic at random, the problem that solves resource lock and share, and can go up at present most widely used performance testing tool HP LoadRunner 8.1 (LR) and use.
The present invention has the following advantages and effect with respect to existing method:
The invention solves the problem that can't generate extensive unique parameter value in the present software performance test business tool, can't satisfy parameter value uniqueness, randomness, alternative simultaneously;
Shared drive and the mutex technology that all provides in each type operating system has been provided in the present invention, and algorithm is simple, and the computer resource expense is little, adopts standard C programming and the WIN32 of Microsoft system call platform, and adjusting just slightly, portable arrives other operating systems.
Description of drawings
Fig. 1 is an embodiment of the invention system architecture synoptic diagram;
Fig. 2 is the generation method flow synoptic diagram of embodiment of the invention test parameter.
Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, below in conjunction with specific embodiment, and with reference to accompanying drawing, the present invention is described in more detail.
Test parameter generation method provided by the invention mainly comprises: for test parameter is provided with unified shared drive; From data file, read whole parameters, be loaded into shared drive; If need randomly draw processing, each user carries out order but unduplicated reading by mutex MUTEX technology to the parameter in the shared drive, and the parameter that reads out is as test parameter.
In addition, the present invention can also further comprise according to different needs:
If parameter value needs randomness, the mode of also further shuffling earlier before then test parameter uses break up processing at random.
If parameter value needs mutual exclusion and recycle design to use, then application of advanced goes out (FIFO) and the circulation formation algorithm of turning back earlier on the optional value array of parameter, being kept in the formation in the operation parameter value, the back dequeue of finishing using guarantees the mutual exclusion attribute at the parameter value that uses.
The logic of the embodiment of the invention is formed as shown in Figure 1, and MUTEX handle and shared parameter are all preserved with the array mode in the present embodiment, to realize using simultaneously the function of a plurality of unique parameters.Unique parameter of sharing between multi-process is stored in the shared drive, and sharing unique parameter array is data structure body array, and the data structure body comprises following data item:
● unique parameter I D: unique ID of parallel a plurality of shared parameters of using, for example certain the province repaid card data in the repaid card data in a plurality of provinces;
● currency: share the current round values of parameter, can be used as the subscript of related external load data array;
● maximal value: the maximal value of the shared parameter that is provided with according to service logic, or the record number of related external data;
● the external load data storage location: in the shared buffer memory of overall importance, the reference position of the external data array that the current shared parameter is associated;
● first in first out (FIFO) queue heads and rear of queue subscript: when shared parameter needs alternative to recycle, realize that on the external data array of association first in first out (FIFO) formation preserved parameter values in use, queue heads and rear of queue subscript are used to mark the formation current location.
Suppose that telecom operators do performance test to the charging system in somewhere, the use test instrument carries out big concurrent charging request test to this system, all needs the rechargeable card ID that specifies not to be used in each charging request.
Realize the step that performance test requires by this patent,, comprise the steps: referring to shown in Figure 2
For the test parameter unification shared drive data structure body array and external data buffer memory are set in advance.
Step 201 in the test incipient stage, reads whole rechargeable card ID data from data file, be loaded into shared drive.
Step 202 if need randomly draw processing, can select to use shuffling algorithm that rechargeable card ID data are broken up at random.
Shuffling algorithm is exemplified below:
(1) described whole rechargeable card ID data sets are become array, it is 0 that current array index is set;
(2) generate one and be 2 32 power random numbers (array that adapts to big length) to the maximum, it is surplus to use the array length that is loaded into shared drive to get, and is used for array index of picked at random in this array;
(3) array index of current array index and the picked at random array item value of doing exchange pointed;
(4) current array index moves one backward, repeats (2)-(3) operation, and array is the most last until moving to, the end of shuffling.
Step 203, each concurrent user carries out order but unduplicated reading by mutex (MUTEX) technology to the rechargeable card ID data of the array index in the shared drive, loading, as the parameter in the charging request, realize test request concurrent, at random, unique parameter value requirement.
A, the currency of specific unique parameter, and compose to output parameter by API as subscript shared array element pointed with currency;
B, the currency of specific unique parameter is increased progressively 1.
The synchronous uniqueness of carrying out with MUTEX technique guarantee code among the above-mentioned steps A-B.
Step 204, if the use of parameter also has uniqueness demand and alternative demand, promptly get access to during parameter value finishes using from parameter value, can not send request (parameter recycles, parameter service time long, when the parameter sample is little this situation can take place) once more with this parameter value, then increase by two call methods of unique parameter, one is parameter acquiring, and one is parameter release.
In the above-mentioned steps 204, realize that the algorithm of parameter alternative use is as follows:
A, the data array that parameter is pointed to ought be the formation of first in first out (FIFO), and it is initial that queue heads and rear of queue initial position are array.
B, when parameter acquiring method is called, return the value that rear of queue points to, rear of queue adds one, and when rear of queue moves to array when last, it is initial to array to turn back.
C, when the parameter method for releasing is called, the value that discharges is composed the array position of pointing to queue heads, queue heads adds one.
The synchronous uniqueness that described step B-C algorithm all uses MUTEX technique guarantee code to carry out can guarantee that the parameter values of using under the multi-process multi-thread environment is kept between queue heads and the rear of queue, and the parameter values of other positions all can be used.
D, if rear of queue is turned back and is increased progressively the back and arrive queue heads, then current whole supplemental characteristics all are used and do not discharge, follow-up parameter is used and is called and will be in waiting status, till the parameter method for releasing is called.
This method has guaranteed that the parameter value of all positions all can roughly be used and discharge equiprobably in the array.
MUTEX and share memory technology in the WIN32 running environment of LR platform place have been used in the method for the invention, the characteristic of utilizing the MUTEX technology is dissolved the mode of locking for shared variable between multi-process to the demand of parameter uniqueness, randomness, alternative and is increased progressively, carries out the array index addressing with variate-value and obtain external load data, array shuffling algorithm, four algorithms of first-in first-out (FIFO) available parameter formation, and the mode by dynamic link library (DLL) provides user-friendly calling interface (API) to give the LR instrument.
Based on said method, the present invention also provides a kind of generation system of test parameter, mainly comprises:
The shared drive that is used for the storage and uniform test parameter;
Data-reading unit is used for reading whole parameters from data file, is loaded into shared drive;
The test parameter generation unit is used for by mutex MUTEX technology the parameter of shared drive being carried out order but unduplicated reading, and sends to each concurrent user as test parameter.
This system also comprises the stochastic parameter processing unit, is used for the whole parameters that are loaded into shared drive are broken up at random by shuffling algorithm.And mutual exclusion and circular treatment unit, be used on the optional value array of parameter application of advanced and go out FIFO and the circulation formation algorithm of turning back earlier, being kept in the formation in the operation parameter value, the back dequeue of finishing using.
Because the present invention just is the operation of simply certain shared variable being carried out locking, reads and increased progressively the back release, therefore can use the global synchronization control MUTEX of shirtsleeve operation system mutex technology in realization, all basically operating system all provides the realization of MUTEX.Then use the shared drive mode at the process data sharing, the high overall situation control that also can realize the parameter logic of efficient.
Above-described specific embodiment is specific embodiments of the invention only, is not limited to the present invention, and is within the spirit and principles in the present invention all, any modification of being made, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (10)

1. the generation method of a test parameter is characterized in that, comprising:
For test parameter is provided with unified shared drive;
From data file, read whole parameters, be loaded into shared drive;
If need randomly draw processing, each user carries out order but unduplicated reading by mutex MUTEX technology to the parameter in the shared drive, as test parameter.
2. method according to claim 1 is characterized in that, describedly reads whole parameters from data file, further comprises after being loaded into shared drive: by shuffling algorithm described whole stochastic parameters are broken up.
3. method according to claim 2 is characterized in that, described shuffling algorithm comprises:
(1) whole parameter group are become array, it is 0 that current array index is set;
(2) generate the adaptation random number of the array of length greatly, it is surplus to use the array length that is loaded into shared drive to get, and is used for array index of picked at random in this array;
(3) array index of current array index and the picked at random array item value of doing exchange pointed;
(4) current array index moves one backward, repeats (2)-(3) operation, and array is the most last until moving to, the end of shuffling.
4. method according to claim 1 is characterized in that, described each concurrent user by the mutex technology parameter in the shared drive is carried out order but the unduplicated process that reads comprises:
Compose to output parameter by API as subscript shared array element pointed the currency of specific unique parameter and with currency;
B, the currency of specific unique parameter is increased progressively 1.
5. method according to claim 1, it is characterized in that, this method is carried out order by mutex MUTEX technology to the parameter in the shared drive each user but also comprised after unduplicated the reading: application of advanced goes out FIFO and the circulation formation algorithm of turning back earlier on the optional value array of parameter, being kept in the formation in the operation parameter value, the back dequeue of finishing using.
6. method according to claim 5 is characterized in that, described on the optional value array of parameter application of advanced go out FIFO and the circulation formation algorithm of turning back earlier, being kept in the formation in the operation parameter value, the back dequeue step of finishing using comprises:
A, the data array that parameter is pointed to ought be the formation of fifo fifo, and it is initial that queue heads and rear of queue initial position are array;
B, when parameter acquiring method is called, return the value that rear of queue points to, rear of queue adds one, and when rear of queue moves to array when last, it is initial to array to turn back;
C, when the parameter method for releasing is called, the value that discharges is composed the array position of pointing to queue heads, queue heads adds one;
D, if rear of queue is turned back and is increased progressively the back and arrive queue heads, then current whole supplemental characteristics all are used and do not discharge, follow-up parameter is used and is called and will be in waiting status, till the parameter method for releasing is called.
7. method according to claim 1 is characterized in that, described whole parameters are preserved with the array mode.
8. the generation system based on the test parameter of any described method of claim 1-7 is characterized in that, comprising:
The shared drive that is used for the storage and uniform test parameter;
Data-reading unit is used for reading whole parameters from data file, is loaded into shared drive;
The test parameter generation unit is used for by mutex MUTEX technology the parameter of shared drive being carried out order but unduplicated reading, and sends to each concurrent user as test parameter.
9. system according to claim 8 is characterized in that this system also comprises the stochastic parameter processing unit, is used for the whole parameters that are loaded into shared drive are broken up at random by shuffling algorithm.
10. system according to claim 8, it is characterized in that this system also comprises mutual exclusion and circular treatment unit, be used on the optional value array of parameter application of advanced and go out FIFO and the circulation formation algorithm of turning back earlier, being kept in the formation in the operation parameter value, the back dequeue of finishing using.
CN200910151312.1A 2009-06-30 2009-06-30 Method and system for generating test parameters Active CN101937387B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200910151312.1A CN101937387B (en) 2009-06-30 2009-06-30 Method and system for generating test parameters

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200910151312.1A CN101937387B (en) 2009-06-30 2009-06-30 Method and system for generating test parameters

Publications (2)

Publication Number Publication Date
CN101937387A true CN101937387A (en) 2011-01-05
CN101937387B CN101937387B (en) 2013-04-17

Family

ID=43390727

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200910151312.1A Active CN101937387B (en) 2009-06-30 2009-06-30 Method and system for generating test parameters

Country Status (1)

Country Link
CN (1) CN101937387B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102955721A (en) * 2011-08-16 2013-03-06 阿里巴巴集团控股有限公司 Device and method for pressure generation for testing
CN105447003A (en) * 2014-08-07 2016-03-30 阿里巴巴集团控股有限公司 Parameter set generation method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100353325C (en) * 2004-08-23 2007-12-05 华为技术有限公司 Method for realing sharing internal stored data base and internal stored data base system
CN101300775B (en) * 2005-10-31 2012-12-19 松下电器产业株式会社 Secure processing device, secure processing method, encrypted confidential information embedding method, program, storage medium, and integrated circuit
CN100487660C (en) * 2007-05-28 2009-05-13 中兴通讯股份有限公司 Multithreading processor dynamic EMS memory management system and method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102955721A (en) * 2011-08-16 2013-03-06 阿里巴巴集团控股有限公司 Device and method for pressure generation for testing
CN105447003A (en) * 2014-08-07 2016-03-30 阿里巴巴集团控股有限公司 Parameter set generation method and device
CN105447003B (en) * 2014-08-07 2019-03-08 阿里巴巴集团控股有限公司 A kind of parameter sets generation method and equipment

Also Published As

Publication number Publication date
CN101937387B (en) 2013-04-17

Similar Documents

Publication Publication Date Title
US8806498B2 (en) Method and system for resolving dependency among the enqueued works and/or finished works and scheduling the dependency-resolved works
CN101650646B (en) Method and device for realizing shared data consistency
CA2706737C (en) A multi-reader, multi-writer lock-free ring buffer
CN103218455B (en) Method of high-speed concurrent processing of user requests of Key-Value database
CN110300328B (en) Video playing control method and device and readable storage medium
US10402223B1 (en) Scheduling hardware resources for offloading functions in a heterogeneous computing system
CN105045632A (en) Method and device for implementing lock free queue in multi-core environment
CN107729135B (en) Method and device for parallel data processing in sequence
CN103309738A (en) User job scheduling method and device
CN106095604A (en) The communication method between cores of a kind of polycaryon processor and device
CN110069557B (en) Data transmission method, device, equipment and storage medium
CN111416825A (en) Inter-thread lock-free log management method and system, terminal and storage medium
CN114675964A (en) Distributed scheduling method, system and medium based on Federal decision tree model training
CN108958950A (en) Task management method, host and the storage device of electronic storage device
CN114827048B (en) Dynamic configurable high-performance queue scheduling method, system, processor and protocol
US8543722B2 (en) Message passing with queues and channels
CN101937387B (en) Method and system for generating test parameters
CN109558241A (en) A kind of method and device obtaining spin lock
US10198784B2 (en) Capturing commands in a multi-engine graphics processing unit
CN112068965A (en) Data processing method and device, electronic equipment and readable storage medium
CN104769553A (en) System and method for supporting work sharing muxing in a cluster
CN110289043A (en) Store apparatus testing method, device, electronic equipment
CN103593606A (en) Contextual information managing method and system
CN115809126A (en) Job scheduling method and device in mixed deployment scene and electronic equipment
CN112800057B (en) Fingerprint table management method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant