zoukankan      html  css  js  c++  java
  • QC中UploadResource的用法

    API文档不详细,摸索半天,终于找到解决办法:

    Function uploadTestResultToQC
     Set objPath  = CreateObject("Scripting.FileSystemObject")
     If Not objPath.FileExists("C:\test\test.xls") Then
        msgbox "not exist  file"
        ExitTest
     End If
     Set objPath = nothing
        Set ResourceFactory = QCConnection.QCResourceFactory      '事先得连接上QC          
     Set ResourceFilter =  ResourceFactory.Filter
        ResourceFilter.Filter("RSC_NAME")="test.xls"
        Set ResourceList =  ResourceFilter.NewList
        If   ResourceList.Count >0 Then
     For j=1 To ResourceList.Count                   
       Set ResourceFile = ResourceList.Item(j)    
       If  ResourceFile.name = "test.xls"Then
       ResourceFile.FileName = "test.xls"  'API文档上有说明,事先得给一个filename
       ResourceFile.post   '必须先post一下,要不然上传不了

       ResourceFile.UploadResource "C:\test\"&"",true  '路径后面一定要加上"",要不然也上传不成功,这是最关键的两点
       End If
     next 
     End If 
     Set ResourceFile = nothing
     Set ResourceFilter = nothing
     Set ResourceFactory = nothing
    end function

  • 相关阅读:
    信息安全系统设计基础实验五报告
    实验六报告
    实验五报告
    第六周学习总结
    实验四
    第五周学习总结
    第四周学习总结
    实验三报告
    《数据结构与面向对象程序设计》第二、三周学习总结
    20182319《数据结构与面向对象程序设计》实验二报告
  • 原文地址:https://www.cnblogs.com/zhangfei/p/2135391.html
Copyright © 2011-2022 走看看