+ Start a Discussion
kjpetersonkjpeterson 

How long does it take you to develop an Apex trigger with tests

What would you say is the average amount of time it takes you to develop an Apex trigger with its tests?
werewolfwerewolf
Well it depends on what it's doing.  If my trigger is just making a field change in a lead, say, then a couple of hours at the most.  If it's a complex trigger that's querying all kinds of stuff and creating things here and there, then longer.
cmarzillicmarzilli
Yes I would say 2 hours minimum for simple triggers.  As the get more complex the time increases.
SteveBowerSteveBower
Don't forget you have to budget time for TestMethod development.  Depending on the complexity of your trigger, the number of end cases, etc. this can take quite a lot of tests to reach 95% coverage.  (Yes, it's 75%, but going for that extra 20% can often find the end-case that's going to blow up in your clients face later.)

I sometimes budget 20% spec, 30% coding, 40% testing, 10% deployment.

Also, it's interesting to try coding at least some of the test cases first.

Best, Steve.