private void ValidateAllReportsRenderHTML5_UnitTest(string scenario)
        {
            if (!_isUnitTest)
            {
                Assert.Fail("This test is not valid to run as a LoadTest");
            }

            HTML50Render renderFormat = new HTML50Render();
            string       url;
            bool         allReportsRendered = true;
            var          failedReports      = new List <string>();
            var          contentManager     = ContentManagerFactory.GetInstance(scenario);

            Parallel.ForEach(contentManager.ExistingReports, (report) =>
            {
                try
                {
                    Logging.Log("Starting Rendering Scenario {0} , Report {1}", scenario, report);
                    RSExecutionInfo info     = contentManager.SoapAccessor.Execution.LoadReport(report, null);
                    RSExecutionInfo execInfo = contentManager.SoapAccessor.Execution.GetExecutionInfo();
                    url = contentManager.ConstructUrl(report, renderFormat, null, 1, 1, execInfo.ExecutionID, null);
                    string execid;
                    contentManager.IssueGetRequest(url, out execid);
                    Logging.Log("Completed Rendering Scenario {0} , Report {1}", scenario, report);
                }
                catch (Exception ex)
                {
                    Logging.Log("Report failed to render, scenario {0}, report {1} exception {2}", scenario, report, ex);
                    failedReports.Add(report);
                    allReportsRendered = false;
                }
            });

            Assert.IsTrue(allReportsRendered, "Reports failed to render {0}", failedReports.ToNewLineSeparatedString());
        }
Ejemplo n.º 2
0
        internal static ICollectionSelector InitializeContentManager(TestContext testContext)
        {
            string                sourceFolder             = string.Empty;
            string                targetFolder             = string.Empty;
            bool                  reportsCreated           = false;
            List <string>         scenarioList             = null;
            string                runtimeResourcesSelector = null;
            List <BadCombination> badCombinations          = null;
            List <ReportWeight>   reportsWeight            = null;

            Logging.Log("Initialize Content for the test");

            // Get runtime parameters
            LoadContextProperty(testContext, SharedConstants.SourceReportFolderKey, ref sourceFolder);
            LoadContextProperty(testContext, SharedConstants.TargetReportFolderKey, ref targetFolder);
            LoadContextProperty(testContext, SharedConstants.ScenarioListKey, ref scenarioList);
            LoadContextProperty(testContext, SharedConstants.RuntimeResourcesSelectorKey, ref runtimeResourcesSelector);
            LoadContextProperty(testContext, SharedConstants.InitializedResourcesKey, ref reportsCreated);
            LoadContextProperty <List <BadCombination> >(testContext, SharedConstants.BadCombinationsKey, ref badCombinations);
            LoadContextProperty <List <ReportWeight> >(testContext, SharedConstants.ReportsWeightKey, ref reportsWeight);

            ICollectionSelector itemSelector = null;

            if (String.IsNullOrEmpty(runtimeResourcesSelector))
            {
                itemSelector = new RandomSelector();
            }
            else
            {
                if (runtimeResourcesSelector.Equals("random", StringComparison.InvariantCultureIgnoreCase))
                {
                    itemSelector = new RandomSelector();
                }
                else
                {
                    itemSelector = new SequentialSelector();
                }
            }

            foreach (string scenario in scenarioList)
            {
                IContentManager contentManager = ContentManagerFactory.GetInstance(scenario);
                contentManager.Initialize(scenario, scenario);
                contentManager.ItemSelector = itemSelector;
                contentManager.PopulateReportListFromServer();
                contentManager.BadReportMethodCombinations = badCombinations;
                contentManager.ReporstWeight = reportsWeight;
            }

            return(itemSelector);
        }