附件来自百度。
为霍山等地区用户提供了全套网页设计制作服务,及霍山网站建设行业解决方案。主营业务为网站设计、成都做网站、霍山网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
脚本正文:
/*
* LoadRunner Java script. (Build: _build_number_)
*
* Script Description:
*
*/
import lrapi.lr;
public class Actions
{
public int init() throws Throwable {
return 0;
}//end of init
public int action() throws Throwable {
com.CTLPTest ct1 = new com.CTLPTest();
ct1.main(null);
return 0;
}//end of action
public int end() throws Throwable {
return 0;
}//end of end
}
jar包内容:
package com; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.security.cert.X509Certificate; import java.util.Properties; import java.util.Random; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLSession; import javax.net.ssl.X509TrustManager; public class CTLPTest { public static void main(String[] args) { CTLPTest lbs = new CTLPTest(); String ltpUrl = lbs.ltpRequestUrl(); System.out.println("ltpUrl:"+ltpUrl); System.out.println("lbs.ltpRequestUrl(ltpUrl):"+lbs.ltpRequestUrl(ltpUrl)); } public int ltpRequestUrl(String ltpRequestUrl) { int returnCount = -1; try { URL url = new URL(ltpRequestUrl); Properties prop = System.getProperties(); System.setProperty("http.proxyHost", "proxy.com"); System.setProperty("http.proxyPort", "80"); //http HttpURLConnection http = (HttpURLConnection)url.openConnection(); http.setUseCaches(false); http.connect(); //http InputStream in = http.getInputStream(); // byte[] b = new byte[in.available()]; in.read(b); // String res = new String(b); System.out.println("res:"); System.out.println(res); //ж,÷ int of = res.indexOf("resultCode"); if (of < 0) { System.out.println("***************failure***********************"); returnCount = -1; } else { returnCount = 1; } }catch(Exception e){ System.out.println("Exception"); System.out.println(e); returnCount = -1; } return returnCount; } public String ltpRequestUrl() { StringBuilder param = new StringBuilder("http://xxx.xxx.com"); // param.append("userid-1"); // param.append("&appName=LBS&Apikey=D39hr1FgplZSjV2eNVW71wvbYbl8Mip4"); return param.toString(); } }
本文名称:Loadrunner进行http接口压力测试
文章位置:https://www.cdcxhl.com/article28/jhgdjp.html
成都网站建设公司_创新互联,为您提供网站设计公司、关键词优化、定制开发、品牌网站设计、微信公众号、做网站
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联