????Sync ????Async ???????????
????.Net 4??5 ???????????ж??????1?????????????????????????VS2012???????????????棬????ν?????????????????VS2010???)??????????о???
???????????????HttpClient????????????????.Net 4.5 ??????????????: Asyn??Await????????????????????????????????????????????????????????????
???????????????Ч????????????????????????????????????e??????Await??Async
var form_data=new Dictionary<string?? string>();
form_data.Add("system_account"??"test1@skight.com");
form_data.Add("system_password"??"123456");
foreach (var key_value in form_data)
{
values.Add(key_value.Key?? key_value.Value);
}
var httpClient = new HttpClient();
var content= await httpClient.GetStringAsync("http://esr20syst.skight.com/District/03/UserLogin.do");
Console.WriteLine(t.Result);
?????????????????????С??????????Node.js???????Web?????Apache????http://zgadzaj.com/benchmarking-nodejs-basic-performance-tests-against-apache-php?????????Javascript????????????????????????С???????.Net??Async????????????????????????????????д????????????????????????????20???????????????????д??HttpClient?????????????????WebClient?????????????HttpClient????????????
??????????? Parallel
????????????????Async????Parallel???????????????????????????????????????????
????Async???????????????????????Parallel???????????????????????????????????????????????????????????????????100 * 10 ????????о??????????????????????????????????????????????????????????????
Parallel.For(1?? 1000?? i =>
Parallel.For(1?? 5?? case_number =>
LoginScenario(case_number)
.run_by(runner)
));
??????:??????????DSL
???????????????????????????????????DSL?????????????????????????????????????ɡ????????????????У??????????????????Web?????????????????????????URL??????????????????ο?????????????????
private static Scenario LoginScenario(int case_number)
{
return
UI.context(Keys.Context.District.with_value(DistrictIdentifier.of("03")))
.to<UserLoginGet>()
.then(
UI.input(SystemPayloadKeys.Account.with_value(string.Format("test{0}@skight.com"?? case_number)))
.and_input(SystemPayloadKeys.Password.with_value("123456"))
.to<UserLoginPost>());
}