public void OnTestFinished(AWSConfigs.HttpClientOption hco, HashSet <string> failedTestCases) { bool retry = retryCount < 3 && failedTestCases.Count > 0; Debug.LogFormat(@"the following test cases {0} for {1} = {2}", retry ? "will be retried" : "failed", hco, string.Join(",", failedTestCases.ToArray <string>())); if (retryCount < 3 && failedTestCases.Count > 0) { retryCount++; EnsureBackgroundExecution(() => { if (hco == AWSConfigs.HttpClientOption.UnityWWW) { runner.HttpClient = hco; runner.RunTestsWithCategory("WWW", failedTestCases); } else { runner.HttpClient = hco; runner.RunTestsWithName(failedTestCases); } }); return; } if (hco == AWSConfigs.HttpClientOption.UnityWWW) { finalFailedWWWTests = new HashSet <string>(failedTestCases); } else if (hco == AWSConfigs.HttpClientOption.UnityWebRequest) { finalFailedUWRTests = new HashSet <string>(failedTestCases); } if (finalFailedUWRTests != null && finalFailedWWWTests != null) { mainThread.Enqueue(() => { Debug.Log("OnTestFinished"); if (finalFailedUWRTests.Count > 0 || finalFailedWWWTests.Count > 0) { PrintResult("SOME TESTS FAILED"); } else { PrintResult("ALL TESTS PASSED"); } }); } }
public void OnTestFinished(int pass, int fail, AWSConfigs.HttpClientOption hco, HashSet <string> failedTestCases) { if (hco == AWSConfigs.HttpClientOption.UnityWebRequest) { failedUWRTests.UnionWith(failedTestCases); } else { failedWWWTests.UnionWith(failedTestCases); } Debug.Log(string.Format(@"the following test cases will be retried for WWW = {0} & UWR= {1}", string.Join(",", failedWWWTests.ToArray <string>()), string.Join(",", failedUWRTests.ToArray <string>()))); if (retryCount < 3 && (failedUWRTests.Count > 0 || failedWWWTests.Count > 0)) { HashSet <string> testNamesToRetryForWWW = failedWWWTests; HashSet <string> testNamesToRetryForUWR = failedUWRTests; failedWWWTests = new HashSet <string>(); failedUWRTests = new HashSet <string>(); retryCount++; EnsureBackgroundExecution(() => { int count = 0; foreach (var httpClient in new AWSConfigs.HttpClientOption[] { AWSConfigs.HttpClientOption.UnityWWW, AWSConfigs.HttpClientOption.UnityWebRequest }) { AWSConfigs.HttpClient = httpClient; if (httpClient == AWSConfigs.HttpClientOption.UnityWWW) { if (testNamesToRetryForWWW.Count > 0) { runner.HttpClient = httpClient; runner.RunTestsWithCategory("WWW", testNamesToRetryForWWW); } } else { if (testNamesToRetryForUWR.Count > 0) { runner.HttpClient = httpClient; runner.RunTestsWithName(testNamesToRetryForUWR); } } Thread.Sleep(TimeSpan.FromSeconds(5)); count++; } }); return; } mainThread.Enqueue(() => { Debug.Log("OnTestFinished"); if (failedUWRTests.Count > 0 || failedWWWTests.Count > 0) { PrintResult("SOME TESTS FAILED"); } else { PrintResult("ALL TESTS PASSED"); } }); }