YouTube Link: https://youtu.be/SDwqcFwvwY0
** Selenium Training:https://www.edureka.co/masters-program/automation-testing-engineer-training **
This ‘JUnit Tutorial’ video by Edureka helps you understand about the unit testing framework in detail. Topics to be covered in this Software Testing Video are:
What is Junit? Advantages and uses
Features
The JUnit framework
How to set up JUnit
How to run a simple JUnit program
JUnit annotations and Assert statements
Exceptions
Parameterized test
JUnit vs TestNG
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
2. What is JUnit? Advantages and uses
Features
The JUnit framework
How to Set Up JUnit
How to run a simple JUnit program
JUnit Annotations and Assert statements
Exceptions
Parameterized test
JUnit vs TestNG
www.edureka.co
4. JUnit is a testing
framework for Java
programming language.
It is important for test-
driven development.
Test first, code later
Unit Testing is used to
verify a small chunk of
code by creating a path,
function or a method.
www.edureka.co
5. 01
02
03
04
05
06
07
JUnit provides a text-based command line
It also provides an AWT and Swing-based graphical test reporting mechanism
The best testing frameworks that can be selected for an efficient testing process
More Application Developer IDEs includes JUnit
JUnitEE test framework that enables it to test within the application server’s container
Widely adopted by many organizations around the world
A benchmark for testing in Java programming language
www.edureka.co
7. JUNIT
It allows you to write
codes faster, which
increases quality
It is elegantly
simple. It is less
complex
Provides annotations
to identify test
methods
It provides test
runners for
running the tests
Tests can be run
automatically
Tests can be organized
into test suites
www.edureka.co
9. JUnit is a Regression Testing framework which is used to
implement unit testing in Java. This framework also allows quick
and easy generation of test data and test cases.
Test fixtures
Test suites
Test runners
JUnit classes
www.edureka.co
10. Test fixtures
Test suites
Test runners
JUnit classes
Text fixtures ensures that there is a well-known and fixed environment in which
tests are run so that results are repeatable.
➢ setUp()
➢ tearDown()
www.edureka.co
11. Test fixtures
Test suites
Test runners
JUnit classes
www.edureka.co
If you want to execute multiple test cases in a specific order, it can be done by
combining all the test cases in a single origin. This origin is called the test suites.
➢ @Runwith
➢ @SuiteClasses
12. Test fixtures
Test suites
Test runners
JUnit classes
www.edureka.co
The test runner is used for executing the test cases.
➢ JUnitCore class is used in order to execute the tests.
➢ runClasses method is used to run one or several test cases.
➢ The return type of this method is the result object that is used to
access information about the tests.
13. Test fixtures
Test suites
Test runners
JUnit classes
www.edureka.co
JUnit classes are used in writing and testing JUnits.
➢ Assert
➢ TestCase
➢ TestResult
20. JUnit Annotations and Assert statements
www.edureka.co
An annotation is a special form of
syntactic metadata that can be
added to the java source code for
better code readability
21. JUnit Annotations and Assert statements
www.edureka.co
Assert is a method used in
determining pass or fail
status of a test case. In
JUnit, all the assertions are
in the Assert class.
25. Create an instance variable
Create test cases using these
instance variables
Create a public constructor
Create @Parameters that returns a
Collection of Objects
Annotate test class with @RunWith
Parameterized test