Implementation of Shopping Mall Interface Test with JMeter
Apache JMeter is a Java-based stress testing tool developed by Apache. Used for stress testing of software, it was originally designed for Web application testing, but later extended to other testing areas. It can be used to test static and dynamic resources, such as static files, Java applets, CGI scripts, Java objects, databases, FTP servers, and so on. JMeter can be used to simulate huge loads on servers, networks, or objects, testing their strength and analyzing overall performance from different stress categories.
1. API description:
Call merchandise to shopping cart interface
2. Request method:
HTTP POST request
3. Interface address:
/ ecshop/upload/flow.php?step=add_to_cart
4. Request parameters:
1) enter parameters:
JSON data format:
2) request example:
POST / ecshop/upload/flow.php?step=add_to_cart
HTTP/1.1
Host: 192.168.126.134
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64
Rv:35.0) Gecko/20100101 Firefox/35.0
Accept:
Text/html,application/xhtml+xml,application/xml;q=0.
Nine minutes, one hand, one, one, two, six.
Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Charset=UTF-8
Referer:
Http://192.168.126.134/ecshop/upload/goods.php?id=1
Content-Length: 69
Cookie: ECS [history] = 1%2C17%2C9%2C5%2C8
ECS [display] = grid; ECS [times _ times] = 2
ECS_ID=e1d0459a234edc14230c8e8c3f12251bb699bd86
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Goods= {"quick": 1, "spec":
["goods_id": 1, "number": "1", "parent": 0}
5. Return parameters
1) response parameters:
2) response example:
Test procedure
1. Right-click on the "Test Plan" node and select Add-- > Threads (users)--
Thread Group
two。 Right-click the "Thread Group" node and select Add-- > Sampler-- > HTTP
Request
3. Right-click the "HTTP Request" node and select Add-- > Listener-- > View
Results Tree
4. Select "HTTP Request" to configure HTTP requests
5. Click "Save" to save the test plan
6. Click "Start" to run the JMeter test
HTTP Request configuration
Request parameters are generally placed in the "Body data" tab:
Goods= {"quick": 1, "spec":
["goods_id": 1, "number": "1", "parent": 0}
In this example, the request parameter is a query string, so it can also be placed in the "Parameters" tab: