I'm maintaining a package that is being sold to third-party organizations, and when doing support I've found out that data creation from within tests can clash with triggers from other packages/custom implementations that the client might have already installed.

The way I got to figure out that was what was happening was that since the package I'm maintaining uses chatter clases, some of the methods require the @seealldata annotation, and those tests didn't fail because the custom configurations required by some other trigger was in place.

Another problem I found, is that since I try to post chatter messages in my tests, I have to create other objects to act as parents for the messages, but I can't know in advance to what objects I can post (I wrote a bunch of tests to post to Account, only to have them fail because account posting was disabled in an org).

How do I prepare my tests to be able to work with triggers I don't know about? And how do I test when I don't know the permissions or configurations that may be in the destination org?

1 Answer 1


If you are creating a managed package then you only worry about the tests passing in your development org.

If you are creating an unmanaged package, you will have to structure your tests to only use common standard object or comment your code where known trouble spots are in case there are issues.

Unfortunately, without knowing your product it is had to say other than being general.

  • 1
    It's worth noting that you still have to worry about other people's triggers messing up your tests/code. If your test inserts an Opportunity that falls foul of a third-party trigger, the test's gonna fail regardless of if it's in a managed package or not. I think. Mar 1, 2017 at 16:45
  • 1
    @GrumpyTechDude - You are correct in that your test will fail but you are incorrect that you have to worry about it. Managed package tests are NOT required to be run or pass in a customer org. You can essentially forget about it if it is a managed package.
    – Eric
    Mar 1, 2017 at 17:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .