/// <summary> /// Verify ExceptionStatistics is collected /// </summary> private void TestExceptionStatisctics(TestWebApplication testApplication) { //testApplication.DoTest( // (application, platform) => // { // // Throw 1 handled and 1 unhandled exception // const string queryString = "handledCount=1&isUnhandled=true"; // const string pageName = "PageThrowsExceptions.aspx"; // application.ExecuteAnonymousRequest(pageName, queryString); // //// The above request would have trigged APMC into action and APMC should have collected exception statistics // //// AIC/SDK requests for this every 5 seconds and sends to the fake end point. // //// Listen in the fake endpoint and see if the exception statistics telemtry is captured // //// Sleep for some secs to give SDK the time to sent the events to Fake DataPlatform. // Thread.Sleep(10000); // var allItems = platform.GetAllReceivedDataItems(); // var items = allItems.Where(i => i.GetFieldValue("name").Equals("Microsoft.ApplicationInsights.Metric")).ToArray(); // // We should recieve 1 item for unhandled exception and 1 for handled exception // Assert.AreEqual(2, items.Length, "Total Count of Exception Statistics items collected in wrong."); // }); }
public static void ExecuteSyncHttpClientTests(TestWebApplication testWebApplication, TimeSpan accessTimeMax, string resultCodeExpected) { testWebApplication.DoTest( application => { var queryString = "?type=httpClient&count=1"; var resourceNameExpected = new Uri("http://www.google.com/404"); application.ExecuteAnonymousRequest(queryString); //// The above request would have trigged RDD module to monitor and create RDD telemetry //// Listen in the fake endpoint and see if the RDDTelemtry is captured var allItems = DeploymentAndValidationTools.SdkEventListener.ReceiveAllItemsDuringTimeOfType <TelemetryItem <RemoteDependencyData> >(DeploymentAndValidationTools.SleepTimeForSdkToSendEvents); var httpItems = allItems.Where(i => i.data.baseData.type == "Http").ToArray(); Assert.AreEqual( 1, httpItems.Length, "Total Count of Remote Dependency items for HTTP collected is wrong."); foreach (var httpItem in httpItems) { // This is a call to google.com/404 which will fail but typically takes longer time. So accesstime can more than normal. Validate(httpItem, resourceNameExpected, accessTimeMax.Add(TimeSpan.FromSeconds(15)), false, "GET", resultCodeExpected); } }); }
/// <summary> /// Helper to execute Sync Http tests /// </summary> /// <param name="testWebApplication">The test application for which tests are to be executed</param> /// <param name="success">indicates if the tests should test success or failure case</param> /// <param name="count">number to RDD calls to be made by the test application. </param> /// <param name="accessTimeMax">approximate maximum time taken by RDD Call. </param> public static void ExecuteSyncHttpTests(TestWebApplication testWebApplication, bool success, int count, TimeSpan accessTimeMax, string resultCodeExpected, string queryString) { testWebApplication.DoTest( application => { var resourceNameExpected = success ? ResourceNameHttpToBing : ResourceNameHttpToFailedRequest; application.ExecuteAnonymousRequest(queryString + count); //// The above request would have trigged RDD module to monitor and create RDD telemetry //// Listen in the fake endpoint and see if the RDDTelemtry is captured var allItems = DeploymentAndValidationTools.SdkEventListener.ReceiveAllItemsDuringTimeOfType <TelemetryItem <RemoteDependencyData> >(DeploymentAndValidationTools.SleepTimeForSdkToSendEvents); var httpItems = allItems.Where(i => i.data.baseData.type == "Http").ToArray(); Assert.AreEqual( count, httpItems.Length, "Total Count of Remote Dependency items for HTTP collected is wrong."); foreach (var httpItem in httpItems) { Validate(httpItem, resourceNameExpected, accessTimeMax, success, "GET", resultCodeExpected); } }); }
/// <summary> /// Helper to execute Azure SDK tests. /// </summary> /// <param name="testWebApplication">The test application for which tests are to be executed.</param> /// <param name="count">number to RDD calls to be made by the test application.</param> /// <param name="type"> type of azure call.</param> /// <param name="expectedUrl">expected url for azure call.</param> public static void ExecuteAzureSDKTests(TestWebApplication testWebApplication, int count, string type, string expectedUrl, string queryString) { testWebApplication.DoTest( application => { application.ExecuteAnonymousRequest(string.Format(CultureInfo.InvariantCulture, queryString, type, count)); //// The above request would have trigged RDD module to monitor and create RDD telemetry //// Listen in the fake endpoint and see if the RDDTelemtry is captured var allItems = DeploymentAndValidationTools.SdkEventListener.ReceiveAllItemsDuringTimeOfType <TelemetryItem <RemoteDependencyData> >(DeploymentAndValidationTools.SleepTimeForSdkToSendEvents); var httpItems = allItems.Where(i => i.data.baseData.type == "Http").ToArray(); int countItem = 0; foreach (var httpItem in httpItems) { TimeSpan accessTime = TimeSpan.Parse(httpItem.data.baseData.duration, CultureInfo.InvariantCulture); Assert.IsTrue(accessTime.TotalMilliseconds >= 0, "Access time should be above zero for azure calls"); string actualSdkVersion = httpItem.tags[new ContextTagKeys().InternalSdkVersion]; Assert.IsTrue(actualSdkVersion.Contains(DeploymentAndValidationTools.ExpectedSDKPrefix), "Actual version:" + actualSdkVersion); var url = httpItem.data.baseData.data; if (url.Contains(expectedUrl)) { countItem++; } else { Assert.Fail("ExecuteAzureSDKTests.url not matching for " + url); } } Assert.IsTrue(countItem >= count, "Azure " + type + " access captured " + countItem + " is less than " + count); }); }
/// <summary> /// Helper to execute Sync SQL tests /// </summary> /// <param name="testWebApplication">The test application for which tests are to be executed</param> /// <param name="success">indicates if the tests should test success or failure case</param> /// <param name="count">number to RDD calls to be made by the test application. </param> /// <param name="accessTimeMax">approximate maximum time taken by RDD Call. </param> /// <param name="queryString">The query string. </param> public static void ExecuteSqlTest( TestWebApplication testWebApplication, bool success, int count, TimeSpan accessTimeMax, string queryString) { testWebApplication.DoTest( application => { application.ExecuteAnonymousRequest(queryString + count); //// The above request would have trigged RDD module to monitor and create RDD telemetry //// Listen in the fake endpoint and see if the RDDTelemtry is captured var allItems = DeploymentAndValidationTools.SdkEventListener .ReceiveAllItemsDuringTimeOfType <TelemetryItem <RemoteDependencyData> >(DeploymentAndValidationTools.SleepTimeForSdkToSendEvents); var sqlItems = allItems.Where(i => i.data.baseData.type == "SQL").ToArray(); Assert.AreEqual( count, sqlItems.Length, "Total Count of Remote Dependency items for HTTP collected is wrong."); var validQuery = queryString.Contains("CommandExecuteScalar") ? ValidSqlQueryCountToApmDatabase : ValidSqlQueryToApmDatabase; var queryToValidate = success ? queryString.Contains("StoredProcedure") ? "GetTopTenMessages" : queryString.Contains("Xml") ? validQuery + " FOR XML AUTO" : validQuery : InvalidSqlQueryToApmDatabase; foreach (var sqlItem in sqlItems) { Validate( sqlItem, ResourceNameSQLToDevApm, queryToValidate, TimeSpan.FromSeconds(20), successFlagExpected: success, sqlErrorCodeExpected: success ? string.Empty : "208", sqlErrorMessageExpected: null); } }); }
/// <summary> /// Helper to execute Azure SDK tests. /// </summary> /// <param name="testWebApplication">The test application for which tests are to be executed.</param> /// <param name="count">number to RDD calls to be made by the test application.</param> /// <param name="type"> type of azure call.</param> /// <param name="expectedUrl">expected url for azure call.</param> private void ExecuteAzureSDKTests(TestWebApplication testWebApplication, int count, string type, string expectedUrl) { testWebApplication.DoTest( application => { application.ExecuteAnonymousRequest(string.Format(QueryStringOutboundAzureSdk, type, count)); //// The above request would have trigged RDD module to monitor and create RDD telemetry //// Listen in the fake endpoint and see if the RDDTelemtry is captured var allItems = DeploymentAndValidationTools.SdkEventListener.ReceiveAllItemsDuringTimeOfType<TelemetryItem<RemoteDependencyData>>(DeploymentAndValidationTools.SleepTimeForSdkToSendEvents); var httpItems = allItems.Where(i => i.data.baseData.type == "Http").ToArray(); int countItem = 0; foreach (var httpItem in httpItems) { TimeSpan accessTime = TimeSpan.Parse(httpItem.data.baseData.duration); Assert.IsTrue(accessTime.TotalMilliseconds >= 0, "Access time should be above zero for azure calls"); var url = httpItem.data.baseData.data; if (url.Contains(expectedUrl)) { countItem++; } else { Assert.Fail("ExecuteAzureSDKTests.url not matching for " + url); } } Assert.IsTrue(countItem >= count, "Azure " + type + " access captured " + countItem + " is less than " + count); }); }
/// <summary> /// Helper to execute Async http test which uses Callbacks. /// </summary> /// <param name="testWebApplication">The test application for which tests are to be executed</param> /// <param name="success">indicates if the tests should test success or failure case</param> private void ExecuteAsyncWithCallbackTests(TestWebApplication testWebApplication, bool success) { var resourceNameExpected = success ? ResourceNameHttpToBing : ResourceNameHttpToFailedRequest; testWebApplication.DoTest( application => { application.ExecuteAnonymousRequest(success ? QueryStringOutboundHttpAsync4 : QueryStringOutboundHttpAsync4Failed); //// The above request would have trigged RDD module to monitor and create RDD telemetry //// Listen in the fake endpoint and see if the RDDTelemtry is captured var allItems = DeploymentAndValidationTools.SdkEventListener.ReceiveAllItemsDuringTimeOfType<TelemetryItem<RemoteDependencyData>>(DeploymentAndValidationTools.SleepTimeForSdkToSendEvents); var httpItems = allItems.Where(i => i.data.baseData.type == "Http").ToArray(); // Validate the RDD Telemetry properties Assert.AreEqual( 1, httpItems.Length, "Total Count of Remote Dependency items for HTTP collected is wrong."); this.Validate(httpItems[0], resourceNameExpected, AccessTimeMaxHttpInitial, success, "GET"); }); }
/// <summary> /// Helper to execute Sync Http tests /// </summary> /// <param name="testWebApplication">The test application for which tests are to be executed</param> /// <param name="success">indicates if the tests should test success or failure case</param> /// <param name="expectedCount">number of expected RDD calls to be made by the test application </param> /// <param name="count">number to RDD calls to be made by the test application </param> /// <param name="accessTimeMax">approximate maximum time taken by RDD Call. </param> private void ExecuteSyncSqlTests(TestWebApplication testWebApplication, bool success, int expectedCount, int count, TimeSpan accessTimeMax) { testWebApplication.DoTest( (application) => { application.ExecuteAnonymousRequest(QueryStringOutboundSql + count); //// The above request would have trigged RDD module to monitor and create RDD telemetry //// Listen in the fake endpoint and see if the RDDTelemtry is captured var allItems = sdkEventListener.ReceiveAllItemsDuringTimeOfType<TelemetryItem<RemoteDependencyData>>(SleepTimeForSdkToSendEvents); var sqlItems = allItems.Where(i => i.Data.BaseData.DependencyKind == RemoteDependencyKind.SQL).ToArray(); Assert.AreEqual( expectedCount, sqlItems.Length, "Total Count of Remote Dependency items for SQL collected is wrong."); foreach (var sqlItem in sqlItems) { string spName = "GetTopTenMessages"; this.ValidateRddTelemetryValues(sqlItem, ResourceNameSQLToDevApm + " | " + spName, spName, expectedCount, accessTimeMax, true, false); } }); }
/// <summary> /// Helper to execute Sync Http tests /// </summary> /// <param name="testWebApplication">The test application for which tests are to be executed</param> /// <param name="success">indicates if the tests should test success or failure case</param> /// <param name="count">number to RDD calls to be made by the test application </param> /// <param name="accessTimeMax">approximate maximum time taken by RDD Call. </param> private void ExecuteSyncSqlTests(TestWebApplication testWebApplication, bool success, int count, TimeSpan accessTimeMax) { this.ExecuteSyncSqlTests(testWebApplication, success, count, count, accessTimeMax); }
/// <summary> /// Helper to execute Sync Http tests /// </summary> /// <param name="testWebApplication">The test application for which tests are to be executed</param> /// <param name="success">indicates if the tests should test success or failure case</param> /// <param name="count">number to RDD calls to be made by the test application. </param> /// <param name="accessTimeMax">approximate maximum time taken by RDD Call. </param> private void ExecuteSyncHttpTests(TestWebApplication testWebApplication, bool success, int count, TimeSpan accessTimeMax) { testWebApplication.DoTest( (application) => { var queryString = success == true ? QueryStringOutboundHttp : QueryStringOutboundHttpFailed; var resourceNameExpected = success == true ? ResourceNameHttpToBing : ResourceNameHttpToFailedRequest; string commandNameExpected = string.Empty; application.ExecuteAnonymousRequest(queryString + count); //// The above request would have trigged RDD module to monitor and create RDD telemetry //// Listen in the fake endpoint and see if the RDDTelemtry is captured var allItems = sdkEventListener.ReceiveAllItemsDuringTimeOfType<TelemetryItem<RemoteDependencyData>>(SleepTimeForSdkToSendEvents); var httpItems = allItems.Where(i => i.Data.BaseData.DependencyKind == RemoteDependencyKind.Http).ToArray(); // Validate the RDD Telemetry properties Assert.AreEqual( count, httpItems.Length, "Total Count of Remote Dependency items for HTTP collected is wrong."); foreach (var httpItem in httpItems) { this.ValidateRddTelemetryValues(httpItem, resourceNameExpected, commandNameExpected, count, accessTimeMax, success, false); } }); }
private void ExecuteSyncHttpClientTests(TestWebApplication testWebApplication, TimeSpan accessTimeMax) { testWebApplication.DoTest( (application) => { var queryString = "?type=httpClient&count=1"; var resourceNameExpected = "http://www.google.com/404"; string commandNameExpected = string.Empty; application.ExecuteAnonymousRequest(queryString); //// The above request would have trigged RDD module to monitor and create RDD telemetry //// Listen in the fake endpoint and see if the RDDTelemtry is captured var allItems = sdkEventListener.ReceiveAllItemsDuringTimeOfType<TelemetryItem<RemoteDependencyData>>(SleepTimeForSdkToSendEvents); var httpItems = allItems.Where(i => i.Data.BaseData.DependencyKind == RemoteDependencyKind.Http).ToArray(); // Validate the RDD Telemetry properties Assert.AreEqual( 1, httpItems.Length, "Total Count of Remote Dependency items for HTTP collected is wrong."); foreach (var httpItem in httpItems) { if (DependencySourceType.Apmc == sourceExpected) { Assert.AreEqual("GET " + resourceNameExpected, httpItem.Data.BaseData.Name, "For StatusMonitor implementation we expect verb to be collected."); } this.ValidateRddTelemetryValues(httpItem, resourceNameExpected, commandNameExpected, 1, accessTimeMax, false, false); } }); }
/// <summary> /// Helper to execute Async Http tests. /// </summary> /// <param name="testWebApplication">The test application for which tests are to be executed.</param> /// <param name="success">Indicates if the tests should test success or failure case.</param> /// <param name="count">Number to RDD calls to be made by the test application. </param> /// <param name="accessTimeMax">Approximate maximum time taken by RDD Call. </param> private void ExecuteAsyncTests(TestWebApplication testWebApplication, bool success, int count, TimeSpan accessTimeMax, string url) { var resourceNameExpected = success == true ? ResourceNameHttpToBing : ResourceNameHttpToFailedRequest; var commandNameExpected = string.Empty; testWebApplication.DoTest( (application) => { var queryString = url; application.ExecuteAnonymousRequest(queryString + count); application.ExecuteAnonymousRequest(queryString + count); application.ExecuteAnonymousRequest(queryString + count); //// The above request would have trigged RDD module to monitor and create RDD telemetry //// Listen in the fake endpoint and see if the RDDTelemtry is captured var allItems = sdkEventListener.ReceiveAllItemsDuringTimeOfType<TelemetryItem<RemoteDependencyData>>(SleepTimeForSdkToSendEvents); var httpItems = allItems.Where(i => i.Data.BaseData.DependencyKind == RemoteDependencyKind.Http).ToArray(); // Validate the RDD Telemetry properties Assert.AreEqual( 3 * count, httpItems.Length, "Total Count of Remote Dependency items for HTTP collected is wrong."); foreach (var httpItem in httpItems) { if (DependencySourceType.Apmc == sourceExpected) { Assert.AreEqual("GET " + resourceNameExpected, httpItem.Data.BaseData.Name, "For StatusMonitor implementation we expect verb to be collected."); } this.ValidateRddTelemetryValues(httpItem, resourceNameExpected, commandNameExpected, 1, accessTimeMax, success, true); } }); }
/// <summary> /// Deploy all test applications and prepera infra. /// </summary> public static void Initialize() { if (!isInitialized) { lock (lockObj) { if (!isInitialized) { Aspx451TestWebApplication = new TestWebApplication { AppName = "Aspx451", Port = Aspx451Port, IsRedFieldApp = false }; Aspx451TestWebApplicationWin32 = new TestWebApplication { AppName = "Aspx451Win32", Port = Aspx451PortWin32, IsRedFieldApp = false }; // this makes all traces have a timestamp so it's easier to troubleshoot timing issues // looking for the better approach... foreach (TraceListener listener in Trace.Listeners) { listener.TraceOutputOptions |= TraceOptions.DateTime; } SdkEventListener = new HttpListenerObservable(Aspx451FakeDataPlatformEndpoint); EtwSession = new EtwEventSessionRdd(); EtwSession.Start(); Aspx451TestWebApplication.Deploy(); Aspx451TestWebApplicationWin32.Deploy(true); if (RegistryCheck.IsNet46Installed) { Trace.TraceInformation("Detected DotNet46 as installed. Will check StatusMonitor status to determine expected prefix"); if (RegistryCheck.IsStatusMonitorInstalled) { Trace.TraceInformation("Detected Status Monitor as installed, ExpectedPrefix: rddp"); ExpectedSDKPrefix = "rddp"; } else { Trace.TraceInformation("Detected Status Monitor as not installed, ExpectedPrefix: rddf"); ExpectedSDKPrefix = "rddf"; } } else { Trace.TraceInformation("Detected DotNet46 as not installed. Will install StatusMonitor if not already installed."); Trace.TraceInformation("Tests against StatusMonitor instrumentation."); ExpectedSDKPrefix = "rddp"; if (!RegistryCheck.IsStatusMonitorInstalled) { Trace.TraceInformation("StatusMonitor not already installed.Installing from:" + ExecutionEnvironment.InstallerPath); Installer.SetInternalUI(InstallUIOptions.Silent); string installerPath = ExecutionEnvironment.InstallerPath; try { Installer.InstallProduct(installerPath, "ACTION=INSTALL ALLUSERS=1 MSIINSTALLPERUSER=1"); Trace.TraceInformation("StatusMonitor installed without errors."); } catch (Exception ex) { Trace.TraceError( "Agent installer not found. Agent is required for running tests for framework version below 4.6" + ex); throw; } } else { Trace.TraceInformation("StatusMonitor already installed."); } } Trace.TraceInformation("IIS Restart begin."); Iis.Reset(); Trace.TraceInformation("IIS Restart end."); isInitialized = true; } } } }
/// <summary> /// Deploy all test applications and prepera infra. /// </summary> public static void Initialize() { if (!isInitialized) { lock (lockObj) { if (!isInitialized) { Aspx451TestWebApplication = new TestWebApplication { AppName = "Aspx451", Port = Aspx451Port, IsRedFieldApp = false }; Aspx451TestWebApplicationWin32 = new TestWebApplication { AppName = "Aspx451Win32", Port = Aspx451PortWin32, IsRedFieldApp = false }; // this makes all traces have a timestamp so it's easier to troubleshoot timing issues // looking for the better approach... foreach (TraceListener listener in Trace.Listeners) { listener.TraceOutputOptions |= TraceOptions.DateTime; } SdkEventListener = new HttpListenerObservable(Aspx451FakeDataPlatformEndpoint); EtwSession = new EtwEventSessionRdd(); EtwSession.Start(); Aspx451TestWebApplication.Deploy(); Aspx451TestWebApplicationWin32.Deploy(true); if (RegistryCheck.IsNet46Installed) { Trace.TraceInformation("Detected DotNet46 as installed. Will check StatusMonitor status to determine expected prefix"); if(RegistryCheck.IsStatusMonitorInstalled) { Trace.TraceInformation("Detected Status Monitor as installed, ExpectedPrefix: rddp"); ExpectedSDKPrefix = "rddp"; } else { Trace.TraceInformation("Detected Status Monitor as not installed, ExpectedPrefix: rddf"); ExpectedSDKPrefix = "rddf"; } } else { Trace.TraceInformation("Detected DotNet46 as not installed. Will install StatusMonitor if not already installed."); Trace.TraceInformation("Tests against StatusMonitor instrumentation."); ExpectedSDKPrefix = "rddp"; if (!RegistryCheck.IsStatusMonitorInstalled) { Trace.TraceInformation("StatusMonitor not already installed.Installing from:" + ExecutionEnvironment.InstallerPath); Installer.SetInternalUI(InstallUIOptions.Silent); string installerPath = ExecutionEnvironment.InstallerPath; try { Installer.InstallProduct(installerPath, "ACTION=INSTALL ALLUSERS=1 MSIINSTALLPERUSER=1"); Trace.TraceInformation("StatusMonitor installed without errors."); } catch (Exception ex) { Trace.TraceError( "Agent installer not found. Agent is required for running tests for framework version below 4.6" + ex); throw; } } else { Trace.TraceInformation("StatusMonitor already installed."); } } Trace.TraceInformation("IIS Restart begin."); Iis.Reset(); Trace.TraceInformation("IIS Restart end."); isInitialized = true; } } } }
/// <summary> /// Helper to execute Sync Http tests /// </summary> /// <param name="testWebApplication">The test application for which tests are to be executed</param> /// <param name="expectedCount">number of expected RDD calls to be made by the test application </param> /// <param name="count">number to RDD calls to be made by the test application </param> /// <param name="accessTimeMax">approximate maximum time taken by RDD Call. </param> private void ExecuteSyncSqlTests(TestWebApplication testWebApplication, int expectedCount, int count, TimeSpan accessTimeMax) { testWebApplication.DoTest( application => { application.ExecuteAnonymousRequest(QueryStringOutboundSql + count); //// The above request would have trigged RDD module to monitor and create RDD telemetry //// Listen in the fake endpoint and see if the RDDTelemtry is captured var allItems = DeploymentAndValidationTools.SdkEventListener.ReceiveAllItemsDuringTimeOfType<TelemetryItem<RemoteDependencyData>>(DeploymentAndValidationTools.SleepTimeForSdkToSendEvents).ToArray(); var sqlItems = allItems.Where(i => i.data.baseData.type == "SQL").ToArray(); Assert.AreEqual( expectedCount, sqlItems.Length, "Total Count of Remote Dependency items for SQL collected is wrong."); foreach (var sqlItem in sqlItems) { string spName = "GetTopTenMessages"; this.Validate( sqlItem, ResourceNameSQLToDevApm, spName, accessTimeMax, successFlagExpected: true, sqlErrorCodeExpected: "0", sqlErrorMessageExpected: null); } }); }
private void ExecuteSyncHttpClientTests(TestWebApplication testWebApplication, TimeSpan accessTimeMax) { testWebApplication.DoTest( application => { var queryString = "?type=httpClient&count=1"; var resourceNameExpected = new Uri("http://www.google.com/404"); application.ExecuteAnonymousRequest(queryString); //// The above request would have trigged RDD module to monitor and create RDD telemetry //// Listen in the fake endpoint and see if the RDDTelemtry is captured var allItems = DeploymentAndValidationTools.SdkEventListener.ReceiveAllItemsDuringTimeOfType<TelemetryItem<RemoteDependencyData>>(DeploymentAndValidationTools.SleepTimeForSdkToSendEvents); var httpItems = allItems.Where(i => i.data.baseData.type == "Http").ToArray(); Assert.AreEqual( 1, httpItems.Length, "Total Count of Remote Dependency items for HTTP collected is wrong."); foreach (var httpItem in httpItems) { this.Validate(httpItem, resourceNameExpected, accessTimeMax, successFlagExpected: false, verb: "GET"); } }); }
/// <summary> /// Helper to execute Sync Http tests /// </summary> /// <param name="testWebApplication">The test application for which tests are to be executed</param> /// <param name="success">indicates if the tests should test success or failure case</param> /// <param name="count">number to RDD calls to be made by the test application. </param> /// <param name="accessTimeMax">approximate maximum time taken by RDD Call. </param> private void ExecuteSyncHttpTests(TestWebApplication testWebApplication, bool success, int count, TimeSpan accessTimeMax) { testWebApplication.DoTest( application => { var queryString = success ? QueryStringOutboundHttp : QueryStringOutboundHttpFailed; var resourceNameExpected = success ? ResourceNameHttpToBing : ResourceNameHttpToFailedRequest; application.ExecuteAnonymousRequest(queryString + count); //// The above request would have trigged RDD module to monitor and create RDD telemetry //// Listen in the fake endpoint and see if the RDDTelemtry is captured var allItems = DeploymentAndValidationTools.SdkEventListener.ReceiveAllItemsDuringTimeOfType<TelemetryItem<RemoteDependencyData>>(DeploymentAndValidationTools.SleepTimeForSdkToSendEvents); var httpItems = allItems.Where(i => i.data.baseData.type == "Http").ToArray(); Assert.AreEqual( count, httpItems.Length, "Total Count of Remote Dependency items for HTTP collected is wrong."); foreach (var httpItem in httpItems) { this.Validate(httpItem, resourceNameExpected, accessTimeMax, success, verb: "GET"); } }); }
/// <summary> /// Initializes static members of the <see cref="RddTests"/> class. /// </summary> static RddTests() { aspx451TestWebApplication = new TestWebApplication { AppName = "Aspx451", Port = Aspx451Port, IsRedFieldApp = false }; aspx451TestWebApplicationWin32 = new TestWebApplication { AppName = "Aspx451Win32", Port = Aspx451PortWin32, IsRedFieldApp = false }; }