REST Assured
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
write readable HTTP tests.
الموضوعات المخطط لها
- REST Assured uses
given / when / thento send requests and check responses. Verify the current version before recording. - Set the port from
@LocalServerPort. - Check status, headers, and body fields with JSON paths:
body("items.size()", is(2)). extract().path(...)pulls a value for the next step (for example a token or id).- Check body fields that matter, not the whole JSON string.
تفاصيل المخطط المبدئي
عرض عملي
given().port(port).contentType(JSON).body(newOrder)
.when().post("/api/orders")
.then().statusCode(201)
.header("Location", containsString("/api/orders/"))
.body("status", equalTo("NEW"));اختبر فهمك
Why not compare the entire JSON string?
أظهر الإجابة
It breaks on harmless changes such as field order or new fields.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.