public void Setup()
        {
            if (File.Exists(testResultFilePath) == false)
            {
                throw new FileNotFoundException("File " + testResultFilePath + " was not found");
            }

            GeneralTree <IDirectoryTreeNode> features = Kernel.Get <DirectoryTreeCrawler>().Crawl(ROOT_PATH);

            var outputDirectory = new DirectoryInfo(OUTPUT_DIRECTORY);

            if (!outputDirectory.Exists)
            {
                outputDirectory.Create();
            }

            var configuration = new Configuration
            {
                OutputFolder        = new DirectoryInfo(OUTPUT_DIRECTORY),
                DocumentationFormat = DocumentationFormat.JSON,
                TestResultsFile     = new FileInfo(testResultFilePath),
                TestResultsFormat   = TestResultsFormat.MsTest
            };

            ITestResults testResults = new MsTestResults(configuration);
            var          jsonDocumentationBuilder = new JSONDocumentationBuilder(configuration, testResults);

            jsonDocumentationBuilder.Build(features);
        }
        public void Setup()
        {
            if (RealFileSystem.File.Exists(this.testResultFilePath) == false)
            {
                throw new System.IO.FileNotFoundException("File " + this.testResultFilePath + " was not found");
            }

            GeneralTree <INode> features = Container.Resolve <DirectoryTreeCrawler>().Crawl(ROOT_PATH);

            var outputDirectory = RealFileSystem.DirectoryInfo.FromDirectoryName(OUTPUT_DIRECTORY);

            if (!outputDirectory.Exists)
            {
                outputDirectory.Create();
            }

            var configuration = new Configuration
            {
                OutputFolder        = RealFileSystem.DirectoryInfo.FromDirectoryName(OUTPUT_DIRECTORY),
                DocumentationFormat = DocumentationFormat.JSON,
                TestResultsFile     = RealFileSystem.FileInfo.FromFileName(this.testResultFilePath),
                TestResultsFormat   = TestResultsFormat.MsTest
            };

            ITestResults testResults = new MsTestResults(configuration);
            var          jsonDocumentationBuilder = new JSONDocumentationBuilder(configuration, testResults, RealFileSystem);

            jsonDocumentationBuilder.Build(features);
        }
        public string Setup()
        {
            const string OutputDirectoryName = FileSystemPrefix + @"JSONFeatureOutput";
            var          rootPath            = FileSystem.DirectoryInfo.FromDirectoryName(FileSystemPrefix + @"JSON\Features");

            const string TestResultFilePath = FileSystemPrefix + @"JSON\results-example-failing-and-pasing-mstest.trx";

            string filePath = FileSystem.Path.Combine(OutputDirectoryName, JsonDocumentationBuilder.JsonFileName);

            this.AddFakeFolderAndFiles("JSON", new[] { "results-example-failing-and-pasing-mstest.trx" });
            this.AddFakeFolderAndFiles(
                @"JSON\Features",
                new[]
            {
                "OneScenarioTransferingMoneyBetweenAccountsFailing.feature",
                "TransferBetweenAccounts_WithSuccess.feature",
                "TwoScenariosTransferingFundsOneFailingOneSuccess.feature",
                "TwoScenariosTransferingMoneyBetweenAccoutsWithSuccess.feature",
            });

            var resultFile = RetrieveContentOfFileFromResources(ResourcePrefix + "JSON.results-example-failing-and-pasing-mstest.trx");

            FileSystem.AddFile(TestResultFilePath, resultFile);

            Tree features = Container.Resolve <DirectoryTreeCrawler>().Crawl(rootPath, new ParsingReport());

            var outputDirectory = FileSystem.DirectoryInfo.FromDirectoryName(OutputDirectoryName);

            if (!outputDirectory.Exists)
            {
                outputDirectory.Create();
            }

            var configuration = new Configuration
            {
                OutputFolder           = FileSystem.DirectoryInfo.FromDirectoryName(OutputDirectoryName),
                DocumentationFormat    = DocumentationFormat.Json,
                TestResultsFormat      = TestResultsFormat.MsTest,
                SystemUnderTestName    = "SUT Name",
                SystemUnderTestVersion = "SUT Version"
            };

            configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName(TestResultFilePath));

            ITestResults testResults = new MsTestResults(configuration, new MsTestSingleResultLoader(), new MsTestScenarioOutlineExampleMatcher());
            var          jsonDocumentationBuilder = new JsonDocumentationBuilder(configuration, testResults, FileSystem, new LanguageServicesRegistry());

            jsonDocumentationBuilder.Build(features);
            string content = FileSystem.File.ReadAllText(filePath);

            return(content);
        }
コード例 #4
0
        public string Setup()
        {
            const string OUTPUT_DIRECTORY   = FileSystemPrefix + @"JSONFeatureOutput";
            const string ROOT_PATH          = FileSystemPrefix + @"JSON\Features";
            const string testResultFilePath = FileSystemPrefix + @"JSON\results-example-failing-and-pasing-mstest.trx";

            string filePath = FileSystem.Path.Combine(OUTPUT_DIRECTORY, JSONDocumentationBuilder.JsonFileName);

            AddFakeFolderAndFiles("JSON", new[] { "results-example-failing-and-pasing-mstest.trx" });
            AddFakeFolderAndFiles(
                @"JSON\Features",
                new[]
            {
                "OneScenarioTransferingMoneyBetweenAccountsFailing.feature",
                "TransferBetweenAccounts_WithSuccess.feature",
                "TwoScenariosTransferingFundsOneFailingOneSuccess.feature",
                "TwoScenariosTransferingMoneyBetweenAccoutsWithSuccess.feature",
            });

            var resultFile = RetrieveContentOfFileFromResources(ResourcePrefix + "JSON.results-example-failing-and-pasing-mstest.trx");

            FileSystem.AddFile(testResultFilePath, resultFile);

            GeneralTree <INode> features = Container.Resolve <DirectoryTreeCrawler>().Crawl(ROOT_PATH);

            var outputDirectory = FileSystem.DirectoryInfo.FromDirectoryName(OUTPUT_DIRECTORY);

            if (!outputDirectory.Exists)
            {
                outputDirectory.Create();
            }

            var configuration = new Configuration()
            {
                OutputFolder           = FileSystem.DirectoryInfo.FromDirectoryName(OUTPUT_DIRECTORY),
                DocumentationFormat    = DocumentationFormat.JSON,
                TestResultsFormat      = TestResultsFormat.MsTest,
                SystemUnderTestName    = "SUT Name",
                SystemUnderTestVersion = "SUT Version"
            };

            configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName(testResultFilePath));

            ITestResults testResults = new MsTestResults(configuration);
            var          jsonDocumentationBuilder = new JSONDocumentationBuilder(configuration, testResults, FileSystem);

            jsonDocumentationBuilder.Build(features);
            string content = FileSystem.File.ReadAllText(filePath);

            return(content);
        }
        public string Setup()
        {
            const string OutputDirectoryName = FileSystemPrefix + @"JSONFeatureOutput";
            const string RootPath = FileSystemPrefix + @"JSON\Features";
            const string TestResultFilePath = FileSystemPrefix + @"JSON\results-example-failing-and-pasing-mstest.trx";

            string filePath = FileSystem.Path.Combine(OutputDirectoryName, JsonDocumentationBuilder.JsonFileName);

            this.AddFakeFolderAndFiles("JSON", new[] { "results-example-failing-and-pasing-mstest.trx" });
            this.AddFakeFolderAndFiles(
                @"JSON\Features",
                new[]
                {
                    "OneScenarioTransferingMoneyBetweenAccountsFailing.feature",
                    "TransferBetweenAccounts_WithSuccess.feature",
                    "TwoScenariosTransferingFundsOneFailingOneSuccess.feature",
                    "TwoScenariosTransferingMoneyBetweenAccoutsWithSuccess.feature",
                });

            var resultFile = RetrieveContentOfFileFromResources(ResourcePrefix + "JSON.results-example-failing-and-pasing-mstest.trx");
            FileSystem.AddFile(TestResultFilePath, resultFile);

            Tree features = Container.Resolve<DirectoryTreeCrawler>().Crawl(RootPath);

            var outputDirectory = FileSystem.DirectoryInfo.FromDirectoryName(OutputDirectoryName);
            if (!outputDirectory.Exists)
            {
                outputDirectory.Create();
            }

            var configuration = new Configuration
            {
                OutputFolder = FileSystem.DirectoryInfo.FromDirectoryName(OutputDirectoryName),
                DocumentationFormat = DocumentationFormat.Json,
                TestResultsFormat = TestResultsFormat.MsTest,
                SystemUnderTestName = "SUT Name",
                SystemUnderTestVersion = "SUT Version"
            };
            configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName(TestResultFilePath));

            ITestResults testResults = new MsTestResults(configuration, new MsTestSingleResultLoader(), new MsTestScenarioOutlineExampleMatcher());
            var jsonDocumentationBuilder = new JsonDocumentationBuilder(configuration, testResults, FileSystem);
            jsonDocumentationBuilder.Build(features);
            string content = FileSystem.File.ReadAllText(filePath);

            return content;
        }