Testing and maintenance
הוצג
19:05
מחזור חיי פיתוח התוכנה
באג קטן מאוד, אם הוא עובר לפרסום, עלול להעלות אלפי דולרים בתיקון — הרבה יותר מאשר זיהויו מוקדם. לכן איננו מתחילים פשוט להקליד קוד. אלא עוברים לפי…
קריינות באנגלית · כתוביות באנגלית ובסינית 中文 שאפשר להחליף ביניהן
בשיעור הזה
| English | משמעות |
|---|---|
| code/kəʊd/ | Instructions written in a programming language for a computer to follow. |
| 16-bit integer | A whole number stored using 16 binary digits. |
| conversion/kənˈvɜːʃn/ | The process of changing a value from one data type to another. |
| overflowed | Describes a value that was outside the range its storage could represent. |
| run-time error/rʌn taɪm ˈerə/ | שגיאת ריצה |
| routine/ruːˈtiːn/ | A set of instructions that performs a particular task within a program. |
| test data/test ˈdeɪtə/ | Data chosen to check whether a program works as expected. |
| testing/ˈtestɪŋ/ | Running a program with chosen inputs to check that it gives the expected outputs. |
| syntax error/ˈsɪntæks ˈerə/ | שגיאת סינטקס |
| keyword/ˈkiːwɜːd/ | A word with a fixed meaning in a programming language or pseudocode. |
| translation/trænˈsleɪʃn/ | Expressing the meaning of a message or text in another language. |
| array index | A whole number that identifies the position of an item in an array. |
| exception/ekˈsepʃn/ | An event that signals an error or unusual condition while a program runs. |
| logic error/ˈlɒdʒɪk ˈerə/ | שגיאת לוגיקה |
| loop/luːp/ | A structure that repeats a sequence of instructions. |
| conditions/kənˈdɪʃnz/ | A requirement or circumstance that affects what happens or whether something is true. |
| tracing/ˈtreɪsɪŋ/ | The process of following a program step by step and recording variable values. |
| translator/trænˈsleɪtə/ | A program that changes code into a form a computer can execute. |
| dry run/draɪ rʌn/ | ריצת יבשה |
| variable/ˈveərɪəbl/ | A quantity or named value that can change or take different values. |
| trace table/treɪs ˈteɪbl/ | A table recording variable values and outputs as an algorithm's steps are followed. |
| walkthrough/ˈwɔːkθruː/ | סקירה |
| White-box testing/waɪt bɒks ˈtestɪŋ/ | Testing that uses the internal structure of code to design tests. |
| statement/ˈsteɪtmənt/ | A line of code that tells a program what to do. |
| branch/bræntʃ/ | A path of instructions chosen according to a condition or value. |
| Black-box testing/blæk bɒks ˈtestɪŋ/ | Testing that uses the specification to design tests without examining the code. |
| specification/ˌspesɪfɪˈkeɪʃn/ | A description of what a program must do and the requirements it must meet. |
| Integration testing/ˌɪntɪˈɡreɪʃn ˈtestɪŋ/ | Testing combined modules to check that they work together correctly. |
| modules/ˈmɒdjuːlz/ | Separately organised program components that perform defined tasks and communicate through interfaces. |
| interfaces | Points where modules connect and exchange data or commands. |
| stub/stʌb/ | תומך (stub) |
| alpha testing/ˈælfə ˈtestɪŋ/ | בדיקה אלפא |
| beta testing/ˈbiːtə ˈtestɪŋ/ | בדיקה בטא |
| Acceptance testing/əkˈseptəns ˈtestɪŋ/ | Testing by the customer against requirements to decide whether a product is suitable. |
| test strategy/test ˈstrætədʒi/ | אסטרטגיית בדיקה |
| test plan/test plæn/ | תוכנית בדיקה |
| expected output/ekˈspektɪd ˈaʊtpʊt/ | The result a test should produce if the program works correctly. |
| actual output | The result a program produces when a test is run. |
| expected result | |
| Normal data/ˈnɔːml ˈdeɪtə/ | Typical valid values inside the range, which should be accepted and processed correctly. |
| Abnormal data/əbˈnɔːml ˈdeɪtə/ | Values that should be rejected, out of range or the wrong type. |
| Extreme data/ekˈstriːm ˈdeɪtə/ | The smallest and largest values that a program should accept. |
| Boundary data/ˈbaʊndəri ˈdeɪtə/ | Values at and just outside the edges of the accepted range. |
| Corrective maintenance/kəˈrektɪv ˈmeɪntənəns/ | The process of fixing faults found in software after release. |
| Adaptive maintenance/əˈdæptɪv ˈmeɪntənəns/ | The process of changing software to keep it working in a changed environment. |
| operating system/ˈɒpəreɪtɪŋ ˈsɪstəm/ | System software that manages hardware resources and provides services for applications. |
| API/ˌeɪ piː ˈaɪ/ | A set of rules that allows one program to use another program's services. |
| Perfective maintenance/pəˈfektɪv ˈmeɪntənəns/ | The process of improving software that already works after its release. |
| algorithm/ˈælɡərɪθəm/ | A finite sequence of precise steps for solving a problem or carrying out a task. |
| data flow | The movement of data through the different parts of a program. |
| subroutine/ˈsʌbruːtiːn/ | A named set of instructions that performs a task when called. |
| caller/ˈkɔːlə/ | The program or module that asks another module to run. |
| parameter list | The ordered list of variables that receive values when a subroutine is called. |
| data structure/ˈdeɪtə ˈstrʌktʃə/ | A way of organising and storing data to support particular operations. |
| regression testing/rɪˈɡreʃn ˈtestɪŋ/ | בדיקה מחזורית |
שלושים ושבע שניות
- ב-4 ביוני 1996 שוקקה הטיל אריאן הראשון 5 מהגויאנה הצרפתית. לאחר 37 שניות הוא סטה ממסלולו והתפוצץ. המטען הכולל ארבעה לוויינים בשווי $370 מיליון.
- הגורם היה שורת קוד אחת, שנעשה שימוש בה באריאן 4, שהמירה מס 64-ביט לשלם 16-ביט. אריאן 5 טסה מהר יותר, המספר היה גדול יותר, וההמרה גרמה לשפיכת ערך (overflow): שגיאת ריצה בפרוצדורה שלא הייתה אפילו נחוצה לאחר ההשקה.
- הקוד לעולם לא נבדק עם נתוני הטיסה של אריאן 5. אף אחד לא בחר נתוני בדיקה בקצוות הטווח של הרקטה החדשה.
- לקח זה עוסק בשלושת סוגי השגיאות, בשיטות הבדיקה, כיצד לבחור נתוני בדיקה, וכיצד לתמרן תוכנית לאחר השקה.

שלושה סוגי שגיאות
- שגיאת סינטקס שוברת את הדקדוק של השפה: סוגריה חסר, מילה מופרעת. היא נמצאת בתרגום, ולכן התוכנית לא תפעל עד שתוקן.
- שגיאת ריצה מתרחשת בזמן הפעלת התוכנית: חלוקה באפס, קובץ שאינו קיים, אינדקס מטריצה מחוץ לטווח. התוכנית קורסת או מזהירה על יוצא דופן; התיקון הוא בדיקה לפני הפעולה המסוכנת.
- שגיאת לוגיקה מאפשרת לתוכנית לפעול ולהפיק תוצאות שגויות:
+עבור-, לולאה עם טעות של אחד, תנאים בסדר הלא נכון. אין שום דבר שמזהיר עליה; רק בדיקה ומעקב חושפים אותה.

נמצאת בתרגום, נמצאת בזמן ריצה, נמצאת רק בתוצאה

Match each kind of error to how it shows up.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
Syntax = caught at translation; logic = wrong output; run-time = crash while running.
דוגמא מפורטת: מציאת שגיאות ותיקונן
Total ← 0
FOR i ← 1 TO Count
Total ← Total + Marks[i]
NEXT i
Average ← Total / Count
IF Average > 50 THEN
OUTPUT "Pass"
- סינטקס: ה
IFחסר לוENDIF. המתרגם דוחה אותו. רציה: אםCountהוא 0 החלוקה נכשל; יש לסגן זאת עםIF Count > 0 THEN. לוגיקה: אם ציון מעבר הוא 50 או יותר, ה> 50מפיל סטודנט עם בדיוק 50; אמור להיות>= 50. - קרא את הסוג, הסבר מדוע זהו הסוג, ותן את התיקון. שלושה חלקים, שלוש נקודות.
A program divides a total by the number of entries and crashes when the input file is empty. This is a:
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Division by zero happens while the program runs and stops it. A guard such as IF Count > 0 fixes it.
שיטות בדיקה: קריאת הקוד
- בדיקה יבשה (Dry run) עוקבת אחר הקוד על נייר, וכותבת את ערך כל משתנה בטבלת מעקב לאחר כל שורה.
- סיור דרך הקוד (Walkthrough) הוא ביקורת צוות: המתכנן מסביר את הקוד שורה אחר שורה בעוד שהעמיתים מחפשים תקלות.
- בדיקת תיבה לבנה (White-box testing) מתכננת בדיקות על בסיס המבנה הפנימי של הקוד, כך שכל הודעה, ענף ולולאה יוצאים לפועל. בדיקת תיבה שחורה (Black-box testing) מתכננת בדיקות על בסיס הספק בלבד: מזינים קלטות, משווה תוצאות למה שצפוי, מבלי להסתכל בקוד.

מבחוץ פנימה, או מפנימה ומסתכלת על כל מסלול

Designing test cases from the specification only (inputs and expected outputs), ignoring the code inside, is called ______-box testing.
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Black-box tests from the spec; white-box uses the code's internal structure to cover statements and branches.
שיטות בדיקה: הרכבה ושחרור
- בדיקת אינטגרציה משלבת מודולים שנבדקו בנפרד ובודקת את הממשקים ביניהם. מודול חלופי (Stub) משמש כמקום לחלופה למודול שעדיין לא נכתב, ומחזיר ערכים קבועים כדי שאר החלקים יוכלו להיבדק מלמעלה למטה.
- בדיקת אלפא (α) נערכת בתוך הארגון על ידי המתכננים לפני השחרור. בדיקת בטא (β) נותנת קבוצה מוגבלת של משתמשים אמיתיים את התוכנה בסביבה שלהם.
- בדיקת קבלה נערכת על ידי הלקוח, בהתאם לדרישות, כדי לקבוע האם המוצר מתאים למטרתו.
Software process lab
Classify development examples by the stage or tool they belong to.
דוגמה מפורטת: איזה שיטה למצב איזה
- מודול הדיווח מוגמר אך מודול הבנקים שהוא קורא עוד לא קיים: לבדוק אותו עם מודול חלופי שמחזיר נתונים קבועים.
- שני מודולים עוברים את הבדיקות שלהם אך כושלים כאשר התוצאה של אחד מאכנת את השני: בדיקת אינטגרציה של הממשק.
- התוכנה מוגמרת; החברה רוצה שתגלו תקלות בתנאי אמיתיים לפני השחרור הכללי: בדיקת בטא על ידי קבוצה מוגבלת של משתמשים.
- הלקוח מחליט אם לשלם: בדיקת קבלה בהתאם לדרישות הנסכמות. קראו את השיטה וגם מה היא נועדה לעשות.
Match each situation to the testing method it needs.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
Stub for a missing part, beta for real users, acceptance for the customer, integration for the joins.
אסטרטגיית בדיקה ותוכנית בדיקה
- אסטרטגיית בדיקה היא הגישה ברמת הגובה: איזה סוגי בדיקות ייעשו, על ידי מי, מתי, ומה חייב לעבור לפני השלב הבא.
- תוכנית בדיקה היא הרשימה המפורטת של הבדיקות. עבור כל אחת: המטרה, נתוני הקלט, התוצאה המצופה, ועמודה לתוצאה האמיתית כאשר הבדיקה מופעלת.
- בדיקה ללא תוצאה מצופה אינה בדיקה. היא מראה רק מה התוכנה עשתה, ולא האם היה זה נכון.
A test plan lists, for each test, the input data and the expected output.
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Purpose, input, expected output and a column for the actual output. The strategy is the high-level approach; the plan is the detailed list.
בחירת נתוני בדיקה
- נתונים תקינים: ערכים סטנדרטיים וקבילים בתוך הטווח, אשר צריכים להתקבל ולעבור עיבוד נכון.
- נתונים לא תקינים: ערכים שיש לדחות, מחוץ לטווח או מהסוג הלא נכון.
- נתונים קיצוניים: הערכים הגדולים והקטנים ביותר שעדיין מתקבלים, בקצוות הטווח. נתוני גבול: הזוגות החוצים את כל קצה, הערך הקיצוני המקובל והערך הדחוי מיד מחוצה לו, שם טעויות אי-התאמה (off-by-one) נסתרות.

בתוך, מחוץ, ובדיוק על הקו

For a field that accepts marks 0–100, which are the boundary test values?
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Boundary data sits at the edges of the valid range (and just outside) — where off-by-one errors hide.
דוגמא פתורה: נתוני בדיקה לציון מ-0 עד 100
| סוג | נתונים | תוצאה מצופה |
|---|---|---|
| תקינים | 50, 75 |
מתקבלים ועוברי עיבוד |
| לא תקינים | -10, 200, "abc" |
נדחים: מחוץ לטווח או סוג שגוי |
| קיצוניים | 0, 100 |
מתקבלים: הערכים הקטנים והגדולים הקבילים ביותר |
| גבול | -1 ו0, 100 ו101 |
-1 נדחה, 0 מתקבל; 100 מתקבל, 101 נדחה |
- לכל שורה יש תוצאה מצופה; טבלה של כניסות בלבד מקבלת חצי נקודות. הקיצוניים מתקבלים:
-1הוא נתון גבול, לא קיצוני.

A field accepts marks from 0 to 100. Which values are extreme test data? Select כולם that apply.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
Extreme values are the smallest and largest still accepted. -1 is rejected, so it is boundary or abnormal; 50 is normal.
תחזוקה
- רוב עלות המחזור החיים של תוכנה מושקעת לאחר השקתה. תחזוקה תיקונית מתקנת באגים שנמצאו במהלך השימוש.
- תחזוקה אדפטיבית שומרת על פעילות התוכנה בסביבה משתנה: מערכת הפעלה חדשה, API חדש, שינוי בחוק.
- תחזוקה מושלמת משפרת תוכנה שכבר פועלת: ביצועים מהירים יותר, תכונה חדשה שהמשתמשים ביקשו. ייתכן שתוכנה תזדקק לשלושת הסוגים הללו לאורך כל מחזור חייה.

תיקון, שמירה על פעילות, שיפור

Corrective maintenance fixes faults, perfective maintenance improves features, and adaptive maintenance keeps the software working in a changed environment.
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Three maintenance types: corrective (fix bugs), perfective (enhance), adaptive (new OS/hardware/rules).
A payroll program is changed because the tax law changed. Which kind of maintenance is this?
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
The program was not faulty and is not being improved; its environment changed. That is adaptive maintenance.
שינוי תוכנה קיימת
- קראו את הקוד הקיים עד שתבינו את האלגוריתם ואת זרימת הנתונים. מצאו היכן השינוי צריך להיכנס: לאילו תת-תוכנית, לאילו שורות.
- ביצע את השינוי כקטן ככל האפשר; אל תכתוב מחדר קוד שפועל. עדכן כל חלק רלוונטי: כל קורא של רשימת פרמטרים משתנה, כל פונקציה שמשתמעת במבנת נתונים משתנה.
- בדיק את ההתנהגות החדשה וגם הישנה: בדיקות נסיגה (regression testing) ודאות שאין דבר שהיה עובד הפך לשבור. לאחר מכן מסמן את השינוי.
After changing a program, regression testing checks that:
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Regression testing re-runs old tests to confirm existing behaviour still works after a change.
Put the steps of amending an existing program in order.
רמת קושי 3/5 · 200 מטבעות + בונוס קטן בהשלמה הראשונה היום
Understand, locate, change small, propagate, test everything, record. Skipping the regression test is how a fix breaks something else.
הכרטיס הזה תוקן, לכן הוא מוצג באנגלית עד שהתרגום שלו יעודכן.
Marks that slip away
- Extreme is accepted; abnormal is rejected.
0and100are extreme;-1and101are boundary values on the rejected side. - A logic error can produce wrong output or lead to a run-time error, such as an out-of-range array access.
- 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.
הבנתך מושלמת
- שגיאות סינטקס עצרות תרגום · שגיאות זמן הרצה גורמות לתכנית בתנועה להתמוטט · שגיאות לוגיות רצות ומחזירות תוצאה שגויה, נמצאות רק על ידי בדיקה
- שיטות: ריצון יבש, סיור (walkthrough), תיבה לבנה (מהקוד), תיבה שחורה (מהמפרט), אינטגרציה (ממשקים, עם סטאבים למודולים חסרים), אלפא (פנימית), בטה (משתמשים אמיתיים), קבלה (הלקוח)
- נתוני בדיקה: נורמלי מתקבל, חריג נדחה, קיצוני הקצוות המתקבלים, גבול בשני צדי כל קצה; לכל בדיקה יש תוצאה מצופה
- תחזוקה: תיקון מתקנים, הסתגלות שומרת על מערכת העבודה, שיפור משפר; לערוך קטן, עדכן קוראים, בדיק נסיגה
מה השתבש? רק צוות האתר רואה זאת.