Interface Test jmeter

#################################

jmeter 
is running Apache developed using java language development test tools,
very powerful,

scene:
1, for a query interface, query 100, the postman this tool is limited to a
2.50 clients simultaneously request , how to do this postman such a tool can not do,
so complex scenarios or use jmeter
such as high concurrency,

 

##################################

jmeter installation 
1, download
2, extract
3, install java environment,


jmeter powerful
1, interface test
2, performance testing, internal, this algorithm is good or bad decision,
3, the number of people stress tests, external, visit ,
4, Web automated testing
5, database testing,
6, the Java program testing,

 

#################################

jmeter directory structure 
1, backups, backup performed will be saved
2, bin directory, there are a lot of executable programs, which has Apache.jmeter.jar This is jmeter launcher,
3, lib directory, there are a lot of jar files we can integrate your own function, jar files can be placed here,

 

################################

Jmeter write a test case 
1, test plans, test cases to fill in the name of XXX-01
2, test plan right, add -threads- thread group
3, right thread group, add -sampler-http request,
the http request has three elements
3.1, the name of
3.2, ip, port 8000, protocol: http, the method get / post .. path-8 encoding UTF
3.3, right-testing program, add - listener - View results tree, then perform the http request, in the result tree on can have the results,
view the results and response status code is primarily a result,

 

##################################

jmeter thread group, which is a component, 
1, group threads and processes, threads will matter,
process: running
thread: task program execution
thread group: In order to facilitate thread management, so divided the group,

concurrent execution: multiple threads at the same time
order execution: the startup sequence,

why the thread group? Because facilitate the management

process - is to test the program
thread group is the thread group ---, a process can add multiple thread groups,
thread in the thread group ---- you can set the number of threads

if the thread group 1 there are two threads, thread group 2 has three threads, each thread will perform a total of five times to perform the request,
which is not a five order of execution, but can be set to be the order of execution in the test plan, run independently of each thread group, tick you can execute the thread group sequence,


 

##################################

Thread Group Application Key: jmeter Everything assembly 
1, when the requested post of head of information needs to be added,
the test plan right, add - configuration elements - header Manager,
add a thread group, right - the original configuration - header Manager
both are, but the scope is not the same,
you need to add data format,

 

################################

Thread Group --- Request Defaults 
1, the test plan - add - configuration elements - request the default value of
2, you can put a fixed ip, http, port, data formats, and so on, configure the default value,
3, this time, you go to add http request, you can not write the content of the above,
if you do not use the default fill, fill up with fill,

 

################################

Using the above are substantially the thread group, 
the following group advanced into the thread portions: a thread scheduler and the properties of the group, 

the position is inside thread group page

attributes:
1, the above study a number of threads may be provided,
2, RAMP- up period 10 which is set to start within 10 seconds of this thread group, with the number of threads, to see performance problems,
3 cycles: input 3 is executed three times, if the number of threads is 1, which is 3 times the number if the thread 3, that is, 9 times, you can set forever,

dispatcher: is the timer, when in use, the number of cycles above, is set to forever
1, the duration, is to continue to run long,
2, startup delay, which is a few seconds delay start,
3, start time, end time, which is a period of time, run, equivalent to the timing of the execution, attention 2,3 conflicts

 

###################################

jmeter parameterization 
1, what are the parameters of
dynamic data acquisition,
such as adding data interface, not the same every time you add content, if not parameterized, it will lead every time you add parameters to be modified, if they have parameterized you can substitute the parameter, to add bulk parameterization,

2, how to parameterize,
there are many ways,


described below csvData SetConfig implementation ---- this is the focus of the focus,
which is a component, this component by adding bulk can be achieved ,

realization of the principle:
the data is submitted format is fixed, but not the same content, the content is replaced by parametric, csv added record may be stored, such as adding three data, provided with the required number of cycles,
can be read by this component which data, and then enter the data set which format to go, then go submit to the interface,
CSV is an external file,

the implementation process
1, create a http request
2, adding the request data format, data which are empty of content, is an empty string
3, the number of repetitions is 3,
4, at the same level test plan folders, create csv file, the contents of each file by a comma-delimited fields, each data line, the end of each line without commas,
5, right thread group added - Configuration Data setConfig element -csv
. 6, csv Data setConfig configuration,
file name, may use relative positioning / parameters / canshu / txt.
encoding scheme: utf-8, consistent
set variable name: if the field is set three three variables: id, name, age, divided comma
7, page http request, submitted content data, parameterized, name: "$ {name} ", must correspond,
great! ! ! !

 

#################################

 

 

 

 

 

 

 

 

 

 

 

########################################

Guess you like

Origin www.cnblogs.com/andy0816/p/12541637.html
Recommended