ATF - validate contents of Dashboard

TMManiMallavolu
Tera Contributor

Hi Team,

 

My requirement is to validate the contents of dashboard using ServiceNow ATF. Any suggestions on how this can be done?

 

#ATF

1 REPLY 1

amanda2369
Kilo Contributor

To validate the contents of a dashboard in ServiceNow using Automated Test Framework (ATF), you can follow these steps:

 

Identify Dashboard Widgets and Data Points:

 

Determine which widgets and data points on the dashboard need to be validated. Each widget might display different types of data, such as lists, charts, or key performance indicators (KPIs).


Create ATF Test Steps:

 

Use ATF to create a test that will load the dashboard and verify the presence and accuracy of each widget. This involves creating test steps that simulate the actions a user would take to view the dashboard.


Use Assertions to Validate Data:

 

Assertions are used in ATF to verify that the data displayed in the widgets matches the expected values. This might involve checking for specific text, values, or the presence of certain elements on the page.
Detailed Steps


Create a New Test in ATF:

 

Navigate to Automated Test Framework > Tests.
Click on "New" to create a new test.
Provide a name and description for your test.


Add Test Steps:

 

Open the Dashboard:


Add a step to navigate to the dashboard. Use the "Open a New Form" or "Open a New Record" step type if the dashboard is opened through a record or form.


Validate Widgets:


Use the "Assert Text" or "Assert Field Values" step types to check that the widgets on the dashboard contain the correct data.
For example, to validate a list widget, you might use the "Assert Text" step to ensure that the expected records appear in the list.


Validate Charts:


For charts, you might use the "Assert Element Exists" step to verify that the chart is present, and then use custom scripts or additional assertion steps to check the data points within the chart.

 

Example Test Steps for a Dashboard:

 

  • Navigate to Dashboard:

 

Step: Open a New Form
Parameters:
  - Table: sys_dashboard
  - Record: [Name of your dashboard]

 

  • Assert Widget Presence:

 

Step: Assert Text
Parameters:
  - UI Element: [CSS selector or XPath of the widget]
  - Text: [Expected text within the widget]

 

  • Assert Data Accuracy:

 

Step: Assert Field Values
Parameters:
  - Table: [Table containing the data]
  - Field: [Field to check]
  - Expected Value: [Expected data value]

 

 

  • Run the Test and Review Results:

Execute the test and review the results to ensure that all widgets are correctly validated. Adjust your test steps as needed to handle any discrepancies or additional validation requirements.

 

Additional Tips


Custom Scripting:

 

  • If the out-of-the-box steps in ATF do not cover your needs, consider using custom scripts. These scripts can interact with the page elements more flexibly.


Reusability:

 

  • Create reusable test templates or steps for common validation tasks. This will save time when creating tests for different dashboards or widgets.


Documentation and Maintenance:

 

  • Keep your tests well-documented. Update them regularly to reflect changes in the dashboard or underlying data structures.

 

Sedgwick