public void Stress() { // Populate Stress Modules StressModules = new List <StressModule>(); StressModules.Add(new ConnectDisconnectStress(random, routers, testLogger)); StressModules.Add(new AirplaneModeStress(random, routers, testLogger)); StressModules.Add(new ScanStress(random, routers, testLogger)); //StressModules.Add(new SleepStress(random, routers, testLogger)); apConfigCreated = false; testLogger.LogComment(string.Format(CultureInfo.InvariantCulture, "Starting Stress at : {0}", DateTime.Now)); DateTime endTime = DateTime.Now.Add(new TimeSpan(0, TestDuration, 0)); testLogger.LogComment(string.Format(CultureInfo.InvariantCulture, "Stress will end around : {0}", endTime)); bool testFailed = false; if (TestDuration < 50) { failForNotEnoughTime = true; testLogger.LogError("The test will fail because it is not scheduled to run long enough. Stress will still run but will ultimatly fail. To fix this inrease the stress run time."); } else { failForNotEnoughTime = false; } if (RunIntegrityCheck() == false) { testLogger.LogError("Ending test because of failed integrity check."); return; } while (DateTime.Now < endTime) { if (nextIntegrityCheckTime < DateTime.Now) { if (RunIntegrityCheck() == false) { testLogger.LogError("Ending test because of failed integrity check."); break; } else { continue; } } StressModule stressModule = null; try { stressModule = GetNextStressModule(); testLogger.LogComment(string.Format(CultureInfo.InvariantCulture, "Starting test {0}", stressModule.Name)); stressModule.Run(profileName1, profileName2); // Wait a few seconds between stress run and next item Wlan.Sleep(5000); } catch (Exception error) { if (stressModule == null) { testLogger.LogError(string.Format(CultureInfo.InvariantCulture, "Exception when preparing test: {0}", error.ToString())); } else { testLogger.LogError(string.Format(CultureInfo.InvariantCulture, "Exception when running test: {0} {1}", stressModule.Name, error.ToString())); } testFailed = true; break; } } bool integrityCheck = true; if (RunIntegrityCheck() == false) { testLogger.LogError("Ending test because of failed integrity check."); integrityCheck = false; } using (Wlan wlanApi = new Wlan()) { var wlanInterfaceList = wlanApi.EnumWlanInterfaces(); Verify.IsTrue(wlanInterfaceList.Count >= 1, string.Format(CultureInfo.InvariantCulture, "wlanInterfaceList.Count = {0}", wlanInterfaceList.Count)); var wlanInterface = wlanInterfaceList[0]; testLogger.LogComment(string.Format(CultureInfo.InvariantCulture, "Deleting Profile {0}", profileName1)); wlanApi.TryDeleteProfile(wlanInterface.Id, profileName1); testLogger.LogComment(string.Format(CultureInfo.InvariantCulture, "Deleting Profile {0}", profileName2)); wlanApi.TryDeleteProfile(wlanInterface.Id, profileName2); } foreach (var stressModule in StressModules) { stressModule.PrintResults(); } Verify.IsTrue(testFailed == false); Verify.IsTrue(integrityCheck == true); if (failForNotEnoughTime == true) { testLogger.LogError("The stress test failed because it was not scheduled to run at a long enough duration. To fix this inrease the stress run time."); } Verify.IsTrue(failForNotEnoughTime == false); }