ਯੂਨਿਟ ਟੈਸਟਿੰਗ ਕੋਡ ਦੀਆਂ ਵਿਅਕਤੀਗਤ ਯੂਨਿਟਾਂ (functions, methods, classes) ਨੂੰ ਵੱਖ ਅਲੱਗ ਰੂਪ ਵਿੱਚ ਪ੍ਰਮਾਣਿਤ ਕਰਦੀ ਹੈ — ਜਾਂਚ ਕਰਦੀ ਹੈ ਕਿ ਹਰੇਕ ਛੋਟਾ ਟੁਕੜਾ ਆਪਣੇ ਆਪ ਨੂੰ ਸਹੀ ਢੰਗ ਨਾਲ ਕੰਮ ਕਰਦਾ ਹੈ। ਯੂਨਿਟ ਟੈਸਟ ਤੇਜ਼, ਫੋਕਸਡ ਹਨ, ਅਤੇ ਇੱਕ ਚੰਗੀ ਟੈਸਟਿੰਗ ਸਟ੍ਰੈਟੇਜੀ ਦੀ ਬਨਿਆਦ ਬਣਾਉਂਦੇ ਹਨ।
ਯੂਨਿਟ ਟੈਸਟ ਕੀ ਹੈ
A UNIT test verifies the smallest testable piece (a function/method) in ISOLATION:
→ test ONE thing; give inputs, check the output/behavior
→ ISOLATED from dependencies (database, network, other units) — mock/stub those
→ FAST (no real I/O), focused, deterministic
