1

vstest.console.exe がテストを実行しません。

            var testProcess = new Process
        {
            StartInfo = new ProcessStartInfo
            {
                FileName = @"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe",
                Arguments = _testDllPath,

                UseShellExecute = false,
                RedirectStandardOutput = true,
                CreateNoWindow = true
            }
        };

コマンドラインを実行すると、次の出力が表示されます。

Microsoft (R) Test Execution Command Line Tool バージョン 11.0.60315.1Copyright (c) Microsoft Corporation. 全著作権所有。

注: MSTest を実行すると、テストが実行されます。

        var testProcess = new Process
        {
            StartInfo = new ProcessStartInfo
            {
                FileName = @"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe",
                Arguments = string.Format(@"/testcontainer:""{0}"" /resultsfile:""{1}""", _testDllPath, _resultsDirectoryPath),

                UseShellExecute = false,
                RedirectStandardOutput = true,
                CreateNoWindow = true
            }
        };

ただし、コマンドラインで mstest を実行すると、VS2012 TestExplorer でテストの失敗を再現できないにもかかわらず、テストの 1 つが失敗します。

4

1 に答える 1

0

テスト dll パスを引用符で囲む必要がありました。

var testProcess = new Process
{
    StartInfo = new ProcessStartInfo
    {
        FileName = @"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe",
        Arguments = _testDllPath.Replace(_testDllPath, '"' + _testDllPath + '"'),

        UseShellExecute = false,
        RedirectStandardOutput = true,
        CreateNoWindow = true
    }
};
于 2015-02-13T13:07:40.430 に答える