General Overview

The following diagram provides an overview of the components of Tricentis Test Automation for ServiceNow.

 

Application:

  • The main point of interaction in ServiceNow.

  • Includes the centralized dashboard, test repository, configurations, test results and more.

Server:

  • Executes tests outside of your ServiceNow instance.

Tricentis Test Automation for ServiceNow mini:

  • Essential to the test writing process.

  • Allows you to playback the test locally (separate from Tricentis Test Automation for ServiceNow server) to validate test scripts as you write them.

Tricentis Test Automation for ServiceNow Recorder:

  • Allows users to generate a test script by recording user actions.

Test Writing Tips

  1. The Tricentis Test Automation for ServiceNow Tutorial Test Plans include a series of templates to write these tests from scratch and have examples of commonly used interactions.

  2. When selecting a form tab, context menu items, button, or related link, you have to use the display value, as there is no other value to reference for those.

  3. If a page is loading or changing, use the following:

    client.waitForSNRender();
    • Absolutely necessary for when you are navigating to a URL of a page.

    • Another useful waiting tool is client.pause(<number of milliseconds>).

    • Be generous with pauses to make sure things load (and thus the test can properly execute) 99+% of the time.

  4. When checking a value, its client.nameof the get function ('<name of the field>').should.equal('<whatever it needs to be>');.

    • You can also use should.contain.

      • If it is an array, it will check to see if the value you entered is in the array. If it is a string, it will see if it contains that piece of text.

      • For numbers, it should be should.be.at.least or should.be.at.most, etc.

      • For arrays, you can use should.eql to compare the results of an array literally to another array, the latter of which you can reference or write manually.

  5. We recommend having one browser window running the instance where you can control/enter things, and another browser window running the instance via Tricentis Test Automation for ServiceNow mini to validate your test script as you develop it.

  6. It is typically better to navigate to a URL directly than to use the left-hand navigation, unless something relevant to the left-hand navigation itself needs to be tested.

    • If you do need to use the left-hand navigation, run client.collapseAllApplications();first to make it easier and more consistent (it collapses everything and moves the left-hand navigation back to the leftmost panel).

  7. When trying to access records, you should use something unique, such as number or sys_id. Alternatively, insert something unique into a text field to query on.

    • You can use sysparm_queryto search on a certain field value.

  8. Try not to use ServiceNow's back button in testing, since it is unreliable due to ServiceNow’s navigation stack. We recommend using client.searchGobal(ctx.<the case to return to>)for more reliability.

  9. Be sure to enable tabs for testing when form tabs are relevant or used in testing.