Forum Discussion

suzanne_e_saund's avatar
suzanne_e_saund
Occasional Contributor
10 years ago

Writing failed test to a text file during test execution

I will be launching a number of tests at the Project level.  While the tests are being executed, if one of the tests fails, I need the name of the failed test written to a text file. 



The other option is to store the names of the failed test cases in an array or in a table and then generate a text file with the test case names when the tests are completed. 



Either way it goes, we do not want the names of the passed tests listed in the file.  Ideas?

3 Replies


  • If you are working with TestItens in your project, you can use this:


     


    //In this case, every error event will generate a log file with the name of the current test case 


    function main(){


      Log.Error("Error");


    }


     


    function GeneralEvents_OnLogError(Sender, LogParams){


      var LogErrorFile = aqFile.OpenTextFile("C:/logfileerror.txt", aqFile.faWrite, aqFile.ctANSI, true);


      LogErrorFile.WriteLine("TestCase name: " + Project.TestItems.Current.Name);


    }