Exemplo n.º 1
0
        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"));
        }
        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);
        }
        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 void Setup()
        {
            if (File.Exists(this.testResultFilePath) == false)
            {
                throw new FileNotFoundException("File " + this.testResultFilePath + " was not found");
            }

            GeneralTree<IDirectoryTreeNode> features = Container.Resolve<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(this.testResultFilePath),
                                        TestResultsFormat = TestResultsFormat.MsTest
                                    };

            ITestResults testResults = new MsTestResults(configuration);
            var jsonDocumentationBuilder = new JSONDocumentationBuilder(configuration, testResults);
            jsonDocumentationBuilder.Build(features);
        }
Exemplo n.º 5
0
 private void UtilizeJsonBuilderToDumpJsonFeatureFileNextToDthmlResources(GeneralTree<INode> features)
 {
     var jsonBuilder = new JSONDocumentationBuilder(configuration, testResults, this.fileSystem);
     jsonBuilder.Build(features);
 }