Вы находитесь на странице: 1из 12

JUNIT

Shiva-Athene Technologies Pvt Ltd


JUNIT

• Junit is an open source framework.


• Written by Erich Gamma and Kent Beck.
• Released under IBM’s CPL.
• Junit has been ported to other
langauge,including PHP(PHP Unit), C#(Nunit),
Pythan(PyUnit), Fortran(fUnit), C++(CPPUnit)
and JavaScript(JSUnit).
• Eclipse supports creating test cases.
• Junit is used to write and run repeatable
automated tests.

2
Advantages of Junit

• Junit helps us to code and test during the


development.
• Run any time when you make any changes in
your code.
• Junit testing framework is beneficial and it
forces you to explicitly declare the expected
results.

3
Advantages of Junit

Junit provides graphical user interface


application to execute all the test scripts quickly
and easily.
Junit tests increase the stability of software

4
Disadvantage of Junit

• Junit can’t directly test the private methods.


• Test method must not have any parameter.

5
Junit Methods
assertEquals(expected, actual)
assertTrue(boolean test)
assertFalse(boolean test)
assertSame(Object expected,
Object actual)
assertNotSame(Object expected,
Object actual)
assertNull(Object  object)
assertNotNull(Object object)
fail()

6
Junit used in Eclipse with example

7
Junit used in Eclipse with example

8
Junit used in Eclipse with example

9
Junit Run in command Line

10
Help

• www.junit.org
• http://sourceforge.net/projects/junit/files/junit

11
Thank You

12

Вам также может понравиться