Skip to content

Test Plans

Question

How do I know that my program works?

testing

Test-driven Development

What's the issue?

  • Computer programs can get complicated with lots of different possible outcomes.
  • It's not feasible to try all possibilities for data.
  • How do we know that our programs work?
  • The simple answer: Testing

What's the solution?

Virtually all programming shops in the area use some variation of a technique called Test-driven Development or TDD.

TDD is a computer programming technique involving writing test cases first; then, implementing just the code needed to pass the test. Test-driven development gives rapid feedback as part of an Extreme Programming methodology. TDD is not merely a method of testing: Adherents emphasize test-driven development as a method of designing software.

Here's a larger description of it: TDD on Wikipedia

Definition of Done

How do you know when your program is "done"? Tests are just part of that answer. From Scrum.ord.

  • Defined coding standards (like identified in tools – FxCop etc)
  • Test- Driven Development
  • Unit Test Coverage
  • Maintainability Index
  • No Defects/Known Defects
  • Technical Debt
  • Design Principles etc.

We will be looking at only the test portion of this methodolgy. But be aware that there is much more to getting your code complete other then tests passing.


Getting Started With Testing

  • The basic idea of testing is that we need to identify some inputs and outputs that would indicate that our code is performing correctly.
  • If our code is supposed to add two numbers together then we should be able to say something like this:
    • If I input the numbers 2 and 3, the answer should be 5.
  • We can also confirm the answers with other means like a calculator.
  • We'll make a list of these inputs and outputs, each one is called a Test Case.
  • The list of test cases is called our Test Plan.
  • Then we run our program with all the values in our test case.
  • If all of our test cases come up with the right answers then we can say our tests have passed.
  • If we don't get all the correct answers, then we know we have more work to do.

Test Plans

We're going to use simple test plans right in our labs and projects. From now on all of our projects and lots of labs and exercises will require a test plan like the one below. You will just fill in the data into a plan like the one above where one is asked for.

TEST PLAN:

Test Case 1:
    Inputs:

    Expected Results:

Test Case 2:
    Inputs:

    Expected Results:

Test Case 3:
    Inputs:

    Expected Results:

Test Case 4:
    Inputs:

    Expected Results:

Test Case 5:
    Inputs:

    Expected Results:

Labs

  1. Lab01: Test plans... aka Preparing for Project 3, Part 4
    • unit03/labs/lab-01-project-part04-prep.html