我们最近从QTP 11升级到UFT 12.我用于QTP 11的vbscript工作得很好,但它没有运行UFT 12.它说
"对变量或参数' IDS_BC'的引用无法解决。“
它说它可能未定义或超出范围。 IDS_BC似乎位于UFT的PDetails.xsl
文件中,但我不想修改该文件。任何帮助将不胜感激。谢谢。
以下是代码:
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>