Junit for SE Class 2008/2009
Upcoming SlideShare
Loading in...5
×
 

Junit for SE Class 2008/2009

on

  • 2,164 views

Slides for SE Class 2008/2009

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

Statistics

Views

Total Views
2,164
Views on SlideShare
2,162
Embed Views
2

Actions

Likes
1
Downloads
60
Comments
0

2 Embeds 2

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

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Junit for SE Class 2008/2009 Junit for SE Class 2008/2009 Presentation Transcript

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