Automate Change Request and Approval Process using ATF

mhoughton
Kilo Explorer

So I'm trying to develop an ATF that automates the change request process through all of the necessary steps until the request is closed in the end.

So far, I have been able to impersonate a user to open a change request form, fill in all necessary fields, and submit the form for approval. Now the next step would be to impersonate the necessary approver and open up the record to approve the request. I have tried multiple different test steps to try to simulate this step but keep running into issues. The problem is is figuring out a way to simulate the approver to open up the same change record that was submitted in the previous process. Does anyone have any experience doing something similar to this? I figured that with request approval being so neccessary, someone in the community has to of figured out how to simulate this whole process, Thanks!

23 REPLIES 23

I am struggling with this, I would be interested in what you did to resolve the issue.  For some reason I only get to choose the impersonate user and not a record.

Thank You

Troy

Hi Troy,

 

Where is it going wrong for you?

 

Have you read through my previous post on how to get this to work?

 

Regards

 

Dos

Prinesh1
Kilo Contributor

HI,

I found the solution.

please follow the  below steps. You will understand.

 

ImpersonateImpersonate the user: Beth Anglin with user Id: beth.anglin 1true 
 Open a New FormOpen a new 'Change Request' form

Change Request [change_request]

2true 
 Set Field ValuesSet the values on the form as follows:
Test plan = ATF CHG test
and Implementation plan = ATF CHG test
and Planned end date = 08/03/2018 05:30:00 PM
and Short description = ATF CHG test
and Planned start date = 08/02/2018 05:30:00 PM
and Backout plan = ATF CHG test
and Justification = ATF CHG test
and Risk and impact analysis = ATF CHG test

Change Request [change_request]

3true 
 Submit a FormSubmit the current form and confirm form submitted to server 4true 
 Open an Existing RecordOpen the 'Change Request' form with id '{{Step 4: Submit a Form.Record}}'

Change Request [change_request]

5true 
 Record UpdateUpdate a record in 'change_request' with the following values:
State = Assess
and Assignment group = Software
Confirm the record was successfully updated

Change Request [change_request]

6true 
 Open an Existing RecordOpen the 'Change Request' form with id '{{Step 4: Submit a Form.Record}}'

Change Request [change_request]

7true 
 Record UpdateUpdate a record in 'change_request' with the following values:
State = Authorize
Confirm the record was successfully updated

Change Request [change_request]

8true 
 Open an Existing RecordOpen the 'Change Request' form with id '{{Step 4: Submit a Form.Record}}'

Change Request [change_request]

9true 
 Field Values ValidationValidate that the form matches the following condition:
Active = true
With a failure timeout of 5 Seconds

Change Request [change_request]

10true 
 Record QueryValidate there is at least one record in 'sysapproval_approver' matching query:
Approving = {{Step 4: Submit a Form.Record}}
and State = Requested
and Approver = {{Step 1: Impersonate.User}}
With a failure timeout of 5 Seconds

Approval [sysapproval_approver]

11true 
 Open an Existing RecordOpen the 'Approval' form with id '{{Step 11: Record Query.First record}}'

Approval [sysapproval_approver]

12true 
 Click a UI ActionConfirm that browser submits 'Approval' form to server when clicking UI Action 'Approve'.

Approval [sysapproval_approver]

13true 
 Record QueryValidate there is at least one record in 'sysapproval_approver' matching query:
State = Approved
and Approving = {{Step 4: Submit a Form.Record}}
With a failure timeout of 5 Seconds

Approval [sysapproval_approver]

14false 
 Click a UI ActionConfirm that browser submits 'Approval' form to server when clicking UI Action 'Approve'.

Approval [sysapproval_approver]

15false 
 Record QueryValidate there is at least one record in 'sysapproval_approver' matching query:
Approver = Howard Johnson
and Approving = {{Step 4: Submit a Form.Record}}
and State = Requested
With a failure timeout of 5 Seconds

Approval [sysapproval_approver]

16true 
 ImpersonateImpersonate the user: Howard Johnson with user Id: howard.johnson 17true 
 Open an Existing RecordOpen the 'Approval' form with id '{{Step 16: Record Query.First record}}'

Approval [sysapproval_approver]

18true 
 Click a UI ActionClick UI Action 'Approve' on 'Approval' form.

Approval [sysapproval_approver]

19true 
 Record UpdateUpdate a record in 'change_request' with the following values:
State = Implement
Confirm the record was successfully updated

Change Request [change_request]

20true 
 Record UpdateUpdate a record in 'change_request' with the following values:
State = Review
Confirm the record was successfully updated

Change Request [change_request]

21true 
 Record UpdateUpdate a record in 'change_request' with the following values:
State = Closed
and Close code = Successful
and Close notes = test 1
Confirm the record was successfully updated

Change Request [change_request]

22true 
 Open an Existing RecordOpen the 'Change Request' form with id '{{Step 4: Submit a Form.Record}}'

Change Request [change_request]

23true

This is really helpful. It's the kind of documentation/scenario that ServiceNow should be providing. There documentation is pretty light and will just show you how to create a ticket.

The frustrating part for me so far is that ATF will pick up any client script or error that you wouldn't normally see while logging tickets in a browser, but it's enough to make ATF error out and fail. I opened one HI ticket already and now came across another bug which seems to be a known issue that causes my tests to fail. 

https://hi.service-now.com/kb_view.do?sysparm_article=KB0692731

 

Fixed In

 Kingston Patch 11
 London Patch 3
 Madrid