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
        private bool InitializeResources()
        {
            Logging.Log("Initializing Resources in the server");
            bool   result          = false;
            string currentScenario = string.Empty;

            try
            {
                // The mobile reports in the Portal scenario depend on the MobileTests scenario content to be available
                if (_scenarios.Contains("Portal") && !_scenarios.Contains("MobileTest"))
                {
                    _scenarios.Add("MobileTest");
                }
                _scenarios.Sort();
                foreach (string scenario in _scenarios)
                {
                    Logging.Log("Initializing Scenario {0}", scenario);
                    currentScenario = scenario;
                    IContentManager contentManager = ContentManagerFactory.GetInstance(scenario);

                    string scenarioAsFolder = scenario.Replace("_", "\\");
                    string sourceFolder     = Path.Combine(SharedConstants.RuntimeResourcesFolder, scenarioAsFolder);
                    contentManager.InitializeWithResources(sourceFolder, scenario);

                    Logging.Log("Initializing Known Datasources");
                    contentManager.CreateKnownDataSources();

                    Logging.Log("Initializing Shared Datasets");
                    contentManager.PublishSharedDataSets();

                    Logging.Log("Initializing Known Reports");
                    contentManager.PublishKnownReports();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                Logging.Log("Initialization failed with {0} in scenario {1}", ex.Message, currentScenario);
                throw;
            }

            return(result);
        }