Junit for SE Class 2008/2009

  • 1,240 views
Uploaded on

Slides for SE Class 2008/2009 …

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

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,240
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
60
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Software Engineering ●Testing ●Unit-testing ●JUnit
  • 2. Why testing at all?
  • 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. 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. 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. 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. 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. In the software eng. process... Imagination Real world Design Coding
  • 9. In the software eng. process... Imagination Real world GAP Design ` Coding
  • 10. In the software eng. process... Imagination Real world Design Testing Coding
  • 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. Let's try it out!
  • 13. Create a new Java Project
  • 14. Let's create a model class ...
  • 15. ... an Ad post
  • 16. Now, a JUnit Class
  • 17. Call it PostTest, to follow a name pattern
  • 18. Confirm to add JUnit library
  • 19. First things first: setup() and tearDown()
  • 20. Add a couple of methods to our model class
  • 21. Let's add some tests!
  • 22. Here we go: Run As => JUnit Test
  • 23. All tests passed!
  • 24. Time for the TestSuite
  • 25. Let's call it PostTestSuite
  • 26. Use it with PostTest.class
  • 27. Let's try it out!
  • 28. Here you have it: JUnit's Swing GUI
  • 29. Introducing new model attribute: price
  • 30. Reflect that in our TestCase and re-run JUnit test ...
  • 31. Oops! Test failed. failed Can you figure out why?
  • 32. Further reading  JUnit FAQ http://junit.sourceforge.net/doc/faq/faq.htm  JUnit http://www.junit.org