Skip to main content

MC/DC analizer for Python

Project description

pymcdc

A Python package to analyze and verify MC/DC (Modified Condition/Decision Coverage) criteria.

V 0.1.1 - add option --cover to manually set requeriment as covered/not covered

Installation

pip install pymcdc

🚀 How to Use

python -m pymcdc foo.py

Analyzes the file foo.py and displays the condition combinations that must be satisfied for each decision.

python -m pymcdc --run foo.py

Executes foo.py and shows which MC/DC combinations were covered.

python -m pymcdc --run --append foo.py

Cumulatively runs foo.py and displays the MC/DC combinations covered across multiple runs.

python -m pymcdc --unittest test_foo.py foo.py

Runs foo.py using the test cases defined in test_foo.py.
The --unittest argument can be used multiple times. The --append option is also supported here.

python -m pymcdc --cover +5 5 1 -18 5 3 foo.py

Sets requirement 1 of decision (5,5) as covered and requirement 3 of decision (18,5) as not covered.

🔍 Example

python3 -m pymcdc bissexto.py
Line number: (5, 5)
Decision: a < 1 or a > 9999
Combinations to be covered: 
    | Result.   a < 1    a > 9999   Cover. 
-------------------------------------------
  1 |  False    False     False     False  
  2 |   True    True      False     False  
  3 |   True    False      True     False  

Run time: 0.00070 
python3 -m pymcdc --run bissexto.py
Line number: (5, 5)
Decision: a < 1 or a > 9999
Combinations to be covered: 
    | Result.   a < 1    a > 9999   Cover. 
-------------------------------------------
  1 |  False    False     False      True  
  2 |   True    True      False     False  
  3 |   True    False      True      True 
python3 -m pymcdc --unittest test_bissexto.py bissexto.py
Running tests...
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

Line number: (5, 5)
Decision: a < 1 or a > 9999
Combinations to be covered: 
    | Result.   a < 1    a > 9999   Cover. 
-------------------------------------------
  1 |  False    False     False     False  
  2 |   True    True      False     False  
  3 |   True    False      True      True  

📝 Notes

  1. The number of MC/DC requirements for a decision with n conditions is not always n+1. It can be slightly larger due to limitations in the computation algorithm.
  2. For decisions with more than 15 conditions, the analysis may take a few minutes. This is only done once when using the --append option.

👤 Author

Marcio Delamaro

📄 License

MIT

🤝 Contributions

Feel free to open issues or submit pull requests!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymcdc-0.1.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymcdc-0.1.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file pymcdc-0.1.1.tar.gz.

File metadata

  • Download URL: pymcdc-0.1.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for pymcdc-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ad845716d3fa2d17b31be8824f50364499ddfdc26d2037b8f7088557e21d4c59
MD5 7581df0117828fc06412ea1f940a8e59
BLAKE2b-256 148a3480a140ee27cd66f8ab35ba2805612b12b64a8ecbac4797559fb32af3fc

See more details on using hashes here.

File details

Details for the file pymcdc-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pymcdc-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for pymcdc-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b99211dd789084e533fc417736b2201bce92895d4f8909d7151c6cc38f1cb2df
MD5 8aa63ba6803830b5f67313be67c2612d
BLAKE2b-256 20358dd80025ee170948ff9322196258aeb2435edb16a9ca978ac78b08c36c30

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page