Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fundamentals of Software Development 1Slide 1 Unit Tests Programs to test other programs a module at a time… This makes sense because:Programs to test.

Similar presentations


Presentation on theme: "Fundamentals of Software Development 1Slide 1 Unit Tests Programs to test other programs a module at a time… This makes sense because:Programs to test."— Presentation transcript:

1 Fundamentals of Software Development 1Slide 1 Unit Tests Programs to test other programs a module at a time… This makes sense because:Programs to test other programs a module at a time… This makes sense because: –Typically software developers work on separate modules –Unit test them before submitting them for integration Unit testing aims to get rids of bugs in a module before one focuses on system bugsUnit testing aims to get rids of bugs in a module before one focuses on system bugs Generally conducted by the developersGenerally conducted by the developers

2 Fundamentals of Software Development 1Slide 2 Robot Example If I am working on the Robots hands and you are working on the legs, we should test our modules before we put the robot together…If I am working on the Robots hands and you are working on the legs, we should test our modules before we put the robot together… –Based on the principle… get your own stuff to work first before meddling with others’ stuff

3 Fundamentals of Software Development 1Slide 3 How Big are Unit Test Modules? Generally one class is considered unit…Generally one class is considered unit… –However, a unit can be defined as any module, varying in size… achieve balance… Unit testing big modules is time-consuming and complicatedUnit testing big modules is time-consuming and complicated Unit testing small modules splits things into too many modulesUnit testing small modules splits things into too many modules Sometimes when several classes are tested together the process is called component testingSometimes when several classes are tested together the process is called component testing –A unit is a component –One or more units combine to make bigger components Unit tests are writing to test every method in a module!Unit tests are writing to test every method in a module!

4 Fundamentals of Software Development 1Slide 4 Another Example For example: A module to convert roman numerals to regular numbersFor example: A module to convert roman numerals to regular numbers –List the valid inputs to be tested and corresponding outputs –Validate output based on the test inputs

5 Fundamentals of Software Development 1Slide 5 Visual Example Test Ball Buttons on the interfaceTest Ball Buttons on the interface –Verify that they create the correct corresponding ball by means of a stub (without observing the ball’s behavior)

6 Fundamentals of Software Development 1Slide 6 Advantages of Unit Testing Helps IntegrationHelps Integration –It is easier to fix smaller modules before they start messing with the rest of the system Facilitates changeFacilitates change –Makes it easier to change and test modules independently

7 Fundamentals of Software Development 1Slide 7 Unit Testing Tools: JUnit Used by developers to implements unit tests in JavaUsed by developers to implements unit tests in Java –Open Source Software Read all about it at its dedicated website:Read all about it at its dedicated website: –http://www.junit.org/index.htm http://www.junit.org/index.htm


Download ppt "Fundamentals of Software Development 1Slide 1 Unit Tests Programs to test other programs a module at a time… This makes sense because:Programs to test."

Similar presentations


Ads by Google