Tuesday 15 May 2012

How does Cucumber differ from JUnit? -



How does Cucumber differ from JUnit? -

can explain difference me between cucumber , junit

from understanding both used test java code although not sure of difference?

are difference implementations of same test suite or aimed @ testing different things?

cucumber , junit different , solve different things.

cucumber behavior driven design (bdd) framework takes "stories" or scenarios written in human readable languages such english language , turns human readable text software test.

here's illustration cucumber story:

cucumber knows how turn text software test create sure software works described. output tell if story software , if not, different:

here's code fixed create cucumber test pass:

this makes called "executable specification" nice way of documenting of features software supports. different normal documentation because without corresponding test, reading document doesn't know if documentation date.

other benefits of executable specifications:

non-programmers can read , understand tests non-programmers can write tests since in plain english.

bdd results , executable specifications high level. cover overall features , perhaps few border cases examples don't test every possible status or every code path. bdd tests "integration tests" in test how code modules work together, don't test thoroughly.

this junit comes in.

junit lower level "unit test" tool allows developers test every possible code path in code. each module of code (or classes, or methods) tested in isolation. much more low level bdd framework. using same calculator story cucumber example, junit tests test lots of different calculation examples , invalid inputs create sure programme responds correctly , computes values correctly.

hope helps

junit cucumber

No comments:

Post a Comment