예제 #1
0
        public override bool Examine(TestFixturOption testFixturOption, DTE2 applicationObject)
        {
            if (testFixturOption.Project == null)
            {
                throw new ArgumentNullException("testFixturOption.Project can not be null");
            }

            if (applicationObject == null)
            {
                throw new ArgumentNullException("applicationObject can not be null");
            }

            try
            {
                string outPutXml = "OpenCoverOutput.xml";

                if (this.binariesDirectory == null || this.binariesDirectory == string.Empty)
                {
                    BrowseForCoverLibraries tvLocateNUnitBinaries = new BrowseForCoverLibraries(UTGHelper.CommonErrors.ERR_UNABLE_TO_LOCATE_COVER_INSTALL_FOLDER, this);

                    tvLocateNUnitBinaries.Show();

                    return(false);
                }

                Project project = testFixturOption.Project;

                string projectPath = ProjectExaminar.GetProjectPath(project);

                if (CoverageExaminationStarted != null)
                {
                    CoverageExaminationStarted();
                }

                string tvArgument = FormatFrameworkArgument(testFixturOption);

                System.Diagnostics.ProcessStartInfo psi =
                    new System.Diagnostics.ProcessStartInfo(System.IO.Path.Combine(this.ConsoleDirectory, this.ConsoleName), tvArgument);

                psi.UseShellExecute = false;

                psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

                psi.RedirectStandardOutput = true;

                psi.CreateNoWindow = true; //this is the one that works

                System.Diagnostics.Process process = System.Diagnostics.Process.Start(psi);

                System.IO.StreamReader myOutput = process.StandardOutput;

                string output = string.Empty;

                if (!process.WaitForExit(exitWaitPeriod))
                {
                    return(false);
                }

                output += myOutput.ReadToEnd();

                bool success = ShowReport(projectPath, outPutXml);

                if (success)
                {
                    if (CoverageExaminationEnded != null)
                    {
                        CoverageExaminationEnded(project, "Changed text to something else here...");
                    }
                }

                //consider moving to http://reportgenerator.codeplex.com/ instead....

                return(true);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(false);
        }
예제 #2
0
        public override bool Examine(TestFixturOption testFixturOption, DTE2 applicationObject)
        {
            if (testFixturOption.Project == null)
            {
                throw new ArgumentNullException("testFixturOption.Project can not be null");
            }

            if (applicationObject == null)
            {
                throw new ArgumentNullException("applicationObject can not be null");
            }

            try
            {
                if (this.binariesDirectory == null || this.binariesDirectory == string.Empty)
                {
                    BrowseForCoverLibraries tvLocateNUnitBinaries = new BrowseForCoverLibraries(UTGHelper.CommonErrors.ERR_UNABLE_TO_LOCATE_COVER_INSTALL_FOLDER, this);

                    tvLocateNUnitBinaries.Show();

                    return(false);
                }

                Project project = testFixturOption.Project;

                if (CoverageExaminationStarted != null)
                {
                    CoverageExaminationStarted();
                }

                string tvArgument = FormatFrameworkArgument(testFixturOption);

                System.Diagnostics.ProcessStartInfo psi =
                    new System.Diagnostics.ProcessStartInfo(System.IO.Path.Combine(this.BinariesDirectory, this.CommandName), tvArgument);

                psi.UseShellExecute = false;

                psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

                psi.RedirectStandardOutput = true;

                psi.CreateNoWindow = true; //this is the one that works

                System.Diagnostics.Process process = System.Diagnostics.Process.Start(psi);

                System.IO.StreamReader myOutput = process.StandardOutput;

                string output = string.Empty;

                if (!process.WaitForExit(exitWaitPeriod))
                {
                    return(false);
                }

                output += myOutput.ReadToEnd();

                UTGCoverage.CoverageReport report = new UTGCoverage.CoverageReport();

                System.IO.StreamReader reader = new System.IO.StreamReader(ProjectExaminar.GetProjectPath(testFixturOption.Project) + "\\PartCoverOutput.xml");

                UTGCoverage.ReportProvider.ReadReport(report, reader);

                reader.Close();

                System.Windows.Forms.TreeView trview = UTGCoverage.ReportProvider.ShowReport(report, UTGHelper.PartCoverUserControle.treeView1);

                UTGHelper.PartCoverUserControle.treeView1.Refresh();

                if (CoverageExaminationEnded != null)
                {
                    CoverageExaminationEnded(testFixturOption.Project, string.Format("{0} at {1}.", "PartCoverOutput.xml", ProjectExaminar.GetProjectPath(testFixturOption.Project)));
                }

                return(true);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(false);
        }
예제 #3
0
      public override bool Examine(TestFixturOption testFixturOption, DTE2 applicationObject)
      {
         if (testFixturOption.Project == null) {

            throw new ArgumentNullException("testFixturOption.Project can not be null");
         }

         if (applicationObject == null) {

            throw new ArgumentNullException("applicationObject can not be null");
         }

         try
         {
            string outPutXml = "OpenCoverOutput.xml";

            if (this.binariesDirectory == null || this.binariesDirectory == string.Empty) {

               BrowseForCoverLibraries tvLocateNUnitBinaries = new BrowseForCoverLibraries(UTGHelper.CommonErrors.ERR_UNABLE_TO_LOCATE_COVER_INSTALL_FOLDER, this);
               
               tvLocateNUnitBinaries.Show();

               return false;
            }

            Project project = testFixturOption.Project;

            string projectPath = ProjectExaminar.GetProjectPath(project);

            if (CoverageExaminationStarted != null)  {

               CoverageExaminationStarted();
            }

            string tvArgument = FormatFrameworkArgument(testFixturOption);

            System.Diagnostics.ProcessStartInfo psi =
                 new System.Diagnostics.ProcessStartInfo(System.IO.Path.Combine(this.ConsoleDirectory, this.ConsoleName), tvArgument);

            psi.UseShellExecute = false;

            psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

            psi.RedirectStandardOutput = true;

            psi.CreateNoWindow = true; //this is the one that works

            System.Diagnostics.Process process = System.Diagnostics.Process.Start(psi);

            System.IO.StreamReader myOutput = process.StandardOutput;

            string output = string.Empty;

            if (!process.WaitForExit(exitWaitPeriod)) {
               return false;
            }

            output += myOutput.ReadToEnd();

            bool success = ShowReport(projectPath, outPutXml);

            if (success)
            {
               if (CoverageExaminationEnded != null)
               {
                  CoverageExaminationEnded(project, "Changed text to something else here...");
               }
            }

            //consider moving to http://reportgenerator.codeplex.com/ instead....

            return true;
         }
         catch (Exception ex)
         {
            Logger.LogException(ex);
         }

         return false;
      }
예제 #4
0
      public override bool Examine(TestFixturOption testFixturOption, DTE2 applicationObject)
      {
         if (testFixturOption.Project == null)
         {
            throw new ArgumentNullException("testFixturOption.Project can not be null");
         }

         if (applicationObject == null)
         {
            throw new ArgumentNullException("applicationObject can not be null");
         }

         try
         {
            if (this.binariesDirectory == null || this.binariesDirectory == string.Empty) {

               BrowseForCoverLibraries tvLocateNUnitBinaries = new BrowseForCoverLibraries(UTGHelper.CommonErrors.ERR_UNABLE_TO_LOCATE_COVER_INSTALL_FOLDER, this);
               
               tvLocateNUnitBinaries.Show();

               return false;
            }

            Project project = testFixturOption.Project;

            if (CoverageExaminationStarted != null)  {
               CoverageExaminationStarted();
            }

            string tvArgument = FormatFrameworkArgument(testFixturOption);

            System.Diagnostics.ProcessStartInfo psi =
                 new System.Diagnostics.ProcessStartInfo(System.IO.Path.Combine(this.BinariesDirectory, this.CommandName), tvArgument);

            psi.UseShellExecute = false;

            psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

            psi.RedirectStandardOutput = true;

            psi.CreateNoWindow = true; //this is the one that works

            System.Diagnostics.Process process = System.Diagnostics.Process.Start(psi);

            System.IO.StreamReader myOutput = process.StandardOutput;

            string output = string.Empty;

            if (!process.WaitForExit(exitWaitPeriod))
            {
               return false;
            }

            output += myOutput.ReadToEnd();

            UTGCoverage.CoverageReport report = new UTGCoverage.CoverageReport();

            System.IO.StreamReader reader = new System.IO.StreamReader(ProjectExaminar.GetProjectPath(testFixturOption.Project) + "\\PartCoverOutput.xml");

            UTGCoverage.ReportProvider.ReadReport(report, reader);

            reader.Close();

            System.Windows.Forms.TreeView trview = UTGCoverage.ReportProvider.ShowReport(report, UTGHelper.PartCoverUserControle.treeView1);

            UTGHelper.PartCoverUserControle.treeView1.Refresh();

            if (CoverageExaminationEnded != null) {

               CoverageExaminationEnded(testFixturOption.Project, string.Format("{0} at {1}.", "PartCoverOutput.xml", ProjectExaminar.GetProjectPath(testFixturOption.Project)));   
            }

            return true;
         }
         catch (Exception ex)
         {
            Logger.LogException(ex);
         }

         return false;
      }