Python में Testing का परिचय
Alexander Levin
Data Scientist
Command-Line Interface (CLI) - ऐसा यूज़र इंटरफ़ेस जिसमें आप टर्मिनल में टेक्स्ट कमांड देकर किसी प्रोग्राम से इंटरैक्ट करते हैं।
CLI से slides.py चलाने का कमांड:
pytest slides.py
Meaning: "कृपया slides.py मॉड्यूल की टेस्ट फ़ाइलों के साथ pytest फ्रेमवर्क चलाएँ"
टेस्ट का आउटपुट:

टेस्ट का आउटपुट:

टेस्ट का आउटपुट:

टेस्ट का आउटपुट:

टेस्ट का आउटपुट:



tests_dir/ में सभी टेस्ट चलाने का कमांड:
pytest tests_dir/
Meaning: "कृपया tests_dir फ़ोल्डर में मिले सभी टेस्ट के साथ pytest फ्रेमवर्क चलाएँ".

tests_ex.py से वे टेस्ट चलाने का कमांड जिनमें "squared" है:
pytest tests_ex.py -k "squared"
Meaning: "कृपया tests_ex.py स्क्रिप्ट के वे सभी टेस्ट चलाएँ जिनमें squared शामिल है".
आउटपुट:

pytest से शुरू होता हैscript_name.py पास करकेdirectory_name/ पास करके-k "keyword_expression" पास करकेPython में Testing का परिचय