Attempting to automate a test run via the command-line Microsoft Test Manager utility, tcm.exe.
I'm using the following command:
tcm run /create /title:"Automated UI Tests" /planid:27 /suiteid:721 /configid:10 /settingsname:"UI Test Settings 3" /testenvironment:"SanityEnvironmentSlemish" /collection:[CollectionUrl] /teamproject:Main
(I haven't included the collection URL above).
However, I've been getting the following error: "A test run must be created with at least one test case".
This is a bit of a mystery to me as my test suite already has a test case associated with it, which is associated with an ordered test list.
The reason it wasn't working was not because the test run didn't have a test case associated with it, but because the test case in question had a state of "Error" (due to previous test run failures), instead of a state of "Active".
To resolve this, you can choose either to edit the state via the Microsoft Test Manager GUI by going to the 'Test' tab, right-click on the test case of the particular test suite and click "Reset test to active".
Alternatively, if you are attempting to run tests using the Microsoft Test Manager command-line interface (tcm.exe), you can simply use the '/include' command-line switch - which includes all test cases in a test run, regardless of state.