SE Lab
0 0

المرجع السريعCheat sheet

القوانين والجداول والخطوات التي تحتاجها للاختبار في صفحة واحدة.The formulas, templates and steps you need for testing, on one page.

الأبيض أم الأسود؟White or black?

White box = structure
ترى الكود: مسارات، شروط، حلقات. غالبًا المطوّر (اختبار وحدة).You see the code: paths, conditions, loops. Usually the developer (unit testing).
Black box = behaviour
لا ترى الكود: مدخلات ← مخرجات متوقّعة من المتطلبات.No code: inputs → expected outputs from the requirements.

حالة الاختبارTest case

steps + test data + expected
الحد الأدنى لأي حالة اختبار.The minimum of any test case.
# | Summary | Dependency
Pre-condition | Post-condition
Execution steps | Expected output
أعمدة جدول حالات الاختبار.The columns of the test case table.
Requirements · Use cases · Design docs
مصادر كتابة حالات الاختبار.Where test cases come from.
R2 → TC2, TC3, TC4
جدول التتبّع: كل متطلب له اختبار على الأقل.Traceability: every requirement has at least one test.

مخطط التدفق (CFG)Flow graph (CFG)

a(); b(); c();  →  (1)
تعليمات متتالية = عقدة واحدة.Consecutive statements = one node.
if (x) … else …  →  1 ─T→ 2, 1 ─F→ 3
القرار له سهمان T و F.A decision has a T edge and an F edge.
while (x) …  →  2 ─T→ 3 → 2
الحلقة: سهم يرجع للشرط.A loop: an edge back to the condition.
if (a && b)  →  2 nodes
الشرط المركّب: كل جزء عقدة مستقلّة.Compound condition: each part is its own node.
switch: k exits  →  k − 1 decisions
switch بـ k مخارج يُحسب k − 1 قرار.A switch with k exits counts as k − 1 decisions.

التعقيد الدوريCyclomatic complexity

V(G) = regions
المناطق المغلقة + المنطقة الخارجية.Closed regions + the outer region.
V(G) = P + 1
عقد القرار + 1.Decision nodes + 1.
V(G) = E - N + 2
الأسهم − العقد + 2.Edges − nodes + 2.
V(G) = 6  →  ≤ 6 basis paths
حدّ أعلى لعدد المسارات المستقلّة وحالات الاختبار.An upper bound on basis paths and test cases.

اختبار المسار الأساسيBasis path testing

1. Draw the CFG
2. Compute V(G)
3. Find the basis paths
4. One test case per path
الخطوات الأربع من محاضرات المقرّر.The four steps from the course slides.
1-2-3-4-5-2-6
المسار المستقل يضيف سهمًا جديدًا واحدًا على الأقل.An independent path adds at least one new edge.
statement ⊂ branch ⊂ path
تغطية التعليمات أضعف من الفروع، والفروع أضعف من المسارات.Statement coverage is weaker than branch, and branch weaker than path.

تقنيات الصندوق الأسودBlack box techniques

age 13–120  →  { 8, 25, 150 }
اختياري · Optional تقسيم التكافؤ: قيمة واحدة لكل فئة.Equivalence partitioning: one value per class.
qty 1–10  →  { 0, 1, 10, 11 }
اختياري · Optional القيم الحدّية: min−1، min، max، max+1.Boundary values: min−1, min, max, max+1.
>  vs  >=
اختياري · Optional أشهر خطأ حدّي، يكشفه اختبار القيمة على الحدّ تمامًا.The classic boundary bug, caught by testing exactly on the edge.
هندسة البرمجيات · السنة الرابعة — تقدّمك محفوظ في هذا المتصفح فقط.Software Engineering · 4th year — your progress is saved in this browser only.