none
Can I use /testmetadata and /category only in MSTest? RRS feed

  • Question

  • Dear all,

    I'm using VS2010 Premium Edition and I'm working on test automation by using MSTest

    I want to specify particular test methods by following two parameters

    [1] to specify all test methods by /testmetadata:[file name].vsmdi

    AND

    [2] to specify category as filter by /category:[test category filter]

    SO THAT

    only the matched category in vsmdi would be executed.

    Is it the recommended way for the usage of MSTest? is there any parameter of MSTest required?

    Thanks in advanced

    Monday, April 8, 2013 3:13 PM

Answers

All replies

  • Hello,

    Thank you for your post.

    You can use /testmetadata and /category to run specific test methods in a solution.

    In addition, you can use /testlist to run those test methods in that test list when you also use /testmetadata option. Also you can use /test option to run one test method.

    If you use /testcontainer, you can run the expected test methods in one test project with /category, /testlist, and /test option.

    Reference: MSTest.exe Command-Line Options

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 9, 2013 8:10 AM
    Moderator
  • as I try /testmetadata and /category only (exactly the command below)

    MSTest.exe /testmetadata:C:\temp\project.vsmdi /category:"MyCategory1"

    But it cannot get the test method with MyCategory1 as test category. And the result return is no test method found.

    And my objective is to have a full list (vsmdi) + a filter (category) to get what TestMethod I want to get.

    As you mentioned that we can have testlist, but it introduce another problem of maintaining this list in ongoing development...

    Tuesday, April 9, 2013 8:16 AM
  • Hello,

    Use /category:group1 runs tests in the test category "group1". So please remove “” to check the result.

    When I try to use /testmetadata, I don’t define the absolute path of .vsmdi file.

    My mstest command line is :

    cd C:\Users\Username\Documents\Visual Studio 2010\Projects\SolutionName (you can copy the solution path and then paste it in VS command prompt)

    MSTest /testmetadata: SolutionName.vsmdi /category:mycategory

    In addition, please make sure that you set TestCategory attribute for TestMethod1.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 9, 2013 8:34 AM
    Moderator
  • Dear Amanda,

    I got the following result when I change to use your method, add test category, and rebuild the project, finally I run the MSTest and cannot find any test method as well...

    C:\MyWorkspace\App>"C:\Program Files (x86)\Microsoft Visual Studio 10.0\""\Common7\IDE\MSTest.exe" /testmetadata:proj1.vsmdi /category:MyCategory1
    Microsoft (R) Test Execution Command Line Tool Version 10.0.30319.1
    Copyright (c) Microsoft Corporation. All rights reserved.

    Loading proj1.vsmdi...
    Starting execution...
    No tests to execute.

    C:\MyWorkspace\App>

    Tuesday, April 9, 2013 11:12 AM
  • Hello,

    Thank you for your post.

    Please make sure that you have unit tests in that solution when you use /testmetadata option. Or you need add the other type of tests such as web performance test into a testlist rather than testcategory and then use /testlist option with /testmetadata when you don’t have unit test in the solution.

    In addition, if the expected test is not unit test, I recommend that you use /testcontainer instead of /testmetadata to run it like this:

    mstest /TestContainer:WebTest1.webtest

    For more information, see: How to: Run a Web Performance Test from the Command Line

    Run load test using MSTest: How to: Run a Load Test from the Command Line

    Run coded UI test from command line: http://blogs.microsoft.co.il/blogs/shair/archive/2010/10/30/how-to-run-coded-ui-tests-from-command-line.aspx

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 10, 2013 1:56 AM
    Moderator