Unit testing presentation
Upcoming SlideShare
Loading in...5

Like this? Share it with your network

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 8

http://www.slideshare.net 7
http://www.linkedin.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Unit Testing Test early and test often. by AbdAllah SaeeD
  • 2. Yet Another CAT Stand-up session :)
  • 3. Software Development Life Cycle Keywords: SDLC, Software Testing
  • 4. Software Tester  Who is he?  Software Testing:  A part of build automation.  Manual.  More about testing and testers:  http://www.softwaretestinghelp.com/ Keywords: Software Tester, Unit Testing
  • 5. Unit Test?  Test Cases?  Unit Testing is a method in which a programmer tests if individual units of source code are fit for use.  Unit Testing is the first level of Software Testing.
  • 6. Why?  Find problems early in the development cycle.  A way to Optimality.  Can be used to validate that the code functionality still works after code changes.  Documentation.
  • 7. When?  How do you know that a method needs a unit test?  Is the code too simple?  Can it be tested by inspection?  Any method that can break is a good candidate for having a unit test.
  • 8. Danger!  you don't have to define unit tests for every single method you have. Although this leads to:  Incomplete coverage. But:  The careful programmer will know that their unit tests must cover every cluster of objects that form their application. Keywords: Integration Testing
  • 9. Automated Testing Input Main class Testing Class Contains the Testing Contains the actual code that will code that need to be operate on the tested. output of the main class. Output True | False?
  • 10. Automated Testing • There are two ways to test your code – The standard way: • Create a class that takes the input and output from the class we want to test after compiling it. Then compile this testing class. – Unit Testing: • Create a class that interacts with the classes and methods -including private ones- of the class we want to test and only compile the testing class.
  • 11. The standard way • What's wrong with this method? – Too hard to implement in Huge applications. – The testing code is totally separated from the main code. – Compiling Twice! • Main class compilation • Test class compilation – Wasting precious time!
  • 12. Unit Testing Frameworks • Unit testing frameworks help simplify the process of unit testing. • You can write unit tests without using any framework. – Slower. – And more error-prone. Keywords: Software Framework
  • 13. Unit Testing Frameworks • Examples: – JUnit (Java) – NUnit (.NET) – Doctest (Python) • For the complete list of unit testing frameworks: – http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks Keywords: JUnit, NUnit, Doctest
  • 14. JUnit • A simple, open source framework to write and run repeatable tests. • Homepage: http://junit.org • Now, lets test!
  • 15. Getting our hands dirty • Java – JUnit – Under Eclipse IDE • Python – Doctest – Under any terminal
  • 16. Keywords • SDLC. • Java • Software Testing. • Eclipse • Test Case • JUnit • Unit Testing. • NUnit • Integration Testing. • Python • System Testing. • Doctest
  • 17. Resources • http://en.wikipedia.org • http://bashmohandes.blogspot.com • http://www.softwaretestinghelp.com/ • http://www.vogella.de • http://junit.sourceforge.net • http://junit.org
  • 18. Questions?
  • 19. Thanks!