Wednesday, 29 July 2015

Execute CodedUI TestMethod() through command prompt



Input the path of the dll in the Developer Command Prompt for VS2012/13..
cd C:\Users\...\Documents\Visual Studio 2012\Projects\CodedUITestProject\CodedUITestProject\bin\Debug
Using VSTest.Console.exe like this:
VSTest.Console.exe CodedUITestProject.dll /Tests:TestMethod1,testMethod2 /UseVsixExtensions:true  /Logger:trx
Note There is no /resultsfile option in VSTest.Console.exe command line. You need to use /Logger.trx if you want to generate a trx file.

Note The /Tests command line option cannot be used with the /TestCaseFilter command line option.

Usage  of /TestCaseFilter
Examples of /TestCaseFilter usage with filter as Priority
/TestCaseFilter:"Priority=1"

Examples of /TestCaseFilter usage with filter as Test Category
/TestCaseFilter:"TestCategory=Nightly

Examples of /TestCaseFilter usage with multiple filters using "|"
/TestCaseFilter:"TestCategory=Nightly|FullyQualifiedName=Namespace.ClassName.MethodName"