mateenhussain
15 years agoOccasional Contributor
Create Log even though TestComplete fails executing
Hi
I have created a custom log for my tests, coz
1) The default logs created by TC all have a prefix "Testrestults" and it becomes hard to identify by looking at their names. And sometimes they are overwritten.
2) I want all of them to go into a fixed folder for archiving.
The way I do it is:
[TestCase]
function test1()
{
.....
CreateLog("test1");
}
function CreateLog(testCaseName)
{
....
Log.SaveResultsAs(path+testCaseName+".mht",2);
}
The problem with this, whenever TestComplete ends execution abruptly due to an error, it never reaches the line "CreateLog("test1");" (which is expected). And as a result I dont get any logs.
I even tried using try{}finally{} block around my testcase, but still it doesn't execute finally, rather simply quits without any log. What can I be doing wrong? Any suggestions?
Thanks,
Mateen
I have created a custom log for my tests, coz
1) The default logs created by TC all have a prefix "Testrestults" and it becomes hard to identify by looking at their names. And sometimes they are overwritten.
2) I want all of them to go into a fixed folder for archiving.
The way I do it is:
[TestCase]
function test1()
{
.....
CreateLog("test1");
}
function CreateLog(testCaseName)
{
....
Log.SaveResultsAs(path+testCaseName+".mht",2);
}
The problem with this, whenever TestComplete ends execution abruptly due to an error, it never reaches the line "CreateLog("test1");" (which is expected). And as a result I dont get any logs.
I even tried using try{}finally{} block around my testcase, but still it doesn't execute finally, rather simply quits without any log. What can I be doing wrong? Any suggestions?
Thanks,
Mateen