Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Automated Test Framework use case: test a Service Catalog request

Automated Test Framework use case: test a Service Catalog request

This use case illustrates testing a service catalog request with the Automated Test Framework.

About this task

With the Replay Request Item test step, you can test the service catalog ordering process once a request exists and has a record in the request item table. In the Kingston release, you cannot create an automated test for the process by which the user creates a new request.
Figure 1. Automated Test Framework: Service catalog example

Screenshot of test steps

Procedure

  1. Replay an existing service catalog request item. This test step inserts a new record in the [sc_request] table for the catalog request item RITM0010001.
    Figure 2. Service Catalog test step 1 details: Replay Request Item

    Screenshot of form for Replay Request Item
    This insertion triggers the Service Catalog Request workflow, which checks the price of the item, determines that it exceeds $1000.00, and therefore generates approval records for users belonging to the Catalog Request Approvals group. In this example, only one user– Eric Schroeder – belongs to this group.
    Figure 3. Screenshot of triggered Service Catalog Request workflow

    Screenshot of Service Catalog Request workflow
  2. Impersonate Eric Schroeder, the user who needs to approve this Service Catalog Request.
    Figure 4. Test step - Impersonate Eric Schroder

    Screenshot of form for impersonate test step
  3. Verify that the system created an approval record for Eric Schroeder and this request. Note that for the Approval for field, you assign the output value from Step 1: Replay Request item > Request.
    Figure 5. Step 3 details: Record Query for Approval record

    Screenshot of form for Record Query test step
  4. Set the state of this approval record to Approved.
    Figure 6. Step 4 details: set approval record to Approved

    Screenshot of record update setting approval state
    The Service Catalog Request workflow sees that all required approval records have the state of Approved and transitions to the Approval Action which marks the request record [sc_request] as Approved.
    Figure 7. Step 4: Triggered workflow marks request record as approved

    Screenshot of sc workflow with approval portion highlighted
    When the record in [sc_request] changes to the Approved state, an associated business rule generates request items [sc_request_item] for each item in the request. In this example, the request contains only one item, so the business rule inserts one record into the [sc_request_item] table. This insertion triggers the Service Catalog Item Request workflow.
    Figure 8. Service Catalog Item workflow

    Screenshot of Service Catalog Item Request workflow

    The first activity in the Service Catalog Item Request workflow generates an approval record for the head of the department in which the requesting user works. In this example, the department head is Natasha Ingram.

    Figure 9. Service Catalog Item workflow: step 4


  5. The workflow does not continue until the department head approves it, so the next test step impersonates Natasha Ingram.
    Figure 10. Step 5 - Impersonate User

    Screenshot of form for Impersonate User test step
  6. Obtain the sys_id for the new approval record with the Record Query step. Note that Record Query creates an output variable with the sys_id of the first record returned from the query.
    Figure 11. Step 6 - Record Query test step

    Screenshot of form for Record Query
  7. Set the approval record to Approved.
    Figure 12. Step 7 - Approval User test step

    Screenshot of form for Approval User test step xxx
    Note how Step 7 refers to the First record output variable from Step 6 to specify which record to approve. When the record is approved, the workflow transitions to the next Approval - User activity, which generates an approval record for the CIO. In this example, the CIO is Bow Ruggeri.
    Figure 13. Step 7 details - Service Catalog Item workflow


  8. Impersonate Bow Ruggeri.
  9. Obtain the sys_id for the approval record for Bow Ruggeri.
  10. Set the approval record to Approved.
    When the record is approved, the workflow transitions to the Approval Action activity which sets the record for this item in the [sc_request_item] table to Approved. The workflow transitions to the Catalog Task activity labelled Asset Mgmt. Fulfills Order. This Catalog Task activity generates a new record in the [sc_task] table that instructs a user in the Fulfillment group to order the item.
    Figure 14. Step 10 - Service Catalog Item workflow

    Screenshot of Service Catalog Item workflow for Step 10
  11. Impersonate a user in the Fulfillment group, in this example ATF.User.
    Figure 15. Step 11 - Impersonate User test step


  12. Obtain the sys_id for the new catalog task with the Record Query step. Note that Record Query creates an output variable with the sys_id of the first record returned from the query.
    Figure 16. Step 12 - Record Query test step


  13. Mark the [sc_task] record as Closed Complete.
    Figure 17. Step 13 - Record Update test step

    Screenshot of form for Record Update test step
    Note how Step 13 uses the First record output variable from Step 12 to specify which record to mark as Closed Complete.
    When the record is marked Closed Complete, the workflow exits the Catalog Task activity along the In Stock exit path.
    Figure 18. Step 13 - Service Catalog Item Request workflow


    The workflow transitions to the Notification activity, then to the Catalog Task activity labelled Deploy Item to User.The Deploy Item to User Catalog Task activity inserts a new record into the [sc_task] table that instructs a user in the Deployment group to deliver the item.
  14. Obtain the sys_id for the new catalog task with the Record Query step. Note that Record Query returns an output variable with the sys_id of the first record returned from the query.
    Figure 19. Step 14 - Record Query test step

    Screenshot of form for Record Query test step
  15. Mark the [sc_task] record as Closed Complete. Note how Step 15 uses the First record output variable from Step 14 to specify which record to mark as Closed Complete.
    Figure 20. Step 15 - Record Update test step

    Screenshot for Step 15 Record Update dialog
    When the record is marked Closed Complete, the workflow exits the Catalog Task activity, logs a message, and exits.
    Figure 21. Step 15 - Service Catalog Item Request workflow

    Screenshot of Service Catalog Item Request workflow
  16. Verify that the request item in [sc_request_item] has the state Closed Complete.
    Figure 22. Step 15 details - Record Validation

    Screenshot of Step 15 Record Validation dialog
  17. Verify that the request [sc_request] has the state Closed Complete.
    Figure 23. Step 16 - Record Validation test step

    Screenshot of form for Step 16 Record Validation