none
How to publish the test result to MTM using the tcm query? RRS feed

  • Question

  • Hello,

    I need to publish the test result to MTM using the tcm query as below:

    tcm run /piblish /suite:1111 /configid:6 /resultowner:"Pratap Reddy" /resultsfile:"C:\TestResult.trx" /collection:<<server_url>> /teamproject:"<<Project Name>>"

    For the above query, i need to get the configuration id and suite id. I can the configid using the configuration name as below

    tcm configs /list /querytext:"SELECT * from TestConfiguration WHERE Name='Windows 8 and IE 9'" /collection:<<server_url>> /teamproject:"<<Project Name>>"

    I am trying to get the suite id using the  below query:

    tcm suites /list /querytext:"SELECT * from TestSuite WHERE PlanId='<<Plan Id>>' and Title='Hello_Suite'" /collection:<<server_url>> /teamproject:"<<Project Name>>"

    The above query returns me more than 1 rows because i have more than 1 suite with name "Hello_Suite" but under different folders in MTM. The suite that i want is like MainTestPlan\Automation\Iteration1\Hello_Suite (Hello_Suite is present in Iteratin2, Iteration3 and so on). How do solve this issue?


    Thanks, Pratap

    Wednesday, November 14, 2012 1:32 PM

Answers

  • Hi Pratap,

    You have nested suite in your test plan structure. The aim of run tcm suites /list command line is get test suite id. Yes, when you have nested test suite with same name, the cammand line will show you more than one result, you can according to the structure get the right ID.

    Take following screenshot as an example, I want the test suite ID with name "Subsuite1" under "Suite2". I run tcm suites /list /querytext:"SELECT * FROM TestSuite WHERE Planid='XX' and Title='Subsuite1'" /collection:collection. It lists two result, one is Subsuite under Suite1, and one is Subsuite1 under Suite2. I know i just want the one under Suite2, so the ID what i want is "9".

    In your side, you know the test suite you want should under Subsuite3, so you can pick up the right ID from the list.

    No matter how you nest the test suite, the path of each test suite from top test plan to parent test suite is unique. As long as you know which one you need, of couse you can pick up the right ID from the test suite list.

    Regards,


    Lily Wu [MSFT]
    MSDN Community Support | Feedback to us

    Friday, November 16, 2012 7:53 AM
    Moderator

All replies

  • Hi Pratap,

    Thank you for your post.

    Can you provide more information about "under different folders"? It is better to make an example.

    Regards,


    Lily Wu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, November 15, 2012 5:39 AM
    Moderator
  • Hello Lily,

    Below is the example that i want to relate to the problem i am facing.

    Now when i run the below query

    tcm suites /list /querytext:"SELECT * from TestSuite WHERE PlanId='<<Plan Id>>' and Title='Node 1'" /collection:<<server_url>> /teamproject:"<<Project Name>>"

    I will get 3 rows as output one for each "Node 1" present inSub suite 2, Sub suite 3 and Sub suite 4. But i want only one output for the node under Sub suite 3 (full path is Root Node\My Test Suite 1\Sub suite 3\Node 1) and not the other ones. Is there anything i can do to achieve this?


    Thanks, Pratap

    Thursday, November 15, 2012 5:45 PM
  • Hi Pratap,

    You have nested suite in your test plan structure. The aim of run tcm suites /list command line is get test suite id. Yes, when you have nested test suite with same name, the cammand line will show you more than one result, you can according to the structure get the right ID.

    Take following screenshot as an example, I want the test suite ID with name "Subsuite1" under "Suite2". I run tcm suites /list /querytext:"SELECT * FROM TestSuite WHERE Planid='XX' and Title='Subsuite1'" /collection:collection. It lists two result, one is Subsuite under Suite1, and one is Subsuite1 under Suite2. I know i just want the one under Suite2, so the ID what i want is "9".

    In your side, you know the test suite you want should under Subsuite3, so you can pick up the right ID from the list.

    No matter how you nest the test suite, the path of each test suite from top test plan to parent test suite is unique. As long as you know which one you need, of couse you can pick up the right ID from the test suite list.

    Regards,


    Lily Wu [MSFT]
    MSDN Community Support | Feedback to us

    Friday, November 16, 2012 7:53 AM
    Moderator
  • Hi Lily,

    Taking your suggestion, i have created a console application in C# that will take the suite and plan name as a parameter and return the suite id. This has solve the issue.


    Thanks, Pratap

    Tuesday, November 20, 2012 5:43 AM