Stop Watch string object
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2010
03:18 AM
04-16-2010
03:18 AM
Stop Watch string object
I get the time in milliseconds from -
set StopWatchObj1 = histuils.stopwatch
stopwatchobj1.tostring
I need to store this in a excel sheet so I use the function aqtime.writetotextfile to write it in a .csv file which I can open in excel.
The resut of stopwatchobj1.tostring in the .csv file when I open as text file shows the right string "0:00:02:690".
When I open the same in excel, I see the result as 00:00:2
Is there a way I can get the same format in excel??
set StopWatchObj1 = histuils.stopwatch
stopwatchobj1.tostring
I need to store this in a excel sheet so I use the function aqtime.writetotextfile to write it in a .csv file which I can open in excel.
The resut of stopwatchobj1.tostring in the .csv file when I open as text file shows the right string "0:00:02:690".
When I open the same in excel, I see the result as 00:00:2
Is there a way I can get the same format in excel??
6 REPLIES 6
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2010
04:50 AM
04-19-2010
04:50 AM
If you're using that Excel sheet just to manually view the values which
TC has output, then you can change the cell formatting in Excel by going
to Format -> Format Cells... (keyboard shortcut "Ctrl + 1"). On the "Number" tab choose the "Custom" option, and then on the right in the "Type" textbox enter:
hh:mm:ss.000
Then click OK and it should appear correctly on the spreadsheet.
TC has output, then you can change the cell formatting in Excel by going
to Format -> Format Cells... (keyboard shortcut "Ctrl + 1"). On the "Number" tab choose the "Custom" option, and then on the right in the "Type" textbox enter:
hh:mm:ss.000
Then click OK and it should appear correctly on the spreadsheet.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2010
06:06 AM
04-19-2010
06:06 AM
Yeah.. i do that.. but is there a way the enduser can view the same format without doing any workaround..
I have to give my scripts to my client.. when they view the result sheet they should be able to get it.
Thanks for your replly...
I have to give my scripts to my client.. when they view the result sheet they should be able to get it.
Thanks for your replly...
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2010
09:37 AM
04-19-2010
09:37 AM
In that case you'll have to modify the value before it gets written to the csv file. There are two options:
1) Preceed the value with a single quote to force it to be interpreted as a string, as follows:
'0:00:02:690
2) Change the last colon to a decimal point and it should be interpreted as a time, as follows:
0:00:02.690
1) Preceed the value with a single quote to force it to be interpreted as a string, as follows:
'0:00:02:690
2) Change the last colon to a decimal point and it should be interpreted as a time, as follows:
0:00:02.690
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2010
02:33 AM
04-20-2010
02:33 AM
Hi Madhi,
Please note that this forum is actually for AutomatedQA TestComplete functionality questions, not for questions on Microsoft Excel.
Best regards,
Alexey
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
04-20-2010
03:32 AM
04-20-2010
03:32 AM
I understand this forum is not for excel. My question is totally related to the output from HISUtils stopwatch object
I tried the aqdatetime.Timeinterval to fnd out the difference between the two results i get from stopwatch. Looks like i need to have date format as well to use the timeinterval method. Do you have any suggestion to calculate the difference
The output from stopwatch object.tostring is in the format hh:mm:ss.000
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2010
08:20 PM
04-20-2010
08:20 PM
You can get the elapsed milliseconds from the StopWatch.Split() and StopWatch.Stop() methods.
JScript:
function StopWatchTest()
{
var stopWatch = HISUtils.StopWatch;
stopWatch.Start();
Sleep(1500);
var startTime = stopWatch.Split();
Sleep(2000);
var endTime = stopWatch.Stop();
Log.Message("Start time: " + startTime + "ms");
Log.Message("End time: " + endTime + "ms");
Log.Message("Duration: " + (endTime - startTime) + "ms");
}
JScript:
function StopWatchTest()
{
var stopWatch = HISUtils.StopWatch;
stopWatch.Start();
Sleep(1500);
var startTime = stopWatch.Split();
Sleep(2000);
var endTime = stopWatch.Stop();
Log.Message("Start time: " + startTime + "ms");
Log.Message("End time: " + endTime + "ms");
Log.Message("Duration: " + (endTime - startTime) + "ms");
}
