I am trying to validate a change set and it's giving me a Duplicate Username error. The problem is that the same test passes in 2 other sandboxes. From my understanding if the same username is being used for the test method in a different sandbox instance the error should be present there as well. However this is not the case. Here's the error.
System.DmlException: Insert failed. First exception on row 0; first error:
DUPLICATE_USERNAME, Duplicate Username.<br>The username already exists in this
or another Salesforce organization. Usernames must be unique across all
Salesforce organizations. To resolve, use a different username (it doesn't
need to match the user's email address). : [Username]
Any ideas why this is happening?
EDIT I changed the username and pushed a new change set. The test passed. The sandbox I am pushing to is FULL and the sandbox I am pushing from is a Partial Copy sandbox.
User
records doesn't inject enough randomness, you may have a non-negligible chance of a naming collision. If it only failed once, run it again.