??y?????????н????????????????)
???????????? ???????[ 2016/5/11 13:58:23 ] ??????????????? ??????
	?????齱?????н????????????????????????????????????н???????????????????????????????н???????????????У??????????????????y?????????н??????????????????????
	????1.?·??
	??????1)???????н??????get?y???????????????????????????????????????????
	????0--???δ????
	????1--???????1???
	????2--???????2???
	????3--???????3???
	??????2?????for????????????y????????testNG??????????????????з?????????????????????????????????У????????????????????????μ??н??????
	??????3?????2???е??н????????????????????????н??????????
	????2.????
	????????????  LotteryTestCase.java ???£?
	package com.krplus.api.autotest.testcase;
	import org.apache.http.HttpEntity;
	import org.apache.http.client.methods.CloseableHttpResponse;
	import org.apache.http.client.methods.HttpGet;
	import org.apache.http.impl.client.CloseableHttpClient;
	import org.apache.http.impl.client.HttpClients;
	import org.apache.http.util.EntityUtils;
	import org.testng.annotations.Test;
	/**
	* Created by wyy on 2016/4/18.
	*/
	public class LotteryTestCase {
	@Test(invocationCount =10?? threadPoolSize = 5)
	//invocationCount----?????б????????????????????б?????10??
	//threadPoolSize-----????????????????????????д????й?? ??????????5???????2?????????????????????????????????У???????е??????///??????????????????????????????????У?????????for??????????????ò??????Ч???????
	public  void testLottery() throws Exception {
	int fail = 0;
	int first = 0;
	int second = 0;
	int third = 0;
	float perfail=0;
	float perfirst=0;
	float persecond=0;
	float perthird=0;
	int m=100;       //??????????get?????
	//        ??????get????????н??????????????н???????????
	for (int i = 0; i <m; i++) {
	CloseableHttpClient httpClient = HttpClients.createDefault();
	HttpGet get = new HttpGet("http://**********")  //??????н??????????????????????п???????????
	// HttpGet get = new HttpGet("http://**********"); //??????н????
	CloseableHttpResponse response = httpClient.execute(get);
	try {
	HttpEntity entity = response.getEntity();
	String result = EntityUtils.toString(entity);
	int res=Integer.parseInt(result);  //???н???????? string????????int?????
	if(res==0){
	fail=fail+1;
	// perfail=(float)fail/m;//????н??????????????????????for??????????Σ???????÷??for?????
	}else if(res==1){
	first=first+1;
	}else if(res==2){
	second=second+1;
	}else{
	third=third+1;
	}
	} finally {
	response.close();
	}
	}
	perfail=(float)fail/m;//????н????????
	perfirst=(float)first/m;
	persecond=(float)second/m;
	perthird=(float)third/m;
	System.out.println("-------?н?????--------");
	System.out.println("?н?????????"+fail);
	System.out.println("????????????"+first);
	System.out.println("?ж??????????"+second);
	System.out.println("?????????????"+third);
	System.out.println("-------?н?????--------");
	System.out.println("?н?????????"+perfail);
	System.out.println("????????????"+perfirst);
	System.out.println("?ж??????????"+persecond);
	System.out.println("?????????????"+perthird);
	}
	}
	????3.???
	??????testNG.xml????????????·??????м??ɡ???????????????1000?Σ???????????100?????????10???÷???????????????????£?
	????[TestNG] Running:
	????D:krplus-api-test	estcase	estcaseLottery	esNG.XML
	????-------?н?????--------
	?????н?????????16
	????????????????2
	?????ж??????????9
	?????????????????73
	????-------?н?????--------
	?????н?????????0.16
	????????????????0.02
	?????ж??????????0.09
	?????????????????0.73
	????????????е??????ж??????
	??????????????е??????????????????????????????????????
	????1.??????н???????????1000?Σ??????н????????0?????????????????д????????????
	????2.??????????????е??????????????????£?
	
	?????????????????????????~O(∩_∩)O??
	??????????????????????????????????? ?齱?????????????~
??????
					
					???·???
App??С????H5?????????????????Щ??
2024/9/11 15:34:34?????????????????????????
2024/9/10 11:13:49P-One ???????????????????????????????????????
2024/9/10 10:14:12???????????????????????????
2024/9/9 18:04:26??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44
					
			
								
								
								
								
								
								
								
								
								
								
				
sales@spasvo.com