+ All Categories
Home > Technology > Junit for SE Class 2008/2009

Junit for SE Class 2008/2009

Date post: 06-Jul-2015
Category:
Upload: crhym3
View: 1,272 times
Download: 1 times
Share this document with a friend
Description:
Slides for SE Class 2008/2009http://projects.jamclass.org/unitnse0809/
32
Software Engineering Testing Unit-testing JUnit
Transcript
Page 1: Junit for SE Class 2008/2009

Software Engineering

●Testing●Unit-testing●JUnit

Page 2: Junit for SE Class 2008/2009

Why testing at all?

Page 3: Junit for SE Class 2008/2009

Simplest case: Development => Production

Development Release0

100

200

300

400

500

600

700

Bugs foundBugfix Cost

(random numbers, but you get the idea)

Page 4: Junit for SE Class 2008/2009

Real world(no testing)

Development Production0

200

400

600

800

1000

1200

1400

1600

435321

€ 200.00

€ 1,500.00

Bugs foundCost per Bug

Page 5: Junit for SE Class 2008/2009

Real world(no testing)

Development Production0

200

400

600

800

1000

1200

1400

1600

435321

€ 200.00

€ 1,500.00

Bugs foundCost per Bug

435 x 200 = €87,000

321 x 1500 = €481,500

Total:€ 568,500

Page 6: Junit for SE Class 2008/2009

Real world+ testing+ testing

Development Production0

200

400

600

800

1000

1200

1400

1600

635

121€ 200.00

€ 1,500.00

Bugs foundCost per Bug

635 x 200 = €127,000

121 x 1500 = €181,500 Total:

€ 308,500

Page 7: Junit for SE Class 2008/2009

no testing vs + testing+ testing

No testing With testing0

100000

200000

300000

400000

500000

600000 € 568,500.00

€ 308,500.00Cost

about a half!about a half!

Page 8: Junit for SE Class 2008/2009

In the software eng. process...

DesignDesign CodingCoding

ImaginationImagination Real worldReal world

Page 9: Junit for SE Class 2008/2009

In the software eng. process...

`

GAPGAP

DesignDesign CodingCoding

ImaginationImagination Real worldReal world

Page 10: Junit for SE Class 2008/2009

In the software eng. process...

TestingTestingDesignDesign CodingCoding

ImaginationImagination Real worldReal world

Page 11: Junit for SE Class 2008/2009

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

Page 12: Junit for SE Class 2008/2009

Let's try it out!

Page 13: Junit for SE Class 2008/2009

Create a new Java Project

Page 14: Junit for SE Class 2008/2009

Let's create a model class ...

Page 15: Junit for SE Class 2008/2009

... an Ad post

Page 16: Junit for SE Class 2008/2009

Now, a JUnit Class

Page 17: Junit for SE Class 2008/2009

Call it PostTest, to follow a name pattern

Page 18: Junit for SE Class 2008/2009

Confirm to add JUnit library

Page 19: Junit for SE Class 2008/2009

First things first: setup()setup() and tearDown()tearDown()

Page 20: Junit for SE Class 2008/2009

Add a couple of methods to our model class

Page 21: Junit for SE Class 2008/2009

Let's add some tests!

Page 22: Junit for SE Class 2008/2009

Here we go: Run AsRun As => JUnit TestJUnit Test

Page 23: Junit for SE Class 2008/2009

All tests passed!

Page 24: Junit for SE Class 2008/2009

Time for the TestSuiteTestSuite

Page 25: Junit for SE Class 2008/2009

Let's call it PostTestSuite

Page 26: Junit for SE Class 2008/2009

Use it with PostTest.classPostTest.class

Page 27: Junit for SE Class 2008/2009

Let's try it out!

Page 28: Junit for SE Class 2008/2009

Here you have it:JUnit's Swing GUI

Page 29: Junit for SE Class 2008/2009

Introducing new model attribute: priceprice

Page 30: Junit for SE Class 2008/2009

Reflect that in our TestCase and re-run JUnit test ...

Page 31: Junit for SE Class 2008/2009

Oops! Test failedfailed. Can you figure out why?

Page 32: Junit for SE Class 2008/2009

Further reading

JUnit FAQ

http://junit.sourceforge.net/doc/faq/faq.htm

JUnit

http://www.junit.org


Recommended