17 Ağustos 2022 Çarşamba

DO-178B Decision Coverage Nedir? - Level B

Giriş
Şeklen şöyle
- Yani koddaki her if/else ve türevi için if ve else kısımlarını çalıştıran en az bir tane test olmalı. 
- Her metoda girilmeli ve tüm çıkış noktalarından bir kere çıkılmalı


Özellikle and, or gibi Boolean logic kullanan if ifadelerinin testi için çok önemli bir faaliyet. Açıklaması şöyle. Yani if/else için "statement coverage" ile aynı şey. Ancak "Boolean value assignment" için farklı
So, what is the difference between decision coverage and branch coverage?

Decision coverage and branch coverage are closely-related forms of structural coverage analysis.

Decision coverage is referenced by DO-178B/DO-178C whereas branch coverage is referenced by ISO 26262.

Branch coverage requires every exit from a conditional source code statement to be executed.

Thus, for an if statement, branch coverage requires the then part and the else part to be executed (if there is no else part, the if statement should still execute the decision as true and false).

For decision coverage, the DO-178B/DO-178C definition of decision covers conditional statements, in the same way as branch coverage, but it also includes assignments of Boolean variables, for example:

a := b or (c and d); (Ada)
a = b || (c && d); (C/C++)

In this case, decision coverage would require tests for the above assignment making a both true and false.

Moreover, given the same source code and tests to exercise it, the percentage of coverage reported may be different between branch and decision coverage.

For example, if 3 out of the 4 branches of a switch statement are executed, the branch coverage would be reported as 75%, but for decision coverage, a decision is considered covered only if all its branches are covered, so the coverage of the switch statement would be reported as 0%.
Örnek
Level B için örnek vermek gerekirse
if (A== 0 and B < 2) {
//True
}
else {
//False
}
kod parçası için True ve False koşullarını sağlayan iki test yeterli. A ve B'nin alabileceği kombinasyonlara bakılmaz. İlk koşul için (TT) değerleri ile test etmek yeterli. Else koşulu için (TF), (FT), (FF) girdilerinden birisi kullanılabilir. Eğer FT veya FF seçilirse B'nin etkisi test edilmemiş olur.

Hiç yorum yok:

Yorum Gönder