Esempio n. 1
0
        /// <summary>
        /// For all processes running on the system, show the process name
        /// and the name of the file that was used to create the process
        /// </summary>
        private void LogProcessesInfo()
        {
            ProcessSW[]   processes = ProcessSW.GetProcesses();
            StringBuilder sb        = new StringBuilder();

            for (int i = 0; i < processes.Length; i++)
            {
                ProcessSW process = processes[i];
                sb.Append(process.ProcessName);
                sb.Append(" ");
            }
            GlobalLog.LogDebug(sb.ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// Runs the compiled application as a separate process.
        /// </summary>
        public void RunCompiledApp()
        {
            String execName = _assemblyName + ".exe";
            String execPath = DirectorySW.GetCurrentDirectory() + "\\bin\\Release\\" + execName;

            GlobalLog.LogStatus("Running Avalon app...");

            TimeSpan           timeOutSpan = new TimeSpan(0, 0, 180);
            ProcessSW          p           = new ProcessSW();
            ProcessStartInfoSW info        = new ProcessStartInfoSW();

            info.FileName = execPath;
            p.StartInfo   = info;

            p.Start();

            bool exited = p.WaitForExit((int)timeOutSpan.TotalMilliseconds);

            if (!exited)
            {
                while (!p.HasExited)
                {
                    p.Kill();
                }
            }


            // If an exception happened within the Avalon app,
            // forward that exception now.
            Exception testResultEx = SerializationHelper.RetrieveException();

            if (testResultEx != null)
            {
                SerializationHelper.StoreException(null);
                throw new TestValidationException("Exception was logged while running compiled app.\r\n\r\n" + testResultEx, testResultEx);
            }

            GlobalLog.LogStatus("Avalon app compiled and ran without error.");
        }