Mia
10 years agoContributor
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 first place is just the test item name and test item result. I know how to get the test item name and result (I use a General event OnStopTest for getting the name and restult). But I couldn't find any way how to save these information into one file (the best would be .txt so the command prompt could show the file content). Is there someone who could help me with this?
Thank you
Mia.
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); }