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);
        }
        private void TweakJsonFile()
        {
            var jsonBuilder  = new JSONDocumentationBuilder(configuration, testResults, this.fileSystem);
            var jsonFilePath = jsonBuilder.OutputFilePath;

            var tweaker = new JsonTweaker(this.fileSystem);

            tweaker.AddJsonPWrapperTo(jsonFilePath);
            tweaker.RenameFileTo(jsonFilePath, jsonFilePath.Replace(".json", ".js"));
        }
示例#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);
        }
示例#5
0
        public void Setup()
        {
            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
            };


            var jsonDocumentationBuilder = new JSONDocumentationBuilder(configuration, null);

            jsonDocumentationBuilder.Build(features);
        }
        public void Setup()
        {
            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
            };


            var jsonDocumentationBuilder = new JSONDocumentationBuilder(configuration, null, RealFileSystem);

            jsonDocumentationBuilder.Build(features);
        }
        private void UtilizeJsonBuilderToDumpJsonFeatureFileNextToDthmlResources(GeneralTree <INode> features)
        {
            var jsonBuilder = new JSONDocumentationBuilder(configuration, testResults, this.fileSystem);

            jsonBuilder.Build(features);
        }