diff --git a/CefSharp.Test/JavascriptBinding/IntegrationTestFacts.cs b/CefSharp.Test/JavascriptBinding/IntegrationTestFacts.cs index 87753d95b3..6517d2c77d 100644 --- a/CefSharp.Test/JavascriptBinding/IntegrationTestFacts.cs +++ b/CefSharp.Test/JavascriptBinding/IntegrationTestFacts.cs @@ -70,11 +70,18 @@ public async Task LoadJavaScriptBindingQunitTestsSuccessfulCompletion() repo.Register("boundAsync2", new AsyncBoundObject(), isAsync: true, options: bindingOptions); browser.CreateBrowser(); - var success = await browser.WaitForQUnitTestExeuctionToComplete(); + var response = await browser.WaitForQUnitTestExeuctionToComplete(); - Assert.True(success); + if (!response.Success) + { + output.WriteLine("QUnit Details : {0}", response.Details); + output.WriteLine("QUnit Passed : {0}", response.Total); + output.WriteLine("QUnit Total : {0}", response.Passed); + } - output.WriteLine("QUnit Tests result: {0}", success); + Assert.True(response.Success); + + output.WriteLine("QUnit Tests result: {0}", response.Success); } } @@ -92,11 +99,18 @@ public async Task LoadLegacyJavaScriptBindingQunitTestsSuccessfulCompletion() repo.Register("boundAsync", new AsyncBoundObject(), isAsync: true, options: bindingOptions); browser.CreateBrowser(); - var success = await browser.WaitForQUnitTestExeuctionToComplete(); + var response = await browser.WaitForQUnitTestExeuctionToComplete(); - Assert.True(success); + if(!response.Success) + { + output.WriteLine("QUnit Details : {0}", response.Details); + output.WriteLine("QUnit Passed : {0}", response.Total); + output.WriteLine("QUnit Total : {0}", response.Passed); + } - output.WriteLine("QUnit Tests result: {0}", success); + Assert.True(response.Success); + + output.WriteLine("QUnit Tests result: {0}", response.Success); } } #endif diff --git a/CefSharp.Test/QUnitTestResult.cs b/CefSharp.Test/QUnitTestResult.cs new file mode 100644 index 0000000000..d816b9491f --- /dev/null +++ b/CefSharp.Test/QUnitTestResult.cs @@ -0,0 +1,19 @@ +// Copyright © 2021 The CefSharp Authors. All rights reserved. +// +// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. + +namespace CefSharp.Test +{ + public class QUnitTestResult + { + public bool Success + { + get { return Passed == Total; } + } + + public int Passed { get; set; } + public int Total { get; set; } + + public string Details { get; set; } + } +} diff --git a/CefSharp.Test/WebBrowserTestExtensions.cs b/CefSharp.Test/WebBrowserTestExtensions.cs index ad2ccfcd5c..b54cf5f77d 100644 --- a/CefSharp.Test/WebBrowserTestExtensions.cs +++ b/CefSharp.Test/WebBrowserTestExtensions.cs @@ -76,11 +76,11 @@ public static Task LoadRequestAsync(this IWebBrowser brows return tcs.Task; } - public static Task WaitForQUnitTestExeuctionToComplete(this IWebBrowser browser) + public static Task WaitForQUnitTestExeuctionToComplete(this IWebBrowser browser) { //If using .Net 4.6 then use TaskCreationOptions.RunContinuationsAsynchronously //and switch to tcs.TrySetResult below - no need for the custom extension method - var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); EventHandler handler = null; handler = (sender, args) => @@ -95,7 +95,7 @@ public static Task WaitForQUnitTestExeuctionToComplete(this IWebBrowser br var total = (int)details.total; var passed = (int)details.passed; - tcs.TrySetResult(total == passed); + tcs.TrySetResult(new QUnitTestResult { Details = details, Passed = passed, Total = total }); } else {