Junit for SE Class 2008/2009

1,428 views
1,386 views

Published on

Slides for SE Class 2008/2009
http://projects.jamclass.org/unitnse0809/

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,428
On SlideShare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
62
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Junit for SE Class 2008/2009

  1. 1. Software Engineering ●Testing ●Unit-testing ●JUnit
  2. 2. Why testing at all?
  3. 3. Simplest case: Development => Production 700 600 500 (random numbers, but you get the idea) 400 Bugs found 300 Bugfix Cost 200 100 0 Development Release
  4. 4. Real world (no testing) 1600 € 1,500.00 1400 1200 1000 800 Bugs found Cost per Bug 435 600 400 321 200 € 200.00 0 Development Production
  5. 5. Real world (no testing) 1600 321 x 1500 = € 1,500.00 Total: 1400 €481,500 € 568,500 1200 435 x 200 = 1000 800 €87,000 Bugs found Cost per Bug 435 600 400 321 200 € 200.00 0 Development Production
  6. 6. Real world + testing 121 x 1500 = 1600 €181,500 € 1,500.00 Total: 1400 € 308,500 1200 635 x 200 = €127,000 1000 635 800 Bugs found 600 Cost per Bug 400 € 200.00 200 121 0 Development Production
  7. 7. no testing vs + testing 600000 € 568,500.00 500000 about a half! 400000 € 308,500.00 300000 Cost 200000 100000 0 No testing With testing
  8. 8. In the software eng. process... Imagination Real world Design Coding
  9. 9. In the software eng. process... Imagination Real world GAP Design ` Coding
  10. 10. In the software eng. process... Imagination Real world Design Testing Coding
  11. 11. Continue with examples  A living cell: A quick introduction to JUnit, D. Steinberg http://www.slideshare.net/sundar22in/junit  Shopping Cart Unit testing with JUnit, T. Zimmermann http://www.slideshare.net/tom.zimmermann/unit-testing-with-junit
  12. 12. Let's try it out!
  13. 13. Create a new Java Project
  14. 14. Let's create a model class ...
  15. 15. ... an Ad post
  16. 16. Now, a JUnit Class
  17. 17. Call it PostTest, to follow a name pattern
  18. 18. Confirm to add JUnit library
  19. 19. First things first: setup() and tearDown()
  20. 20. Add a couple of methods to our model class
  21. 21. Let's add some tests!
  22. 22. Here we go: Run As => JUnit Test
  23. 23. All tests passed!
  24. 24. Time for the TestSuite
  25. 25. Let's call it PostTestSuite
  26. 26. Use it with PostTest.class
  27. 27. Let's try it out!
  28. 28. Here you have it: JUnit's Swing GUI
  29. 29. Introducing new model attribute: price
  30. 30. Reflect that in our TestCase and re-run JUnit test ...
  31. 31. Oops! Test failed. failed Can you figure out why?
  32. 32. Further reading  JUnit FAQ http://junit.sourceforge.net/doc/faq/faq.htm  JUnit http://www.junit.org

×