0

do you know if it is possible to create a community in test class without to use the feature seeAllData=true

I would like to create a community, create community users and assign users to the community without the feature seeAllData=true

Do you know if there is a solution?

2

do you know if it is possible to create a community in test class without to use the feature seeAllData=true

Irrespective of seeAllData, you cannot create a community in your test class. A community is represented by Network object, and that there are no API to create one in your code. seeAllData is used for data visibility in test classes, whereas you are dealing with a metadata.

As for your other question:

I would like to create a community, create community users and assign users to the community

As mentioned, you cannot create a community. While I am not exactly aware of your testing scenarios, but the way to create a user and assign them to the community should be tested with some set of pre-requisites:

  • Your community should already been created
  • The profile that you are trying to test with in your test class is already added as a member in the Community

Now, you can just create the Users in your test class and assign the User to the respective profile, and then you can proceed with your other test scenarios.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.