Error when using TestService.SetupTestData()
The following code produces the following error
private static void createAcctSeedTestData() {
//create Accounting Seed Test Data
AcctSeed.ServiceResultsr = AcctSeed.TestService.setupTestData(true,true,true);
if(sr.isSuccess) {
system.debug(sr.data);
}
else {
system.debug(sr.errors);
}
Error:
Error:[code=System.DmlException, detail=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], id=null])
I've tried different parameters for the method and keep getting the same error.
I need to create Accounting Seed Test GL Accounts within an Apex Test Data Factory Calss for custom objects that are related to Accounting Seed GL Accounts.
Any idea why this isn't working? It's a Full Sandbox
-
Hey Sam, I wasn't able to get this test class working either. I ultimately created my own helper class to initialize all required AccountingSeed data. I've included some rough code below; hit me up (charles AT cloudmastery.com) if additional help is needed.
After deploying the TestsUtils class below, simply use the TestsUtils.setupAccountingSeedTestData() in any of your test methods as needed.
Please sign in to leave a comment.
Comments
1 comment