You need to sign in to do that
Don't have an account?

unable to deploy trigger in production
Hi
I have written an apex trigger in Sandbox. It is working fine. I have written apex class to test the trigger and when i run the tests, it is showing 94% coverage.
But when i try to deploy it into production using eclipse force.com ide and validate deployment, it throws an error saying
Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required
I have gone through dev community and tried many options like changing api version to 11.0 in xml files but it was of no use.
Please suggest me a solution for this asap.
Thanks.
Iqbal
I have written an apex trigger in Sandbox. It is working fine. I have written apex class to test the trigger and when i run the tests, it is showing 94% coverage.
But when i try to deploy it into production using eclipse force.com ide and validate deployment, it throws an error saying
Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required
I have gone through dev community and tried many options like changing api version to 11.0 in xml files but it was of no use.
Please suggest me a solution for this asap.
Thanks.
Iqbal
Salaamz Iqbal,
I suggest you try the ant deployment tool - it makes things a lot more easier. And with your nick being "j2ee", it shouldn't really be a problem for you, would it? :smileyhappy:
I personally haven't had any luck with Force.com IDE in this regard. Trust me, I've wasted quite a few billable hours over this! :smileymad: The Force.com IDE is a good tool, but I think there's a lot that still needs to be done, and this issue is one of them. That said, do post here if you get to resolve this issue.
Thanks.
thanks .. i tried doing it in ant ..
but am facing same error.
How to increase the test coverage? any ideas
System.assert(false);
Now, when you try deploying the code, it will fail on the first "System.assert(false);" statement that it hits, and will indicate the line number. This will give you an idea of where the control is going, and where it's not. Then you can investigate why the control is not going to a certain block, which is causing the code coverage %age to fall.
Hope this helps!
Thanks.
Jason
Hi,
.Creating the test data in the test methods is most important. dont use the existing data(like hard coding (or) retrieving the data using the select queries) in the test methods. that might be the cause for the failure.
. The other point might be, since you might not have covered the events on which your trigger is being called. say if you trigger gets invoked on insert event, your test method should have an insert call so that it covers the trigger in the test method.
Thanks
sfdeveloper