How to execute tests locally using TCM.exe command-line?

How to execute tests locally using TCM.exe command-line?

Rate This
  • Comments 8

I have seen a lot of customers who use TCM.exe to execute tests on remote environments, but I have not seen many who use the same command-line to execute the tests locally. Here by locally, I mean tests running on the developer’s/tester’s box,  which does not have any test controller or test agent and has only MTM. Yes, it’s possible to do this in 2012 version. :)

Now Let us go over the steps which you should follow to execute the tests locally.

  • Use TCM.exe to create a test run without specifying the test environment name. Your command will look something like this: -

tcm run /create /title:"Nightly Run" /planid:1 /suiteid:5 /configid:13 /settingsname:"<Name of your automated test settings>" /collection:<CollectionURL> /teamproject:<Team Project name>

  • On successful test run creation, you will get output from an output similar to the one mentioned below. From this output, you will know about the id of the test run which got created.

Run created with ID: <xxx>

  • Launch TCM.exe again to execute the newly created test run locally.

tcm run /execute /id:id /collection:<CollectionURL> /teamproject:<Team project name>

On completion, you will get the results as shown below.

image 

Enjoy !!

Leave a Comment
  • Please add 4 and 5 and type the answer here:
  • Post
  • Super useful; thanks!

  • Could you describe what is setting name in the command ( /settingsname:"<Name of your automated test settings>" )

    Thanks

    Mahender

  • Mehender, You can find the name of your test settings from MTM (MTM -> Lab Center -> Test Settings ->Name Column). Please try this out and do let me know in case you have any further question.

    Regards

    Aseem Bansal

  • We followed the same steps, but we are getting the error(

    A potentially dangerous Request.Path value was detected from th client).

    Is there any other option to see the result in Test manager?

    Thanks

    Mahender

  • Hi Mahender,

    This error generally occurs if there are invalid characters in some specified http url.

    Can you please specify the exact command line arguments that you are passing in the below format

    tcm run /create /title:"Nightly Run" /planid:1 /suiteid:5 /configid:13 /settingsname:"<Name of your automated test settings>" /collection:<CollectionURL> /teamproject:<Team Project name>

    You can mail the details to abchakra@microsoft.com

    Thanks

  • There doesn't seem to be any way to specify an order for test case execution with this - one 'possible' workaround was to group dependent test cases into suites, but ... there doesn't seem to be any way to wait for the suite to complete before kicking off the next suite either.

    Any ideas on how we could control the order of test cases being run with this?

  • Roy, you should use an ordered test to control the order of execution of tests.

    msdn.microsoft.com/.../ms182630(v=vs.90).aspx

    Regards

    Aseem Bansal

  • Hi Bansal,

    i tried to run tests locally with out specifying the test envirionment name but test caes got failed . in resluts im getting error message like this: "If you specify a test environment name, you must also specify the name of the test controller for that test environment.

    Parameter name: testEnvironmentName".

    i have created new testsettings  and tried too. but getting same error message. Is there any other way or workaround to execute tests locally using tcm.exe commands?

    Thanks&Regards

    Rajesh

Page 1 of 1 (8 items)