LoadRunner??javavuser???н?????
???????????? ???????[ 2015/10/21 11:27:38 ] ?????????????????? ??????????
????????????????poptest????????а???????????????л????????????????????????????????????????????????????????????????????????????????????????????????????loadrunner??????????????????????????javavuser??????Щ??????????java???????????????????????????
???????????loadrunner????java_vuser??? ??
???????????????????Create/Edit Script-->New Script-->???javaЭ??-->java_vuser ?????????
???????????????loadrunner???????
??????run-time-setting ????classpath??
???????????????????????java????
??????java????????? ?????import com.lr_class.*????????????com????У???com?????lr_class????У????????????????????С?
???????????????javavuser??????????gzip????????????????????
?????????httpЭ????? web_custom_request?????е? BodyBinary??????????????????????ɡ?
import lrapi.lr;
import com.lr_class.*;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.impl.client.DefaultHttpClient;
public class Actions
{
public int init() throws Throwable {
return 0;
}
public int action() throws Throwable {
String url ="http://xx.xx.xx.xx/stats/uploadData";
int code;
byte[] dataBytes= Fdata.putData("<testing>"??"<user>"??"<id>"??"<age>"??"<time>"??1??1??5??1??1348042886??4??13432909036L??1234567890123455L??1??1);
System.out.println(dataBytes);
byte[] b = UnGZIP.compressToByte(dataBytes);
b = XXXXXRC4.code(b);
System.out.println(b);
lr.start_transaction("????");
ByteArrayInputStream bs = null ;
bs = new ByteArrayInputStream(b?? 0?? b.length);
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type"?? "application/octet-stream");
HttpEntity he = new InputStreamEntity(bs?? b.length);
httpPost.setEntity(he);
HttpResponse httpResponse = new DefaultHttpClient().execute(httpPost);
code = httpResponse.getStatusLine().getStatusCode();
if (code == 901) {
lr.output_message("??? code:"+code);
lr.end_transaction("????"?? lr.PASS);
}
else{
lr.error_message("??? code:"+code);
lr.end_transaction("????"?? lr.FAIL);
}
return 0;
}
public int end() throws Throwable {
return 0;
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11