cokyn
12 years agoContributor
JScript runtime error when "OnStopTest" event handled
Hello everyone,
could you please help me with the following problem? I have created "OnStopTest" handler to export logs if the latest test item has been reached. I used the following code for handler
could you please help me with the following problem? I have created "OnStopTest" handler to export logs if the latest test item has been reached. I used the following code for handler
function
STOP_OnStopTest(Sender)
{
var LastTestItem=Project.Variables.LastTestItem;
var CurrentTestItem=Project.TestItems.Current.Name;
var logpath=Project.Variables.Log_Path;
if (CurrentTestItem==LastTestItem)
{ Log.SaveResultsAs(logpath, lsHTML);
Log.Message("The last test item " + LastTestItem + " has been executed.");}
else
{Log.Message("The test item " + CurrentTestItem + " has been executed.");}
When I run the project and current test item = the last item then logs are correctly exported but the test item itself fails with message "Microsoft JScript runtime error." It looks like, there is some problem with this line var CurrentTestItem=Project.TestItems.Current.Name;
Any ideas will be appreciated.
Martin