Presentation is loading. Please wait.

Presentation is loading. Please wait.

Testing Tutorial 7.

Similar presentations


Presentation on theme: "Testing Tutorial 7."— Presentation transcript:

1 Testing Tutorial 7

2 Program testing Testing is intended to show that a program does what it is intended to do and to discover program defects before it is put into use. You need to use artificial data to test your program. You check the results of the test run for errors, anomalies, etc. Testing reveals the presence of errors.

3 Testing process goals Validation testing Defect testing
Check whether the software meets its requirements At least one test for every requirement in the requirement list. A successful tests shows the same result as the system operates. Defect testing To discover faults or defects in the software where its behaviour is incorrect. Reveal undesirable system behavior such as system crashes, unwanted interactions with other systems, incorrect computations and data corruption. Testing makes the system perform incorrectly and exposes a defect in the system.

4 Difference between Verification & Validation
“Are we building the product right”. The software conforms to its specification. Validation: “Are we building the right product”. The software should do what the user really requires.

5 Verification & Validation Con’t
Verification is achieved through: Static analysis Evaluation of work products in the context Code review Effective but costly Dynamic testing Observing the behaviour software executing on a computer Running the code Usually in the implementation stage of a project

6 Static Verification

7 Dynamic Verification

8 Validation It demonstrates that a software or systems product is fit for purpose. System testing is a major validation event where a system is validated against the user’s statement of requirement.

9 Unit testing Implementation is correct, each bit is correct
Developer tests their code, functions, classes, procedures, to verify that they are all working as expected.

10 Failures & Faults & Errors
Fault: abnormal aspect of the code that, if executed, will put the system into an error state An incorrect step, process, or data definition in the program E.g. forget to initialize a field in one constructor so that it is null when it should not be Error: The system is in a state different from what it is supposed to be, which if not dealt with, will lead to failure E.g. if the constructor is executed, the system is in an error state(but another constructor is used) Failure: Externally observed incorrect behaviour of code Incorrect result E.g. if the field is ever dereferenced, then NullPointerException

11 What is Testing An activity in which system or a component is executed under specfic conditions, the results are recorded, and an evaluation is made of some aspect of the system or component. Testing must be done in an organised, systematic, manner process. Testing vs Debugging Testing is trying to produce failures Debugging is trying to find faults that caused failures

12 What is Testing, Con’t What are you doing for testing:
Compile the program Enter example values to test your program Code walk through Insert system.out.println statement to print out some values Use debugger Ask friend for testing your program

13 Development Testing “Black-box” - performing tests based on what the component is supposed to do Used during all level of testing “White-box” - performing tests based on how the component is implemented Not good at detecting faults relating to requirements

14 Development Testing, Con’t
Unit Testing It is the process of testing individual component in isolation Units may be: Individual functions or methods within an object Object classes with several attributes and methods Complete test coverage associated of a class involves Testing all operations associated with an object Setting and checking all object attributes

15 Structure of a Test Specifies the pre-test state, the inputs, and the expected state or behavior Test: carry out the test case Supply the test inputs Execute with test case values Perform any necessary post-test actions to end the test Compare the observed state or behavior with expected state or behavior Report results. If the resulting state matches the expected results, then the test has passed, otherwise it fails

16 Test Case Specification
Purpose: To define a test case identified by a test design specification. Outline: A test case specification shall have the following structure: Test case specification identifier; Test items; Input specifications; Output specifications; Environmental needs; Special procedural requirements;

17 Unit Testing The Java Library JUnit helps us to easily perform unit testing. The basic idea: For a given class Foo, create another class FooTest to test it, containing various “test case” methods to run Each method looks for particular results and passes/ fails JUnit provides “assert” commands to help us write tests. The idea: put assertion calls in your test methods to check things you expect to be true. If they aren’t, the test fails.

18 JUnit & Eclipse Please follow the lecture 20 to know more detailed information about how to use JUnit in the Eclipse And I would also show you some steps to use JUnit in the Eclipse.

19 Testing Strategies Assuming a fault exists: the higher the probability of causing a failure, the better the quality of the test Look at where faults are likely to be Consider quality of the test suite (individual tests of limited value) Consider the example…

20 Equivalence Partition
Partition testing, where you identify groups of inputs that have common characteristics and should be processed in the same way.

21 Boundary Analysis Testing
Boundary testing is the process of testing between extreme ends or boundaries between partitions of the input values. Errors more likely to occur at extreme values of a variable Like Start - End, Lower - Upper, Maximum - Minimum are called boundary values and the testing is called “boundary testing”. The basic idea in boundary value testing is to select input variable values at thier: Minimum Just above the minimum A normal value Just below the maximum Maximum


Download ppt "Testing Tutorial 7."

Similar presentations


Ads by Google