Forum Discussion
Yeah it is confusing.
The way the scope works is to report on ALL results UNTIL the current testitem NOT just the test Item
So....
function foo() { Log.Message("Hello"); } function boo() { Log.Message("Boo"); Log.SaveResultsAs("d:\\lino.mht", 2, true, 2); } function SaveMyFile() { Log.Message("Saving"); }
if you run these in the project in that order, only Hello () and Boo() will be reported to the mht file.
If you move Boo() up to be the first funtion to run, than only Boo() will be reported to the MHT
Hope that helps
Cheers
-Lino
- whuang5 years agoRegular Contributor
Thanks LinoTadros , I see how it works now. Is there anyway I can only export the log for the current running test item? Say I have a test set that has 5 tests, and TC executes the tests one by one from top to bottom, when it finish executing the first test, then export the log file for the first test only, when it finish executing the second test, then export the log file for the second test only, I don't need the log for the first test again, I already have it.
Test Project:
Test 1 --> Export log for test 1
Test 2 --> Export log for test 2
Test 3 --> Export log for test 3
Test 4 --> Export log for test 4
Test 5 --> Export log for test 5
- LinoTadros5 years agoCommunity Hero
Unfortunately, there is no way using the current mehanism in TestComplete as of 14.1
The way I usually do it is to implement the OnLogError event and I can specifically log whatever I want to any file I want. I don't use the TestComplete Log file as it always runs at the END of the test. So even if your total test takes 6 hours to run, the MHT file does not get created or touched until the end (6 hours later) even if you use the SaveResultAs(...). So implementing the event is best as it happens immediately
Hope that helps
-Lino
- whuang5 years agoRegular Contributor
Hi LinoTadros can you please explain more how I can use the OnLogError event to export test log files? Isn't it only working when there is an error? Bacially what I need is export the test log file for the current test item if it passed. Below is the VBScript code I was using.
If (Log.WrnCount = 0 And Log.ErrCount = 0) Then Call Log.SaveResultsAs(FileName, lsMHT, True, lesCurrentTestItem) Else Exit Sub
But as I mentioned above, it exports the logs for the entire test project .
Related Content
- 8 years agoMulgraveTester
- 9 years agom_essaid
Recent Discussions
- 60 minutes agoSubhraDas
- 7 hours agoJacobjacob44