SlideShare a Scribd company logo
1 of 12
Introduction
Every application that is created by a developer
has to be tested for its functionality. JUnit is one
such testing platform that uses Java as a
mainstream language. If you are a JUnit
aspirant, make sure you have studied the
questions that could be possibly asked by the
interviewer.
JUnit Interview Questions
Explain what is JUnit?
JUnit is a testing framework for unit testing. It
uses Java as a programming platform, and it is
an Open Source Software managed by the
JUnit.org community. It uses Java Archive
package file format during compilation. The
entire package framework resides under
different names for different versions. For
example, for JUnit 3.8, it is junit.framework
package and for JUnit 4 and later, it is org.junit
package.
JUnit Interview Questions
Mention different methods of
exception handling in JUnit?
Exceptional or analogous conditions during
program execution require special processing
methods and this exception handling process in
a program computation can be of many types.
There are different methods of exception
handling in JUnit
JUnit Interview Questions
Explain who should use JUnit – a
developer or tester? Why you use
JUnit to test your code?
JUnit is more often used by developers to
implement unit tests in JAVA. It is designed for
unit testing that is more a coding process and
not a testing process. However, many testers
and QA engineers use JUnit for unit testing.
JUnit is used because
It test early and does automate testing.
JUnit tests can be compiled with the build so that
at unit level, regression testing can be done.
It allows test code re-usage.
JUnit Interview Questions
What are the important JUnit
annotations?
The test runner is used to execute the test cases.
@Test: This is the test method to run first unless
otherwise specified.
@BeforeClass: This is run once before any of the
other test methods present in the class.
@Before: This is run before @Test.
@After: As the name suggests, this is run after
the @Test.
@AfterClass: This is run one after all of the tests
in the class have been run.
JUnit Interview Questions
What are the features of JUnit?
There are several features of JUnit such as:
Open source
Annotation support for test cases
Assertion support for checking the expected result
Test runner support to execute the test case
JUnit Interview Questions
What are the useful JUnit
extensions?
There are several JUnit extensions such as:
JWebUnit
XMLUnit
Cactus
MockObject
JUnit Interview Questions
Explain what is Unit Test Case?
Unit Test Case is a part of the code that ensures
that another part of the code (method) behaves
as expected. For each requirement, there must
be at least two test cases one negative test and
one positive test.
JUnit Interview Questions
Explain how you can write a simple
JUnit test case?
The simplest way to write a JUnit test case is:
Determine a subclass of TestCase
To initialize object(s) under test, override the
setup() method
To release object(s) under test override the
teardown() method
Determine one or more public test XYZ() methods
that exercise the objects under test and assert
expected results.
JUnit Interview Questions
Explain what is meant by ignoring
test in JUnit?
When your code is not ready, and it would fail if
executed then you can use @Ignore annotation.
It will not execute a test method annotated with
@Ignore
It will not execute any of the test methods of test
class if it is annotated with @Ignore
JUnit Interview Questions
What are the top advantages of
writing unit tests?
The advantages of writing unit tests include
Design testability, Code testability and Code
maintainability as good unit tests enforces
Object Oriented principles such as Single
Responsibility etc. which enables people to
avoid code smells such as long classes, long
methods, large conditionals etc.
JUnit Interview Questions
Thank you
For reading
JUnit Interview Questions
More intervew question visit us:
Online interview questions
JUnit Interview Questions

More Related Content

What's hot

Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And Mocking
Joe Wilson
 
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Jacinto Limjap
 
Introduction To J unit
Introduction To J unitIntroduction To J unit
Introduction To J unit
Olga Extone
 
Quality Software With Unit Test
Quality Software With Unit TestQuality Software With Unit Test
Quality Software With Unit Test
alice yang
 

What's hot (20)

SE2_Lec 21_ TDD and Junit
SE2_Lec 21_ TDD and JunitSE2_Lec 21_ TDD and Junit
SE2_Lec 21_ TDD and Junit
 
Xp Day 080506 Unit Tests And Mocks
Xp Day 080506 Unit Tests And MocksXp Day 080506 Unit Tests And Mocks
Xp Day 080506 Unit Tests And Mocks
 
Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And Mocking
 
N Unit Presentation
N Unit PresentationN Unit Presentation
N Unit Presentation
 
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
 
Unit testing
Unit testingUnit testing
Unit testing
 
Introduction To J unit
Introduction To J unitIntroduction To J unit
Introduction To J unit
 
Manuel testing word
Manuel testing wordManuel testing word
Manuel testing word
 
Clean Unit Test Patterns
Clean Unit Test PatternsClean Unit Test Patterns
Clean Unit Test Patterns
 
Unit and integration Testing
Unit and integration TestingUnit and integration Testing
Unit and integration Testing
 
Quality Software With Unit Test
Quality Software With Unit TestQuality Software With Unit Test
Quality Software With Unit Test
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
NUnit Features Presentation
NUnit Features PresentationNUnit Features Presentation
NUnit Features Presentation
 
J Unit
J UnitJ Unit
J Unit
 
Testing ppt
Testing pptTesting ppt
Testing ppt
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NET
 
Implementing TDD in for .net Core applications
Implementing TDD in for .net Core applicationsImplementing TDD in for .net Core applications
Implementing TDD in for .net Core applications
 
Workshop unit test
Workshop   unit testWorkshop   unit test
Workshop unit test
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Unit Testing Concepts and Best Practices
Unit Testing Concepts and Best PracticesUnit Testing Concepts and Best Practices
Unit Testing Concepts and Best Practices
 

Similar to Junit Interview Questions-ppt

Introduction to test automation in java and php
Introduction to test automation in java and phpIntroduction to test automation in java and php
Introduction to test automation in java and php
Tho Q Luong Luong
 
Software Testing - A sneak preview By Srikanth
Software Testing - A sneak preview By SrikanthSoftware Testing - A sneak preview By Srikanth
Software Testing - A sneak preview By Srikanth
Srikanth Krishnamoorthy
 

Similar to Junit Interview Questions-ppt (20)

Top 20 Junit interview questions for sdet
Top 20 Junit interview questions for sdetTop 20 Junit interview questions for sdet
Top 20 Junit interview questions for sdet
 
JUnit with_mocking
JUnit with_mockingJUnit with_mocking
JUnit with_mocking
 
Introduction To UnitTesting & JUnit
Introduction To UnitTesting & JUnitIntroduction To UnitTesting & JUnit
Introduction To UnitTesting & JUnit
 
The Ultimate Guide to Java Testing Frameworks.pdf
The Ultimate Guide to Java Testing Frameworks.pdfThe Ultimate Guide to Java Testing Frameworks.pdf
The Ultimate Guide to Java Testing Frameworks.pdf
 
JUnit- A Unit Testing Framework
JUnit- A Unit Testing FrameworkJUnit- A Unit Testing Framework
JUnit- A Unit Testing Framework
 
Introduction to test automation in java and php
Introduction to test automation in java and phpIntroduction to test automation in java and php
Introduction to test automation in java and php
 
5 Best Unit Test Frameworks to Automate Unit Tests
5 Best Unit Test Frameworks to Automate Unit Tests5 Best Unit Test Frameworks to Automate Unit Tests
5 Best Unit Test Frameworks to Automate Unit Tests
 
Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++
 
An insight to test driven development and unit testing
An insight to test driven development and unit testingAn insight to test driven development and unit testing
An insight to test driven development and unit testing
 
Munit_in_mule_naveen
Munit_in_mule_naveenMunit_in_mule_naveen
Munit_in_mule_naveen
 
What is JUnit? | Edureka
What is JUnit? | EdurekaWhat is JUnit? | Edureka
What is JUnit? | Edureka
 
Android testing part i
Android testing part iAndroid testing part i
Android testing part i
 
Project Onion unit test environment
Project Onion unit test environmentProject Onion unit test environment
Project Onion unit test environment
 
Automation testing & Unit testing
Automation testing & Unit testingAutomation testing & Unit testing
Automation testing & Unit testing
 
Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)
 
TDD Workshop UTN 2012
TDD Workshop UTN 2012TDD Workshop UTN 2012
TDD Workshop UTN 2012
 
Unit testing and junit
Unit testing and junitUnit testing and junit
Unit testing and junit
 
Software Testing - A sneak preview By Srikanth
Software Testing - A sneak preview By SrikanthSoftware Testing - A sneak preview By Srikanth
Software Testing - A sneak preview By Srikanth
 
Unit Testing in .NET Core 7.0 with XUnit.pptx
Unit Testing in .NET Core 7.0 with XUnit.pptxUnit Testing in .NET Core 7.0 with XUnit.pptx
Unit Testing in .NET Core 7.0 with XUnit.pptx
 
Test driven development(tdd)
Test driven development(tdd)Test driven development(tdd)
Test driven development(tdd)
 

More from Mayank Kumar

More from Mayank Kumar (7)

Devops interview-questions-PDF
Devops interview-questions-PDFDevops interview-questions-PDF
Devops interview-questions-PDF
 
Linux interview questions-ppt
Linux interview questions-pptLinux interview questions-ppt
Linux interview questions-ppt
 
Struts interview-questions-ppt
Struts interview-questions-pptStruts interview-questions-ppt
Struts interview-questions-ppt
 
PHP Interview Questions-ppt
PHP Interview Questions-pptPHP Interview Questions-ppt
PHP Interview Questions-ppt
 
Core Java interview questions-ppt
Core Java interview questions-pptCore Java interview questions-ppt
Core Java interview questions-ppt
 
Tableau interview questions-ppt
 Tableau interview questions-ppt Tableau interview questions-ppt
Tableau interview questions-ppt
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview Questions
 

Recently uploaded

Zeeman Effect normal and Anomalous zeeman effect
Zeeman Effect normal and Anomalous zeeman effectZeeman Effect normal and Anomalous zeeman effect
Zeeman Effect normal and Anomalous zeeman effect
PriyanshuRawat56
 
Bur Dubai Call Girl Service #$# O56521286O Call Girls In Bur Dubai
Bur Dubai Call Girl Service #$# O56521286O Call Girls In Bur DubaiBur Dubai Call Girl Service #$# O56521286O Call Girls In Bur Dubai
Bur Dubai Call Girl Service #$# O56521286O Call Girls In Bur Dubai
parisharma5056
 
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service 🧳
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service  🧳CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service  🧳
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service 🧳
anilsa9823
 
Call Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
anilsa9823
 
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
amitlee9823
 
Internship Report].pdf iiwmoosmsosmshkssmk
Internship Report].pdf iiwmoosmsosmshkssmkInternship Report].pdf iiwmoosmsosmshkssmk
Internship Report].pdf iiwmoosmsosmshkssmk
SujalTamhane
 

Recently uploaded (20)

Zeeman Effect normal and Anomalous zeeman effect
Zeeman Effect normal and Anomalous zeeman effectZeeman Effect normal and Anomalous zeeman effect
Zeeman Effect normal and Anomalous zeeman effect
 
Bur Dubai Call Girl Service #$# O56521286O Call Girls In Bur Dubai
Bur Dubai Call Girl Service #$# O56521286O Call Girls In Bur DubaiBur Dubai Call Girl Service #$# O56521286O Call Girls In Bur Dubai
Bur Dubai Call Girl Service #$# O56521286O Call Girls In Bur Dubai
 
VVVIP Call Girls In East Of Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In East Of Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In East Of Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In East Of Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
Hyderabad 💫✅💃 24×7 BEST GENUINE PERSON LOW PRICE CALL GIRL SERVICE FULL SATIS...
 
Get To Know About "Lauren Prophet-Bryant''
Get To Know About "Lauren Prophet-Bryant''Get To Know About "Lauren Prophet-Bryant''
Get To Know About "Lauren Prophet-Bryant''
 
Toxicokinetics studies.. (toxicokinetics evaluation in preclinical studies)
Toxicokinetics studies.. (toxicokinetics evaluation in preclinical studies)Toxicokinetics studies.. (toxicokinetics evaluation in preclinical studies)
Toxicokinetics studies.. (toxicokinetics evaluation in preclinical studies)
 
Book Paid Saswad Call Girls Pune 8250192130Low Budget Full Independent High P...
Book Paid Saswad Call Girls Pune 8250192130Low Budget Full Independent High P...Book Paid Saswad Call Girls Pune 8250192130Low Budget Full Independent High P...
Book Paid Saswad Call Girls Pune 8250192130Low Budget Full Independent High P...
 
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen DatingDubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
 
Top Rated Pune Call Girls Warje ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Warje ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Warje ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Warje ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service 🧳
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service  🧳CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service  🧳
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service 🧳
 
Brand Analysis for reggaeton artist Jahzel.
Brand Analysis for reggaeton artist Jahzel.Brand Analysis for reggaeton artist Jahzel.
Brand Analysis for reggaeton artist Jahzel.
 
TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...
TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...
TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...
 
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...
 
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big BoodyDubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
 
Call Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hoodi Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
TEST BANK For An Introduction to Brain and Behavior, 7th Edition by Bryan Kol...
TEST BANK For An Introduction to Brain and Behavior, 7th Edition by Bryan Kol...TEST BANK For An Introduction to Brain and Behavior, 7th Edition by Bryan Kol...
TEST BANK For An Introduction to Brain and Behavior, 7th Edition by Bryan Kol...
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
 
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Btm Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
Joshua Minker Brand Exploration Sports Broadcaster .pptx
Joshua Minker Brand Exploration Sports Broadcaster .pptxJoshua Minker Brand Exploration Sports Broadcaster .pptx
Joshua Minker Brand Exploration Sports Broadcaster .pptx
 
Internship Report].pdf iiwmoosmsosmshkssmk
Internship Report].pdf iiwmoosmsosmshkssmkInternship Report].pdf iiwmoosmsosmshkssmk
Internship Report].pdf iiwmoosmsosmshkssmk
 

Junit Interview Questions-ppt

  • 1. Introduction Every application that is created by a developer has to be tested for its functionality. JUnit is one such testing platform that uses Java as a mainstream language. If you are a JUnit aspirant, make sure you have studied the questions that could be possibly asked by the interviewer. JUnit Interview Questions
  • 2. Explain what is JUnit? JUnit is a testing framework for unit testing. It uses Java as a programming platform, and it is an Open Source Software managed by the JUnit.org community. It uses Java Archive package file format during compilation. The entire package framework resides under different names for different versions. For example, for JUnit 3.8, it is junit.framework package and for JUnit 4 and later, it is org.junit package. JUnit Interview Questions
  • 3. Mention different methods of exception handling in JUnit? Exceptional or analogous conditions during program execution require special processing methods and this exception handling process in a program computation can be of many types. There are different methods of exception handling in JUnit JUnit Interview Questions
  • 4. Explain who should use JUnit – a developer or tester? Why you use JUnit to test your code? JUnit is more often used by developers to implement unit tests in JAVA. It is designed for unit testing that is more a coding process and not a testing process. However, many testers and QA engineers use JUnit for unit testing. JUnit is used because It test early and does automate testing. JUnit tests can be compiled with the build so that at unit level, regression testing can be done. It allows test code re-usage. JUnit Interview Questions
  • 5. What are the important JUnit annotations? The test runner is used to execute the test cases. @Test: This is the test method to run first unless otherwise specified. @BeforeClass: This is run once before any of the other test methods present in the class. @Before: This is run before @Test. @After: As the name suggests, this is run after the @Test. @AfterClass: This is run one after all of the tests in the class have been run. JUnit Interview Questions
  • 6. What are the features of JUnit? There are several features of JUnit such as: Open source Annotation support for test cases Assertion support for checking the expected result Test runner support to execute the test case JUnit Interview Questions
  • 7. What are the useful JUnit extensions? There are several JUnit extensions such as: JWebUnit XMLUnit Cactus MockObject JUnit Interview Questions
  • 8. Explain what is Unit Test Case? Unit Test Case is a part of the code that ensures that another part of the code (method) behaves as expected. For each requirement, there must be at least two test cases one negative test and one positive test. JUnit Interview Questions
  • 9. Explain how you can write a simple JUnit test case? The simplest way to write a JUnit test case is: Determine a subclass of TestCase To initialize object(s) under test, override the setup() method To release object(s) under test override the teardown() method Determine one or more public test XYZ() methods that exercise the objects under test and assert expected results. JUnit Interview Questions
  • 10. Explain what is meant by ignoring test in JUnit? When your code is not ready, and it would fail if executed then you can use @Ignore annotation. It will not execute a test method annotated with @Ignore It will not execute any of the test methods of test class if it is annotated with @Ignore JUnit Interview Questions
  • 11. What are the top advantages of writing unit tests? The advantages of writing unit tests include Design testability, Code testability and Code maintainability as good unit tests enforces Object Oriented principles such as Single Responsibility etc. which enables people to avoid code smells such as long classes, long methods, large conditionals etc. JUnit Interview Questions
  • 12. Thank you For reading JUnit Interview Questions More intervew question visit us: Online interview questions JUnit Interview Questions