51Testing软件测试论坛

标题: 如何使DB output value 返回空时,测试结果集不报错 [打印本页]

作者: yxh1981    时间: 2009-4-15 11:06
标题: 如何使DB output value 返回空时,测试结果集不报错
插入一个DB output value
DbTable("DbTable").Output CheckPoint("DbTable")

当查询结果返回为空时(我把这种情况作为一种正常情况),
希望结果测试结果集不显示为报错

如何操作?
作者: yxh1981    时间: 2009-4-15 11:08
用的是qtp9.2
作者: wugecat    时间: 2009-4-15 11:31
是不是没有找到对象呀,怎么报错了?报什么错,说清楚点
作者: yxh1981    时间: 2009-4-15 13:25
数据库连接与sql都对的,当查询语句返回空时,测试结果中检查点报错,我不想让它作为Fail

The checkpoint failed because the query returned an empty result set. You specified the following dbtable property values: Connection string: (null). Source: select *** from *** where charname='yxh333'.
作者: wugecat    时间: 2009-4-15 14:17
转换以下了 把null 赋值成""
作者: yxh1981    时间: 2009-4-15 15:06
出来的时候就已经做为一个failure,只有在做output value 这里加相关东东,我记得是有个相关函数/方法的
作者: wugecat    时间: 2009-4-15 15:40
数据库链接和执行SQL的方法可以自己写一个,网上有很多。不需要用QTP的。这样你就可以控制返回值了。
作者: tank1295969    时间: 2011-2-23 18:16
能说的再具体点吗?
作者: willsmas    时间: 2011-2-23 23:27
执行 on error next resume
错误信息可以写到日志里面
if err.number<>0 then
创建文件对象,利用文件流把错误信息写到txt文本里
作者: tank1295969    时间: 2011-2-24 10:49
问题解决了,谢谢大大~~




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