How MC/DC Can Speedup Unit Test Creation

MC/DC is commonly used in avionics software development to guaranty safe flights and prevention of failures.

What is MC/DC?

  • 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.

Basic Definitions and Examples




  • We’re not dealing here with TDD (Test-Driven Development) approach, we’ll assume that the development is top-down. This means that code is already prepared for unit test creation.

The Benefits and How it Works

  1. As mentioned, MC/DC will produce the optimal number of test cases for a certain Boolean expression. The optimal number will be at least n+1 cases; where n is the total number of atomic conditions. Once you know the total number of test cases to generate, then most likely, you can come up with minimal test functions while enjoying the benefits of high code coverage results.
  2. The test cases generated from the evaluation of MC/DC can also provide a high percentage of code coverage. The branch coverage, decision coverage and condition coverage are few of the main items being covered by MC/DC. It ensures that for a specific function, the majority of the logic and lines are being covered. Code reviewer will be happy to review your logic and shy away with your noncompliance to project metrics.
  3. When you already have the MC/DC results, you don’t have to worry too much about missed out conditional scenarios and at the same time, you avoid redundant test cases. Of course, there are certain cases that might require to check for the validity of the logic, then in that case you should consider adding more logical test cases to ensure correctness of logic. Because you already know what scenarios to consider, it saves you and others a great deal of time, wherein you can invest that time into more pressing matters.
  4. You can identify which conditions are not being evaluated. This helps developers identify which part of their codes are unreachable and non-executable. Avoiding costly reworks when moving the product to a higher environment.

The cost of fixing a defect detected during unit testing is minor compared to the cost (effort, time and humilation) of fixing a defect in user acceptance and live environments.






Software Development. Indie Hacker. Startups. Tech.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

A Material Design Framework — Materialize CSS

What’s New at AWS?

Version Control Database Changes With Flyway

The Mighty Switch Statement

Early Praise for Adopting Elixir

Auribises Technologies Internship Week 12

Wordpress og tags Scrtip no need to use third party plugins

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Software Development. Indie Hacker. Startups. Tech.

More from Medium

Functional Testing Types-2

Why Developing Tests Is Needed?

Bug Life Cycle or Defect Life Cycle -Tester

Top 5 test management solutions for Banking

5 test management solutions for Banking