Get the Execution time (Start and End Time)
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2010
06:30 PM
11-15-2010
06:30 PM
Get the Execution time (Start and End Time)
Hello,
I am trying to get the below Information once the Test Suite Execution is completed.Is their any built in function available?
1.Start and End time of Test execution once
2.Run time
3.File name
4.No.of Errors
5.No.of Warnings
6.Duration taken to complete the Test Suite Execution(Diff between start and End time)
Can anyone help me how to get the data?
Thanks,
Madhavisri
I am trying to get the below Information once the Test Suite Execution is completed.Is their any built in function available?
1.Start and End time of Test execution once
2.Run time
3.File name
4.No.of Errors
5.No.of Warnings
6.Duration taken to complete the Test Suite Execution(Diff between start and End time)
Can anyone help me how to get the data?
Thanks,
Madhavisri
6 REPLIES 6
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2010
10:45 PM
11-23-2010
10:45 PM
Hi Madhavisri,
You can get this information using the script below:
function getResults()
{
Log.Message("See Information data in the Additional Info panel", getInformationData());
}
function getInformationData()
{
var tempFolder = aqEnvironment.GetEnvironmentVariable("temp") + "\\" + Math.floor(Math.random() * 10000) + "\\";
aqFileSystem.CreateFolder(tempFolder);
Log.SaveResultsAs(tempFolder, lsXML);
var xDoc = Sys.OleObject("MSXML2.DOMDocument.4.0");
xDoc.load(tempFolder + "Description.tcLog");
// Warning count
var wrnC = VarToInteger(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="warning count"]/@value').text);
//Error count
var errC = VarToInteger(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="error count"]/@value').text);
//Execution time
var startTime = VarToFloat(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="start time"]/@value').text);
var stopTime = VarToFloat(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="stop time"]/@value').text);
aqFileSystem.DeleteFolder(tempFolder, true);
var res =
"Errors: " + errC + "\r\n" +
"Warnings: " + wrnC + "\r\n" +
"Start Time: " + DateTimeToStr(startTime) + "\r\n" +
"Stop Time: " + DateTimeToStr(stopTime) + "\r\n" +
"Run Time: " + aqConvert.DateTimeToFormatStr(stopTime - startTime, "%H:%M:%S");
return res;
}
--
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2012
10:33 PM
07-25-2012
10:33 PM
Thank you for this code. I am using it on different machines. On my machine it runs perfectly. But recently we installed 2 more machines and on them the following command produces a JScript error:
What can be the cause of this problem? I guess some libraries are missing, am I right?
var xDoc = Sys.OleObject("MSXML2.DOMDocument.4.0");
What can be the cause of this problem? I guess some libraries are missing, am I right?
Using TestComplete 9.0.2460.7
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2012
10:56 PM
07-25-2012
10:56 PM
The solution was found by a colleague: msxml.msi was missing. Get it here.
Using TestComplete 9.0.2460.7
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2014
10:31 PM
07-03-2014
10:31 PM
Hello i need the same along with
how to get it from log file
[Equivalent VBScript for above example]
function getResults()
Log.Message "See Information data in the Additional Info panel", getInformationData
End function
function getInformationData
tempFolder = aqEnvironment.GetEnvironmentVariable("temp") & "\" & Int(rnd * 10000) & "\"
aqFileSystem.CreateFolder(tempFolder)
Log.SaveResultsAs tempFolder, lsXML
Set xDoc = Sys.OleObject("MSXML2.DOMDocument.4.0")
Call xDoc.load(tempFolder + "Description.tcLog")
' // Warning count
wrnC = VarToInteger(xDoc.selectSingleNode("Nodes/Node[@name='root']/Prp[@name='warning count']/@value").text)
'//Error count
errC = VarToInteger(xDoc.selectSingleNode("Nodes/Node[@name='root']/Prp[@name='error count']/@value").text)
' //Execution time
startTime = VarToFloat(xDoc.selectSingleNode("Nodes/Node[@name='root']/Prp[@name='start time']/@value").text)
stopTime = VarToFloat(xDoc.selectSingleNode("Nodes/Node[@name='root']/Prp[@name='stop time']/@value").text)
aqFileSystem.DeleteFolder tempFolder,true
getInformationData = "Errors: " & errC & vblf &_
"Warnings: " & wrnC & vblf &_
"Start Time: " & DateTimeToStr(startTime) & vblf &_
"Stop Time: " & DateTimeToStr(stopTime) & vblf &_
"Run Time: " & aqConvert.DateTimeToFormatStr(stopTime - startTime, "%H:%M:%S")
End function
Test duration
Total Project Test Items
Executed Project test items
Passed and Failed test item count.
how to get it from log file
[Equivalent VBScript for above example]
function getResults()
Log.Message "See Information data in the Additional Info panel", getInformationData
End function
function getInformationData
tempFolder = aqEnvironment.GetEnvironmentVariable("temp") & "\" & Int(rnd * 10000) & "\"
aqFileSystem.CreateFolder(tempFolder)
Log.SaveResultsAs tempFolder, lsXML
Set xDoc = Sys.OleObject("MSXML2.DOMDocument.4.0")
Call xDoc.load(tempFolder + "Description.tcLog")
' // Warning count
wrnC = VarToInteger(xDoc.selectSingleNode("Nodes/Node[@name='root']/Prp[@name='warning count']/@value").text)
'//Error count
errC = VarToInteger(xDoc.selectSingleNode("Nodes/Node[@name='root']/Prp[@name='error count']/@value").text)
' //Execution time
startTime = VarToFloat(xDoc.selectSingleNode("Nodes/Node[@name='root']/Prp[@name='start time']/@value").text)
stopTime = VarToFloat(xDoc.selectSingleNode("Nodes/Node[@name='root']/Prp[@name='stop time']/@value").text)
aqFileSystem.DeleteFolder tempFolder,true
getInformationData = "Errors: " & errC & vblf &_
"Warnings: " & wrnC & vblf &_
"Start Time: " & DateTimeToStr(startTime) & vblf &_
"Stop Time: " & DateTimeToStr(stopTime) & vblf &_
"Run Time: " & aqConvert.DateTimeToFormatStr(stopTime - startTime, "%H:%M:%S")
End function
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2016
12:09 PM
11-22-2016
12:09 PM
Hello Dmitry
Trying to implement your code I received this error message
Error Invalid class string: cannot obtain ClassID.
I was hoping you could shed some light on it.
Thank you
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2016
06:35 AM
11-23-2016
06:35 AM
That error is generated by the line that calls Sys.OleObject("MSXML2.DOMDocument.4.0")
Basically, it means that, in your environment, that particular MSXML object does not exist.
Try changing the code to simply Sys.OleObject("MSXML2.DOMDocument") and leave the version information off the end. That MIGHT fix it.
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
