Ask a Question

DataSet.Text

Greeb
Occasional Contributor

DataSet.Text

When I set this up the only thing I get is .schema and my output always comes up as undefined even though there are text messages in my log and the if condition is passing. it does not throw an error but the text message always has undefined in my output.

 

for (var i = 0; i < Num; i++)
{
var LogItem2 = LogsCol.LogItem(i);
var LogData = LogItem2.Data(0);
var Sch = LogData.Scheme;
var LogDataType = Sch.DataType;

if ( LogDataType == ldtText )
{
LogText = LogText + LogData.Txt + "<br />";
}

 

results when appended as:

 

Results The Keyword Test Log [Sales_Order_BankWire] item has the following status: Passed
Tests Cases Run: 4
ErrorCount: 0
Warning Count: 0

undefined

 

I am trying to parse out my messages I am leaving in my test log and put them in my email summary and while I can count the messages and it detects them I can't get the contents.

 

 

5 REPLIES 5
Greeb
Occasional Contributor

I stand corrected, I've updated things and it was not detecting any text messages even though there are many there:

 

// Obtains a collection of logs
var LogsCol = Project.Logs;
// Obtains the total number of log items in the collection
var Num = LogsCol.LogItemsCount;
var LogMessage;

if ( Num > 0 )
{
// Iterates through the items
for (var i = 0; i < Num; i++)
{
var LogItem2 = LogsCol.LogItem(i);
var LogData = LogItem2.Data(0);
var Sch = LogData.Scheme;
var LogDataType = Sch.DataType;

if ( LogDataType == ldtText )
{
LogText = LogText + LogData.Txt + "<br />";
}
else
{
LogText = LogText + 'No Messages' + "<br />";
}
}

 

Results The Keyword Test Log [Sales_Order_BankWire] item has the following status: Passed
Tests Cases Run: 4
ErrorCount: 0
Warning Count: 0
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages
No Messages

Greeb
Occasional Contributor

when I change to 

 

{
LogText = LogText + LogData.Scheme.DataType + "<br />";
}

 I get 0 over and over and if it says LogData.Scheme it gives me "Test Log" over and over.

Greeb
Occasional Contributor

Ok I managed to figure out that it is looking only at the top level of every single log file in my history. 

 

I am trying to only parse out the messages from my current log.

 

I'm using things like Log.ErrCount to get raw error count but there does not seem to be anything that gives me particular access to the messages in the current log itself?

Greeb
Occasional Contributor

 
tristaanogre
Esteemed Contributor

As I understand it, you are attempting to write code to parse out error messages from your current test log and email them to interested parties in your organization. Is this correct?

Our of curiosity, is there a reason why an export of the log to an HTML page, centrally stored on a file server, and then coupled with an e-mail of the link to that file wouldn't work as well? The code would be much simpler and the end result would be the same. You could even build in the logic that you would send two different email messages. If there are errors, you would send one message with the link, if not, send a different one without the link. 


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: