|
创建测试脚本的第一步,还是要先了解被测的程序,知道被测程序需要用什么协议来录制,比如说我们今天测试的phpwind程序使用的就是Http协议,同时也带有Ajax协议,了解了程序协议后,我们就可以开始创建测试脚本了。打开SilkPerformer,弹出的第一个窗口,显示的是SilkPerformer的注册信息,如下图所示:
如图所示显示的是评估的License,还剩余45天的试用时间。同时还显示了SilkPerformer的版本及版本号,发布时间等信息。
选择“File”—“New Project”,弹出如下图所示的窗口:
选择协议HTML/HTTP,并输入项目名称,选择“Next”,弹出录制窗口,如下图所示:
其中“Application Profile”里选择浏览器的类型,同时也可以通过“Setting”来完成浏览器的配置;“URL”里输入程序访问地址;“Start recording”开始录制;“Record Over a Secure Connection”通过加密方式连接,主要是针对https的访问协议来开始录制的。
选择“Start recording”进入录制状态。今天我们主要完成论坛的登录,然后进行发帖操作。如下图所示:
操作完成后点击“停止”按钮,如下图所示:
保存脚本后,需要再次点击录制工具条上的“关闭”按钮来完成此次录制脚本的退出,如下图所示:
脚本代码如下:
// ----------------------------------------------------------------------
// Recorded 2013/9/16 by Silk Performer Recorder v10.0.0.5729
// ----------------------------------------------------------------------
// Rule set "ASP.NET ViewState"
// * Rule "Parse and Replace __VIEWSTATE"
// * Rule "Parse and Replace __EVENTVALIDATION"
// ----------------------------------------------------------------------
@codepage(936)
benchmark SilkPerformerRecorder
use "WebAPI.bdh"
dcluser
user
VUser
transactions
TInit : begin;
TMain : 1;
var
dclrand
dcltrans
transaction TInit
begin
WebSetBrowser(WEB_BROWSER_MSIE9);
WebModifyHttpHeader("Accept-Language", "zh-CN");
//WebSetUserBehavior(WEB_USERBEHAVIOR_FIRST_TIME);
//WebSetDocumentCache(true, WEB_CACHE_CHECK_SESSION);
end TInit;
transaction TMain
var
hWeb0 : number;
hWebStoredCtx_phpwind_Powered_by_phpwind : number;
begin
SetEncoding("UTF-8");
WebCookieSet("444fc_lastpos=index; path=/phpwind_UTF8_8.7/upload; expires=Sat, 16 Sep 2023 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("444fc_ol_offset=98; path=/phpwind_UTF8_8.7/upload; expires=Sat, 16 Sep 2023 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("444fc_ipstate=1378089529; path=/phpwind_UTF8_8.7/upload; expires=Sat, 16 Sep 2023 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("444fc_cloudClientUid=1025552; path=/phpwind_UTF8_8.7/upload; expires=Sat, 16 Sep 2023 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("444fc_jobpop=0; path=/phpwind_UTF8_8.7/upload; expires=Sat, 16 Sep 2023 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet(
"444fc_lastvisit=0%091378090678%09%2Fphpwind_UTF8_8.7%2Fupload%2Findex.php; path=/phpwind_UTF8_8.7/upload; expires=Sat, 1"
"6 Sep 2023 07:05:13 GMT", "http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("444fc_ci=index%091378090678%09%09; path=/phpwind_UTF8_8.7/upload; expires=Sat, 16 Sep 2023 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("2c63b_lastpos=index; path=/; expires=Tue, 16 Sep 2014 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("2c63b_ol_offset=98; path=/phpwind_UTF8_8.7/upload; expires=Sat, 16 Sep 2023 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("2c63b_ipstate=1379311228; path=/phpwind_UTF8_8.7/upload; expires=Sat, 16 Sep 2023 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("2c63b_cloudClientUid=5348525; path=/phpwind_UTF8_8.7/upload; expires=Sat, 16 Sep 2023 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("2c63b_threadlog=%2C2%2C; path=/; expires=Tue, 16 Sep 2014 07:09:37 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("2c63b_jobpop=0; path=/; expires=Tue, 16 Sep 2014 07:09:29 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet(
"2c63b_readlog=%2C93%2C94%2C95%2C96%2C97%2C98%2C99%2C100%2C101%2C102%2C; path=/; expires=Tue, 16 Sep 2014 07:11:04 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet(
"2c63b_bubble=a%3A2%3A%7Bs%3A17%3A%22pw_all_tip_tucool%22%3Bi%3A1%3Bs%3A19%3A%22pw_all_tip_usercard%22%3Bi%3A1%3B%7D; pat"
"h=/phpwind_UTF8_8.7/upload; expires=Sat, 16 Sep 2023 07:05:13 GMT", "http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("2c63b_clearm_2=3; path=/phpwind_UTF8_8.7/upload; expires=Sat, 16 Sep 2023 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("editmode=0; path=/phpwind_UTF8_8.7/upload; expires=Sat, 16 Sep 2023 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("hasplmlang=_int_; path=/phpwind_UTF8_8.7/upload; expires=Sat, 16 Sep 2023 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet(
"2c63b_lastvisit=0%091379311228%09%2Fphpwind_UTF8_8.7%2Fupload%2Findex.php; path=/; expires=Tue, 16 Sep 2014 07:05:13 GMT"
, "http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebCookieSet("2c63b_ci=index%091379311228%09%09; path=/; expires=Tue, 16 Sep 2014 07:05:13 GMT",
"http://localhost:8000/phpwind_UTF8_8.7/upload/");
WebPageParseUrl("Variable 'url' in page phpwind - Powered by phpwind", "var url=\"", "\"", WEB_FLAG_IGNORE_WHITE_SPACE);
WebPageParseUrl("value", "value=\"", "\"", WEB_FLAG_IGNORE_WHITE_SPACE);
WebPageUrl("http://localhost:8000/phpwind_UTF8_8.7/upload/", "phpwind - Powered by phpwind");
WebPageStoreContext(hWebStoredCtx_phpwind_Powered_by_phpwind);
ThinkTime(5.2);
WebPageLink("Variable 'url' in page phpwind - Powered by phpwind", "init.php");
WebModifyHttpHeader("Accept-Language", "zh-CN");
WebPageSetActionUrlAbs("http://localhost:8000/phpwind_UTF8_8.7/upload/login.php", PHPWIND_UTF8_8_7_UPLOAD_LOGIN_PH008);
WebPageSubmit("login_FORM", LOGIN_FORM007, "login.php", 1, NULL, hWebStoredCtx_phpwind_Powered_by_phpwind); // Form 1
WebPageAddUrl("images/down.png");
WebPageAddUrl("images/g/facebg_a.png");
WebPageAddUrl("images/job/doupdatedata.gif");
WebPageAddUrl("images/job/doupdateavatar.gif");
WebPageAddUrl("images/job/doaddfriend.gif");
WebPageAddUrl("images/job/dosendmessage.gif");
WebPageAddUrl("images/job/menu_tasksA.png");
WebPageLink("value", "phpwind - Powered by phpwind (#1)", 1, NULL, hWebStoredCtx_phpwind_Powered_by_phpwind);
WebPageLink("Variable 'url' in page phpwind - Powered by phpwind", "init.php (#1)", 1, NULL,
hWebStoredCtx_phpwind_Powered_by_phpwind);
WebPageUrl("http://localhost:8000/phpwind_UTF8_8.7/upload/pw_ajax.php", "pw_ajax.php", PHPWIND_UTF8_8_7_UPLOAD_PW_AJAX_009);
// Ajax identified
ThinkTime(2.6);
WebPageForm("http://localhost:8000/phpwind_UTF8_8.7/upload/pw_ajax.php", PHPWIND_UTF8_8_7_UPLOAD_PW_AJAX_010,
"pw_ajax.php (#1)", PHPWIND_UTF8_8_7_UPLOAD_PW_AJAX_011);
WebPageAddUrl("images/wind/post.png", PHPWIND_UTF8_8_7_UPLOAD_IMAGES_W012);
WebPageAddUrl("images/pwicon/checkbox.png");
WebPageAddUrl("images/wind/thread/sideicon.gif");
WebPageAddUrl("images/wind/hB.png");
WebPageAddUrl("images/pw_all_tip.png");
ThinkTime(5.5);
WebPageLink(ToEncoding("默认版块"), "默认版块 - phpwind - Powered by phpwind", 1, NULL, hWebStoredCtx_phpwind_Powered_by_phpwind);
// Link 35
WebPageLink("Variable 'url' in page phpwind - Powered by phpwind", "init.php (#2)", 1, NULL,
hWebStoredCtx_phpwind_Powered_by_phpwind);
WebPageBack();
WebPageAddUrl("js/breeze/editor/editor.js", PHPWIND_UTF8_8_7_UPLOAD_JS_BREEZ013);
WebPageAddUrl("images/input_down.png");
WebPageAddUrl("images/pwicon/at.png");
WebPageAddUrl("images/pwicon/ms_tips.png");
WebPageAddUrl("js/breeze/core/dom.js", PHPWIND_UTF8_8_7_UPLOAD_JS_BREEZ014);
WebPageAddUrl("js/breeze/core/event.js", PHPWIND_UTF8_8_7_UPLOAD_JS_BREEZ015);
WebPageAddUrl("js/breeze/editor/ubb.js", PHPWIND_UTF8_8_7_UPLOAD_JS_BREEZ016);
WebPageAddUrl("js/breeze/editor/style/full.png");
WebPageAddUrl("js/breeze/app/at.js", PHPWIND_UTF8_8_7_UPLOAD_JS_BREEZ017);
WebPageAddUrl("js/breeze/editor/style/B_ico.png");
WebPageAddUrl("js/breeze/util/localStorage.js", PHPWIND_UTF8_8_7_UPLOAD_JS_BREEZ018);
WebPageAddUrl("images/post/c_editor/w_edit_but.png");
ThinkTime(44.9);
WebPageLink(ToEncoding("发帖"), "phpwind - Powered by phpwind (#2)"); // Link 49
WebPageSetActionUrlAbs("http://localhost:8000/phpwind_UTF8_8.7/upload/post.php", PHPWIND_UTF8_8_7_UPLOAD_POST_PHP019);
ThinkTime(39.3);
WebPageSubmitBin(NULL, "-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"magicname\"\r\n"
"\r\n"
"\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"magicid\"\r\n"
"\r\n"
"\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"verify\"\r\n"
"\r\n"
"00b95046\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"cyid\"\r\n"
"\r\n"
"0\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"ajax\"\r\n"
"\r\n"
"1\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"iscontinue\"\r\n"
"\r\n"
"0\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"atc_title\"\r\n"
"\r\n"
"testfatie001\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"atc_content\"\r\n"
"\r\n"
"testfatie001\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"usernames\"\r\n"
"\r\n"
"\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"atc_tags\"\r\n"
"\r\n"
"\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"atc_money\"\r\n"
"\r\n"
"0\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"atc_credittype\"\r\n"
"\r\n"
"money\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"atc_rvrc\"\r\n"
"\r\n"
"0\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"replyrewardcredit\"\r\n"
"\r\n"
"money\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"replyreward[replyrewardnum]\"\r\n"
"\r\n"
"\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"replyreward[replyrewardtimes]\"\r\n"
"\r\n"
"\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"replyreward[replyrewardreptimes]\"\r\n"
"\r\n"
"1\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"replyreward[replyrewardchance]\"\r\n"
"\r\n"
"10\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"atc_usesign\"\r\n"
"\r\n"
"1\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"atc_autourl\"\r\n"
"\r\n"
"1\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"atc_convert\"\r\n"
"\r\n"
"1\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"step\"\r\n"
"\r\n"
"2\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"pid\"\r\n"
"\r\n"
"\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"action\"\r\n"
"\r\n"
"new\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"fid\"\r\n"
"\r\n"
"2\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"tid\"\r\n"
"\r\n"
"0\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"article\"\r\n"
"\r\n"
"0\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"special\"\r\n"
"\r\n"
"0\r\n"
"-----------------------------7dd31d120d6e\r\n"
"Content-Disposition: form-data; name=\"_hexie\"\r\n"
"\r\n"
"31d58c03\r\n"
"-----------------------------7dd31d120d6e--\r\n", STRING_COMPLETE,
"multipart/form-data; boundary=---------------------------7dd31d120d6e", "post.php"); // Form 1
WebPageAddUrl("images/wind/reply.png", PHPWIND_UTF8_8_7_UPLOAD_IMAGES_W021);
WebPageAddUrl("images/wind/read/yin.gif");
WebPageAddUrl("images/online.gif");
WebPageAddUrl("images/pre.png");
WebPageAddUrl("images/wind/read/userOper.gif");
WebPageAddUrl("images/pwicon/read_prev.png");
WebPageAddUrl("images/wind/breadEm.png");
WebPageAddUrl("images/pwicon/shareAll.png");
WebPageAddUrl("images/pwicon/add_home.png");
WebPageAddUrl("images/pwicon/add_fri.png");
WebPageAddUrl("images/pwicon/add_pro.png");
WebPageAddUrl("images/post/smile/default/3.gif");
WebPageAddUrl("images/post/smile/default/9.gif");
WebPageAddUrl("images/post/smile/default/2.gif");
WebPageAddUrl("images/post/smile/default/6.gif");
WebPageAddUrl("images/post/smile/default/5.gif");
WebPageAddUrl("images/post/smile/default/7.gif");
WebPageAddUrl("images/post/smile/default/8.gif");
WebPageAddUrl("images/post/smile/default/4.gif");
WebPageAddUrl("images/post/smile/default/1.gif");
WebPageAddUrl("images/post/smile/default/10.gif");
WebPageAddUrl("images/post/smile/default/11.gif");
WebPageAddUrl("images/post/smile/default/12.gif");
WebPageAddUrl("images/post/smile/default/13.gif");
WebPageAddUrl("images/post/smile/default/14.gif");
WebPageAddUrl("images/post/fp_editor_bg.png");
WebPageUrl("http://localhost:8000/phpwind_UTF8_8.7/upload/read.php", "testfatie001|默认版块 - phpwind - Powered by phpwind",
PHPWIND_UTF8_8_7_UPLOAD_READ_PHP020);
WebPageLink("Variable 'url' in page phpwind - Powered by phpwind", "init.php (#3)", 1, NULL,
hWebStoredCtx_phpwind_Powered_by_phpwind);
WebPageDeleteContext(hWebStoredCtx_phpwind_Powered_by_phpwind);
ThinkTime(13.7);
WebUrl("http://localhost:8000/phpwind_UTF8_8.7/upload/u/images/next.cur", 0.00);
WebUrl("http://localhost:8000/phpwind_UTF8_8.7/upload/u/images/pre.cur", 0.00);
WebUrl("http://localhost:8000/phpwind_UTF8_8.7/upload/images/blank.gif", 0.06);
WebUrl("http://localhost:8000/phpwind_UTF8_8.7/upload/images/search/pImg.png", 0.00);
WebUrl("http://localhost:8000/phpwind_UTF8_8.7/upload/images/search/pImg_close.png", 47.22);
WebTcpipConnect(hWeb0, "42.120.63.85", WEB_PORT_HTTP); // Port: 80
WebTcpipShutdown(hWeb0);
end TMain;
dclform
EXT_CHECKUPDATE001:
"classname" := "0012",
"uid" := "5vh6n1zm",
"ieVersion" := "9.0.8112.16421";
EXT_SEARCHENGINES002:
"version" := "3.5.6.6",
"application" := "undefined",
"pid" := "ri012",
"locale" := "zh";
EXT_NOTIFICATION003:
"uid" := "5vh6n1zm",
"pid" := "ri012",
"version" := "3.5.6.6";
S_GIF004:
"p" := "0012",
"u" := "5vh6n1zm",
"v" := "3.5.6.6",
"t" := "1379315108",
"s" := "553501721769869511b393ecfe475302",
"a" := "check";
EXT_SITECONFIG005:
"locale" := "zh",
"version" := "3.5.6.6",
"pid" := "ri012",
"uid" := "5vh6n1zm";
S_GIF006:
"a" := "up",
"p" := "ri012",
"u" := "5vh6n1zm",
"v" := "3.5.6.6",
"t" := "1379315124",
"c" := "XnRdCg3NIz8CATr3HRq7UdFe";
LOGIN_FORM007:
"jumpurl" := "" <USE_HTML_VAL> , // hidden, unchanged, value: "http://localhost:8000/phpwind_UTF8_8.7/uplo
// ad/index.php"
"step" := "" <USE_HTML_VAL> , // hidden, unchanged, value: "2"
"ajax" := "" <USE_HTML_VAL> , // hidden, unchanged, value: "1"
"pwuser" := "test1", // changed
"pwpwd" := Decrypt3DES("B8MP+eevV0TEKGKCw9bkm8U="), // changed
"lgt" := "" <USE_HTML_VAL> ; // hidden, unchanged, value: "0"
PHPWIND_UTF8_8_7_UPLOAD_LOGIN_PH008:
"nowtime" := "1379315366661",
"verify" := "68b3e2c8";
PHPWIND_UTF8_8_7_UPLOAD_PW_AJAX_009:
"action" := "jobpop",
"nowtime" := "1379315369331",
"verify" := "00b95046";
PHPWIND_UTF8_8_7_UPLOAD_PW_AJAX_010:
"job" := "cookie",
"v" := "1";
PHPWIND_UTF8_8_7_UPLOAD_PW_AJAX_011:
"action" := "jobpop",
"nowtime" := "1379315371921",
"verify" := "00b95046";
PHPWIND_UTF8_8_7_UPLOAD_IMAGES_W012:
"" := "101129";
PHPWIND_UTF8_8_7_UPLOAD_JS_BREEZ013:
"v" := "1.0.1109";
PHPWIND_UTF8_8_7_UPLOAD_JS_BREEZ014:
"v" := "1.0.1109";
PHPWIND_UTF8_8_7_UPLOAD_JS_BREEZ015:
"v" := "1.0.1109";
PHPWIND_UTF8_8_7_UPLOAD_JS_BREEZ016:
"v" := "1.0.1109";
PHPWIND_UTF8_8_7_UPLOAD_JS_BREEZ017:
"v" := "1.0.1109";
PHPWIND_UTF8_8_7_UPLOAD_JS_BREEZ018:
"v" := "1.0.1109";
PHPWIND_UTF8_8_7_UPLOAD_POST_PHP019:
"fid" := "2",
"nowtime" := "1379315461796",
"verify" := "00b95046";
PHPWIND_UTF8_8_7_UPLOAD_READ_PHP020:
"tid" := "103",
"ds" := "1";
PHPWIND_UTF8_8_7_UPLOAD_IMAGES_W021:
"" := "101129"; |
|