Unanswered How to get a value of Notes and Comments from TestResult

  • Tuesday, November 01, 2011 7:52 AM
     
      Has Code

    Hello,

    My task is to programmatically obtain the properties of the test, but I have not found how do I get information from the fields of 'Notes' and 'Comments'.
    For the understanding of the question see screenshot from Test Result of Microsoft Test Manager 2010.

    var TestPoints = testPlan.QueryTestPoints(String.Format("SELECT * FROM TestPoint WHERE SuiteId={0} AND TestCaseId={1}", iTestSuiteId, iTestCaseId));
    string sTestResultQuery = String.Format("SELECT * FROM TestResult WHERE TestPlanId={0} AND TestPointId={1} ORDER BY CreationDate DESC", iTestPlanId, iTestPointId);
    var TestResult = this._project.TestResults.Query(sTestResultQuery);
    ITestCaseResult CurrentTesResult = TestResult[0];
    

    Then, I'm trying to get from object ITestCaseResult value of 'Notes' and 'Comments'. I can not find property responsible for the field values 'Notes' and 'Comments'.

    Please tell me how I get the value of field 'Notes' and 'Comments'.


All Replies

  • Tuesday, November 01, 2011 5:09 PM
     
      Has Code

    Hello MA_.

     

    I find a way to get comment.

     

            private TeamProjectPicker dpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false);
            private ITestManagementTeamProject projectTest;
            private ITestManagementService testManagement;

    ContructorClass
    {
    dpp.ShowDialog();
                
                TfsTeamProjectCollection projetos = dpp.SelectedTeamProjectCollection;
    
                testManagement = (ITestManagementService)projetos.GetService(typeof(ITestManagementService));
    
                projetoTest = testManagement.GetTeamProject(dpp.SelectedProjects.GetValue(0).ToString());
    }
    
    
    public void ConsoleWriteCommentResult(int idTestPlan)
    {
    ITestCaseResultCollection results = projectTest.TestResults.Query("select * from TestResult where TestPlanId = "+id.ToString());
    
                foreach (ITestCaseResult result in results)
                {
                       Console.WriteLine(result.Comment);
    //OR
    ITestRun run = result.GetTestRun();
                       Console.WriteLine(run.Comment);
                }
    }
    

     

    To get Notes i need a study.

     

    Hope Helps


    Paulo T. C. Mariano
    • Edited by ptcmariano Tuesday, November 01, 2011 5:11 PM Add fields
    •  
  • Wednesday, November 02, 2011 9:27 AM
     
      Has Code

    Hello MA_.

     

    I find a way to get comment.

     

            private TeamProjectPicker dpp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false);
            private ITestManagementTeamProject projectTest;
            private ITestManagementService testManagement;

    ContructorClass
    {
    dpp.ShowDialog();
                
                TfsTeamProjectCollection projetos = dpp.SelectedTeamProjectCollection;
    
                testManagement = (ITestManagementService)projetos.GetService(typeof(ITestManagementService));
    
                projetoTest = testManagement.GetTeamProject(dpp.SelectedProjects.GetValue(0).ToString());
    }
    
    
    public void ConsoleWriteCommentResult(int idTestPlan)
    {
    ITestCaseResultCollection results = projectTest.TestResults.Query("select * from TestResult where TestPlanId = "+id.ToString());
    
                foreach (ITestCaseResult result in results)
                {
                       Console.WriteLine(result.Comment);
    //OR
    ITestRun run = result.GetTestRun();
                       Console.WriteLine(run.Comment);
                }
    }
    

     

    To get Notes i need a study.

     

    Hope Helps


    Paulo T. C. Mariano


    Thanks, but i still could not get Notes value.

  • Friday, November 18, 2011 10:53 AM
     
     

    Hi,

    Could you please let me know what are the assembly refernce I need to give to achieve this.

    It would be great if you could provide the solution which fetches the comments.

     

    Thanks & Regards,

    Basava Kumar M

  • Friday, November 18, 2011 1:05 PM
     
     

    Hi,

    Could you please let me know what are the assembly refernce I need to give to achieve this.

    It would be great if you could provide the solution which fetches the comments.

     

    Thanks & Regards,

    Basava Kumar M

     

    Sorry, i forgot about that.

    Assemblies:

    Microsoft.TeamFoundation.TestManagement.Client;

    Microsoft.TeamFoundation.Client;

    Microsoft.TeamFoundation.Server;

    Microsoft.TeamFoundation.WorkItemTracking.Client;


    Paulo T. C. Mariano