求助qtp关于数据库一列值的验证(从库中查出一组小数的数据然后和预期值进行比对)
想对某人的还款计划的本金进行检查(12行数据),打算的是用函数从数据库中取出来值,然后和期望值进行比对,但是发现问题如下:1、期望值只能为整数,而我的输出值为2精度的DECIMAL类型的数值,这点让人很郁闷,难道期望值不能为小数吗?
2、多行转列后无法输出为333.33,444.44或222.22|555.55类型,就算我将.替换为0,333033进行比对,但是12期的值就很长了,直接期望值给我科学计数法计算了,导致不论怎么比都是失败的。
麻烦哪位大神能帮看看....
或者有能和excel比对的方法也行
反正要实现的就是从库中查出一组小数的数据然后和预期值进行比对
sql转换前:select group_concat(RETURNSUM) as test from cr_returnplan where cifno = '10000034' and pactno in (select pactno from cr_pactmanage where appno in (select appno from cr_apply where useexp = 'yyy'))order by termnum;
sql转换后:select group_concat(conv(( RETURNSUM ) , 10, 10 ) separator"0" ) as test from cr_returnplan where cifno = '10000034' and pactno in (select pactno from cr_pactmanage where appno in (select appno from cr_apply where useexp = 'yyy'))order by termnum;
自定义了一个数据库验证函数 :
Function VerifySQLDaTa(conStr,sqlStr,verifyProperty,expectValue)
Set adoConn = CreateObject("ADODB.connection")
adoConn.Open conStr
Set adoRst = adoConn.Execute(sqlStr)
actualValue = adoRst.Fields.Item(verifyProperty).value
If CStr(expectValue)= CStr(actualValue) Then
Reporter.ReportEvent micPass,"sql_data_check","[ expectValue = actualValue = " + CStr(actualValue)+"]"
Else
Reporter.ReportEvent micFail,"sql_data_check","[ expectValue = " + cstr(expectValue) + " ;actualValue = " + cstr(actualValue)+" ]"
End If
adoConn.Close
Set ado = Nothing
End Function
Environment.LoadFromFile "d:\qtpconfig\sqlconfig.xml"
verifySQLDaTa Environment.Value("ConnStr"),Environment.value("sqlStr"), "test",84250842508425084250842508425084250842508425084250842508426
xml:
<Environment>
<Variable>
<Name>ConnStr</Name>
<Value>DRIVER={MySQL ODBC 3.51 Driver}; DATABASE=xedk;DSN=loan;OPTION=0;PWD=admin;PORT=3306;SERVER=192.168.2.223;UID=xedk</Value>
</Variable>
<Variable>
<Name>sqlStr</Name>
<Value>select RETURNSUM as test from cr_returnplan where cifno = '10000034' and pactno in (select pactno from cr_pactmanage where appno in (select appno from cr_apply where useexp = 'yyy'))order by termnum;
</Value>
</Variable>
</Environment> 这个问题 有点难 还不会 学习 只是从数据库查了下数据并且用MSGBOX看了下效果(怕动坏了数据领导骂,QTP的数据操作没怎么实践o(╯□╰)o),依据个人理解,你的问题出在期望值那里,将EXCEL里的期望数据格式改成文本格式试试(*^__^*) 要是也不行给个回音,我也去试试~
页:
[1]