How to create ATF for change request can anyone share its test step.

AdityaRajG
Tera Contributor
 
1 ACCEPTED SOLUTION

Abbas_5
Tera Sage
Tera Sage

Hello @AdityaRajG,

 

To create an ATF test for change requests in ServiceNow, you can follow these general steps: define the test case, set up the environment, add test steps, and execute the testYou can use steps like impersonating a user, opening a form, submitting a form, and verifying record values. Specific steps for change requests might involve creating change tasks, associating them with change requests, and verifying those associations, according to a ServiceNow forum post. 
 
Detailed Steps:
  1. 1. Create a New Test:
    • Navigate to the Automated Test Framework (ATF) in ServiceNow.
    • Click "Create New Test".
    • Name and describe the test case.
  2. 2. Define Test Steps:
    • Impersonate a user: If needed, use the "Impersonate" step to act as a specific user.
    • Open a Form: Use the "Open Form" step to open the change request form.
    • Set Field Values: Populate the form with relevant data.
    • Submit a Form: Use the "Submit a Form" step to submit the change request.
    • Create Change Tasks (if applicable):
      • Open a "New Form" step for the change_task table.
      • Set the "Change request" field to the relevant change request.
    • Record Query and Update:
      • Use "Record Query" to find a specific record, then use "Record Update" to modify it.
    • Search and Verify:
      • Add a "Search" step to verify the record exists.
      • Use "Record Validation" to ensure the record meets specific criteria.
  3. 3. Execute and Review:
    • Execute the test to verify its functionality.
    • Review the results to ensure the test passes or fails as expected.
    • Clean up any test data if necessary. 
       
Examples:
  • Creating a change request: Open a form, set fields, submit, and verify that the record was created.
  • Associating a change task: Open a change task form, set the "Change request" field, and submit, then verify the association.
  • Closing a change task: Impersonate a user with ITIL roles, open the change task form, update fields to reflect closure, and submit. 
     
Additional Tips:
  • Use "Record Query" to find existing records and update them within the test.
  • Utilize "Record Validation" to check if records meet specific criteria.
  • Consider using server-side scripts for more complex logic.
  • Refer to the ServiceNow documentation for ATF.
  • Explore existing OOB tests for change management. 

If this is helpful, please hit the thumbs up button and accept the correct solution by referring to this solution, it will be helpful to them.

 

Thanks & Regards,

Abbas Shaik

View solution in original post

4 REPLIES 4

Abbas_5
Tera Sage
Tera Sage

Hello @AdityaRajG,

 

To create an ATF test for change requests in ServiceNow, you can follow these general steps: define the test case, set up the environment, add test steps, and execute the testYou can use steps like impersonating a user, opening a form, submitting a form, and verifying record values. Specific steps for change requests might involve creating change tasks, associating them with change requests, and verifying those associations, according to a ServiceNow forum post. 
 
Detailed Steps:
  1. 1. Create a New Test:
    • Navigate to the Automated Test Framework (ATF) in ServiceNow.
    • Click "Create New Test".
    • Name and describe the test case.
  2. 2. Define Test Steps:
    • Impersonate a user: If needed, use the "Impersonate" step to act as a specific user.
    • Open a Form: Use the "Open Form" step to open the change request form.
    • Set Field Values: Populate the form with relevant data.
    • Submit a Form: Use the "Submit a Form" step to submit the change request.
    • Create Change Tasks (if applicable):
      • Open a "New Form" step for the change_task table.
      • Set the "Change request" field to the relevant change request.
    • Record Query and Update:
      • Use "Record Query" to find a specific record, then use "Record Update" to modify it.
    • Search and Verify:
      • Add a "Search" step to verify the record exists.
      • Use "Record Validation" to ensure the record meets specific criteria.
  3. 3. Execute and Review:
    • Execute the test to verify its functionality.
    • Review the results to ensure the test passes or fails as expected.
    • Clean up any test data if necessary. 
       
Examples:
  • Creating a change request: Open a form, set fields, submit, and verify that the record was created.
  • Associating a change task: Open a change task form, set the "Change request" field, and submit, then verify the association.
  • Closing a change task: Impersonate a user with ITIL roles, open the change task form, update fields to reflect closure, and submit. 
     
Additional Tips:
  • Use "Record Query" to find existing records and update them within the test.
  • Utilize "Record Validation" to check if records meet specific criteria.
  • Consider using server-side scripts for more complex logic.
  • Refer to the ServiceNow documentation for ATF.
  • Explore existing OOB tests for change management. 

If this is helpful, please hit the thumbs up button and accept the correct solution by referring to this solution, it will be helpful to them.

 

Thanks & Regards,

Abbas Shaik

Thanks for the solution

But when I am clicking on Implement button via UI action It gave me below error
Succesfully opened form via ATF submitted it
Opened the change request form and gave the approval successfully reached upto schedule But as I performed the UI action to click on implement it gave me below error and change task was there in my change request.

 

Can you please help me with this

Thanks



 

I got below error when I performed implement button via UI action of ATF. I followed all steps 16 test steps passed like approval , change request, shedule but stuck with below error. I guess my change task is not getting attached by ATF and give me ATF step to avoid below error

AdityaRajG_0-1748572343628.png

 

Shaqeel
Mega Sage

Hi @AdityaRajG   

 

ATF have some pre created ATF test for Change Management.

Kindly start with that and you can modify according to your test case.

 

Shaqeel_0-1748499577132.png

Regards

Shaqeel


***********************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

***********************************************************************************************************************





Regards

Shaqeel