protected override void CallNUnit3(List<string> arguments)
 {
     string nunitConsoleRunnerPath = @"NUnit3-Runner\tools\nunit3-console.exe";
     var nunitConsolePath = Path.Combine(AssemblyFolderHelper.GetTestAssemblyFolder(), nunitConsoleRunnerPath);
     var processHelper = new ProcessHelper();
     processHelper.RunProcess(nunitConsolePath, string.Join(" ", arguments));
 }
        public TestRunSummary Execute()
        {
            string vsFolder = Environment.Is64BitProcess ? @"%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\IDE" : @"%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE";
            var nunitConsolePath = Path.Combine(AssemblyFolderHelper.GetTestAssemblyFolder(),
                Environment.ExpandEnvironmentVariables(vsFolder + @"\MsTest.exe"));

            string resultsFilePath = Path.Combine(inputProjectDriver.DeploymentFolder, "mstest-result.trx");

            var provessHelper = new ProcessHelper();
            provessHelper.RunProcess(nunitConsolePath, "\"/testcontainer:{0}\" \"/resultsfile:{1}\"", 
                inputProjectDriver.CompiledAssemblyPath, resultsFilePath);

            XDocument logFile = XDocument.Load(resultsFilePath);

            TestRunSummary summary = new TestRunSummary();

            XmlNameTable nameTable = new NameTable();
            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(nameTable);
            namespaceManager.AddNamespace("mstest", "http://microsoft.com/schemas/VisualStudio/TeamTest/2010");

            var summaryElement = logFile.XPathSelectElement("//mstest:ResultSummary/mstest:Counters", namespaceManager);
            if (summaryElement != null)
            {
                summary.Total = int.Parse(summaryElement.Attribute("total").Value);
                summary.Succeeded = int.Parse(summaryElement.Attribute("passed").Value);
                summary.Failed = int.Parse(summaryElement.Attribute("failed").Value);
                summary.Pending = int.Parse(summaryElement.Attribute("inconclusive").Value);
                summary.Ignored = 0; // mstest does not support ignored in the report
            }

            testExecutionResult.LastExecutionSummary = summary;

            return summary;
        }
示例#3
0
        public void WhenIGenerateSpecFlowMsTestExecutionReport()
        {
            ProcessHelper processHelper = new ProcessHelper();

            reportInfo.FilePath = Path.Combine(inputProjectDriver.DeploymentFolder, "executionreport.html");

            processHelper.RunProcess(
                Path.Combine(AssemblyFolderHelper.GetTestAssemblyFolder(), @"SpecFlow\tools\specflow.exe"),
                "mstestexecutionreport \"{0}\" \"/testResult:{1}\" \"/out:{2}\" {3}", inputProjectDriver.ProjectFilePath,
                Path.Combine(inputProjectDriver.DeploymentFolder, "mstest-result.trx"), reportInfo.FilePath, GetCustomXsltArgument());
        }
        public TestRunSummary ExecuteOutProc()
        {
            string resultFilePath = Path.Combine(inputProjectDriver.DeploymentFolder, "nunit-result.xml");
            string logFilePath = Path.Combine(inputProjectDriver.DeploymentFolder, "nunit-result.txt");

            var provessHelper = new ProcessHelper();
            var nunitConsolePath = Path.Combine(AssemblyFolderHelper.GetTestAssemblyFolder(), @"NUnit.Runners\tools\nunit-console-x86.exe");
            provessHelper.RunProcess(nunitConsolePath, "\"{0}\" \"/xml:{1}\" /labels \"/out={2}\" {3}", 
                inputProjectDriver.CompiledAssemblyPath, resultFilePath, logFilePath, GetIncludeExclude());

            return ProcessNUnitResult(logFilePath, resultFilePath);
        }
        public TestRunSummary Execute()
        {
            string resultFilePath = Path.Combine(inputProjectDriver.DeploymentFolder, "xunit-result.xml");
            string logFilePath = Path.Combine(inputProjectDriver.DeploymentFolder, "xunit-result.txt");
            var xunitConsolePath = Path.Combine(AssemblyFolderHelper.GetTestAssemblyFolder(), @"xunit.runner.console\tools\xunit.console.exe");

            var provessHelper = new ProcessHelper();
            provessHelper.RunProcess(xunitConsolePath, "\"{0}\" -nunit \"{1}\"",
                inputProjectDriver.CompiledAssemblyPath, resultFilePath);
           
            File.WriteAllText(logFilePath, provessHelper.ConsoleOutput);
            return ProcessNUnitResult(logFilePath, resultFilePath);
        }
        public TestRunSummary ExecuteWithNUnit3() //TODO: add NUnit3 as reference and use in-proc execution
        {
            string resultFilePath = Path.Combine(inputProjectDriver.DeploymentFolder, "nunit-result.xml");
            string logFilePath = Path.Combine(inputProjectDriver.DeploymentFolder, "nunit-result.txt");

            var provessHelper = new ProcessHelper();
            string nunitConsoleRunnerPath = @"NUnit3-Runner\bin\nunit-console.exe";
            var nunitConsolePath = Path.Combine(AssemblyFolderHelper.GetTestAssemblyFolder(), nunitConsoleRunnerPath);
            provessHelper.RunProcess(nunitConsolePath, "\"{0}\" \"--result={1};format=nunit2\" --labels=All \"--out={2}\" {3}",
                inputProjectDriver.CompiledAssemblyPath, resultFilePath, logFilePath, GetIncludeExclude());

            return ProcessNUnitResult(logFilePath, resultFilePath);
        }
示例#7
0
        public void WhenIGenerateSpecFlowStepDefinitionReport()
        {
            ProcessHelper processHelper = new ProcessHelper();

            reportInfo.FilePath = Path.Combine(inputProjectDriver.DeploymentFolder, "stepdefinitionreport.html");

            processHelper.RunProcess(
                Path.Combine(AssemblyFolderHelper.GetTestAssemblyFolder(), @"SpecFlow\tools\specflow.exe"),
                "StepDefinitionReport \"{0}\" \"/out:{1}\" {2}", inputProjectDriver.ProjectFilePath, reportInfo.FilePath, Debugger.IsAttached ? "/debug" : "");

            //StepDefinitionReportParameters reportParameters =
            //    new StepDefinitionReportParameters(inputProjectDriver.ProjectFilePath, reportInfo.FilePath, "", "bin\\Debug", true);
            //var generator = new StepDefinitionReportGenerator(reportParameters);
            //generator.GenerateAndTransformReport();
        }