3 ms·
> Coverage for test methods on Salesforce.com is calculated per line, which means if you swap this: > for this: > you'll start to see those coverage numbers r
by zalew 14y ago
> Coverage for test methods on Salesforce.com is calculated per line, which means if you swap this:
> for this:
> you'll start to see those coverage numbers rising
I'd rather focus on better coverage of the most important elements than waste time on such irrelevant stuff. I got a lot of tests that don't increase the coverage factor, so what. Tools are meant to work for you, not the other way around.
- laceysnr 14y agoZalew, that's a great point but in the force.com environment you must have 75% coverage and as /wrote, I err on the side of caution in my code which can cost me in terms of %. I don't like to change my code for the sake of tests, but layout is another matter.
- NateDad 14y agoYou're using layout to cover up the fact that you're not testing the most important line in that function. Error handling should be the FIRST thing you test.
- laceysnr 14y agoI test most, but like l said I tend to be over cautious such that some exceptions are not mine to throw, as in only major platform issues will generate them, and I refuse to add logic to the main code to facilitate tests. On some platforms I would be in complete agreement with you but Force.com has it's own specific peculiarities.