Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Unit testing presentation


Published on

  • D0WNL0AD FULL ▶ ▶ ▶ ▶ ◀ ◀ ◀ ◀
    Are you sure you want to  Yes  No
    Your message goes here
  • After many failed attempts, I almost packed in my GCSE maths altogether. But fortunately I didn't, thanks to Jeevan's guide! When I read it, I found out exactly where I was going wrong all this time! I followed his approach and achieved 90% in my next sitting. I was shocked and I thought it was a total fluke so I put his strategy to the test again. This time, I got 100%! Fantastic! If only I came across Jeevan's strategy sooner. Learn more.. ♥♥♥
    Are you sure you want to  Yes  No
    Your message goes here

Unit testing presentation

  1. 1. Unit Testing Test early and test often. by AbdAllah SaeeD
  2. 2. Yet Another CAT Stand-up session :)
  3. 3. Software Development Life Cycle Keywords: SDLC, Software Testing
  4. 4. Software Tester  Who is he?  Software Testing:  A part of build automation.  Manual.  More about testing and testers:  Keywords: Software Tester, Unit Testing
  5. 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. 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. 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. 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. 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. 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. 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. 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. 13. Unit Testing Frameworks • Examples: – JUnit (Java) – NUnit (.NET) – Doctest (Python) • For the complete list of unit testing frameworks: – Keywords: JUnit, NUnit, Doctest
  14. 14. JUnit • A simple, open source framework to write and run repeatable tests. • Homepage: • Now, lets test!
  15. 15. Getting our hands dirty • Java – JUnit – Under Eclipse IDE • Python – Doctest – Under any terminal
  16. 16. Keywords • SDLC. • Java • Software Testing. • Eclipse • Test Case • JUnit • Unit Testing. • NUnit • Integration Testing. • Python • System Testing. • Doctest
  17. 17. Resources • • • • • •
  18. 18. Questions?
  19. 19. Thanks!