Jmeter 证书导入
(1) Change .cer and .key to .p12
\1. Download openssl
\2. Use command, cd into .cer and .key path
\3. Use command:
openssl pkcs12 -export -out server.p12 -inkey server.key -in server.crt
- server.p12: file name of .p12 file
- server.key: .key file name
- server.crt: .cer file name
\4. Enter .p12 fie password
\5. .p12 file will be generated in the folder same with .cer and .key
(2) Use .p12 generate .keystore
\1. Cd to .p12 file path
\2. Use command:
keytool -importkeystore -srckeystore certificate.P12 -srcstoretype PKCS12 -srcstorepass certificate_password -keystore mystore.keystore -storepass keystore_password
- certificate.P12: .p12 file name
- certificate_password: .p12 file password
- keystore_password: set .keystore file password
sample:
keytool -importkeystore -srckeystore server.p12 -srcstoretype PKCS12 -srcstorepass porschepreview -keystore myporshe.keystore -storepass porschepreview
By this command will generate a certificate named myporshe.keystore with password porschepreview
(3) Import .keystore file into Jmeter
Other
Export all response body
import java.io.*;
import java.io.IOException;
String returnData = prev.getResponseDataAsString();
log.info(returnData);
String fileName = "C:\\Users\\ Desktop \\result\\Log.txt";
BufferedWriter fw = new BufferedWriter (new OutputStreamWriter (new FileOutputStream (fileName,true),"UTF-8"));
fw.write(returnData);
fw.write("\r\n");
fw.close();
Different Thread Group
Different Thread Group
Open this option will run different thread group one by one, with this function we can run load test with client number change requirement.
Close this option can make different thread group run in same time, so that we can run load test with different client number requirement.
Random Controller
In one thread group, if want to send different http request with random time, can use this controller.