Esempio n. 1
0
        public int CallMsTest(int pId, int tcId, string msTestExeFullName, string testAssemblyFullName, string reportFullName, string testCaseFolder)
        {
            try
            {
                TempRecorder temp = new TempRecorder();
                temp.WriteContent(pId, 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);

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

                try
                {
                    ConsoleLogger.LogInfo(msTestExeFullName);
                    using (Process p = Process.Start(pStartInfo))
                    {
                        if (p != null)
                        {
                            ConsoleLogger.LogDebug("Current Process ID: {0}", p.Id);
                        }
                        p.WaitForExit();
                        return p.ExitCode;
                    }
                }
                catch (Win32Exception e)
                {
                    ConsoleLogger.LogError("class:MSTestShooter, method:CallMsTest:{0}", e);
                    return ExitCode.ProcessStartException;
                }
            }
            catch (Exception e)
            {
                ConsoleLogger.LogError("unknown exception:{0}", e);
                return ExitCode.UnknownPlaybackException;
            }
        }
Esempio n. 2
0
        public int CallMsTest(int pId, int tcId, string msTestExeFullName, string testAssemblyFullName, string reportFullName, string testCaseFolder)
        {
            try
            {
                TempRecorder temp = new TempRecorder();
                temp.WriteContent(pId, 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);

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

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