none
Object Model: Test Results RRS feed

  • Question

  • I have a few questions about accessing test results via the Object Model.

    There's a function for a Test, GetTestResults.  A TestResult has a function, GetTestLogs.

    I've written a short function:

    ReadOnlyCollection<TestResult> results = test.GetTestResults();

    foreach (TestResult result in results){

      ReadOnlyCollection<TestResult> logs = result.GetLogs();

      foreach (TestLog log in logs){

        log.WriteTo(projectName, testName, path)

      }

    }

    So - if I run this on a test, it copies all of the raw logs to path.  However, I've noticed that it doesn't copy the .wtl file associated with the tests.  For example, if I run this to copy out the log files for "NDISTest 6.5 - WLANWakeTests" - I get three folders with logs - client, server, and ap.  I also get some .xml setup files.  I don't, however, get the .wtl log file associated with the run.  If I go to the Job monitor, and select "Browse Logs" the folder that I go to has the three folders, and an additional folder with a GUID, which contains the corresponding .wtl file.  For a number of tests, it would be really useful to be able to copy out and save these .wl files.

    So - my questions are:

    1 - Is there a way to get the PATH to a test run, instead of just copying out the files?  That would have all of this information, so that we can automatically gather test result information.

    2 - If not, is there a way to also copy out the relevant .wtl files as well as the raw test log files using the OM?

    Thanks.

    Saturday, October 20, 2012 5:36 AM

Answers

  • Logs live at both the Task and Result level. Whenever possible, the Logs are associated with the task, and everything else is associated at the result level

    to wit.

    foreach (TaskResult result in Test.GetTestResults())
    {
       foreach (TestLog log in result.GetLogs())
       {
       Console.writeline ("Result Log name: {0}, type {1}",       log.Name, log.LogType.ToString())
       }
    foreach (TaskResult task in result.GetTasks())
    {
       WalkTasks(task)
    }
    
    
    
    void WalkResult(WalkTasks task)
    {
       foreach (TestLog log in task.GetLogFiles())
       {
          Console.WriteLine("Task log name: {0}, type {1}",
          log.Name, log.LogType.ToString());
       }
    
       foreach (TaskResult childTask in task.GetChildTasks())
       {
          WalkTasks(childTask);
       }
    }

    Note that the result logs will get things like gahterer and infrastructure logs, thinkgs that are not directly created by the test, and very rarely used for debugging the reason that a test failed.
    Monday, October 22, 2012 5:12 PM