testing methods carl smith national certificate year 2 – unit 4

Post on 02-Jan-2016

212 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Testing Methods

Carl SmithNational CertificateYear 2 – Unit 4

Unit 4 objectives Apply simple analysis and design

techniques to the software development process.

Develop basic high-level code using an appropriate procedural programming language.

Use suitable testing methods to ascertain the correctness of a working piece of code.

Produce appropriate documentation for a given program application.

Errors in your code

What are the types of errors we need to test for?

Syntax Errors Syntax Errors: errors in the use

of the Pascal language. The most common examples are

missing semicolons and misspelled words.

These errors are detected by the compiler and an error message is produced.

Runtime Errors

Runtime Errors: a program stops executing because a program statement, although syntactically correct, produces a meaningless or impossible result e.g. dividing by zero

Logic Errors Logic Errors: a program completes

execution but the results expected are not correct.

A calculation may have been coded incorrectly or the sequence of instructions may be incorrect

The level of error checking provided by the compiler and the meaningfulness of error messages displayed vary depending on the implementation of the development environment (e.g. TP)

Detecting Errors The compiler will detect syntax

errors.Execution of the program will terminate when a run-time error is present

It is important that we have a strategy for detecting the existence of logic errors

Black Box Testing Also known as functional testing. A software

testing technique whereby the internal workings of the item being tested are not known by the tester. For example, in a black box test on a software design the tester only knows the inputs and what the expected outcomes should be and not how the program arrives at those outputs. The tester does not ever examine the programming code and does not need any further knowledge of the program other than its specifications.

Advantages & Disadvantages The advantages of this type of testing include:

The test is unbiased because the designer and the tester are independent of each other.

The tester does not need knowledge of any specific programming languages.

The test is done from the point of view of the user, not the designer.

Test cases can be designed as soon as the specifications are complete.

The disadvantages of this type of testing include: The test can be redundant if the software designer has

already run a test case. The test cases are difficult to design. Testing every possible input stream is unrealistic because it

would take a inordinate amount of time; therefore, many program paths will go untested.

White Box Testing Also known as glass box, structural, clear box and open

box testing. A software testing technique whereby explicit knowledge of the internal workings of the item being tested are used to select the test data. Unlike black box testing, white box testing uses specific knowledge of programming code to examine outputs. The test is accurate only if the tester knows what the program is supposed to do. He or she can then see if the program diverges from its intended goal. White box testing does not account for errors caused by omission, and all visible code must also be readable.

For a complete software examination, both white box and black box tests are required.

The Test Plan A test plan may or may not form

part of the technical specification, but one needs to be produced.

It should be developed by a systems analyst with an overview of the entire system being produced (and certainly not by a programmer involved in the coding process)

The Test Plan - 2 Individual programmers will test

their own programs as part of the development process.

The test plan may provide for testing of individual programs, but should concentrate on testing how the various elements of the new system “co-operate” together. It must test the entire system.

Successful Testing Since the purpose of testing is to

discover “bugs”, a test is termed successful if it uncovers an error, and is unsuccessful if the program behaves as it should.

Try to “break” your program – don’t try to convince yourself it works.

Involve others in your testing…!

Testing Stages Design your test strategy Record your test plan List the results

Example Test Plan Table here…

Summary We covered:-

National Certificate Unit 4 objectivesThe importance of testingSyntax, Runtime and Logic errorsSuccessful TestingExample Test Plan

Any Questions?

top related