Forum Discussion
ory_z
14 years agoContributor
Thanks for the response.
Didn't quite have time to look at it until today...
We need the result in Text format (and not HTML) due to the fact that the whole idea behind the secondary logging functionality is that it is text based and can be tailed easily.
Adding ontop of that is the complexity of the functionality: When I use the Log.Error operation, the AdditionalInfo are passed as text. However when TestComplete logs an error (such as object not found), it passes it as HTML.
In any case I have changed my code as follows:
var HTML_Text = LogParams.AdditionalText;
var errorMessage = LogParams.MessageText
if ( HTML_Text.indexOf( "<html>" ) != -1 )
{
var re = /<p>.*<\/p>/;
errorMessage += "(" + HTML_Text.match(re) + ")";
}
else
errorMessage += "(" + HTML_Text + ")";
VIX.Logs.writeToExternalLog( "!!! ERROR - " + errorMessage );
But the result of the operation you suggested is still not that "clean", here is what HTML_Text.match(re) evaluates as:
The object does not exist. See Additional Information for details.(<p>An error occurred while calling the "Click" method or property of the "<a href="lnamemapping://{225B2166-C880-4BD1-BCCF-7A46171069A3}.{73626755-8CE9-4667-90D2-14EC71C4BB1B}">EnableDisableBtn</a>" object.<br/>The object or one of its parent objects does not exist.</p><h4>Tested Object</h4><table cellpadding="0" cellspacing="0" noborder><tbody><tr><td><b>Alias:</b></td><td>Aliases.RIOS_SSC32.Play.EnableDisableBtn</td><tr><td><b>Mapping item:</b></td><td>NameMapping.Sys.RIOS_SSC32.Play.EnableDisableBtn</td></tr></tbody></table><h4>Missing Object</h4><table><tbody><tr><td><b>Alias:</b></td><td>Aliases.RIOS_SSC32</td><tr><td><b>Mapping item:</b></td><td>NameMapping.Sys.RIOS_SSC32</td></tr></tbody></table><p style="margin-top: 12px;"><a href="aqa-help://2201">Possible causes of the error</a></p>)
Unfortunately I'm not proficient enough with Regular Expression in order to try and fix it.
Other suggestions?
Didn't quite have time to look at it until today...
We need the result in Text format (and not HTML) due to the fact that the whole idea behind the secondary logging functionality is that it is text based and can be tailed easily.
Adding ontop of that is the complexity of the functionality: When I use the Log.Error operation, the AdditionalInfo are passed as text. However when TestComplete logs an error (such as object not found), it passes it as HTML.
In any case I have changed my code as follows:
var HTML_Text = LogParams.AdditionalText;
var errorMessage = LogParams.MessageText
if ( HTML_Text.indexOf( "<html>" ) != -1 )
{
var re = /<p>.*<\/p>/;
errorMessage += "(" + HTML_Text.match(re) + ")";
}
else
errorMessage += "(" + HTML_Text + ")";
VIX.Logs.writeToExternalLog( "!!! ERROR - " + errorMessage );
But the result of the operation you suggested is still not that "clean", here is what HTML_Text.match(re) evaluates as:
The object does not exist. See Additional Information for details.(<p>An error occurred while calling the "Click" method or property of the "<a href="lnamemapping://{225B2166-C880-4BD1-BCCF-7A46171069A3}.{73626755-8CE9-4667-90D2-14EC71C4BB1B}">EnableDisableBtn</a>" object.<br/>The object or one of its parent objects does not exist.</p><h4>Tested Object</h4><table cellpadding="0" cellspacing="0" noborder><tbody><tr><td><b>Alias:</b></td><td>Aliases.RIOS_SSC32.Play.EnableDisableBtn</td><tr><td><b>Mapping item:</b></td><td>NameMapping.Sys.RIOS_SSC32.Play.EnableDisableBtn</td></tr></tbody></table><h4>Missing Object</h4><table><tbody><tr><td><b>Alias:</b></td><td>Aliases.RIOS_SSC32</td><tr><td><b>Mapping item:</b></td><td>NameMapping.Sys.RIOS_SSC32</td></tr></tbody></table><p style="margin-top: 12px;"><a href="aqa-help://2201">Possible causes of the error</a></p>)
Unfortunately I'm not proficient enough with Regular Expression in order to try and fix it.
Other suggestions?
Related Content
- 8 years ago
- 12 years ago
- 8 years ago
- 8 years ago
- 12 months ago
Recent Discussions
- 3 days ago
- 3 days ago
- 7 days ago