Theory
શું project ખરેખર work કરે છે?
તમે system build કરી છે. પરંતુ શું તે ખરેખર correctly, reliably અને usersની જરૂર મુજબ કામ કરે છે? આ જાણવા માટે testing કરાય છે. સારી testing projectને impressive બનાવે છે, જ્યારે testing વગર demo વખતે problems બહાર આવી શકે છે.
Testing 3 levels પર થાય છે: સૌથી નાના piecesથી શરૂ કરીને users સાથે આખી system સુધી: unit testing, integration testing અને user acceptance testing (UAT). દરેક level અલગ પ્રકારની problem શોધે છે. આ lessonમાં ત્રણેય levels શીખશો જેથી evaluators અથવા users શોધે તે પહેલાં bugs શોધી શકો.
At a glance
| Level | Tests what | Question it answers |
|---|---|---|
| Unit testing | Functions, methods અને components જેવા નાના pieces isolationમાં | દરેક individual part correctly કામ કરે છે? |
| Integration testing | Connected parts સાથે કામ કરે છે, જેમ કે front end + back end અને back end + database | Parts સાથે મળીને કામ કરે છે? |
| User acceptance testing (UAT) | Usersની real needs સામે આખી system | System ખરેખર userને જોઈતું કામ કરે છે? |
Theory
નાના piecesથી આખી system સુધી
Testing levels smallથી large તરફ build થાય છે.
Unit testing નાના pieces, એટલે કે individual functions, methods અથવા components, એમને isolationમાં check કરે છે. દરેક piece પોતાનું job correctly કરે છે કે નહીં તે તપાસાય છે. Single pieceમાં bug હોય તો તે શરૂઆતમાં જ મળી જાય છે.
Integration testing connected parts સાથે કામ કરે છે કે નહીં તે check કરે છે: front end અને back end, back end અને database અથવા interacting modules. અગાઉની integration lesson પ્રમાણે mismatched formats અને authentication જેવી connection problems અહીં બહાર આવે છે.
User acceptance testing (UAT) usersની real needs સામે whole system check કરે છે. Requirements પ્રમાણે system userને ખરેખર જે જોઈએ છે તે આપે છે કે નહીં? તે ઘણીવાર real users અથવા stakeholders સાથે થાય છે. UATનો પ્રશ્ન માત્ર 'system ચાલે છે?' નહીં, પરંતુ 'આ system તે લોકો માટે useful છે જેમના માટે બનાવવામાં આવી છે?' છે.
Quiz
Individual functions અથવા components isolationમાં correctly કામ કરે છે કે નહીં તે કઈ testing level check કરે છે?
- User acceptance testing, કારણ કે તેમાં users સામેલ હોય છે
- Unit testing, જે functions, methods અને components જેવા નાના pieces individually check કરે છે
- Integration testing, કારણ કે તે parts connect કરે છે
- આ testing નથી
Show the answer
Unit testing, જે functions, methods અને components જેવા નાના pieces individually check કરે છે
Individual functions અથવા componentsને isolationમાં test કરવું unit testing છે. તે systemના સૌથી નાના piecesને target કરે છે. User acceptance testing whole systemને usersની real needs સામે check કરે છે, individual functionને નહીં. Integration testing connected parts સાથે મળીને કામ કરે છે કે નહીં તે તપાસે છે, isolationમાં રહેલા pieceને નહીં. Levels યાદ રાખો: unit = individual pieces, integration = connected parts, UAT = whole system અને users.
Think first
માત્ર અંતે whole system check કરવાને બદલે multiple levels પર testing કેમ?
UAT આખી system check કરે છે, તો unit અને integration testing શા માટે કરવી? પછી tap.
Show the answer
કારણ કે અંતે માત્ર whole system test કરવાથી 'કંઈક broken છે' એટલું ખબર પડે છે, પરંતુ WHERE broken છે તે ખબર પડતી નથી. Multiple levels પર testing problemsને sourceની નજીક અને વહેલી stageમાં શોધે છે, તેથી fix કરવી સરળ અને સસ્તી રહે છે.
Unit testing દરેક નાના pieceને independently check કરે છે. Function ખોટી હોય તો તરત કઈ function fix કરવી તે ખબર પડે છે. Integration testing connected partsની વચ્ચેના mismatched assumptions શોધે છે. તે fail થાય તો problem ખાસ connectionમાં છે કે આખી applicationમાં, તે narrow થઈ જાય છે. UAT પછી અલગ પ્રશ્ન પૂછે છે: complete system usersની real needs પૂરી કરે છે કે નહીં?
Unit અને integration skip કરીને અંતે whole system test કરશો તો large interconnected systemમાં bug ક્યાં છે તે શોધવું ખૂબ મુશ્કેલ બનશે. તે single function, bad connection અથવા requirementsની misunderstanding હોઈ શકે છે. Bugs late મળવાથી fix કરવા time ઓછો રહે છે.
આ layered approach bricks, walls અને આખા houseની inspection જેવી છે: નાના scope પર problem શોધશો તો fix સસ્તી અને સરળ છે. Whole-system test વખતે મોટાભાગના low-level faults પહેલેથી દૂર થયેલા હોય છે, તેથી UAT user value પર focus કરી શકે છે. ત્રણેય levels redundant નથી; દરેક એવી problem શોધે છે જે બીજું level કદાચ ન શોધી શકે. Small, connected, whole: આ ક્રમમાં test કરો.
Summary
Key takeaways
- Testing project works અને requirements meet કરે છે કે નહીં તે verify કરે છે.
- Unit testing functions, methods અને components જેવા નાના piecesને isolationમાં check કરે છે.
- Integration testing front end + back end, back end + database અને modules જેવા connected partsને check કરે છે.
- User acceptance testing (UAT) usersની real needs સામે આખી system test કરે છે.
- Testing levels build થાય છે: unit = pieces, integration = parts together, UAT = whole system and users.
- Multiple levels પર testing sourceની નજીક bugs વહેલા અને ઓછા ખર્ચે શોધે છે.
- Memory hook: unit pieces test કરે છે, integration connections test કરે છે અને UAT users માટે whole system test કરે છે.