I have hunted for this answer off and on for a couple of days so apologies if I missed the answer.
I have a MS test that I want to run from the command line (eventually in Jenkins). I have the MSTest.exe and the \\testcontainer setup but cant get the syntax for the actual test I want to run.
My solution IntegrationTest has two projects (using the Page Model Design Pattern), IntegrationTest and Tests. FYI \\testcontainer points to the assembly (dll) in IntegrationTest
The test I want to run is in Tests/UnitTest1/Login_To_system. I have tried:
/test:Tests.UnitTest1.Login_To_system
/test:Tests/UnitTest1/Login_To_system
And a variety of combinations with the results of "cannot be found”
There is no metadata files for tests – using Community 2015.
The whole line, up to one of the test attempts is:
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\mstest.exe" /resultsfile:"C:\public\data\trunk\AutomatedTesting\IntegrationTest\TestResults\Results.trx" /testcontainer:"C:\public\data\trunk\AutomatedTesting\IntegrationTest\IntegrationTest\bin\Debug\IntegrationTest.dll" /test:Tests.UnitTest1.Login_To_system
Any help would be appreciated.
This works for me.
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace FooTest
{
[TestClass]
public class One
{
[TestMethod]
public void TestMethod1()
{
;
}
}
}
Fom the command line:
C:\\tmp\\FooTest\\FooTest\\bin\\Release> mstest /testcontainer:"./FooTest.dll" /test:"FooTest.One." Microsoft (R) Test Execution Command Line Tool Version 14.0.23107.0 Copyright (c) Microsoft Corporation. All rights reserved.
Loading ./FooTest.dll... Starting execution...
Results Top Level Tests ------- --------------- Passed FooTest.One.TestMethod1 1/1 test(s) Passed
Summary ------- Test Run Completed. Passed 1 --------- Total 1 Test Settings: Default Test Settings
So it is "AssemblyName.ClassName.MethodName" to identify a test, in /test https://msdn.microsoft.com/en-us/library/ms182489.aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.