示例#1
0
        public static void RunAndCompareTests(
            [QueueTrigger("run-and-compare-tests")] TestComparisonRequest request,
            [Blob("testzips/{TestComparisonId}.zip", FileAccess.Read)] Stream testZip,
            [Blob("testcomparisons/{TestComparisonId}.json")] CloudBlockBlob outputBlob)
        {
            string currentDirectory = AppDomain.CurrentDomain.BaseDirectory;
            string testDirectory    = Path.Combine(currentDirectory, request.TestComparisonId);

            ExtractTestZip(testZip, testDirectory);
            string             pathToTestDll     = Path.Combine(testDirectory, "old", request.TestDll);
            string             pathToOldCoverage = Path.Combine(testDirectory, "OldCoverage");
            string             pathToNewCoverage = Path.Combine(testDirectory, "NewCoverage");
            CodeCoverageRunner runner            = CreateRunner(currentDirectory, request);

            runner.TestRunnerArguments               = string.Format("\"\"{0}\"\" -method {1} -noshadow", pathToTestDll, request.TestToRun);
            runner.PathToCodeCoverageXmlFile         = Path.Combine(testDirectory, "old.xml");
            runner.PathToCodeCoverageReportDirectory = Path.Combine(testDirectory, "OldCoverage");
            runner.RunCodeCoverage();
            pathToTestDll = Path.Combine(testDirectory, "new", request.TestDll);
            runner.TestRunnerArguments               = string.Format("\"\"{0}\"\" -method {1} -noshadow", pathToTestDll, request.TestToRun);
            runner.PathToCodeCoverageXmlFile         = Path.Combine(testDirectory, "new.xml");
            runner.PathToCodeCoverageReportDirectory = Path.Combine(testDirectory, "NewCoverage");
            runner.RunCodeCoverage();
            IEnumerable <FileDifferences> differences = new CodeCoverageComparison().CompareDirectories(pathToOldCoverage, pathToNewCoverage);

            outputBlob.UploadText(FileDifferencesSerializer.ToString(differences));
            Directory.Delete(testDirectory, true);
        }
示例#2
0
        public static void Main(string[] args)
        {
            Options options = new Options();

            Parser.Default.ParseArgumentsStrict(args, options);
            string pathToOldCodeCoverageReportDirectory = Path.Combine(options.PathToCodeCoverageReportDirectory, "old");
            string pathToNewCodeCoverageReportDirectory = Path.Combine(options.PathToCodeCoverageReportDirectory, "new");

            RunCodeCoverage(options, pathToOldCodeCoverageReportDirectory, pathToNewCodeCoverageReportDirectory);
            CodeCoverageComparison        comparison  = new CodeCoverageComparison();
            IEnumerable <FileDifferences> differences = comparison.CompareDirectories(
                pathToOldCodeCoverageReportDirectory,
                pathToNewCodeCoverageReportDirectory);
            string differenceText = FileDifferencesSerializer.ToString(differences);

            SaveToFile(differenceText, options);
            SaveToAzure(differenceText, options);
        }
示例#3
0
        public static void Main(string[] args)
        {
            string baseDirectory = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\.."));

            FileDifferencesSerializer.ToFile(
                Path.Combine(baseDirectory, @"..\restsharp.json"),
                CodeCoverageComparison.CompareFileContent(File.ReadAllText(args[0]), File.ReadAllText(args[1])));

            /*(new CodeCoverageRunner()
             * {
             *  PathToOpenCover = Path.Combine(baseDirectory, @"RestSharp\packages\OpenCover.4.5.3723\OpenCover.Console.exe"),
             *  PathToReportGenerator = Path.Combine(baseDirectory, @"RestSharp\packages\ReportGenerator.2.1.4.0\ReportGenerator.exe"),
             *  PathToTestRunner = Path.Combine(baseDirectory, @"RestSharp\packages\xunit.runner.console.2.0.0\tools\xunit.console.exe"),
             *  TestRunnerArguments = "\"\"" + Path.Combine(baseDirectory, @"RestSharp\RestSharp.IntegrationTests\bin\Debug\RestSharp.IntegrationTests.dll") + @""""" -method RestSharp.IntegrationTests.FileTests.Handles_Binary_File_Download -noshadow",
             *  PathToCodeCoverageXmlFile = Path.Combine(baseDirectory, @"RestSharp\Coverage2.xml"),
             *  PathToCodeCoverageReportDirectory = Path.Combine(baseDirectory, @"RestSharp\Coverage2"),
             *  CodeCoverageFilter = @"+[RestSharp*]*"
             * }).RunCodeCoverage();*/
        }