Example #1
0
        public static string Get(TestFolders folderType)
        {
            Assembly asm = Assembly.GetAssembly(typeof(PathToTestFolder));

            if (asm != null)
            {
                var appDir = new DirectoryInfo(Path.GetDirectoryName(GetAssemblyCodeBaseLocation(asm)));
// ReSharper disable PossibleNullReferenceException
                string result = string.Format("{0}\\{1}.Tests\\", appDir.Parent.Parent.FullName, folderType);
                if (Directory.Exists(result))
                {
                    return(result);
                }

                result = string.Format("{0}\\bv.tests\\{1}.Tests\\", appDir.Parent.Parent.Parent.FullName, folderType);
                if (Directory.Exists(result))
                {
                    return(result);
                }

                // For tests
                return(string.Format("{0}\\{1}.Tests\\", appDir.FullName, folderType));

                ;

// ReSharper restore PossibleNullReferenceException
            }
            return("..\\" + folderType + ".Tests\\");
        }
        public override void RefreshOnProjectChanged(ProjectChangedEventArgs args)
        {
            TimeUntilNextRun = Project.Frequency;
            Timer.Change(0, 1000);

            HashSet <DateTime> currentDates = new HashSet <DateTime>();

            foreach (TreeItemFolderViewModel folder in TestFolders)
            {
                currentDates.Add(folder.Date.Date);
            }

            foreach (TestResult result in args.AddedTests)
            {
                if (!currentDates.Contains(result.DateOfTesting.Date))
                {
                    currentDates.Add(result.DateOfTesting.Date);
                    TestFolders.Add(new TreeItemFolderViewModel(result.DateOfTesting, new List <TestResult>()));
                }
            }

            foreach (TreeItemFolderViewModel folder in TestFolders)
            {
                folder.RefreshOnProjectChanged(args);
            }
        }
        private static string CreateValidCompressionFolder()
        {
            var compressionFolder = TestFolders.CreateTempFolder();
            var metricsFile       = Path.Combine(compressionFolder, BuildMetrics.FileName);

            File.WriteAllText(metricsFile, BuildMetrics.GetValidContents());
            return(compressionFolder);
        }
        private RunResults ExecuteCompress(string options = "")
        {
            var compressionFolder = CreateValidCompressionFolder();
            var fileNameToCreate  = TestFolders.DefineTempFile("FileNameToCreate.zip");
            var results           = DryRunExe(fileNameToCreate, compressionFolder, options);

            return(results);
        }
 private void GenerateProject(GeneratorOptions generatorOptions)
 {
     generatorOptions.CreatedFor    = $"{FeatureContext.FeatureInfo.Title}_{ScenarioContext.ScenarioInfo.Title}";
     generatorOptions._TargetFolder = Path.Combine(TestFolders.TempFolder, @"DeveroomTest\DS_{options}");
     generatorOptions.FallbackNuGetPackageSource = TestFolders.GetInputFilePath("ExternalPackages");
     _projectGenerator = generatorOptions.CreateProjectGenerator(s => _outputHelper.WriteLine(s));
     _projectGenerator.Generate();
 }
Example #6
0
        public void TestWithoutSizeInfo()
        {
            var u = new Library.Utility.Uri(TestUtils.GetDefaultTarget());
            SizeOmittingBackend.WrappedBackend = u.Scheme;
            var target = u.SetScheme(new SizeOmittingBackend().ProtocolKey).ToString();

            SVNCheckoutTest.RunTest(TestFolders.Take(5).ToArray(), TestOptions, target);
        }
        public void InputFolderExistsWithoutFailuresWithAbortOnFailuresSuccessful()
        {
            var fileNameToCreate  = TestFolders.DefineTempFile("FileNameToCreate.zip");
            var compressionFolder = CreateValidCompressionFolder();
            var results           = RunExe(fileNameToCreate, compressionFolder, "--abortOnFailures");

            Assert.Equal(0, results.ExitCode);
        }
        public void FolderDoesntExistErrors()
        {
            var fileNameToCreate = TestFolders.DefineTempFile("FileNameToCreate.zip");
            var results          = RunExe(fileNameToCreate, "doesntExistFolder");

            Assert.NotEqual(0, results.ExitCode);
            Assert.Contains("Input folder 'doesntExistFolder' cannot be found.", results.StandardError);
        }
        public static void InitialiseReport()
        {
            var htmlReporter = new ExtentHtmlReporter(TestFolders.GetOutputFilePath("ExtentReport.html"));

            htmlReporter.Config.Theme = AventStack.ExtentReports.Reporter.Configuration.Theme.Dark;

            extent = new ExtentReports();
            extent.AttachReporter(htmlReporter);
        }
        public void ValidInputSuccessful()
        {
            var compressionFolder = CreateValidCompressionFolder();
            var fileNameToCreate  = TestFolders.DefineTempFile("FileNameToCreate.zip");
            var results           = RunExe(fileNameToCreate, compressionFolder);

            Assert.Equal(0, results.ExitCode);
            Assert.True(File.Exists(fileNameToCreate));
        }
        public void FileExistsWithoutOverwriteErrors()
        {
            var existingZip       = TestFolders.CreateTempFile("zip");
            var compressionFolder = CreateValidCompressionFolder();
            var results           = RunExe(existingZip, compressionFolder);

            Assert.NotEqual(0, results.ExitCode);
            Assert.Contains("Output file '" + existingZip + "' already exists.", results.StandardError);
        }
        public void InputFolderExistsWithFailuresWithAbortOnFailuresErrors()
        {
            var fileNameToCreate  = TestFolders.DefineTempFile("FileNameToCreate.zip");
            var compressionFolder = CreateValidCompressionFolderWithFailures();
            var results           = RunExe(fileNameToCreate, compressionFolder, "--abortOnFailures");

            Assert.NotEqual(0, results.ExitCode);
            Assert.Contains("Input folder '" + compressionFolder + "' has recorded failures.", results.StandardError);
        }
        public void InputFolderExistsWithoutBuildMetricsErrors()
        {
            var compressionFolder = TestFolders.CreateTempFolder();
            var fileNameToCreate  = TestFolders.DefineTempFile("FileNameToCreate.zip");
            var results           = RunExe(fileNameToCreate, compressionFolder);

            Assert.NotEqual(0, results.ExitCode);
            Assert.Contains("Input folder '" + compressionFolder + "' is not recognised as Coverity Scan results.", results.StandardError);
        }
        public void FileExistsWithOverwriteErrors()
        {
            var existingZip       = TestFolders.CreateTempFile("zip");
            var compressionFolder = CreateValidCompressionFolder();
            var results           = RunExe(existingZip, compressionFolder, "--overwrite");

            Assert.Equal(0, results.ExitCode);
            Assert.Contains("Overwritting file '" + existingZip + "' with new compression data.", results.StandardOutput);
            Assert.True(File.Exists(existingZip));
        }
        public void WhenTheParserGenerationIsPerformedUsing(string templateName)
        {
            var parser  = new BerpGrammar.Parser();
            var ruleSet = parser.Parse(new TokenScanner(new StringReader(grammarDefinition)));
            var states  = StateCalculator.CalculateStates(ruleSet);

            try
            {
                var generator = new Generator(ruleSet.Settings);
                outputFile = TestFolders.GetTempFilePath("output.txt");
                generator.Generate(Path.Combine("GeneratorTemplates", templateName), ruleSet, states, outputFile);
            }
            catch (Exception ex)
            {
                generationError = ex;
            }
        }
Example #16
0
 public void TestWithSVNLong()
 {
     SVNCheckoutTest.RunTest(TestFolders.ToArray(), TestOptions, TestTarget);
 }
Example #17
0
 public void TestWithSVNShort()
 {
     SVNCheckoutTest.RunTest(TestFolders.Take(5).ToArray(), TestOptions, TestTarget);
 }
        public void GivenThereIsAComplexGrammar()
        {
            var fullPath = TestFolders.GetInputFilePath(@"BerpGrammarParserForTest\BerpGrammar.berp");

            grammarDefinition = File.ReadAllText(fullPath);
        }
Example #19
0
        public void GivenTheInputSourceFrom(string fileName)
        {
            var fullPath = TestFolders.GetInputFilePath(fileName);

            sourceContent = File.ReadAllText(fullPath);
        }
Example #20
0
        private static string CreateTempZipFile()
        {
            var testfilePath = TestFolders.CreateTempFile("zip");

            return("\"" + testfilePath + "\"");
        }
 //Set the connection to tests here
 public TestPlan(TDAPIOLELib.TDConnection OALMConnection)
 {
     Test        = new Test(OALMConnection);
     TestFolders = new TestFolders(OALMConnection);
 }