51Testing软件测试论坛
标题:
需要关联的值在关联函数前产生,如何能关联到这个新值
[打印本页]
作者:
prettyxd
时间:
2013-7-31 11:46
标题:
需要关联的值在关联函数前产生,如何能关联到这个新值
web_url("toPubJobBefore.do_2",
"URL=http://linfen.lgs.com/lgs/joinUs/toPubJobBefore.do?oneNameId=000000003b6020b0013b6520cd7d0472",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=http://linfen.lgs.com/lgs/joinUs/toPubJobBefore.do?oneNameId=",
"Snapshot=t9.inf",
"Mode=HTML",
LAST);
web_submit_data("pubJobBefore.do",
"Action=http://linfen.lgs.com/lgs/joinUs/pubJobBefore.do",
"Method=POST",
"TargetFrame=",
"RecContentType=text/plain",
"Referer=http://linfen.lgs.com/lgs/joinUs/toPubJobBefore.do?oneNameId=000000003b6020b0013b6520cd7d0472",
"Snapshot=t10.inf",
"Mode=HTML",
ITEMDATA,
"Name=oneId", "Value=000000003b6020b0013b652184d60473", ENDITEM,
LAST);
/* Registering parameter(s) from source task id 126
// {WCSParam2} = "ff8080814018ad1901402e0957e20040"
// */
web_reg_save_param("WCSParam2",
"LB/IC=input type=\"hidden\" id=\"jid\" name=\"jid\" value=\"",
"RB/IC=\"/",
"Ord=1",
LAST);
web_url("toAdd.do",
"URL=http://linfen.lgs.com/lgs/joinUs/toAdd.do?id=ff8080814018ad1901402e0957e20040",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=http://linfen.lgs.com/lgs/joinUs/toPubJobBefore.do?oneNameId=000000003b6020b0013b6520cd7d0472",
"Snapshot=t11.inf",
"Mode=HTML",
EXTRARES,
"URL=../ckeditor/config.js?t=C3HA5RM", "Referer=http://linfen.lgs.com/lgs/joinUs/toAdd.do?id={WCSParam2}", ENDITEM,
"URL=../ckeditor/skins/kama/editor.css?t=C3HA5RM", "Referer=http://linfen.lgs.com/lgs/joinUs/toAdd.do?id={WCSParam2}", ENDITEM,
"URL=../ckeditor/lang/zh-cn.js?t=C3HA5RM", "Referer=http://linfen.lgs.com/lgs/joinUs/toAdd.do?id={WCSParam2}", ENDITEM,
"URL=../ckeditor/skins/kama/images/sprites_ie6.png", "Referer=http://linfen.lgs.com/lgs/joinUs/toAdd.do?id={WCSParam2}", ENDITEM,
"URL=../ckeditor/skins/kama/icons.png", "Referer=http://linfen.lgs.com/lgs/joinUs/toAdd.do?id={WCSParam2}", ENDITEM,
"URL=../ckeditor/contents.css", "Referer=http://linfen.lgs.com/lgs/joinUs/toAdd.do?id={WCSParam2}", ENDITEM,
"URL=../ckeditor/plugins/styles/styles/default.js?t=C3HA5RM", "Referer=http://linfen.lgs.com/lgs/joinUs/toAdd.do?id={WCSParam2}", ENDITEM,
LAST);
lr_think_time(36);
复制代码
代码如上。。。
问题是:web_submit_data("pubJobBefore.do",这段代码执行完后,就会生成一个新的主键,产生新的一条数据,但是关联函数是在web_url("toAdd.do",这段代码后才能找到匹配的左右边界,所以每次关联到的数据库主键,仍然是录制脚本时的,所以提交后的记录实际是update,而不是add。
该如何能让关联函数取到新产生的那个主键呢?
备注:把关联函数如果加到web_submit_data("pubJobBefore.do",这个之前,就会报错,找不到匹配的左右边界值。。。。
作者:
398073412
时间:
2013-7-31 16:10
你录制时的主键id是不是=ff8080814018ad1901402e0957e20040 ??
第38行的id要换成参数{WCSParam2}吧
"URL=http://linfen.lgs.com/lgs/joinUs/toAdd.do?id=ff8080814018ad1901402e0957e20040",
把所有的
ff8080814018ad1901402e0957e20040
换成
{WCSParam2}
试试
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2