Description
Use the WebAudits object to create and run web audits checkpoints for web pages in your script tests.
Requirements
- 
TestComplete version 14.1.
 - 
An active license for the Web module.
 - 
An active license for the Intelligent Quality add-on.
 - 
The Intelligent Quality add-on and its Web Audits plugin must be enabled in TestComplete.
You can enable the add-on and plugin during TestComplete installation. If you did not enable them during the installation, you can do this at any moment later via the File > Install Extensions dialog. To do that, select File > Install Extensions from the TestComplete main menu and enable the Intelligent Quality > Intelligent Quality Core and Web Audits plugins in the resulting dialog.
 - 
Google Chrome must be installed on your computer.
 
Members
Example
The following example runs all the available audits against the tested web page and verifies the audit scores against the default threshold value (90):
JavaScript, JScript
function VerifyWebPage()
{
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 WebAudits.For(url).Check();
									}
Python
def VerifyWebPage():
  url = "http://services.smartbear.com/samples/TestComplete14/smartstore"
  WebAudits.For(url).Check()
VBScript
Sub VerifyWebPage
 url = "http://services.smartbear.com/samples/TestComplete15/smartstore"
 WebAudits.For(url).Check()
End Sub
DelphiScript
procedure VerifyWebPage();
var url;
begin
 url :='http://services.smartbear.com/samples/TestComplete15/smartstore';
 WebAudits.For(url).Check();
end;
C++Script, C#Script
function VerifyWebPage()
{
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 WebAudits["For"](url)["Check"]();
									}
The following example performs SEO and Accessibility audits against the tested web page and verifies the audit scores against the specified threshold values:
JavaScript, JScript
function VerifyWebPage()
{
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 var w = WebAudits.For(url);
 w.AddSEOAudits(70).AddAccessibilityAudits(60).Check();
									}
Python
def VerifyWebPage():
  url = "http://services.smartbear.com/samples/TestComplete14/smartstore"
  w = WebAudits.For(url)
  w.AddSEOAudits(70).AddAccessibilityAudits(60).Check()
VBScript
Sub VerifyWebPage
 url = "http://services.smartbear.com/samples/TestComplete15/smartstore"
 Set w = WebAudits.For(url)
 w.AddSEOAudits(70).AddAccessibilityAudits(60).Check()
End Sub
DelphiScript
procedure VerifyWebPage();
var url, w;
begin
 url :='http://services.smartbear.com/samples/TestComplete15/smartstore';
 w := WebAudits.For(url);
 w.AddSEOAudits(70).AddAccessibilityAudits(60).Check();
end;
C++Script, C#Script
function VerifyWebPage()
{
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 var w = WebAudits["For"](url);
 w["AddSEOAudits"](70)["AddAccessibilityAudits"](60)["Check"]();
									}
The following example demonstrates how to get audit scores, compare them against the specified threshold values and post the result to the test log:
JavaScript, JScript
function VerifyWebPage()
{
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 var w = WebAudits.For(url);
 var auditsResult = w.AddAccessibilityAudits().Query();
 if (auditsResult.AccessibilityScore < 30){
   Log.Error("Accessibility audit failed!");
   return;
 }
 if (auditsResult.AccessibilityScore < 70){
   Log.Warning("Accessibility audit passed with a warning!");
   return;
 }
 Log.Message("Accessibility audit passed!");
									}
Python
def VerifyWebPage():
 url = "http://services.smartbear.com/samples/TestComplete14/smartstore"
 w = WebAudits.For(url)
 auditsResult = w.AddAccessibilityAudits().Query()
 if (auditsResult.AccessibilityScore < 30):
   Log.Error("Accessibility audit failed!")
   return
 
 if (auditsResult.AccessibilityScore < 70):
   Log.Warning("Accessibility audit passed with a warning!")
   return
 
 Log.Message("Accessibility audit passed!")
VBScript
Sub VerifyWebPage
 url = "http://services.smartbear.com/samples/TestComplete15/smartstore"
 Set w = WebAudits.For(url)
 Set auditsResult = w.AddAccessibilityAudits().Query()
 If (auditsResult.AccessibilityScore < 30) Then
   Log.Error("Accessibility audit failed!")
   return
 End If
 If (auditsResult.AccessibilityScore < 70) Then
   Log.Warning("Accessibility audit passed with a warning!")
   return
 End If
 Log.Message("Accessibility audit passed!")
End Sub
DelphiScript
procedure VerifyWebPage();
var url, w, auditsResult;
begin
 url := 'http://services.smartbear.com/samples/TestComplete15/smartstore';
 w := WebAudits.For(url);
 auditsResult := w.AddAccessibilityAudits().Query();
 if (auditsResult.AccessibilityScore < 30) then
    begin
      Log.Error('Accessibility audit failed!');
      exit;
    end;
  if (auditsResult.AccessibilityScore < 70) then
    begin
      Log.Warning('Accessibility audit passed with a warning!');
      exit;
    end;
   
  Log.Message('Accessibility audit passed!');
end;
C++Script, C#Script
function VerifyWebPage()
{
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 var w = WebAudits["For"](url);
 var auditsResult = w["AddAccessibilityAudits"]()["Query"]();
 if (auditsResult["AccessibilityScore"] < 30){
   Log["Error"]("Accessibility audit failed!");
   return;
 }
 if (auditsResult["AccessibilityScore"] < 70){
   Log["Warning"]("Accessibility audit passed with a warning!");
   return;
 }
 Log["Message"]("Accessibility audit passed!");
									}

Methods