You need to sign in to do that
Don't have an account?
Apex coding
How to write testcases for triggers
Hi
I have wriiten some classes and triggers whcih contain Apex coding
To deploy that on to production or Sandbox of Salesforce
Salesforce.com recommends that at least 75% of your Apex scripts should be covered by unit tests, and all triggers should have some test coverage.
I have wriiten test classes for classes and I dont know How to write test cases for Triggers
what do you mean by " all triggers should have some test coverage."
can any one help me in this regard
regards
sunil
http://community.salesforce.com/sforce/board/message?board.id=apex&thread.id=4492
Regards,
Jon
For example, I have a trigger on "after insert" for Membership Payment, so my test method creates a list of 20 dummy records and then I just execute an "insert" command. Remember that test methods do not make any changes to the actual database - it seems they use a virtual copy that merges your existing data plus any changes you cause within the test method. For example, if your test method inserts a new Contact record and then selects the ID of that record, you will get a valid ID even though it doesn't exist in your actual database.
David