+ Start a Discussion
Nisse Knudsen.ax1026Nisse Knudsen.ax1026 

Creating TestCoverage for ContentDocument trigger not possible?

Hey! :)


I added a ContentDocument trigger via Force.com IDE und wanted to include this trigger in my managed package.

I create a test method that should fire my trigger, which then calls a trigger handler class.


Now the problem:


Whe I run the test class, I see as a result, that 80-ish% of my trigger handler code has been covered. This means, the trigger did definitely fire!! But I can't see this trigger in the result list.

But the biggest problem is, that the packaging process aborts everytime with the reason, that the ContentDocument trigger has 0% test coverage.


I don't know what to do, it just appears to me, that the ContentDocument trigger has not been fully integrated by SFDC?


Any help is appreciated!


Best Regards,




Hi Nisse Knudsen,

You can use this code of Test Method for your Trigger

private class TestClass{


private static void runTest(){

ContentVersion contentVersionObj = new ContentVersion();
contentVersionObj.Title = 'Google.com';            
insert contentVersionObj;




Hi All,


I want to write a trigger on chatter file upload . so when a user upload a file , if file size is greater than 10 MB then it should throw an error message . please help, it would be a great help if you could send me a code example.


How does one go about generating a ContentDocument trigger?  I could use one if it were avaialble, but can't seem to discover how to do it in the Setup screens...


Does this only apply to specific licenses?




I believe you cannot create a ContentDocument trigger from the UI or setup page. You instead need to the Force.com IDE.


For more details, see theSpring '12 Force.com Platform Release ContentDocument Triggers Notes:




Kai Wifi AmundsenKai Wifi Amundsen
I am having the same issue. It seems that ContentDocument and ContentVersion triggers do not fire in a Unit Test context.  Can anyone confirm this?  I can't even find an ideas to confirm it is a known limitation.