function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Testing ....

Is there any example of this... any demonstration of what the tests are to accomplish?
My app is done. Ready to go. Deployable.
There are a few paragraphs in the developer guide ...
I've got my code in a trigger.
I open a recordset (trigger)
I write a few records to the recordset (trigger).
What am I supposed to test?
First of all, please keep all of your similar posts in one thread. There are currently 4 posts of yours that detail different aspects of the same problem. It is much easier on the community if all the information is in one place. Don't be afraid to reply to or edit your own posts as the situation progresses.

That said, you will need to put a testMethod in an Apex Class. Basic skeleton for this is as follows:

public class CaseController {

static testMethod void testCalculateStuff() {

// perform trigger tests here



 As for the "perform trigger tests here" portion, it all depends on what your trigger(s) do(es). At the very least, create test code that will insert/update/delete/undelete/etc. records of the same type your triggers do. For instance, if you have a trigger with the following signature:

trigger CalculateStuff on Case (after insert, after update )
you will want something like the following in the testMethod in the Class:

/* Code to insert test Case */
Case newCase = new Case();
newCase.status = 'Working';
// add any other required and/or pertinent fields
insert newCase;

/* Code to update existing Case */
Case existingCase = [select id, status from case where id = '500700000057uhZ'];
existingCase.status = 'Escalated';
update existingCase;

 Keep in mind that the Id I used in the existing case portion will not work for you as it is specific to my DE. Also, I haven't tested the above code so there may be some bugs, but it should get you started.