首页 新闻 赞助 找找看

qtp中datatable导入excel工作表发生常规错误

0
悬赏园豆:10 [已关闭问题] 关闭于 2019-01-03 15:22
qtp脚本如下
'1、目录生成
Dim testpath
testpath=Environment.Value("TestDir")
testpaths=split(testpath,"testscript")
'msgbox testpaths(0)
executefile testpaths(0)& "commomlib通用函数\creat folder.vbs"
genfolder testpaths(0)&"testlog"
genfolder testpaths(0)&"testpic"

'2、测试用例加载
'判断测试用例是否存在
Dim fso
Dim oacaseexist
Dim casepath
casepath =testpaths(0)&"testcase\oacase.xlsx"
Set fso=createobject("scripting.filesystemobject")
oacaseexist=fso.FileExists(casepath)
If oacaseexist Then
    'datatable.ImportSheet casepath,"Login",1,"Action1"
    datatable.ImportSheet casepath,"Login","Action1"这句有问题
else
    reporter.ReportEvent micFail,"Login test","测试用例不存在"
    ExitTest 
End If

'3、日志生成
'4、应用程序启动
openapp "iexplore.exe","iexplore.exe","http://w.oa.cn"
Sub OpenApp(APPName,AppPath,AppParam)
    Dim gobj,wsh,proc
    Dim i
    On error resume next
    Set gobj=getobject("winmgmts:\\.\root\cimv2")
    Set wsh=createobject("wscript.shell")
    Set proc=gobj.execquery("select * from win64_process where name="&"'"&AppName&"'")
    For each i in proc
        systemutil.CloseProcessByName(AppName)
        wscript.quit
    Next
End Sub
'5、测试对象加载
loadtrs testpaths(0)&"testobject对象\login.tsr"
Sub loadtrs(trsname)
    repositoriescollection.RemoveAll
    repositoriescollection.Add trsname
End Sub

executefile "F:\oatest\testscript\login.vbs"
肥兔one的主页 肥兔one | 菜鸟二级 | 园豆:202
提问于:2018-05-23 16:30
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册