0

我们最近从 QTP 11 升级到了 UFT 12。我用于 QTP 11 的 vbscript 运行良好,但它不能与 UFT 12 一起运行。它说

“无法解析对变量或参数‘IDS_BC’的引用。”

它说它可能未定义或超出范围。IDS_BC 似乎在PDetails.xslUFT 的文件中,但我不想修改该文件。任何帮助将不胜感激。谢谢你。

这是代码:

Set xmlSource = CreateObject("MSXML.DOMDocument")
Set xmlXForm = CreateObject("MSXML.DOMDocument")

xmlSource.validateOnParse = True
xmlXForm.validateOnParse = True
xmlSource.async = False
xmlXForm.async = False

xmlSource.Load "\\cpsrv01\wwwroot\QA\QTPScripts\Curriculum_Pathways\TestResults\Server Actions\AppServers\Report\Results.xml"

If Err.Number <> 0 Then
    strErr = Err.Description & vbCrLf
    strErr = strErr & xmlSource.parseError.reason & " line: " & xmlSource.parseError.Line & " col: " & xmlSource.parseError.linepos & " text: " & xmlSource.parseError.srcText
    MsgBox strErr, vbCritical, "Error loading the XML"
End If

xmlXForm.Load "C:\Program Files (x86)\HP\Unified Functional Testing\dat\PDetails.xsl"

If Err.Number <> 0 Then
    strErr = Err.Description & vbCrLf
    strErr = strErr & xmlSource.parseError.reason & " line: " & xmlSource.parseError.Line & " col: " & xmlSource.parseError.linepos & " text: " & xmlSource.parseError.srcText
    MsgBox strErr, vbCritical, "Error loading the Transform"
End If

strResult = xmlSource.transformNode(xmlXForm)

If Err.Number <> 0 Then
    strErr = Err.Description & vbCrLf
    strErr = strErr & xmlSource.parseError.reason & " line: " & xmlSource.parseError.Line & " col: " & xmlSource.parseError.linepos & " text: " & xmlSource.parseError.srcText
    MsgBox strErr, vbCritical, "Error loading the Transform"
End If

Set fso = CreateObject("Scripting.FileSystemObject")
strPath = "\\cpsrv01\wwwroot\QA\QTPScripts\Curriculum_Pathways\TestResults\Server Actions\AppServers\Report\TestResults_" & TimeStamp & ".html"
Set file = fso.opentextfile(strPath, ForWriting, True)
file.write strResult
Set file2 = fso.GetFile(strPath)
file2.copy ("\\cpsrv01\wwwroot\QA\QTPScripts\Curriculum_Pathways\AppServerResults\")
file.close

这是.xsl

<xsl:template match="Doc">
<xsl:choose>
    <xsl:when test="@type = 'BC'">  
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr><td class="iteration_head" bgcolor="gray"><xsl:copy-of select="$IDS_BC"/><xsl:value-of select="DName"/>
            <xsl:if test="@BCIter">(Iteration <xsl:value-of select="@BCIter"/>) </xsl:if>
            </td></tr>              
            <tr>
4

0 回答 0