Пример #1
0
        public void WhenTheParsedResultIsSavedTo(string parsedFileName)
        {
            var assemblyFolder = AssemblyFolderHelper.GetAssemblyFolder();

            assemblyFolder.Should().EndWith(@"\bin\Debug\netcoreapp3.0", "parsed file saving can only be done from a development environment");
            parserDriver.SaveSerializedFeatureTo(Path.Combine(assemblyFolder, @"..\..\..\TestFiles", parsedFileName));
        }
Пример #2
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());
        }
Пример #3
0
        private void AddReference(InputProjectDriver inputProjectDriver, Project project, string reference)
        {
            string referenceFullPath = Path.GetFullPath(Path.Combine(AssemblyFolderHelper.GetTestAssemblyFolder(), reference));
            string assemblyName      = Path.GetFileNameWithoutExtension(referenceFullPath);

            Debug.Assert(assemblyName != null);

            project.AddItem("Reference", assemblyName, new[]
            {
                new KeyValuePair <string, string>("HintPath", referenceFullPath),
            });
        }
Пример #4
0
        public void WhenIGenerateSpecFlowNUnitExecutionReport()
        {
            ProcessHelper processHelper = new ProcessHelper();

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

            processHelper.RunProcess(
                Path.Combine(AssemblyFolderHelper.GetTestAssemblyFolder(), @"SpecFlow\tools\specflow.exe"),
                "nunitexecutionreport --ProjectFile=\"{0}\" --xmlTestResult=\"{1}\" --testOutput=\"{2}\" --OutputFile=\"{3}\" {4}", inputProjectDriver.ProjectFilePath,
                Path.Combine(inputProjectDriver.DeploymentFolder, "nunit-result.xml"), Path.Combine(inputProjectDriver.DeploymentFolder, "nunit-result.txt"),
                reportInfo.FilePath, GetCustomXsltArgument());
        }
Пример #5
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 --ProjectFile=\"{0}\" --OutputFile=\"{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();
        }
Пример #6
0
        private string SaveFileFromTemplate(string compilationFolder, string templateName, string outputFileName, Dictionary <string, string> replacements = null)
        {
            if (replacements == null)
            {
                replacements = new Dictionary <string, string>();
            }

            replacements.Add("SpecFlowRoot", Path.Combine(AssemblyFolderHelper.GetTestAssemblyFolder(), "SpecFlow"));

            string fileContent = templateManager.LoadTemplate(templateName, replacements);

            string outputPath = Path.Combine(compilationFolder, outputFileName);

            File.WriteAllText(outputPath, fileContent, Encoding.UTF8);
            return(outputPath);
        }