📌 Schema Validation කියන්නේ මොකක්ද?

QA Engineer | Selenium, Playwright, Postman, JMeter | API/UI Testing | Manual & Automation | MERN Stack | ISTQB Trainee | QA Blogger
Schema කියන්නේ basically blueprint එකක් for your data.ඒ කියන්නේ, API එකෙන් එන data එකේ ආකාරය, format එක, මොකක්ද කියලා define කරන එක.API එකක් test කරනකොට, data එක පමණක් නොව, එය data එන structure එකත් බලන්න ඕන. මේකට Schema Validation කියල කියනවා
🔎 උදාහරණයක්
API එකෙන් user profile එකක් එනවා කියලා හිතමු:
{
"id": 101,
"name": "Amila",
"email": "amila@test.com",
"age": 25
}
👉 Schema එක කියනවා:
id→ අංකයක් (number) වෙන්න ඕනේname→ අකුරු (string) වෙන්න ඕනේemail→ email format එකට ගැලපෙන්න ඕනේage→ අංකයක් වෙන්න ඕනේ
🚨 Error එකක් නම්
API එක "age": "twenty-five" දුන්නොත් → Schema එකට ගැලපෙන්නේ නෑ → Test එක fail වෙනවා.මොකද "age": "twenty-five" යනු string එකක් එක Number එකක් වෙන්න ඕනේ කියලා schema එකේ define කරලා තියෙනවා
👉 හිතාගන්න:
Schema Validation = Data check කරන නීතිය ✅


Schema validation වලට ජනප්රිය tools.
- Postman
API test කරන්න ඕනෑම කෙනෙක් බහුලවම භාවිත කරන tool එක postmanමේ tool එකෙන්. JavaScript වලින් test case ලියලා response එක schema එකට ගැලපෙනවාද බලන්න පුළුවන්. උදාහරණයක්: "id" කියන field එක number එකක් ද, "name" කියන field එක string එකක් ද කියලා check කරන්න.
- Swagger (OpenAPI)
Swagger කියන්නේ API එකක් design කරන්නත්, documentation කරන්නත් යොදාගන්න tool එකක් . Swagger එකෙන් API response එක schema එකට ගැලපෙනවද කියලා validate කරන්න පුළුවන්. API structure එක සහ docs හරිහැටි අවබෝධ කරගන්න Swagger document එක භාවීතා කරයි.
If you have any questions or encounter any issues while implementing these test case strategies, feel free to message me. I'm happy to help and offer further guidance to ensure your testing process is as effective as possible.



