Beispiel #1
0
        static void Main(string[] args)
        {
            String p = @"C:\Data\Development\MySpace\Performance\Tracker\Reports.Performance\bin\Debug\";
            ProcessedDataPackage package1 = null;

            try
            {
                package1 = ProcessedDataCollector.CollectAll(p, 53595);
            }
            catch (DirectoryNotFoundException)
            {
                System.Console.Error.Write("Invalid input folder!");
                return;
            }



            return;



            CommandLineArguments cla = new CommandLineArguments(args);

            if (cla.IsValid() == false)
            {
                CommandLineArguments.PrintUsage(System.Console.Error);
                return;
            }

            String outfolder = Directory.GetCurrentDirectory().ToString().Replace("\\", "/");
            String confolder = Path.GetDirectoryName(Assembly.GetAssembly(typeof(Program)).Location) + "\\conf\\";

            if (String.IsNullOrEmpty(confolder) ||
                String.IsNullOrEmpty(outfolder) ||
                Directory.Exists(confolder) == false ||
                Directory.Exists(outfolder) == false ||
                File.Exists(confolder + "DefaultPageValidation.xml") == false)
            {
                System.Console.Error.Write("Invalid Configuration!");
                return;
            }

            ProcessedDataPackage package = null;

            try
            {
                package = ProcessedDataCollector.CollectAll(cla.Path, cla.CollectionId);
            }
            catch (DirectoryNotFoundException)
            {
                System.Console.Error.Write("Invalid input folder!");
                return;
            }

            if (package == null || package.Count == 0)
            {
                System.Console.Error.Write("Error while processing data!");
                return;
            }

            ValidationRunner vr = new ValidationRunner();

            vr.LoadFromFile(confolder + "DefaultPageValidation.xml");

            ValidationResultsPackage rsults = vr.ValidateBlocking(package);


            if (rsults == null || rsults.Count == 0)
            {
                System.Console.Error.Write("Error while validating results!");
                return;
            }

            if ("xml".Equals(cla.SaveType))
            {
                SavePackage(new XMLImportExportManager(), package, outfolder);
            }
            else if ("msf".Equals(cla.SaveType))
            {
                SavePackage(new MSFImportExportsManager(), package, outfolder);
            }
            else if ("har".Equals(cla.SaveType))
            {
                SavePackage(new HARImportExportsManager(), package, outfolder);
            }

            SaveValidation(rsults, outfolder);
        }
Beispiel #2
0
        private void ProcessResults(ProcessedDataPackage package)
        {
            IConfigGetter getter = ConfigProvider.Instance.GetConfigGetter("MSFast.Global");

            if (getter == null)
            {
                SetTestRunning(false);
                SetTestStatus(TestEventType.TestEnded, false, PageDataCollectorErrors.InvalidConfiguration, -1);
            }

            #region Collected Data

            String graphResults = null;

            if (getter.GetBoolean(MSFastGlobalConfigKeys.PAGE_GRAPH))
            {
                if (package.ContainsKey(typeof(DownloadData)) != false ||
                    package.ContainsKey(typeof(RenderData)) != false ||
                    package.ContainsKey(typeof(PerformanceData)) != false)
                {
                    SerializedResultsFilesInfo srfi = new SerializedResultsFilesInfo(package);

                    if (String.IsNullOrEmpty(srfi.GetFolderNameAndCheckIfValid()))
                    {
                        SetTestRunning(false);
                        SetTestStatus(TestEventType.TestEnded, false, PageDataCollectorErrors.InvalidConfiguration, -1);
                        return;
                    }

                    package.ThumbnailsRoot = "file://" + srfi.GetFolderNameAndCheckIfValid();

                    XmlDocument x = package.Serialize();

                    if (x == null)
                    {
                        SetTestRunning(false);
                        SetTestStatus(TestEventType.TestEnded, false, PageDataCollectorErrors.Unknown, -1);
                        return;
                    }

                    try
                    {
                        x.Save(srfi.GetFullPath());
                        graphResults = srfi.GetFullPath();
                    }
                    catch
                    {
                        SetTestRunning(false);
                        SetTestStatus(TestEventType.TestEnded, false, PageDataCollectorErrors.Unknown, -1);
                        return;
                    }
                }
            }
            #endregion

            #region Validation

            ValidationResultsPackage validationResults = null;

            if (getter.GetBoolean(MSFastGlobalConfigKeys.PAGE_VALIDATION))
            {
                if (validationRunner == null)
                {
                    CreateValidationRunner();
                }

                if (validationRunner != null)
                {
                    validationResults = validationRunner.ValidateBlocking(package);
                }
            }

            #endregion

            SetTestRunning(false);
            SetTestStatus(TestEventType.TestEnded, true);

            ShowOutcome(graphResults, validationResults, package);
        }