'Field Values Validation' test passes but is not validating correctly

aansell
Mega Expert

I am having a problem with ATF, the Field Values Validation setting is passing successfully even though the value in the record is different to the filed being tested. Here is the validation test.

find_real_file.png

When I run my test it suceeds.

find_real_file.png

But this is not what was set on the record. Here' part of the screen shot that ATF records. You will see that the contact type is actually set to 'Direct Input'. See below.

find_real_file.png

Does anyone have any clue to what may be going on?

Thanks in advance,

Arthur

 

1 ACCEPTED SOLUTION

Hi Mark,

Further work (and help from a fresh pair of eyes from one of my colleagues!) revealed the solution and it was simple in the end. The problem was due to using 'Field Values Validation' rather than 'Record Validation'. Once the newly created record is opened, the requirement was to validate that new record hence the need for record validation rather than field validation.

The solution is as follows:

1. Set the 'Field Values Validation' step Active = False, or alternatively delete it completely, but I left it in for the screen shot.

2. Add extra step 'Record Validation' to the Test. 

  

With the above change made the validation works as expected.

Best regards,

Arthur

View solution in original post

8 REPLIES 8

Mark Stanger
Giga Sage

Contact type should be a choice field but your screenshot makes it look like it's a string field.  Do you have more than one field named contact type?  Are you 100% sure that you're dealing with the same table and the same field?

aansell
Mega Expert

Hi Mark,

Thanks for responding. Due to the size of the screenshot I included it was misleading. Sorry about that! Here is a better copy of the file; you'll see the contact type shows the drop down and there is no other field on the form called 'Contact type'. So I believe I am validating the correct field. 

find_real_file.png

However this field is below the fold so it doesn't appear in the screen shots produced by ATF so I have modified ATF to raise a record producer in my name 'Arthur Ansell' and then changed the validation to check for a colleagues name instead of mine. I would expect the test to fail, but it still passes? Here is my setup:

1. The ATF 'Set Variable Values'

find_real_file.png

 

2. My record producer has the following script line that passes the variable 

current.requested_for = producer.snow_requested_for

3. Here is the screenshot output created by ATF, showing my name as the 'Requested for'.

find_real_file.png

4. Here is my validation - deliberately checking the wrong name.

find_real_file.png

5. So as before i would expect the validation to fail? But it passes with the output below:

find_real_file.png

So is it possible to explain this?

Thanks,

Arthur

 

Can you share a screenshot of the previous test steps?  Also, what version of ServiceNow are you running in this instance?  If you give me the basic steps I can try to reproduce in my instance.

Hi Mark,

Here's the screenshots - there are 5 steps - let me know if I can provide any more info.

 

find_real_file.png

 

 

 

find_real_file.png

find_real_file.png

find_real_file.png

 

find_real_file.png