51Testing软件测试论坛

标题: ajax协议实例探讨 [打印本页]

作者: flyven    时间: 2010-11-17 15:55
标题: ajax协议实例探讨
本帖最后由 flyven 于 2010-11-17 16:02 编辑

协议是ajax,下面是action中的脚本,脚本的目的是要创建一条记录
回放时日志报错误信息,但是系统中会创建一条记录,不过这条记录中的字段都是空值,为什么会是空值?别人给了我解决方法,但是我不知道怎么通过错误信息来分析,请高手对此进行分析




Action()
{

    lr_start_transaction("创建任务");

    web_submit_data("maintainTaskAC!createSearchTaskByDirect.action",
        "Action=http://s.sipo/neusipo/siposearch/maintainTaskAC!createSearchTaskByDirect.action",
        "Method=POST",
        "RecContentType=application/json",
        "Referer=http://s.sipo/neusipo/siposearch/direct_login_success.action",
        "Snapshot=t8.inf",
        "Mode=HTML",
        ITEMDATA,
        "Name=taskInfo", "Value={\"taskName\":\"ddd\",\"taskDetail\":\"dd\"}", ENDITEM,
        "Name=ess.bizlog.modulelevel", "Value=102.10201.1020103", ENDITEM,
        LAST);

    web_custom_request("keepAlive.action",
        "URL=http://s.sipo/neusipo/platform/keepAlive.action",
        "Method=POST",
        "Resource=0",
        "RecContentType=application/json",
        "Referer=http://s.sipo/neusipo/siposearch/direct_login_success.action",
        "Snapshot=t9.inf",
        "Mode=HTML",
        "EncType=",
        LAST);

    web_url("framework.action",
        "URL=http://s.sipo/neusipo/siposearch/framework.action",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=",
        "Snapshot=t10.inf",
        "Mode=HTML",
        LAST);

    web_custom_request("JsConfig_root.js",
        "URL=http://s.sipo/neusipo/platform/js/conf/JsConfig_root.js",
        "Method=POST",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t11.inf",
        "Mode=HTML",
        "EncType=",
        LAST);

    web_url("neusipo-common.js",
        "URL=http://s.sipo/neusipo/compile/neusipo-common.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t12.inf",
        "Mode=HTML",
        LAST);

    web_url("neusipo-first.js",
        "URL=http://s.sipo/neusipo/compile/neusipo-first.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t13.inf",
        "Mode=HTML",
        LAST);

    web_url("message_manager.js",
        "URL=http://s.sipo/neusipo/platform/message/message_manager.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t14.inf",
        "Mode=HTML",
        LAST);

    web_url("message_publish.js",
        "URL=http://s.sipo/neusipo/platform/message/message_publish.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t15.inf",
        "Mode=HTML",
        LAST);

    web_url("message_show.js",
        "URL=http://s.sipo/neusipo/platform/message/message_show.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t16.inf",
        "Mode=HTML",
        LAST);

    web_url("message_template.js",
        "URL=http://s.sipo/neusipo/platform/message/message_template.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t17.inf",
        "Mode=HTML",
        LAST);

    web_url("message_welcome.js",
        "URL=http://s.sipo/neusipo/platform/message/message_welcome.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t18.inf",
        "Mode=HTML",
        LAST);

    web_url("message.js",
        "URL=http://s.sipo/neusipo/platform/message/message.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t19.inf",
        "Mode=HTML",
        LAST);

    web_url("database_detail_view.js",
        "URL=http://s.sipo/neusipo/siposearch/tools/database/database_detail_view.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t20.inf",
        "Mode=HTML",
        LAST);

    web_url("menu.js",
        "URL=http://s.sipo/neusipo/siposearch/menu/menu.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t21.inf",
        "Mode=HTML",
        LAST);

    web_custom_request("databaseMetadataList!queryDatabaseMetadataListWithIndexCount.action",
        "URL=http://s.sipo/neusipo/prosearch/databaseMetadataList!queryDatabaseMetadataListWithIndexCount.action",
        "Method=POST",
        "Resource=0",
        "RecContentType=application/json",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t22.inf",
        "Mode=HTML",
        "EncType=",
        LAST);

    web_url("menuResource.js",
        "URL=http://s.sipo/neusipo/siposearch/menu/menuResource.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t23.inf",
        "Mode=HTML",
        LAST);

    web_url("sysmgr_onlinehelp_store.js",
        "URL=http://s.sipo/neusipo/siposearch/sysmgr/onlinehelp/sysmgr_onlinehelp_store.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t24.inf",
        "Mode=HTML",
        LAST);

    web_url("sysmgr_cognate.js",
        "URL=http://s.sipo/neusipo/siposearch/sysmgr/cognate/sysmgr_cognate.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t25.inf",
        "Mode=HTML",
        LAST);

    web_url("framework.js",
        "URL=http://s.sipo/neusipo/siposearch/framework/framework.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t26.inf",
        "Mode=HTML",
        LAST);

    web_url("ESSEncoder.js",
        "URL=http://s.sipo/neusipo/platform/js/ESSEncoder.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t27.inf",
        "Mode=HTML",
        LAST);

    web_url("current_version.js",
        "URL=http://s.sipo/neusipo/platform/version/current_version.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t28.inf",
        "Mode=HTML",
        LAST);

    web_custom_request("pollMessages!init.action",
        "URL=http://s.sipo/neusipo/platform/pollMessages!init.action",
        "Method=POST",
        "Resource=0",
        "RecContentType=application/json",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t29.inf",
        "Mode=HTML",
        "EncType=",
        LAST);

    web_url("PagingTreeLoader.js",
        "URL=http://s.sipo/neusipo/platform/js/PagingTreeLoader.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t30.inf",
        "Mode=HTML",
        LAST);

    web_url("detail_view_interface_component.js",
        "URL=http://s.sipo/neusipo/siposearch/z_view/fast_detail/interface/detail_view_interface_component.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t31.inf",
        "Mode=HTML",
        LAST);

    web_url("detail_view_interface_control.js",
        "URL=http://s.sipo/neusipo/siposearch/z_view/fast_detail/interface/detail_view_interface_control.js",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://s.sipo/neusipo/siposearch/framework.action",
        "Snapshot=t32.inf",
        "Mode=HTML",
        LAST);
lr_end_transaction("创建任务",LR_AUTO);

    return 0;
}
作者: flyven    时间: 2010-11-17 16:03
日志报错内容如下:

Action.c(130): Detected non-resource "http://s.sipo/siposearch/searching/strategy/epoque_search.jsp" in "http://s.sipo/neusipo/siposearch/menu/menu.js"          [MsgId: MMSG-26574]
Action.c(130): Detected non-resource "http://s.sipo/neusipo/siposearch/menu/'+ Ext.WEB_APP + '/siposearch/searching/medication/medication_search.jsp" in "http://s.sipo/neusipo/siposearch/menu/menu.js"          [MsgId: MMSG-26574]
Action.c(130): Detected non-resource "http://s.sipo/neusipo/siposearch/menu/' + * Ext.WEB_APP + '/prosearch/showSearchReportAC!showList.action" in "http://s.sipo/neusipo/siposearch/menu/menu.js"          [MsgId: MMSG-26574]
Action.c(130): Detected non-resource "http://s.sipo/neusipo/siposearch/menu/'+ Ext.WEB_APP+ '/prosearch/statistic/process_main_report.action?resultPage=process_effect" in "http://s.sipo/neusipo/siposearch/menu/menu.js"          [MsgId: MMSG-26574]
Action.c(130): Detected non-resource "http://s.sipo/neusipo/siposearch/menu/'+ Ext.WEB_APP+ '/prosearch/statistic/process_main_report.action?resultPage=process_use" in "http://s.sipo/neusipo/siposearch/menu/menu.js"          [MsgId: MMSG-26574]
Action.c(130): Detected non-resource "http://s.sipo/neusipo/siposearch/menu/'+ Ext.WEB_APP+ '/prosearch/statistic/process_main_report.action?resultPage=process_liter" in "http://s.sipo/neusipo/siposearch/menu/menu.js"          [MsgId: MMSG-26574]
Action.c(130): Detected non-resource "http://s.sipo/neusipo/siposearch/menu/'+ Ext.WEB_APP+ '/prosearch/statistic/process_main_report.action?resultPage=process_func" in "http://s.sipo/neusipo/siposearch/menu/menu.js"          [MsgId: MMSG-26574]
Action.c(130): Detected non-resource "http://s.sipo/neusipo/siposearch/menu/'+ Ext.WEB_APP+ '/prosearch/statistic/process_main_report.action?resultPage=process_time" in "http://s.sipo/neusipo/siposearch/menu/menu.js"          [MsgId: MMSG-26574]
Action.c(130): Error -26627: HTTP Status-Code=404 (Not Found) for "http://s.sipo/siposearch/searching/strategy/epoque_search.jsp"          [MsgId: MERR-26627]
Action.c(130): Error -26627: HTTP Status-Code=404 (Not Found) for "http://s.sipo/neusipo/siposearch/menu/'+ Ext.WEB_APP + '/siposearch/searching/medication/medication_search.jsp"          [MsgId: MERR-26627]
Action.c(130): Error -26627: HTTP Status-Code=404 (Not Found) for "http://s.sipo/neusipo/siposearch/menu/' + * Ext.WEB_APP + '/prosearch/showSearchReportAC!showList.action"          [MsgId: MERR-26627]
Action.c(130): Error -26627: HTTP Status-Code=404 (Not Found) for "http://s.sipo/neusipo/siposearch/menu/'+ Ext.WEB_APP+ '/prosearch/statistic/process_main_report.action?resultPage=process_effect"          [MsgId: MERR-26627]
Action.c(130): Error -26627: HTTP Status-Code=404 (Not Found) for "http://s.sipo/neusipo/siposearch/menu/'+ Ext.WEB_APP+ '/prosearch/statistic/process_main_report.action?resultPage=process_use"          [MsgId: MERR-26627]
Action.c(130): Error -26627: HTTP Status-Code=404 (Not Found) for "http://s.sipo/neusipo/siposearch/menu/'+ Ext.WEB_APP+ '/prosearch/statistic/process_main_report.action?resultPage=process_liter"          [MsgId: MERR-26627]
Action.c(130): Error -26627: HTTP Status-Code=404 (Not Found) for "http://s.sipo/neusipo/siposearch/menu/'+ Ext.WEB_APP+ '/prosearch/statistic/process_main_report.action?resultPage=process_func"          [MsgId: MERR-26627]
Action.c(130): Error -26627: HTTP Status-Code=404 (Not Found) for "http://s.sipo/neusipo/siposearch/menu/'+ Ext.WEB_APP+ '/prosearch/statistic/process_main_report.action?resultPage=process_time"          [MsgId: MERR-26627]
Action.c(130): web_url("menu.js") highest severity level was "ERROR", 34936 body bytes, 2286 header bytes          [MsgId: MMSG-26388]
Action.c(130): Notify: Transaction "创建任务" ended with "Fail" status (Duration: 4.5696).
作者: flyven    时间: 2010-11-17 18:05
没人顶呢?这么个好东西,是不是大家都是学习型的,工作中这个经常用到的,同志们呀
作者: PrefTest    时间: 2010-11-17 23:40
Error是404
这个页面请求出错了:
http://s.sipo/siposearch/searching/strategy/epoque_search.jsp

分析一下这个请求之前的脚本运行出了什么问题导致没能请求到这个页面
作者: flyven    时间: 2010-11-18 10:35
本帖最后由 flyven 于 2010-11-18 14:39 编辑

既然没人顶,那我公布解决方法:在web_submit_data()中添加ajax类型,如下,再运行,脚本通过,系统中创建了一条记录:(为什么需要添加AJAX类型,从报错信息中是怎么分析得出的?这个问题希望高手能指点)
web_submit_data("maintainTaskAC!createSearchTaskByDirect.action",
        "Action=http://s.sipo/neusipo/siposearch/maintainTaskAC!createSearchTaskByDirect.action",
        "Method=POST",
        "RecContentType=application/json",
        "Referer=http://s.sipo/neusipo/siposearch/direct_login_success.action",
        "Snapshot=t8.inf",
        "Mode=HTML",
        ITEMDATA,
       "Name=submit-type","Value=ajax",ENDITEM,
        "Name=taskInfo", "Value={\"taskName\":\"ddd\",\"taskDetail\":\"dd\"}", ENDITEM,
        "Name=ess.bizlog.modulelevel", "Value=102.10201.1020103", ENDITEM,
        LAST);
作者: androidone    时间: 2010-11-18 10:47





欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2