You need to sign in to do that
Don't have an account?
sduda
Validation Rules w/ APEX Testing
One major annoyance I've come across with creating APEX test cases are validation rules & required fields. Say I want to create a new Account in a test case, I need to specify all of the required fields for that object - that's fine the first time around. Now, when I go back to test my APEX code a month later, there's a high probability that another required field has been added to the Account object or some new validation was created. This causes my test case to fail, and in turn requires me to update the APEX code.
What approach have other people used to avoid this issue?
What approach have other people used to avoid this issue?
I agree that in a lot of cases, the adding of a required field perhaps doesn't have any impact on your code but if you're running tests, it means you are in a development fase anyway and updating the test cases is a small price to pay.
By the way : this also happens in other programming languages / databases : If you have for example Java or .NET code that is running on a relational database in which a column all of a sudden gets set to a 'not null' requirement, you'll have the exact same scenario ...
-David