6

After seeing this question and asking the OP to improve the question I began to wonder if it is the type of question we want on this site. As it stands, the question is very specific and I'm not sure it'll be helpful for others. I do recognize the potential for generic "how to improve code coverage" tips, though.

What do our APEX gurus think? Is this an appropriate question?

  • Did we ever create this standard "How to improve code coverage" question? I feel like we keep getting these questions and they typically get down-voted and closed, but I feel that if we could at least flag them as duplicates of a question with a good standard answer, it would be more helpful. – martin Apr 25 '17 at 13:34
6

I think we should actively try to steer away from questions like "please do this for me", which sadly are common in the salesforce developer boards. But we should also not be to hard about it, there's a learning curve to anything, including the SE way of doing things.

To me, if questions are specific, as like "how do I deal with this scenario" and if that happens to be about code coverage that is fine. There are some things which are not easy to test and are justified to ask imo. But just dumping your entire code base and expecting the community to sort it out, is a no go.

I think the question referenced is a bit in the grey zone. To me it is a valid question to ask, on how to get the last few %'s of coverage. OP has already done most of the work, but seems to be less skilled in writing clear, easy readable questions with the possible non relevant stuff taken out.

4

My gut and basic feeling is that such questions are not the correct place or type of what we want.

Yes, you can update the question to be of a more general question, but that can really limit the number of questions, and eventually there will be none to ask :-)

Still, many users whom have a lot of experiance can better answer such questions, and with that, give an EUREKA face to the OP.

As for the specific question: It's bad in more ways than I can count, and indeed I would vote to close it for been too localized (if not edited) but my votes don't count - they are final - so I will wait with that.

Reread my answer and can't see a decisive decision: so, yes, I think these types of questions have a place on the site, at least until we build a critical mass of users and q's.

4

It's been too long since the question was asked, and there are still lots of code coverage questions on this site. However, I thought I could give my opinion here.

I find that people who ask for code coverage questions don't really understand what tests are doing for them. Whenever I answer those questions I never tell them how to increase code coverage, but rather how to improve their testing (with the right asserts, etc.). Sometimes, you can even spot an error in their code that good unit testing would highlight immediately, so I try to point that out as well.

Hopefully that can steer them in the right direction.

3

I think the problem is that people come here wanting us to provide the solution for them.

Most of the time, the real question is very different from the question they're asking.

i.e. It should be 'How do I test the values in a map', rather than 'how do I get code coverage for this section'

Ideally, we should be able to determine the cause of the code coverage, and close it as a duplicate with a link to am existing problem that covers it. That way it's clear that this isn't a new problem, but gives them a way to work out what's required. Unfortunately, who's going to go to that level of effort? It's a bit of a LMGTFY.

The trouble is, there are a lot of lazy people that come here (especially those posting for the first time), and they just don't seem to care. You try to coax some answers from them, but they'll either start a new question (sometimes under a new user), or just ignore you.

  • Do find myself agreeing about the lazy questioners as so often the same things are getting asked again and again with little evidence of them even bothering to search for 'how do I create a test class salesforce apex' or similar simple queries that would give them what they are looking for. – Dave Humm Jul 20 '16 at 9:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .