انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهJNR-022-L02

السكربتات والطلبات المتسلسلة

  • الدرس 2 من 5
  • Junior
في هذا الدرس 4 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

pass data from one response into the next request.

الموضوعات المخطط لها

  • A post-response script runs after a response arrives and can save values to variables.
  • Typical chain: create a product, capture its ID, use {{productId}} in the next requests.
  • The same works for tokens: log in, store the token, send it in Authorization.
  • Add simple tests (status is 201, body has id) so a run shows pass or fail.
  • Run the whole collection in order with the collection runner.
تفاصيل المخطط المبدئي

عرض عملي

javascript
const body = pm.response.json();
pm.environment.set("productId", body.id);
pm.test("created", () => pm.response.to.have.status(201));

اختبر فهمك

How does request 2 get the ID created by request 1?

أظهر الإجابة

Request 1 stores it in a variable.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.