ATF Catalog Item Approval Issues

someone_passing
Kilo Contributor

Hello,

I am trying to update the record and approve it but I am running into couple problems. I followed this tutorial from servicenow, but it is not working. I am using Kingston btw.

The TL;DR version is, how do you approve a catalog item record. What are the steps for it? The tutorial I linked did not help me.

The long version is below.

What I am trying to do:

In ATF, I want to open a catalog item, set the values, submit it and go through the multiple approval process of the record.

 

What I did:

First Approach

I created a test file, say Test 1. What I first tried to do in Test 1 is:

  1. Impersonate (as User 1)
  2. Open a Catalog Item
  3. Set Variable Values
  4. Order Catalog Item <-- Successful up to this point
  5. Impersonate (as User 2)
  6. Record Query <-- Failing here saying (1** see below)
  7. Record Update

 

Second Approach

I created two test files. One is Test 1 and Test 2.

In Test 1:

  1. Impersonate (as User 1)
  2. Open a Catalog Item
  3. Set Variable Values
  4. Order Catalog Item

In Test 2:

Before I start Test 2, I go to the table where the record was created from Test 1 and paste into the Replay Request Item as shown in the tutorial in Test 2. It defeats the purpose of Automation if I have to do something manually, but I just want to pass the test, but it still doesn't work.

  1. Replay Request Item (paste the RITM number I got from the record)
  2. Impersonate (as User 2)
  3. Record Query <-- Again, failing here (2** see below)
  4. Record Update

I have more approvals I need to go through, but for now, I just want only one approval working before I proceed.

 

Problems I am running into:

1** On my first approach, I am trying to get it approved from sysapproval_approver table. I am trying to find the record using the RITM number, but I get an error saying it couldn't find the record but it shows it was looking using the REQ number and not the RITM number. The condition I put was Approval for | is | Step 4: Order Catalog Item > Request

 

2** On my second approach, the problem I am running into the same problem as above. The table is same but the condition is a little different. The condition is Approval for | is | Step 1: Replay Request Item > Replayed Request Item > Request and instead of searching the record using the RITM number, it is looking it up using the REQ number.

 

I did more testing and I was running into more weird problems, but if I mention all that, the post will get really long and I doubt anybody will read it. So my question is, how do you get the record to approve in ATF?

 

Thanks

 

Update: Follow up post to this with more questions is here.

1 ACCEPTED SOLUTION

bbf3562
Kilo Guru

Here is what I would suggest as it working on my side for approval,

  1. Impersonate (as User 1)
  2. Open a Catalog Item
  3. Set Variable Values
  4. Order Catalog Item
  5. Record Query -> To get RITM record using Req ID from #4
  6. Record Validation - > to ensure that RITM exist and the stage is approval
  7. Record Query - > To get Approval(sys_approval) record using RITM ID from #5
  8. Impersonate -> impersonate approver to validate
  9. Open exist form -> To open approval form using Approval ID from #7
  10. Set Variable Values -> You can select option to Approved.
  11. UI action/button -> Click Save button to save the form.

View solution in original post

10 REPLIES 10

dave_edgar
Mega Guru

once the record is created it disappears basically, effectively you cannot really test end to end at the moment, as as soon as the CR moves to request an approval the CR disappears and no actual approval record is created.

So everything has to be tested in isolation, unfortunately.  So what we have done is lookup sysapproval records that need approving for a CR and test that they work but of course at the end of the test it will rollback so unless you are viewing the record you wont have proof, a screen shot, of the approval.

 

It's not ideal but the way it is at.  If you needed something like an e2e test and your company wants to invest you'd probably be better of looking at a tool like autotestpro.  

 

Hope that helps

bbf3562
Kilo Guru

Here is what I would suggest as it working on my side for approval,

  1. Impersonate (as User 1)
  2. Open a Catalog Item
  3. Set Variable Values
  4. Order Catalog Item
  5. Record Query -> To get RITM record using Req ID from #4
  6. Record Validation - > to ensure that RITM exist and the stage is approval
  7. Record Query - > To get Approval(sys_approval) record using RITM ID from #5
  8. Impersonate -> impersonate approver to validate
  9. Open exist form -> To open approval form using Approval ID from #7
  10. Set Variable Values -> You can select option to Approved.
  11. UI action/button -> Click Save button to save the form.

So with your way, I feel like I am close, but I am running into an error at Step 5. For Step 5, I am trying to get the RITM using the following configuration:

 

Table: Approval [sysapproval_approver]

Conditions: Approval for | is | Step 4: Order Catalog Item > Request

 

And it looks for it is using the Request number in the Approval Column (where all RITM numbers exists) instead of the RITM number. The good news is, the Request number for that RITM number is the same as it was looking up and it is not incrementing. This is what I am talking about.

 

-------------------------------------------------------------------------

Created Record:

Approval for (List View)/Number: RITM0031283

Request: REQ0031290

 

Failed Test Result:

No records matching query:
Approval for = REQ0031290

-------------------------------------------------------------------------

 

Now in the Conditions for Record Query, I don't see Request in the dropdown.

 

I don't know why but I am always having a problem at the Record Query step. What did you do, or what should I change?

Looks like you are trying to do step 7 at step 5. Record Query -> To get RITM record using Req ID from #4