GRADE 7 · COMPUTING · UNIT 2 · LESSON 2.10

Decomposing problems: Creating a smart solution

Effective testing

Read a little. Try the workbook. Check your answers. Choose one section below to get started.

8 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Effective testing

A test plan lists inputs and expected outputs before observing actual outcomes. Include ordinary values and values on both sides of a decision boundary. Keep a paper trace, simulator result and physical-device result clearly distinguished; each supports a different claim.

Today’s two goals
  • Predict expected outputs for test inputs on both sides of and at a threshold.
  • Record actual behaviour and pass/fail outcomes in a test plan.
Original PaxaKids illustration for Effective testing. Precise program text and data are supplied in the workbook models.
An original PaxaKids workbook scene. Use the supplied programs and data for precise workbook facts.

Explore the clues

Tap one card to find out more.

Understand the idea

A test plan lists inputs and expected outputs before observing actual outcomes. Include ordinary values and values on both sides of a decision boundary. Keep a paper trace, simulator result and physical-device result clearly distinguished; each supports a different claim.

Concept to practise: Effective testing.

Work through an example

For an alarm condition level <= 10, readings 0, 9 and 10 should activate it, while 11 should not. Testing only 0 and 150 would miss some boundary mistakes. Record actual results after the chosen test.

Try before your workbook

Choose three nearby readings that test the boundary of level <= 10 and state their expected outputs.

Check my readiness thinking

Use 9, 10 and 11. The expected outputs are ON, ON and OFF. Compare actual results with these expectations; do not invent a hardware observation when only a trace was completed.

Your original programs and learning models

These original PaxaKids program and data models support your workbook. Some examples deliberately contain faults to investigate. Follow their headings and preserve exact code case, punctuation and order. Traces and supplied records are not claims of physical testing.

Turn a prediction into a useful test

Our goal: predict outputs below, at and above a threshold; record actual results; repair a failed test and retest.

Maya writes the expected result before running the program. Sami records what actually happens. A test passes when the observed result matches the requirement for the tested input and revision.

The intended light-alarm rule

    Decision: level <= 10?

    True branch
    1. Alarm ON
    False branch
    1. Alarm OFF

    Use a failed result to investigate

    Use a failed result to investigate — original model
    Record partExample meaning
    ExpectedON, from the intended <= 10 rule.
    ActualOFF, observed for the tested revision.
    ResultFail: observed output differs.
    Next actionInspect the comparison, repair, retest.

    An original starter with a boundary fault

    ORIGINAL TESTABLE STARTER
    from microbit import *
    import music
    TEST_LEVEL = None
    
    while True:
        if TEST_LEVEL is None:
            level = display.read_light_level()
        else:
            level = TEST_LEVEL
        if level < 10:
            music.pitch(880, duration=-1, wait=False)
        else:
            music.stop()
        sleep(100)

    Run controlled and measured tests separately

    To record real readings, temporarily add print(level) after the input-selection block, at the same indentation as if level ..., and view serial output. Cover and uncover the LED area. Record measured values; keep them separate from the exact injected tests.
    1. Record input, expected output and source revision
    2. Save and send that exact revision to the board
    3. Observe output; record Actual and Pass/Fail
    4. Repair a failed requirement and save a new revision
    5. Retest; restore None for real sensor measurements
    Paxa the Fox

    Try one step with Paxa!

    Use the API for the chosen editor. Label paper traces, simulator runs and physical tests accurately; ask a grown-up before connecting equipment. Save personal responses before leaving.

    Our Unit 2 learning path
    1. Lesson 2.1: All about software
    2. Lesson 2.2: Introducing the micro:bit
    3. Lesson 2.3: Using Python with the micro:bit
    4. Lesson 2.4: The micro:bit Python environment
    5. Lesson 2.5: Correcting errors using a flowchart
    6. Lesson 2.6: Using sensors in programming
    7. Lesson 2.7: Flowcharts for algorithm planning
    8. Lesson 2.8: Algorithmic solutions and data types
    9. Lesson 2.9: Planning a smart solution
    10. Lesson 2.10: Effective testing
    11. Lesson 2.11: Evaluating a program
    12. Lesson 2.12: Testing accelerometer gestures
    13. Lesson 2.13: Protecting a museum crown
    14. Lesson 2.14: Final project
    15. Lesson 2.15: Evaluation
    16. Lesson 2.16: What can you do?
    For grown-ups: using this lesson

    Your answers are checked in your browser. Open responses need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses.

    Read one explanation, discuss the model and try the readiness check before the workbook. Choose “Mark lesson finished” when ready. Optional account progress saves lesson position and completion across devices; save personal responses before leaving.

    2. Fill in your workbook

    Read the teaching and the complete workbook instructions. Choose, write or draw; Answer list offers larger controls. Trace code precisely and distinguish predictions from actual tests. Review designs, explanations and drawings with a grown-up.

    Effective testing8 student pages · original artwork

    Opening your PDF…

    Swipe sideways across the worksheet on a small screen, or use “Answer list” for larger controls.

    TAKE YOUR PRACTICE OFFLINE

    3. Download the student worksheet

    All 8 original A4 student pages, ready for pencil-and-paper practice. Choose Review Answers to check your work on this webpage.

    Student worksheet only · PDF · 8.3 MiB · No answer key included

    Download worksheet PDF ↓

    TRY FIRST, THEN CHECK TOGETHER

    Download the student worksheet →

    4. Answers & guidance

    Finished your try? Open the guide and compare one worksheet at a time. Your own words may be different and still explain the right idea.

    Shown on this webpage only. There is no answer-key download, and this guide is left out when printing the page.

    Show answers for all 8 worksheets

    Worksheet 1

    1. Question 1: When should the expected result be decided? from the requirement before the run
    2. Question 2: What makes an actual result useful evidence? an observed output tied to an input and revision

    Worksheet 2

    This page introduces the activity. There are no marked responses on this sheet.

    Worksheet 3

    1. Question 3: Light level 0: expected alarm output? ON / on
    2. Question 4: Light level 150: expected alarm output? OFF / off
    3. Question 5: Light level 10: expected alarm output? ON / on
    4. Question 6: Light level 9: expected alarm output? ON / on
    5. Question 7: Light level 80: expected alarm output? OFF / off

    Worksheet 4

    1. Question 8: What is the result of the example test? Fail
    2. Question 9: Which set best checks this boundary? 9, 10 and 11

    Worksheet 5

    This page introduces the activity. There are no marked responses on this sheet.

    Worksheet 6

    1. Question 10: Does TEST_LEVEL = 10 prove the physical sensor measured 10? No; the program substitutes a controlled input.

    Worksheet 7

    1. Question 11: Use rows 1–6 for controlled readings 0, 150, 10, 9, 80 and 11, in that order. Trace the intended chart to fill Expected first. Test the starter, record Actual and Pass/Fail, then name its revision. Record repairs and retests below; keep unperformed tests marked pending. Expected rows: ON, OFF, ON, ON, OFF, OFF. Original faulty <10 gives ON, OFF, OFF, ON, OFF, OFF; boundary10 fails. Actual observations only from identified controlled-input program runs, not inferred from the key. Six-row table may hold baseline; use supplied CSV or additional labelled retest entries for corrected revision. Change to <=10 and retest; corrected expected values all match. Include method, revision and actual observations. If unavailable, mark pending rather than invent results. Controlled TEST_LEVEL substitution is not physical sensing. No numeric score. Grown-up review; personal evidence is required.

    Worksheet 8

    1. Question 12: Identify the comparison fault and justify its correction. Record the retest at 10 and at least one input on each side. Then use TEST_LEVEL = None to test measured light in active and inactive conditions; give actual readings, alarm observations and any limitation. Compare findings with your partner and explain the difference between a controlled-input test and a physical sensor test. Repair 10 music.stop/OFF. Cover/uncover may not achieve exact values; adjust normal conditions and record actual measured values rather than invent0/150/etc. Require physical active/inactive evidence for board assessment; if unavailable or branch not reached mark pending. Compare with partner and record finding, or honest self-check. Controlled substitution tests logic without proving sensor reading; measured mode exercises sensor response. No numeric scoring. Grown-up review; personal evidence is required.
    Back to my workbook ↑

    Curriculum & workbook reference

    Computing for your homeschool day

    Explore Effective testing with this free Grade 7 Computing lesson. Read one idea together, try the fillable workbook and return to review at your own pace. Download the same student worksheet PDF for pencil-and-paper practice.

    Fit learning around your family’s day. There is no timer and no sign-up is needed to use the lesson. An optional account saves your lesson position and completion across devices. Workbook responses and drawings stay in this tab; save a copy of your responses before leaving.

    Understand your results

    Your answers are checked in your browser. Open responses need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses.

    Choose Review Answers after trying the activity. The guide stays on the webpage; the worksheet download contains only the student pages.

    For programme background, visit the Cambridge Lower Secondary Computing overview. PaxaKids provides independent original companion practice.

    The book pages identify the related teaching topic. The explanations, characters, programs and exercises here are original PaxaKids companion practice. Practical tasks require the appropriate editor and, where applicable, suitable equipment. A design or paper trace is not a verified hardware result. Only completed, reviewed lessons are listed.

    Explore the Cambridge Lower Secondary Computing curriculum for programme background. PaxaKids is an independent learning resource.