Query Method

Applies to TestComplete 14.40, last modified on April 22, 2021

Description

Runs the audits the WebAuditsCheckpoint object includes and returns an object that contains the scores of all run audits.

Declaration

WebAuditsCheckpointObj.Query()

WebAuditsCheckpointObj An expression, variable or parameter that specifies a reference to a WebAuditsCheckpoint object
Result A WebAuditsCheckpointResult object

Applies To

The method is applied to the following object:

Result Value

A WebAuditsCheckpointResult object that contain the actual scores of all run audits.

Example

The following example shows how to use the method to get audit scores for a web page:

JavaScript, JScript

function VerifyWebPage()
{
 var url = "http://services.smartbear.com/samples/TestComplete14/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/TestComplete14/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/TestComplete14/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/TestComplete14/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
Web Audits Checkpoints

Highlight search results