-
Notifications
You must be signed in to change notification settings - Fork 0
Testing and Debugging
Testing and debugging are related, but they are not the same activity.
Testing checks whether software behaves as expected.
Debugging is the process of finding and correcting the cause of a problem.
Use the Test README for the required Module Two steps. This page explains the testing and debugging ideas you encounter during the assignment.
Test-phase instructions:
https://github.com/GC-STEM/it140-m2-assignment/blob/main/Part-A/tests/README.md
Testing does not begin only after you finish writing the program.
During Part A:
- In Design, you follow a provided test case through the planned solution.
- In Construct, you run the program after small changes.
- In Test, you check the completed program against requirements and expected results.
This progression helps you find problems closer to the point where they were introduced.
A test compares:
Expected result — what should happen
Actual result — what actually happened
If those results match, the test passes.
If they do not match, you have information that can help you locate a problem.
A failed test does not automatically tell you which line of code to change. It tells you which behavior needs investigation.
Manual testing means you run the program yourself and enter test data.
For the name_age program, manual testing lets you observe:
- The prompts
- The values you type
- Whether the program completes
- The displayed result
- Whether the output format matches the requirement
Before using other feedback tools, make sure the program can run normally.
An acceptance test checks whether software provides required behavior.
The Module Two SRS contains the shared acceptance test cases for the name_age program.
SRS:
https://github.com/GC-STEM/it140-m2-assignment/blob/main/Part-A/analysis/name_age_srs.md
The cases include both typical and edge-case values.
When a test fails, compare the result with the corresponding acceptance case and requirement before changing code.
An edge case uses an unusual, extreme, or boundary value that can reveal assumptions in a solution.
The assignment asks you to identify provided edge cases during Analyze.
You do not need to invent additional requirements for handling values that the SRS does not require.
A useful rule is:
Test the behavior the requirements specify. Do not silently create new requirements while testing.
During Construct, the repository recommends changing a small amount and running the program again.
This approach is useful because:
- The program worked before your recent change.
- You make one small change.
- A new problem appears.
- The recent change becomes a likely place to inspect first.
This does not prove the recent line is the only possible cause, but it narrows the search.
The Test README identifies the current 2-3 Instant Feedback Tool in D2L Brightspace as the official course feedback method for this assignment.
Use the current Test README and D2L instructions for:
- Where to open the tool
- How to provide your program
- How to interpret course-specific feedback
- Any current technical details
Feedback from the tool does not submit your assignment for grading.
Return to D2L Brightspace and follow the Module Two What to Submit instructions when your work is complete.
The repository also includes:
Part-A/tests/test_name_age.py
The local automated tests are optional.
You have not studied Python testing yet, so you are not expected to understand or modify the test file.
The test program:
- Runs your
name_age.pyprogram with known input. - Captures what your program produces.
- Compares the result with the expected result.
- Reports whether each acceptance test passed.
Use the current command in the Test README:
https://github.com/GC-STEM/it140-m2-assignment/blob/main/Part-A/tests/README.md
Do not copy an older command from notes, screenshots, or another repository.
When an individual automated test passes, its result ends with:
... ok
That test's actual result matched what the test expected.
When the test runner reports:
OK
after running all provided tests, your program passed those local acceptance tests.
This does not guarantee a particular assignment grade. The grading rubric includes requirements beyond simply passing the local test cases.
A result of:
FAIL
means the test completed, but your program's behavior did not match the expected result.
A useful response is:
- Identify which test failed.
- Read the failure information.
- Find the matching acceptance test in the SRS.
- Identify the requirement being checked.
- Inspect the corresponding part of
name_age.py. - Correct one problem.
- Run the program again.
- Rerun the tests.
Do not edit the provided test to make your program appear to pass.
A result of:
ERROR
means the automated test could not complete normally.
This can happen for reasons different from an ordinary wrong answer.
Follow the Test README's current troubleshooting checks before changing files.
A Python error can stop the program before it produces the required result.
The exact message matters.
Read the bottom portion of the error output and look for information such as:
- The file involved
- A line number
- The type of error
- A short explanation
Then compare that location with the code you most recently changed.
A syntax error means Python cannot interpret the code as valid Python syntax.
Common beginner causes include:
- Unmatched quotation marks
- Unmatched parentheses
- Incorrect indentation
- Missing punctuation required by the statement
- Typing a Python statement incorrectly
Use the recent change, the error message, and VS Code indicators to locate the problem.
A runtime error occurs after Python starts running the program.
For example, a program may try to perform an operation using a value in a form that does not support that operation.
Read the error information and compare the failed operation with the type of data your program is using.
A program can run without a Python error and still be incorrect.
Examples include:
- Wrong calculation
- Wrong value displayed
- Missing required text
- Extra text
- Incorrect output format
This is why testing must compare program behavior with the SRS rather than only checking that Python runs.
VS Code can identify some issues in the Problems panel.
It can help you locate syntax, formatting, or code-quality concerns, but it is not a replacement for the assignment requirements or program tests.
When you see a problem:
- Read the message.
- Identify the file and line.
- Decide whether it relates to code you are allowed to change.
- Use the assignment instructions and relevant zyBooks material before making a change.
The Module Two starter file contains provided structure that you should not rewrite merely because it is unfamiliar.
When several things appear wrong, avoid changing many lines at once.
Use this loop:
Test → Find one problem → Correct it → Test again
This helps you learn which change affected the result.
If the program becomes more confusing after several edits, use Git and GitHub history or the repository recovery instructions rather than randomly deleting files.
See Git and GitHub During the Assignment.
If your result does not match the SRS, do not change the expected result to fit your code.
Return through the chain:
Requirement → Design → Code → Test
The SRS tells you what is expected.
The provided design helps show the planned solution.
Your code should implement that plan.
The tests check the result.
Ask for help when:
- You cannot interpret an error after reviewing the relevant instructions.
- You cannot get
name_age.pyto run. - A provided test reports an unexpected technical error.
- A course-provided file appears missing or damaged.
- You are unsure whether the problem is your code or the course environment.
Before asking, collect:
- What you were trying to do
- What you expected
- What happened
- The exact error message or test result
- The file and line involved, if shown
- The troubleshooting steps you already tried
Do not publicly post passwords, tokens, private information, or complete solutions to graded work.
See Assignment Problems and Support for the correct support channel.