How can you make sure your function is coverage enough?

Hi Guys,

This is old question and a lot of interviewer ask us. Please feel free to discuss.


  1. cemueses

    Coverage is a tricky subject. Take this function:

    var results = new function(a, b) {

    return a + b;

    results(10, 11);

    Coverage for this can be as simple as using a couple of negative integers and floating values. Then taking into account how the possible structure of the final result will affect some other function down the road. Is the result something that hurts the value of your application? Not an error, but a result that you wouldn’t want.

    If your function will be isolated the approach to assessing coverage is different than a function that will have heavy integration. Also, coverage has a context that should be taken in consideration.

    The “Enough” factor ultimately will depend on you and the risk level you can afford.

  2. Thanh Huynh

    Hi cemueses,

    Well said. This is the best answer to me.

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2024 AskTester

Theme by Anders NorenUp ↑