The CreatorCon Call for Content is officially open! Get started here.

ATF for field

Rahul84
Tera Contributor

Hey Team,

I am new to ATF. I need to create a ATF test cases for one of my requirement.
I have a field on a form and it a type of choice field.

Only particular members of a group can edit this field , for others it is read only.

Please let me know , all the steps that can be covered in the ATF creation for the above requirement.

 step by step explanation would be much appreciated.

Thanks

1 ACCEPTED SOLUTION

Tauqueer
ServiceNow Employee
ServiceNow Employee

Following below Steps you can achieve the mentioned requirement.

  1. Impersonate a User which is having Access to that field.
  2. Open a form.
  3. Field state validation and validating the field is not read only.
  4. Impersonate User which dont having Access to that field.
  5. Open a form. (Same form as step 2)
  6. Field state validation and validating the field is now read only.

View solution in original post

4 REPLIES 4

pratiksha5
Mega Sage

Most of the atf start with impersonating the user with role who can access, in your case you can try with the user who don't have access.. Then you can open form which you need to check. Then you need to check if the you can update it or not. 

Tauqueer
ServiceNow Employee
ServiceNow Employee

Following below Steps you can achieve the mentioned requirement.

  1. Impersonate a User which is having Access to that field.
  2. Open a form.
  3. Field state validation and validating the field is not read only.
  4. Impersonate User which dont having Access to that field.
  5. Open a form. (Same form as step 2)
  6. Field state validation and validating the field is now read only.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Rahul,

you will require 2 Tests for this

1) With that group member and validate if fields are read-only

2) Without the group member and validate if fields are editable

What have you started & where are you stuck?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar ,

Successfully able to create ATF for the scenario but one issue I am facing with

I am creating a ATF case for my 5 fields on a form in a particular table that these fields should be editable by the members of particular group and for others it should be read only

I have added my all five fields as a non- read only in a field validation step.

The issue is that , this field validation step is failing becoz of one of the field out of these mentioned 5 fields. 

test result is having error as = Expected field 'abc' to not be read only but it was read only

Also while running the test case , that field is not coming in the screenshot of the form

we have the ACL as well on these fields ,and they are working fine.

If we manually testing the form by impersonation the members of a group. It is working fine and all five fields are editable for them

but not sure in the case of ATF why it is failing for only one field out of 5 , for others 4 it is working fine..

Pls let us know why this happing and what needs to be done/change