You need to sign in to do that
Don't have an account?
Starz26
Test Methods BUG: Validation Rules
If we are not using the seealldata = true and thus have to create ALL records then why does the validation rules that fire during test methods see all data?
We have a few validation rule that check to ensure a field is unique. One of them being email.
In test methods I use a lot of test@tes.com for email addresses and sometimes users will create records with test@test.com. When the test methods are run after that they fail the validation rule.
For now, I will have to create a more uniwue email that users are not likely to use.
Anyone else observed this?
This is interesting, I'll try this.
I hope you are not using the same email address in multiple records in single test execution. Or I think if run all is done it counts the previously created record in test method in same execution (please correct me if am wrong)
I also faced another strange problem with test classes. Let's say an object is having autonumber and in test class I have created three records (AN-00001, AN-00002, AN-00003), now when I create the original record it gets the count AN-00004.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
It is my understanding that autonumbers are consumed by test methods and they are not rolled back.
Oh, I am only inserting this one record with that email in this test method.
Here is the debug log from my first post. The debug was placed immediatly before the insert. seealldata is NOT set. An existing record in the database before the test contains the email on the record of test@test.com. I am inserting a record during the test method using this email and there is a validation rule (using vlookup) to check for duplicates. (Behind the scenes, a trigger is parsing the domain from the email and the domain ends up being test.com and is the name of the record that cannot be duplicate.
Ankit,
Did you ever get a chance to test this yourself?