Forum Discussion

Mia's avatar
Mia
Contributor
10 years ago

Creating own result file, passing test result into .txt file

Hello,   my goal is to create simple result file, which can be after test execution displayed in command prompt. I have a test run which consists from many test items, and all I want to see on the ...
  • Mia's avatar
    10 years ago

    I found a solution using the following function.

     

     

    function OwnResult_OnStopTest(Sender)
    {
      var kwName = Project.TestItems.Current.Name;
      var sPath = "c:\\IDC\\QAResult\\AutomatedTestsResult.txt";
      
      if (Log.ErrCount > 0)
        strTestResult = "FAILED";
      else if (Log.WrnCount > 0 && Log.ErrCount == 0)
        strTestResult = strTestResult != "FAILED" ? "WARNING" : "FAILED";
      else
        strTestResult = strTestResult != "FAILED" ?
                          (strTestResult != "WARNING" ? "PASSED" : "WARNING") : "FAILED";
    
      Log.Message(strTestResult + "... \t" + kwName);  
    
      if (!aqFile.Exists(sPath)) 
        aqFile.Create(sPath);
      aqFile.WriteToTextFile(sPath, strTestResult + "... \t " + kwName + "\r\n", aqFile.ctANSI, false);
    
    }