UNIT TESTING


Using


JUNIT Framework


by : Eslam Hamouda

WHAT IS TESTING



Testing is the process of checking the
functionality of the application whether it
is working as per requirements

WHAT IS JUNIT


framework for developing unit test in java


Promotes the idea of "first testing then coding“

(Test-First Development)

FEATURES OF JUNIT 


An open source framework which is used for

writing & running tests


Shows test progress in a bar that is green
if test is going fine and it turns red when a test fails


Provides Annotation & Assertions

WHAT IS UNIT TEST CASES ?


Unit testing is the testing of single entity
(class or method)


A Unit Test Case is a part of code which ensures that

the another part of code (method) works as expected


There must be at least two test cases for each requirement:

one positive test and one negative test

Example


public class TestJunit { 

@Test
public void testAdd() {
assertEquals(2, 2 + 1); // Fails
}

}



DEMO

5 minutes :)

UNIT TESTING

By Eslam Hamouda

UNIT TESTING

JUnit

  • 660