I have a test class failing while validating it and its base class deployment to production. The test setup is creating several records in 2 objects (1 standard 1 custom) and inserting them as a system administrator and the test method then validates the base class is finding the correct records from the setup.
This worked fine in my Dev, Test and Stage environments. I created a new sandbox from Production, and it passes validation there as well.
After troubleshooting, I narrowed it down to the @TestSetup
method (i.e. everything runs fine if I use our custom Administrator profile during test setup). Comparing the System Admin profile in Stage and Prod, I see no difference in any of its object permission for the objects I'm attempting to insert, and because it is production, I can't really just force it in and debug it there. So my question is two-fold.
- What else should I be looking at from a difference in permissions/settings. I validated profile permissions on the objects' fields and record types, user (deployment user) permission sets (none) and "View/Modify All" so far.
- Is there any method to get a debug log during deployment validation (I'm using Gearset for deployment if that makes a difference).
At this point, I'm thinking there is a custom setting being applied while creating one of the two types of records. I haven't found any custom settings or metadata that would impact these objects.
@TestSetup
method look like?@testSetup
?