WebAuditsCheckpointResult Object

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

WebAuditsCheckpointResult is a helper object containing the scores of performed web audits. The scores are defined as properties. You can use the object to get individual audit scores, for example, to compare them against the expected values.

Properties

The object contains the properties listed below:

Property Name Description
AccessibilityScore The score the tested web page got for the Accessibility audit.
BestPracticesScore The score the tested web page got for the Best Practices audit.
PerformanceScore The score the tested web page got for the Performance audit.
ProgressiveWebAppScore The score the tested web page got for the Progressive Web App audit.
SEOScore The score the tested web page got for the SEO audit.

If an audit was not run, the appropriate property value returns -1.

Members

Example

The following example shows how to get the scores of performed web audits:

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!");
}

See Also

WebAuditsCheckpoint Object

Highlight search results