الاختبار والصيانة
| English | العربية |
|---|---|
| run-time error/rʌn taɪm ˈerə/ | خطأ وقت التشغيل |
| syntax error/ˈsɪntæks ˈerə/ | خطأ صياغة |
| logic error/ˈlɒdʒɪk ˈerə/ | خطأ منطق |
| dry run/draɪ rʌn/ | التشغيل الجاف |
| walkthrough/ˈwɔːkθruː/ | المراجعة المرافقة |
| white-box testing/waɪt bɒks ˈtestɪŋ/ | اختبار الصندوق الأبيض |
| black-box testing/blæk bɒks ˈtestɪŋ/ | اختبار الصندوق الأسود |
| integration testing/ˌɪntɪˈɡreɪʃn ˈtestɪŋ/ | اختبار التكامل |
| stub/stʌb/ | ثقب |
| alpha testing/ˈælfə ˈtestɪŋ/ | اختبار ألفا |
| beta testing/ˈbiːtə ˈtestɪŋ/ | اختبار بيتا |
| acceptance testing/əkˈseptəns ˈtestɪŋ/ | اختبار القبول |
| test strategy/test ˈstrætədʒi/ | استراتيجية الاختبار |
| test plan/test plæn/ | خطة الاختبار |
| normal data/ˈnɔːml ˈdeɪtə/ | بيانات عادية |
| abnormal data/əbˈnɔːml ˈdeɪtə/ | بيانات غير عادية |
| extreme data/ekˈstriːm ˈdeɪtə/ | بيانات متطرفة |
| boundary data/ˈbaʊndəri ˈdeɪtə/ | بيانات حدودية |
| corrective maintenance/kəˈrektɪv ˈmeɪntənəns/ | الصيانة التصحيحية |
| adaptive maintenance/əˈdæptɪv ˈmeɪntənəns/ | الصيانة التكيفية |
| perfective maintenance/pəˈfektɪv ˈmeɪntənəns/ | الصيانة المثالية |
| regression testing/rɪˈɡreʃn ˈtestɪŋ/ | اختبار الانحدار |
Thirty-seven seconds
- On 4 June 1996 the first Ariane 5 rocket lifted off from French Guiana. Thirty-seven seconds later it veered off course and destroyed itself. The payload was four satellites worth $370 million.
- The cause was one line of code, reused from Ariane 4, that converted a 64-bit number into a 16-bit integer. Ariane 5 flew faster, the number was bigger, and the conversion overflowed: a run-time error 运行时错误 in a routine that was not even needed after lift-off.
- The code had never been tested with Ariane 5's flight data. Nobody had chosen test data at the extremes of the new rocket's range.
- This lesson is the three kinds of error, the methods of testing, how to choose test data, and how a program is kept alive after release.
Three kinds of error
- A syntax error 语法错误 breaks the grammar of the language: a missing bracket, a misspelled keyword. It is found at translation, so the program will not run until it is fixed.
- A run-time error happens while the program runs: division by zero, a file that does not exist, an array index out of range. The program crashes or raises an exception; the fix is a check before the risky operation.
- A logic error 逻辑错误 lets the program run and produce wrong results:
+for-, an off-by-one loop, conditions in the wrong order. Nothing flags it; only testing and tracing reveal it.

Found at translation, found at run time, found only in the output
صوّغ كل نوع من الأخطاء بكيفية ظهورها.
الخطأ النحوي = يُكتشف عند الترجمة؛ المنطقي = مخرجات خاطئة؛ وقت التشغيل = انهيار أثناء التشغيل.
Worked example: find and correct the errors
Total ← 0
FOR i ← 1 TO Count
Total ← Total + Marks[i]
NEXT i
Average ← Total / Count
IF Average > 50 THEN
OUTPUT "Pass"
- Syntax: the
IFhas noENDIF. The translator rejects it. Run-time: ifCountis 0 the division fails; guard it withIF Count > 0 THEN. Logic: if a pass is 50 or more,> 50fails a student on exactly 50; it should be>= 50. - Name the type, say why it is that type, and give the correction. Three parts, three marks.
يقسم برنامج ما المجموع الكلي على عدد المدخلات وينهار عندما يكون ملف الإدخال فارغاً. هذا يمثل:
تحدث القسمة على صفر أثناء تشغيل البرنامج ويتوقف عن العمل. يمكن إصلاح ذلك باستخدام شرط مثل IF Count > 0.
Testing methods: reading the code
- A dry run 手工跟踪 traces the code on paper, writing each variable's value in a trace table after each line.
- A walkthrough 走查 is a team review: the programmer explains the code line by line while colleagues look for faults.
- White-box testing 白盒测试 designs tests from the code's internal structure, so that every statement, branch and loop is exercised. Black-box testing 黑盒测试 designs tests from the specification only: feed inputs, compare the outputs with what was expected, without looking at the code.

Outside looking in, or inside looking at every path
تصميم حالات الاختبار بناءً على المواصفات فقط (الإدخالات والمخرجات المتوقعة)، مع تجاهل الكود الداخلي، يسمى اختبار ______-box.
اختبارات الصندوق الأسود من المواصفات؛ استخدام الصندوق الأبيض يعتمد على البنية الداخلية للكود لتغطية العبارات والفروع.
Testing methods: assembling and releasing
- Integration testing 集成测试 combines modules that were tested separately and tests the interfaces between them. A stub 桩 stands in for a module that is not yet written, returning fixed values so the rest can be tested top-down.
- Alpha testing α测试 is done in-house by the developers before release. Beta testing β测试 gives a limited group of real users the program in their own environment.
- Acceptance testing 验收测试 is done by the customer, against the requirements, to decide whether the product is fit for purpose.
معمل عملية البرمجيات
صنّف أمثلة التطوير حسب المرحلة أو الأداة التي تنتمي إليها.
Worked example: which method for which situation
- The reporting module is finished but the database module it calls does not exist yet: test it with a stub that returns fixed data.
- Two modules pass their own tests but fail when the output of one feeds the other: integration testing of the interface.
- The software is complete; the company wants faults found in real conditions before general release: beta testing by a limited group of users.
- The customer decides whether to pay: acceptance testing against the agreed requirements. Name the method and what it is for.
طابق كل موقف مع طريقة الاختبار المناسبة له.
وهمية للجزء المفقود، اختبار بيتا للمستخدمين الحقيقيين، اختبار القبول للعميل، اختبار التكامل للروابط.
Test strategy and test plan
- A test strategy 测试策略 is the high-level approach: which kinds of testing will be done, by whom, when, and what must pass before the next stage.
- A test plan 测试计划 is the detailed list of tests. For each: the purpose, the input data, the expected output, and a column for the actual output when the test is run.
- A test without an expected result is not a test. It only shows what the program did, not whether that was right.
يحتوي خطة الاختبار، لكل اختبار، على بيانات الإدخال والمخرجات المتوقعة.
الهدف، الإدخال، المخرجات المتوقعة وعمود للمخرجات الفعلية. الاستراتيجية هي النهج العام؛ الخطة هي القائمة التفصيلية.
Choosing test data
- Normal data 正常数据: typical valid values inside the range, which should be accepted and processed correctly.
- Abnormal data 异常数据: values that should be rejected, out of range or the wrong type.
- Extreme data 极端数据: the largest and smallest values still accepted, at the edges of the range. Boundary data 边界数据: the pairs that straddle each edge, the accepted extreme and the rejected value just outside it, where off-by-one errors hide.

Inside, outside, and right on the line
لمجال يقبل علامات من 0 إلى 100، ما هي قيم اختبار الحدود؟
تقع بيانات الحدود عند حواف النطاق المقبول (وخارجه مباشرة) — حيث تختبئ أخطاء الانحراف بمقدار واحد.
Worked example: test data for a mark from 0 to 100
| Kind | Data | Expected result |
|---|---|---|
| normal | 50, 75 |
accepted and processed |
| abnormal | -10, 200, "abc" |
rejected: out of range or wrong type |
| extreme | 0, 100 |
accepted: the smallest and largest valid values |
| boundary | -1 and 0, 100 and 101 |
-1 rejected, 0 accepted; 100 accepted, 101 rejected |
- Every row needs the expected result; a table of inputs alone scores half. The extremes are accepted:
-1is boundary, not extreme.
يقبل مجال علامات من 0 إلى 100. أي القيم تمثل بيانات اختبار متطرفة؟ حدد كل الخيارات الصحيحة.
القيم المتطرفة هي الأصغر والأكبر المقبولة. -1 مرفوض، لذا فهو حد أو غير طبيعي؛ 50 قيمة عادية.
Maintenance
- Most of a program's lifetime cost is spent after release. Corrective maintenance 纠正性维护 fixes faults found in use.
- Adaptive maintenance 适应性维护 keeps the program working in a changing environment: a new operating system, a new API, a change in the law.
- Perfective maintenance 完善性维护 improves a program that already works: faster performance, a new feature users asked for. A program may need all three throughout its life.

Fix it, keep it working, make it better
الصيانة التصحيحية تصلح الأخطاء، والصيانة المثالية تحسن الميزات، والصيانة التكيفية تبقي البرمجيات تعمل في بيئة متغيرة.
ثلاثة أنواع من الصيانة: تصحيحية (إصلاح الأخطاء)، مثالية (تحسين)، تكيفية (نظام تشغيل/عتاد/قوانين جديدة).
تم تعديل برنامج رواتب لأن قانون الضرائب تغير. ما نوع الصيانة هذا؟
لم يكن البرنامج به خطأ ولم يتم تحسينه؛ بل تغيرت بيئته. هذه صيانة تكيفية.
Amending an existing program
- Read the existing code until you understand the algorithm and the data flow. Find where the change belongs: which subroutine, which lines.
- Make the change as small as possible; do not rewrite working code. Update every related part: each caller of a changed parameter list, each routine that uses a changed data structure.
- Test the new behaviour and the old: regression testing 回归测试 checks that nothing that used to work has broken. Then document the change.
بعد تغيير البرنامج، يقوم اختبار الانحدار بالتحقق من أن:
يعيد اختبار الانحدار تشغيل الاختبارات القديمة للتأكد من أن السلوك السابق لا يزال يعمل بعد التغيير.
رتب خطوات تعديل برنامج موجود بالتسلسل الصحيح.
الفهم، تحديد الموقع، تغيير صغير، نشر، اختبار كل شيء، تسجيل. skipping اختبار الانحدار هو ما يؤدي إلى كسر شيء آخر بسبب الإصلاح.
Marks that slip away
- Extreme is accepted; abnormal is rejected.
0and100are extreme;-1and101are boundary values on the rejected side. - A logic error does not crash the program. If it crashed, it was a run-time error.
- Alpha is in-house; beta is real users outside. A stub replaces a missing module; it is not a test method for finished code.
- A test plan row without an expected output earns nothing. Regression testing follows every change.
You've got it
- syntax errors stop translation · run-time errors crash a running program · logic errors run and give wrong output, found only by testing
- methods: dry run, walkthrough, white-box (from the code), black-box (from the specification), integration (interfaces, with stubs for missing modules), alpha (in-house), beta (real users), acceptance (the customer)
- test data: normal accepted, abnormal rejected, extreme the accepted edges, boundary either side of each edge; every test has an expected result
- maintenance: corrective fixes, adaptive keeps up with the environment, perfective improves; amend small, update callers, regression test