あなたの質問が正しいとは確信していませんが、答えは「はい」だと思います。 mstestがアセンブリをビルドする必要はありません。 [TestClass]/[TestMethod]を含む任意のアセンブリを指すと、mstestはコンパイルを一切行わずにテストを実行します。
ここに例があります。 using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTest
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
}
}
}
これをVS of msbuildで簡単に作成します。これにより、次のアセンブリが作成されます。アンダー
UnitTest.dll
:ある私の場合は
C:\tmp\unittest\UnitTest\UnitTest\bin\Debug
次に、あなたが単に実行します。
C:\tmp\unittest\UnitTest\UnitTest\bin\Debug>mstest /testcontainer:UnitTest.dll
あなたはここで任意のDLLファイルを指すことができないことをしてください。
出力(コマンド):私はあなたと同じコマンドを実行してい
C:\tmp\unittest\UnitTest\UnitTest\bin\Debug>mstest /testcontainer:UnitTest.dll
Microsoft (R) Test Execution Command Line Tool Version 14.0.23107.0
Copyright (c) Microsoft Corporation. All rights reserved.
Loading UnitTest.dll...
Starting execution...
Results Top Level Tests
------- ---------------
Passed UnitTest.UnitTest1.TestMethod1
1/1 test(s) Passed
Summary
-------
Test Run Completed.
Passed 1
---------
Total 1
Results file: C:\tmp\unittest\UnitTest\UnitTest\bin\Debug\TestResults\jocke_DESKTOP-S6MP97G 2016-07-12 21_16_40.trx
Test Settings: Default Test Settings
C:\tmp\unittest\UnitTest\UnitTest\bin\Debug>
、/ binに/ debugフォルダーから。問題は、MSBuildがTestResultフォルダ、 "user_machine timestamp"フォルダ、およびすべてのテストのDLLを含むOutフォルダを作成することです。私の理解は、\ TestResults \ user_machineのタイムスタンプ\アウトフォルダからdllを実行することであり、テストは/ bin/debugフォルダから実行する必要があります。 –