# Testing & Test Cases > Tenth graders learn to test their code — thinking up test cases (including tricky edge cases), running them, fixing failures, and re-testing. Testing catches… **Computer Science** | **Grade 10** *A free lesson plan from K12 Academics. Source page: https://lessonplans.k12academics.com/k12-lesson-g10-cs-testing.html* Tenth graders learn to test their code — thinking up test cases (including tricky edge cases), running them, fixing failures, and re-testing. Testing catches bugs before users do. They order the process, then write test cases for a program. **Copy link** works with Canvas, Schoology, Moodle and any other LMS — paste it in as a resource or assignment. ## Everything you need before the bell rings ### Learning Objectives Students will be able to… - Write **test cases**. - Cover **edge cases**. - Run tests & **fix**. - Re-test. How do you make sure your code actually works — in every case? ## Order the Testing Steps Project this and have students put the testing steps in order. ## 50 minutes, five moves Tap any phase to open the teacher moves and student actions. ### Hook — Does It Work? Your code runs once — but does it work for ALL inputs? #### 👩‍🏫 Teacher Moves - Pose the question. - Share ideas. - Set the goal. #### 🎒 Student Actions - Think. - Share. - Get ready. ### Use — Testing Students learn. #### 👩‍🏫 Teacher Moves - Send students to Order the Testing Steps. - Order the steps. - Note include edge cases. #### 🎒 Student Actions - Order. - Say. - Note it. ### Modify — Test It Students practice. #### 👩‍🏫 Teacher Moves - List normal test cases. - Add an edge case. - Predict each result. #### 🎒 Student Actions - List. - Edge. - Predict. ### Create — Create Students apply. #### 👩‍🏫 Teacher Moves - Test a small program. - Fix a failure. - Re-test it. #### 🎒 Student Actions - Test. - Fix. - Re-test. ### Reflect — Reflect Students close. #### 👩‍🏫 Teacher Moves - What is an edge case? - Why re-test after a fix? - Complete the exit ticket. #### 🎒 Student Actions - Say it. - Say it. - Complete the exit ticket. ## Built to the standards you report on Aligned to the CSTA K-12 Computer Science Standards and the ISTE Standards for Students. Systematically test and debug programs. Evaluate correctness with test cases. Develop and test as a process. Verify computational solutions. ## One lesson, every learner ### Multilingual Learners - Testing-step cards. - Frame: "an edge case is ___." - Test a tiny program. ### Support & Access - Use 3 core steps. - Use one normal test. - Use a template. ### Stretch & Extend - Write automated tests. - Add boundary cases. - Test a partner’s code. ### What to gather - 📽️Screen / board - 🧪Testing cards - 💻Order the Testing Steps - 📋Test-case worksheet - 📓Notebooks - 🎫Exit-ticket slips ### Key terms - **test case**: an input and its expected result - **edge case**: an unusual or extreme input - **expected result**: what should happen - **bug**: an error in code - **debug**: find and fix a bug - **pass/fail**: whether a test succeeds - **coverage**: how much is tested - **re-test**: test again after a fix ## Exit Ticket Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students. ### Reflect: testing & test cases. Have students write test cases for a small program. A printable test-case worksheet is in the CS library. ## Check your understanding **1. What does “test case” mean?** - how much is tested - find and fix a bug - an input and its expected result *(correct)* - an unusual or extreme input “test case” means: an input and its expected result **2. Which word means: “an unusual or extreme input”?** - edge case *(correct)* - pass/fail - debug - expected result “edge case” means: an unusual or extreme input **3. What does “expected result” mean?** - an input and its expected result - how much is tested - test again after a fix - what should happen *(correct)* “expected result” means: what should happen **4. Which word means: “an error in code”?** - bug *(correct)* - coverage - expected result - edge case “bug” means: an error in code **5. What does “debug” mean?** - find and fix a bug *(correct)* - an input and its expected result - how much is tested - an error in code “debug” means: find and fix a bug **6. Which word means: “whether a test succeeds”?** - edge case - debug - pass/fail *(correct)* - re-test “pass/fail” means: whether a test succeeds ## Printable worksheet --- Full lesson page: https://lessonplans.k12academics.com/k12-lesson-g10-cs-testing.html All lessons: https://lessonplans.k12academics.com/