QA Tutorials

STATEMENT COVERAGE TESTING

WHITE BOX TESTING

There are two major types of White box testing techniques: Statement coverage testing and branch coverage testing.

STATEMENT COVERAGE TESTING:

Statement coverage type of white box software testing technique. It is called line or segment coverage testing. This testing is done to the code written to test whether the code written is qualitative or whether it does what it is expected to be done. It is checked in true conditions it is verified for every line of statements. Consider an example:

Example 1:

Read A
Read B
If A > B then
x = 0
End if

To achieve 100% statement coverage we need to check only one test case here. We ensure that A value is greater than B for input values like A=14 and B=11. Here we check the structural design first as we are choosing input values to make certain the statement of coverage. The main disadvantage of this technique is here we cannot check the false condition of statements.

Example 2:

To check if number is greater than 50

Read A
If A > 50 then
print “A is greater than 50”
End if

In statement coverage testing, to achieve 100% statement coverage we check with value of A greater than 50.

In statement coverage testing, 100% statement coverage is said to be achieved if all the statements are tested at least once. This type of testing is usually performed by the developers using development tools.
Check your understanding:

What is difference between statement coverage and decision coverage
Which one is better? statement coverage or decision coverage? Why?

Facebook Comments
Tags

Related Articles

46 thoughts on “STATEMENT COVERAGE TESTING”

  1. Ans.: The difference between statement coverage & decision coverage:
    • Statement coverage is called line or segment coverage testing BUT Decision testing is called branch testing.
    • Statement testing is done to the code written to test whether the code written is qualitative or whether it does what it is expected to be done. It is checked in true conditions it is verified for every line of statements BUT the decision testing is a process which checks the behavior of the application by providing different combinations of input and obtains various result
    Ans.: Decision coverage is better than statement coverage because we can check both TRUE & FALSE condition of statement in decision coverage whereas we cannot check the FALSE condition of statement in statement coverage.

  2. 1.The difference between statement coverage and decision coverage:
    * Statement coverage :This testing is done to the code written to test whether the code written is qualitative or whether it does what it is expected to be done.
    *The main disadvantage of this technique is here we cannot check the false condition of statements.
    *Decision coverage : The decision testing is a process which checks the behaviour of the application by providing different combinations of input and obtains various results.
    *In this technique we can check both pass and false condition of statements.
    2.Decision Testing is better then statement coverage testing because in this technique we can check both pass and false condition of statements.

  3. Statement coverage testing is done to the code written to test whether the code written is qualitative or whether it does what it is expected to be done. It is checked in true conditions.it is checked in the true conditions only.
    The decision testing is a process which checks the behavior of the application by providing different combinations of input and obtains various results. It is also called as Branch Testing where the different types of inputs are supplied to check a particular condition
    Decision testing is stronger /better since it checks both false /true condition.

  4. The difference between statement coverage and decision coverage is that statement coverage tests 100% statement coverage at once. whereas, in decision coverage testing, all decisions and outputs are tested in true and false statement.
    Decision coverage testing is better as its tests true and false statement.

  5. Statement coverage testing: Here we check the structural design first as we choose input values to make certain statement of coverage. We check in true conditions & verify for every line of statement. We cannot check the false condition of statements.
    Decision coverage testing: Various decisions and conditions in the codes are tested. Here, we test all the possible outcomes to 100 per decision coverage. Test cases should be written to cover both true and false conditions.
    Decision coverage testing is better because it tests both the true and false conditions and tests all the possible outcomes to achieve the 100 per decision coverage.

  6. Statement coverage testing is a white box type of testing. The testing only covers the TRUE value of the requirements just like in the example if A > 10 True. It does not care what if its less than 10.
    Decision testing is more complex and more practical in a way. It tests all the possible inputs/outcomes of the requirements or conditions.
    Decision testing is better than the statement because it covers all possibilities of TRUE and False conditions.

  7. Statement coverage type of white box software testing technique. It is called line or segment coverage testing. This testing is done to the code written to test whether the code written is qualitative or whether it does what it is expected to be done.In statement coverage testing, 100% statement coverage is said to be achieved if all the statements are tested at least once. This type of testing is usually performed by the developers using development tools.
    The decision testing is a process which checks the behavior of the application by providing different combinations of input and obtains various results. It is also called as Branch Testing where the different types of inputs are supplied to check a particular condition.
    In the above two coverage decision coverage is better because here there is a possibility to know the true and false statements..

  8. Statement coverage testing is testing the statements in the code whether it is written as it should that means it tests the structure of the code. It finds errors such as logical errors, missing statements etc. 100% statement coverage is achieved only when all statements at tested at least once.
    Decision coverage testing is taking possible inputs and then testing various conditions such as true or false.
    Decision coverage is better than statement coverage testing as it covers both true and false conditions unlike statement coverage testing which covers only true conditions.

  9. Difference between Statement coverage & Decision coverage:
    In statement coverage testing tests only true conditions while decision coverage testing tests both true and false conditions.
    Decision coverage is better than statement coverage testing because decision coverage checks both true and false conditions of software. This method assures with false input software is not behaving abnormally.

  10. 1. Statement Coverage tests only for the true conditions whereas Decision Coverage tests for true and false conditions.
    2. Decision coverage is better than Statement coverage because all conditions are not tested in Statement coverage.

  11. Both Statement Coverage and Decision coverage Testing are White Box Testing, done by Developers. The difference between Statement and Decision testing is
    In Statement testing we can only test the true conditions whereas in decision testing we can test both, true and false conditions.

    The decision testing is better as it checks both the true and false conditions, checking the behaviour of the application by providing different combinations of input and obtains various results.

  12. In statement coverage it tests the true conditions of the code written
    In decision testing it tests all the conditions true, false with all possible sets of input combinations.
    This has 100% test coverage. Hence decision testing is preferred.

  13. Decision coverage testing and statement coverage testing are both part of white box testing techniques.
    Statement coverage is also called segment coverage or line coverage testing and it only test the true conditions and these test are done by developers but decision coverage tests are both true and false tests .It includes both the scenarios in different possibilities.
    If the statement is true what is the out come and if the statement is wrong what is the outcome.

  14. Statement Coverage Testing:It is type of white box testing.It is called line or segment testing coverage testing.It is done to the code written to test whether the code written qualitative or whether it does what it is expected to be done.
    Decision Testing:It is also called branch testing.It is also a type of white box testing.It is a process which checks the behavior of the application by providing different combination of input and obtain various result.
    Decision testing is better from both as it checks the process whether the result is true or false.

  15. In statement coverage testing, 100% statement coverage is said to be achieved if all the statements are tested at least once. Meaning only the specified condition is tested once fulfilling the 100% statement coverage for the test case.
    Whereas 100% decision coverage can be achieved when all the possible paths between start to end are covered. Meaning all “True or False” possible outcomes are tested to verify the behavior of the software.

  16. What is difference between statement coverage and decision coverage
    Which one is better? statement coverage or decision coverage? Why
    Statement Coverage is said to make sure that every statement in the code is executed at least once.
    Decision /branch Coverage is said to test that each branch/ output of a decisions is tested i.e. all statements in both false / true branches will be executed.
    Decision coverage may be better than statement coverage because we can check both TRUE & FALSE condition.

  17. • The statement coverage testing tests only one test case. It tests only the true values.
    • The decision coverage testing tests from start to end of all test cases. It tests both the true and false values of inputs.
    • The decision coverage testing is better than the statement coverage, since it tests all test cases.

  18. In Statement testing the application is tested only with true scenario
    where as in decision testing the application is tested with both true and false scenarios.
    I feel decision testing is better because both true and false scenarios are executed.

  19. The difference between statement coverage and decision coverage is :
    Testing coverage is a segment coverage and deicsion coverage is a branch testing. Statement coverage is done to check if the code written is qualified. on the other hand the decision coverage is a process which check the behavior of the appplicatio by providing differents combinations of inputs and different results.
    In decision testing we can check the true and false stetament. That makes it better coverage.

  20. 1.What is difference between statement coverage and Decision coverage.
    The Statement coverage and decision coverage testing are two major types of White box testing.
    Difference between Statement coverage and Decision coverage are:

    • statement coverage testing also called line or segment coverage testing.
    • This testing is done to the code written to test whether the code written is qualitative or whether it does what it is expected to be done.
    • It only check the true conditions it is verified for every line of statements.
    • To achieve 100% statement coverage we need to check only TRUE conditions in a flow chart

    • The decision testing checks the behaviour of the application by providing different combinations of input and obtains various results.
    • also called as Branch Testing .
    • the different types of inputs are supplied to check a particular condition.
    • 100% decision coverage can be achieved when all the possible paths between start to end are covered.
    2.Which one is better? statement coverage or decision coverage? Why?
    The Decision Testing can be considered as better since it cover both the TRUE&FALSE scenarios in the flow chart diagram

  21. Statement coverage: every statement in the code is executed at least once. We check only for true statement and not false statement.
    Decision coverage: test each branch/output of a decisions is tested. All statements in both false/true branches will be executed.
    The decision coverage cover all the areas where statement coverage did not cover.

  22. 1.What is difference between statement coverage and Decision coverage.
    The Statement coverage and decision coverage testing are two major types of White box testing.
    Difference between Statement coverage and Decision coverage are:

    • statement coverage testing also called line or segment coverage testing.
    • This testing is done to the code written to test whether the code written is qualitative or whether it does what it is expected to be done.
    • It only check the true conditions it is verified for every line of statements.
    • To achieve 100% statement coverage we need to check only TRUE conditions in a flow chart

    • The decision testing checks the behaviour of the application by providing different combinations of input and obtains various results.
    • also called as Branch Testing .
    • the different types of inputs are supplied to check a particular condition.
    • 100% decision coverage can be achieved when all the possible paths between start to end are covered.
    2.Which one is better? statement coverage or decision coverage? Why?
    The Decision Testing can be considered as better since it cover both the TRUE&FALSE scenarios in the flow chart diagram

  23. What is difference between statement coverage and decision coverage
    Which one is better? statement coverage or decision coverage? Why?
    All statements are tested when executing the code in statement coverage or line coverage testing. This type of testing checks for logical errors, inconsistencies in code, dead code issues , memory leaks etc. In statement coverage 100% coverage can be achieved when all the lines in the statement are tested or covered.
    In decision or branch or condition testing, all the decisions and conditions are tested. Here 100% decision coverage can be achieved only when all possible paths
    ( true and false conditions) are covered from start to the end.
    Decision coverage testing is better because it tests both the true and false conditions where as in statement coverage testing only the true condition is verified. It doesn’t check the false conditions.

  24. In statement coverage every statement in the code is executed at least once.
    In decision or branch coverage ,here both false/true branches will be executed at least once.
    Decision coverage is stronger than statement coverage and it requires more test case to achieve 100% decision coverage
    100%. decision coverage guarantees 100% statement coverage but 100% statement coverage does not guarantee 100% decision coverage.

  25. 1)A difference between statement and decision coverage.:
    • statement coverage testing also called line or segment coverage testing.
    • This testing is done to the code written to test whether the code written is qualitative or whether it does what it is expected to be done.
    • It only check the true conditions it is verified for every line of statements.
    • To achieve 100% statement coverage we need to check only TRUE conditions in a flow chart

    • The decision testing checks the behaviour of the application by providing different combinations of input and obtains various results.
    • also called as Branch Testing .
    • the different types of inputs are supplied to check a particular condition.
    • 100% decision coverage can be achieved when all the possible paths between start to end are covered.

    2)Decision coverage is better because it test both true and false condition. Statement coverage testing test only true condition.

  26. STATEMENT TESTING is only one testing case tested. DECISION COVERAGE TESTING will do all the steps tested and it tests the truth and false conditions .
    to avoid more defects in the software decision coverage is better

  27. Decision Testing checks the behavior of the application by providing different combinations of input and obtaining various results. With different types of input, 100% descsion coverage can be achieved when all the possible paths between start to end are covered. Statement testing tests the True condition paths for every line of statements. The False conditions of statements is not checked/tested.
    Decision Testing is the better method of testing because it tests more of the systems’s functionality and process. Through Decision Testing, more errors/issues will be discovered.

  28. Statement coverage testing test only one case at a time by focusing on the true values while the decision coverage testing test every case by providing different combinations of input to obtain various results.
    By comparing both statement coverage and decision coverage testing, I can say that, the decision coverage testing is better because it combines both true and false condition at a single case while statement coverage use only the true condition value. Therefore, decision coverage testing provides more accuracy and efficiency than the statement coverage testing.

  29. Statement coverage is type of white box software testing technique. It is called line or segment coverage testing.
    In statement coverage testing tests only true conditions while decision coverage testing tests both true and false conditions.
    Decision testing is also called branch testing. It is test design technique for white box testing.
    The decision coverage testing tests from start to end of all test cases.
    The decision testing is better as it checks both the true and false conditions,

  30. Statement coverage testing is a white box technique and also called as segment coverage testing. It is limited on testing the true condition of the statements.
    Whereas, decision coverage testing also known as Branch Testing checks the behaviour of the application by providing different combinations of input and obtains various results. It is where the different types of inputs are supplied to check a particular condition. Branch testing checks true and false statements so branch testing is better than statement coverage testing.

  31. Both Statement Coverage and Decision coverage Testing are White Box Testing, done by Developers.
    The statement coverage testing tests only one test case. It tests only the true values.
    The decision coverage testing tests from start to end of all test cases. It tests both the true and false values of inputs.
    The decision coverage testing is better than the statement coverage, since it tests all test cases.

  32. Statement coverage is said to make sure that every statement in the code is executed at least once. This type of testing does not ensure coverage of all the functionality.
    Decision/branch coverage is said to test that each branch/output of a decisions is tested, i.e. all statements in both false/true branches will be executed. In Statement coverage we need to execute all statements so I guess it can be only done by running all possible ways.
    In the branch coverage we need to cover all the edges, which we missed in the statement coverage .
    The decision testing is better than the Statement coverage, as it checks both the true and false conditions, checking the behavior of the application by providing different combinations of input and obtains various results and covers all the edges to ensure the perfection.

  33. STATEMENT COVERAGE TESTING

    Statement coverage VS decision coverage

    Decision testing is usually done by the developer to check the behavior of application. – This test done with different possibilities that way they obtain various results.

    Statement coverage – only need to check on test case.

    I think decision testing is better, because more possibilities are tested in which will get a better result in developing a software.

  34. What is difference between statement coverage and decision coverage
    A difference between statement and decision coverage. Statement coverage is said to make sure that every statement in the code is executed at least once. Decision/branch coverage is said to test that each branch/output of a decisions is tested, i.e. all statements in both false/true branches will be executed.
    Which one is better? statement coverage or decision coverage? Why?
    The Decision coverage can be considered as better since it cover both the TRUE&FALSE scenarios in the flow chart diagram.

  35. What is difference between statement coverage and decision coverage
    Which one is better? statement coverage or decision coverage? Why?

    Statement coverage and Decision coverage are 2 types of white box testing. In statement coverage testing is done to ensure that every statement to the code written to test whether the code written is qualitative or whether it does what it is expected to be done. It is checked in true conditions it is verified for every line of statements.
    Branch testing on the other hand is different from statement testing in the sense that decision coverage testing tests from start to end of all test cases. It tests both the true and false values of inputs.

    Branch testing tests the true or false values of inputs and hence is better that statement testing.

  36. 1.Statement coverage type of white box software testing technique. It is called line or segment coverage testing. This testing is done to the code written to test whether the code written is qualitative or whether it does what it is expected to be done. It is checked in true conditions it is verified for every line of statements.

    The decision testing is a process which checks the behavior of the application by providing different combinations of input and obtains various results. It is also called as Branch Testing where the different types of inputs are supplied to check a particular condition.

    2. Decision testing is better as we check both true and false conditions in contrast to the statement coverage where we check only the true conditions.

  37. Since statement/ Line segment coverage testing is limited for the true values whereas decision/branch coverage testing is done for the both true or false values which gives more accuracy of the testing compare to statement coverage testing. In this regard decision coverage testing is better than statement coverage testing and both are types of white box testing and done by the developers

  38. 1. Statement coverage testing is done to the code written to test whether the code written is qualitative or whether it does what is expected to be done.
    Decision testing is a process which checks the behaviour of the application by providing different combinations of input and obtains various results. It is also called branch testing.

    2. Decision testing is better as we check with true and false conditions. Also this testing covers all the possible paths from start to end. Whereas statement coverage can check only one test case.

  39. The decision testing is a process which checks the behaviour of the application by providing different combinations of
    input and obtains various results, where decision coverage check in check the both valve true and false
    Statement coverage testing is checking the true values only ( it checks only one test case)

  40. Statement Coverage involves in the execution of all the executable statements in the source code at least once.
    Decision Coverage reports the true or false outcomes of each Boolean expression. In this coverage, expressions can sometimes get complicated. Therefore, it is hard to achieve 100% coverage.
    Statement Coverage is better than Decision Coverage

  41. What is difference between statement coverage and decision coverage:
    Statement coverage is said to make sure that every statement in the code is executed at least once.
    Decision/branch coverage is said to test that each branch/output of a decisions is tested, i.e. all statements in both false/true branches will be executed
    Which one is better? statement coverage or decision coverage? Why?
    Decision testing is stronger /better since it checks both false /true condition.

  42. Statement coverage is said to make sure that every statement in the code is executed at least once.
    Decision/branch coverage is said to test that each branch/output of a decisions is tested, i.e. all statements in both false/true branches will be executed.
    The Statement Coverage is a type of White-Box Testing technique, involving execution of all statements at least once. Statement coverage is a simple metric to calculate & measure the number of statements in a method or class which have been executed. Its key benefit is its ability to identify which blocks of code have not been executed.

    The Branch Coverage is an outcome of a decision, and measures the number of decision outcomes or branches, which have been tested. This takes a more in-depth view of the source code rather than a simple Statement Coverage. A branch is an outcome of a decision. For example Boolean decisions like an “If – Statement”, has two outcomes or branches (i.e. True and False).
    According to me, Decision coverage is better because it can test both true and false conditions and It also eliminate problems that occur with statement coverage testing.

  43. What is difference between statement coverage and decision coverage?
    The Statement coverage and decision coverage testing are two major types of White box testing.
    Differences:
    1.Statement coverage testing is aka line or segment coverage testing. Whereas, Decision coverage testing is aka Branch testing.
    2.Statement Coverage testing finds out whether the code written is qualitative or whether it does what it is expected to be done. This type of testing checks for logical errors, inconsistencies in code, dead code issues, memory leaks etc. Whereas, Decision Coverage Testing checks the behavior of the application by providing different combinations of input and obtains various results.
    3.In statement coverage testing, we cannot check the false condition of statements. However, in decision coverage testing technique we can check both true and false condition of statements.
    4.To achieve 100% statement coverage, we need to check only TRUE conditions in a flow chart. Whereas, 100% decision coverage can be achieved when all the possible paths between start to end are covered.

    Which one is better? statement coverage or decision coverage? Why?
    Decision coverage is better than statement coverage testing as it covers both true and false conditions unlike statement coverage testing which covers only true conditions!

  44. Statement coverage: Here every statement of the code is executed at least once. It covers only the true condition.
    Branch coverage: Here all the statements in both false/true branches will be executed. It tests each branch/output of decisions.
    Branch coverage is better because it tests both false and true conditions.

  45. Statement Coverage and Branch coverage are types of White Box Testing.
    STATEMENT coverage: Checks whether the code written is qualitative or if it does what is should do.
    It only tests for the true condititon, it cannot test for the false condition.

    Branch coverage: Tests code for both the true and false conditions .

    Branch coverage is the better one as it can test the behavior of application 100%. All the possible input data can be tested for.

Leave a Reply

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

Check Also

Close
Close