コード例 #1
0
ファイル: MSTestShooter.cs プロジェクト: Gnail-nehc/Brick
        public int CallMsTest(string tcId, string msTestExeFullName, string testAssemblyFullName, string reportFullName, string testCaseFolder)
        {
            try
            {

                TempRecorder temp = new TempRecorder();
                temp.WriteContent(tcId, testCaseFolder);
                ProcessStartInfo pStartInfo = new ProcessStartInfo(msTestExeFullName);
                pStartInfo.CreateNoWindow = false;
                pStartInfo.UseShellExecute = false;

                pStartInfo.Arguments = string.Format("/nologo /testcontainer:\"{0}\" /test:{1} /resultsfile:\"{2}\"",
                    testAssemblyFullName,
                    TEST_METHOD_NAME,
                    reportFullName);

                ConsoleLog.LogDebug("Process Arguments: {0}", pStartInfo.Arguments);

                try
                {
                    ConsoleLog.LogInfo(msTestExeFullName);
                    using (Process p = Process.Start(pStartInfo))
                    {
                        if (p != null)
                        {
                            ConsoleLog.LogDebug("Current Process ID: {0}", p.Id);
                        }
                        p.WaitForExit();
                        return p.ExitCode;
                    }
                }
                catch (Win32Exception e)
                {
                    ConsoleLog.LogError("class:MSTestShooter, method:CallMsTest:{0}", e);
                    return ExitCode.ProcessStartException;
                }
            }
            catch (Exception e)
            {
                ConsoleLog.LogError("unknown exception:{0}", e);
                return ExitCode.UnknownPlaybackException;
            }
        }
コード例 #2
0
        public int CallMsTest(string tcId, string msTestExeFullName, string testAssemblyFullName, string reportFullName, string testCaseFolder)
        {
            try
            {
                TempRecorder temp = new TempRecorder();
                temp.WriteContent(tcId, testCaseFolder);
                ProcessStartInfo pStartInfo = new ProcessStartInfo(msTestExeFullName);
                pStartInfo.CreateNoWindow  = false;
                pStartInfo.UseShellExecute = false;

                pStartInfo.Arguments = string.Format("/nologo /testcontainer:\"{0}\" /test:{1} /resultsfile:\"{2}\"",
                                                     testAssemblyFullName,
                                                     TEST_METHOD_NAME,
                                                     reportFullName);

                ConsoleLog.LogDebug("Process Arguments: {0}", pStartInfo.Arguments);

                try
                {
                    ConsoleLog.LogInfo(msTestExeFullName);
                    using (Process p = Process.Start(pStartInfo))
                    {
                        if (p != null)
                        {
                            ConsoleLog.LogDebug("Current Process ID: {0}", p.Id);
                        }
                        p.WaitForExit();
                        return(p.ExitCode);
                    }
                }
                catch (Win32Exception e)
                {
                    ConsoleLog.LogError("class:MSTestShooter, method:CallMsTest:{0}", e);
                    return(ExitCode.ProcessStartException);
                }
            }
            catch (Exception e)
            {
                ConsoleLog.LogError("unknown exception:{0}", e);
                return(ExitCode.UnknownPlaybackException);
            }
        }