简体   繁体   中英

I have a few question about MC/DC and piarwise testing

Recently, I started working on software testing, and I had some questions.

Pairwise testing is the combination of all the values that this parameter can have, and is it also applicable to Boolean Expression?

For example,

boolean expression is (A || B) && C (It is assumed that each parameter has only 0 and 1.)

Here, Is it applicable to Boolean Exp ??

The second question is about MC/DC.

I had learned how to make test case through MC/DC

But, I wondered how MC/DC could prove to cover almost 90% code coverage ?

In (A || B) && C, there are 4 combination test case in my guess.

But, All combination is 8. how could MC/DC reduce cases ?

  1. Is it applicable in Boolean expressions?

Yes. It's applicable to Boolean expressions.

真相表

Getting all possible combinations of your Boolean expression, we can have the truth table above.


  1. How could MC/DC prove to cover almost 90% code coverage?

MC/DC can't assure over 90% code coverage. However, it can assure the decision , branch , and condition coverages, which are integral parts of a piece of code.

But, how could it prove to cover?

The answer will lie in the properties of the MC/DC criterion:

  • Each condition in a Boolean expression should take every possible outcome.
  • Each decision takes every possible outcome.
  • Each condition is shown to independently affect the outcome of the decision.

So each condition's Boolean outcome has been considered (TRUE/FALSE) and the combination of these condition's Boolean outcome (decision) will result in every possible value (TRUE/FALSE).


  1. How could MC/DC reduce cases?

When you identify MC/DC pairs, you will come up with this table:

MC / DC对

Some of these pairs are similar. Why? Because when you evaluate the Boolean expression, you can short-circuit some of the conditions. This means that your expression can have a decision even if at least one of the conditions are not being evaluated.

最终的MC / DC测试案例

This will be the final result. Notice that some of the rows have (-) empty values. This means that it wasn't evaluated, but the decision can be inferred.


Although relevant, but unrelated, I wrote an article here: How MC/DC Can Speedup Unit Test Creation

Hope this helps despite being late. :D

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM