Forms in Service Portal category
- UpdatedAug 1, 2024
- 9 minutes to read
- Xanadu
- Automated Test Framework
Forms in Service Portal category
Validate the functionality of fields and UI actions in Service Portal form widgets.
Service Portal dependency
Creating automated Service Portal steps requires knowledge of the ServiceNow data model and Service Portal form and data structures.
Open a Form (SP)
Opens a form in a portal.
Use this step for the base system Form page. For custom form pages, use the Open Service Portal Page step from the Custom UI category.
| Field | Description |
|---|---|
| Execution order | Integer specifying the order in which the test executes this
step. As you create steps, the system automatically assigns each step an incremental value. This value causes the test to execute steps in the order that you created them in. You can change this default order by editing the Execution order values. |
| Active | Option to activate this test step for use. |
| Timeout | Number of seconds allowed before the step fails. If the validation fails, the system repeats the step until it reaches the duration of the timeout. If the validation fails after the timeout duration has passed, the step fails. |
| Application | Application scope in which the system runs this step. |
| Test | Read-only name of the test that you're adding the step to. |
| Step config | Read-only name of the step. |
| Description | Description of the test step. This field value is automatically set based on the field values of the test step. This field appears after the test step is submitted. |
| Notes | Notes about the test step. |
| Portal | Portal in which the defined form opens. Service Portal is the default. |
| Page | Page to open in the defined portal. The form page is the default. |
| Table | Table containing the form to open. |
| sys_id | Sys_id of the record to open. Default is -1, which opens a new record. |
| View | The form view to open. If blank, the system uses the default view. |
| Query parameters | Additional URL query parameters and values for the form. |
Set Field Values (SP)
Sets the values of fields in a form. To use this step, you must have already opened a form using the Open a Form (SP) test step.
| Field | Description |
|---|---|
| Execution order | Integer specifying the order in which the test executes this
step. As you create steps, the system automatically assigns each step an incremental value. This value causes the test to execute steps in the order that you created them in. You can change this default order by editing the Execution order values. |
| Active | Option to activate this test step for use. |
| Application | Application scope in which the system runs this step. |
| Test | Read-only name of the test that you're adding the step to. |
| Step config | Read-only name of the step. |
| Description | Description of the test step. This field value is automatically set based on the field values of the test step. This field appears after the test step is submitted. |
| Notes | Notes about the test step. Note: Use the
condition builder to set the field value. The condition builder displays an
appropriate control for the field data type. For example, a reference field displays
a Lookup record control. |
| Table | The table for the form on which to set field values. The value should be the table in the Open a Form (SP) step. |
| Field values | Fields for which to set values and the values to be set for those fields. |
Field Values Validation (SP)
Validates field values on the current form based on defined conditions. To use this step, you must have already opened a form using the Open a Form (SP) test step.
| Field | Description |
|---|---|
| Execution order | Integer specifying the order in which the test executes this
step. As you create steps, the system automatically assigns each step an incremental value. This value causes the test to execute steps in the order that you created them in. You can change this default order by editing the Execution order values. |
| Active | Option to activate this test step for use. |
| Application | Application scope in which the system runs this step. |
| Test | Read-only name of the test that you're adding the step to. |
| Step config | Read-only name of the step. |
| Description | Description of the test step. This field value is automatically set based on the field values of the test step. This field appears after the test step is submitted. |
| Notes | Notes about the test step. Note: Use the
condition builder to set the field value. The condition builder displays an
appropriate control for the field data type. For example, a reference field displays
a Lookup record control. |
| Table | The table that contains the form on which to validate fields. The value should be the table in the Open a Form (SP) step. |
| Conditions | Conditions used to validate one or more fields on the form. If the condition evaluates to true, the step passes. |
Field State Validation (SP)
Validates field states on a form in Service Portal.
| Field | Description |
|---|---|
| Execution order | Integer specifying the order in which the test executes this
step. As you create steps, the system automatically assigns each step an incremental value. This value causes the test to execute steps in the order that you created them in. You can change this default order by editing the Execution order values. |
| Active | Option to activate this test step for use. |
| Application | Application scope in which the system runs this step. |
| Test | Read-only name of the test that you're adding the step to. |
| Step config | Read-only name of the step. |
| Description | Description of the test step. This field value is automatically set based on the field values of the test step. This field appears after the test step is submitted. |
| Notes | Notes about the test step. |
| Table | The table for the form on which to validate field states. The value should be the table in the Open a Form (SP) step. |
| Visible | Validates whether the fields on this form are visible. The test fails if the fields are not visible. |
| Not visible | Validates whether the fields on this form are visible. The test fails if the fields are visible. |
| Read only | Validates whether the fields on this form are read only. The test fails if the fields are not read only. |
| Not read only | Validates whether the fields on this form are read only. The test fails if the fields are read only. |
| Mandatory | Validates whether the fields on this form are mandatory. The test fails if the fields are not mandatory. |
| Not Mandatory | Validates whether the fields on this form are mandatory. The test fails if the fields are mandatory. |
Add Attachments to Form (SP)
Test the functionality of attaching a file to a Service Portal form widget.
To use this step, you must have already opened a form using the Open a Form (SP) test step or Open Service Portal Page steps. This step can't be used after a Submit Form step or Click a UI Action step has been used.
| Field | Description |
|---|---|
| Execution order | Integer specifying the order in which the test executes this
step. As you create steps, the system automatically assigns each step an incremental value. This value causes the test to execute steps in the order that you created them in. You can change this default order by editing the Execution order values. |
| Active | Option to activate this test step for use. |
| Application | Application scope in which the system runs this step. |
| Test | Read-only name of the test that you're adding the step to. |
| Step config | Read-only name of the step. |
| Notes | Notes about the test step. |
| Upload Attachments | Button to attach one or more files to the form. |
UI Action Visibility Validation (SP)
Determines whether a UI action on the current Service Portal form is visible. To use this step, you must have already opened a form using the Open a Form (SP) test step.
Service Portal only supports server UI actions. The setRedirectURL() method and client UI actions are not supported. UI action visibility can vary depending on the currently logged in or impersonated user.
| Field | Description |
|---|---|
| Execution order | Integer specifying the order in which the test executes this
step. As you create steps, the system automatically assigns each step an incremental value. This value causes the test to execute steps in the order that you created them in. You can change this default order by editing the Execution order values. |
| Active | Option to activate this test step for use. |
| Application | Application scope in which the system runs this step. |
| Test | Read-only name of the test that you're adding the step to. |
| Step config | Read-only name of the step. |
| Description | Description of the test step. This field value is automatically set based on the field values of the test step. This field appears after the test step is submitted. |
| Notes | Notes about the test step. |
| Table | The table for the form on which to check UI action visibility. The value should be the table in the Open a Form (SP) step. |
| Visible | Fields from the UI Actions table to be checked for visibility. Includes only
form-based UI actions. The test fails if the UI action is not visible on the form for
the currently logged in user. Note: If the list contains UI actions with the same name,
check the form to determine the sys_id of the element. Then filter by sys_id in the
UI Action table to select the correct element in the step. |
| Not visible | Fields from the UI Actions table to be checked for visibility. Includes only
form-based UI actions. The test fails if the UI action is visible on the form for the
currently logged in user. Note: If the list contains UI actions with the same name,
check the form to determine the sys_id of the element. Then filter by sys_id in the
UI Action table to select the correct element in the step. |
Click UI Action (SP)
Selects a UI action on the current Service Portal form and outputs the table and sys_id of the record on which the action was selected.
To use this step, you must have already opened a form using the Open a Form (SP) test step. After using this step, you cannot use any other form steps.
| Field | Description |
|---|---|
| Execution order | Integer specifying the order in which the test executes this
step. As you create steps, the system automatically assigns each step an incremental value. This value causes the test to execute steps in the order that you created them in. You can change this default order by editing the Execution order values. |
| Active | Option to activate this test step for use. |
| Timeout | Number of seconds allowed before the step fails. If the validation fails, the system repeats the step until it reaches the duration of the timeout. If the validation fails after the timeout duration has passed, the step fails. |
| Application | Application scope in which the system runs this step. |
| Test | Read-only name of the test that you're adding the step to. |
| Step config | Read-only name of the step. |
| Description | Description of the test step. This field value is automatically set based on the field values of the test step. This field appears after the test step is submitted. |
| Notes | Notes about the test step. |
| Table | The table for the form on which to click a UI action. The value should be the table in the Open a Form (SP) step. |
| UI action | The UI action to click, selected from the UI Actions table. Includes only form-based UI actions. |
| Assert type | Specifies where to check for form submission after
clicking the UI action:
|
| Field | Description |
|---|---|
| record_id | Sys_id of the record on which the action was clicked. |
| table | Table with the clicked UI action. |
Submit a Form (SP)
Submits the current form in a Service Portal page and outputs the table and sys_id of the submitted record.
To use this step, you must have already opened a form using the Open a Form (SP) test step. After using this step, the page closes. You can't use any other steps on the current page.
| Field | Description |
|---|---|
| Execution order | Integer specifying the order in which the test executes this
step. As you create steps, the system automatically assigns each step an incremental value. This value causes the test to execute steps in the order that you created them in. You can change this default order by editing the Execution order values. |
| Active | Option to activate this test step for use. |
| Timeout | Number of seconds allowed before the step fails. If the validation fails, the system repeats the step until it reaches the duration of the timeout. If the validation fails after the timeout duration has passed, the step fails. |
| Application | Application scope in which the system runs this step. |
| Test | Read-only name of the test that you're adding the step to. |
| Step config | Read-only name of the step. |
| Description | Description of the test step. This field value is automatically set based on the field values of the test step. This field appears after the test step is submitted. |
| Notes | Notes about the test step. |
| Assert type | Specifies where to check for form submission:
|
| Field | Description |
|---|---|
| record_id | Sys_id of the submitted record. |
| table | Table for the submitted record. |