Esempio n. 1
0
        void RunTests(TestPlan inTests)
        {
            var testsPath = Path.GetTempFileName();

            inTests.Save(testsPath);

            var runner = FindRunner();

            if (string.IsNullOrEmpty(runner))
            {
                MessageBox.Show("Could not find QuickTestRunner.exe");
                return;
            }

            var info = new System.Diagnostics.ProcessStartInfo {
                FileName  = runner,
                Arguments = "\"" + testsPath + "\"",
                RedirectStandardOutput = true,
                StandardOutputEncoding = Encoding.UTF8,
                UseShellExecute        = false,
                CreateNoWindow         = true,
            };
            var proc   = System.Diagnostics.Process.Start(info);
            var output = proc.StandardOutput.ReadToEnd();

            proc.WaitForExit(5000);

            try {
                var outTests = TestPlan.Open(new StringReader(output));

                foreach (var t in outTests.Tests)
                {
                    _tests.GetTest(t.Id).RecordResults(t);
                }

                _projectRepo.Save(_repoPath);

                File.Delete(testsPath);
            }
            catch (Exception) {
            }

            BeginInvoke((Action) delegate {
                Progress.Visible = false;
                if (proc.ExitCode == 0)
                {
                    OutputTests();
                }
                else
                {
                    SetStatus(FailStatusIcon, "Execution Failed: " + output);
                }
            });
        }
Esempio n. 2
0
        TestRepo SetProject(Project project)
        {
            var projectPath = project.FullName;

            if (projectPath != _projectPath)
            {
                _projectPath = projectPath;

                var dir = Path.GetDirectoryName(projectPath);

                ProjectItem repoItem = null;
                foreach (ProjectItem i in project.ProjectItems)
                {
                    if (Path.GetExtension(i.Name) == TestRepo.FileExtension)
                    {
                        repoItem = i;
                    }
                }
                if (repoItem == null)
                {
                    var filename = project.Name + TestRepo.FileExtension;
                    _repoPath = Path.Combine(dir, filename);

                    _projectRepo = new TestRepo();
                    _projectRepo.Save(_repoPath);

                    project.ProjectItems.AddFromFile(_repoPath);
                }
                else
                {
                    _repoPath    = Path.Combine(dir, repoItem.Name);
                    _projectRepo = TestRepo.Open(_repoPath);
                }
            }

            return(_projectRepo);
        }