130 likes | 208 Vues
Testing. Lecture 7 HNC – Programming Concepts. 1. Aims. To understand the purpose of testing To explore the four types of test data Have a understanding of Test plans and Test logs To have an understanding of Syntax and Semantic errors. 2. Testing - Purpose.
E N D
Testing Lecture 7 HNC – Programming Concepts 1
Aims • To understand the purpose of testing • To explore the four types of test data • Have a understanding of Test plans and Test logs • To have an understanding of Syntax and Semantic errors 2
Testing - Purpose • The purpose of testing is not to demonstrate how solid your code is, it is to find the bugs. • Testing is an art. No method always works, you must think about what the user may do, not what you would do. 3
Testing – What should be tested? • If a program is long then you can’t test all the possible routes through it (even something that is safety critical such as the flight control software of the Airbus was not fully tested). 4
Testing – What should be tested?TEST DATA • There are four different conditions that testers use to test programs, these are: • Normal – valid data that the program should handle correctly • Extreme – also valid data, but at the limit in terms of size/ range (tests the boundaries) • Erroneous – totally invalid data i.e. text into a numeric field • Wrong – invalid data that is clearly incorrect 5
Test Plan • A test plan is used to provide a basis for specifying tests that are to be carried out during the development of a program. • A test plan if carried out correctly provides valuable evidence that the system (or sub systems) performs as it should. • A test plan should contain normal, extreme, erroneous and wrong test data. 6
Test log • A test log is used to prove that all the tests carried out in the test plan were carried out. Below shows an example of a test that would be shown in the test log. Test number 1 (this refers to the test No in the test plan) 8
Syntax Errors • These types of errors are very common especially with new developers. • A syntax error occurs when the developer has incorrectly written code (broken the syntax rules of the programming language) • An example of this in English would be: Why did the the chicken cross the road? 9
Syntax Errors – Continued Can you spot the two syntax errors! 10
Semantic error • Semantic errors include technically correct code, but fundamental problems with the meaning of the code. • Semantic errors are detected usually at runtime, normally when the program does not output what you expected it to. • An example of this in English would be: This sentence is excellent Italian. 11
Semantic Errors – Continued Can you spot the semantic Error below? 12
Conclusion • We have covered the following aims • To understand the purpose of testing • To explore the four types of test data • Have a understanding of Test plans and Test logs • To have an understanding of Syntax and Semantic errors 13