Junit testing Interview Questions & Answers with tutorial in Spring boot Java | Code Decode |Part -1

preview_player
Показать описание
In this video of code decode we have explained junit interview questions and answers for experienced with explaination

Udemy Course of Code Decode on Microservice k8s AWS CICD link:

Course Description Video :

What is JUnit?
JUnit is the testing framework, it is used for unit testing (The process of testing individual functionality (known as a unit) of the application is called unit testing.) of Java code. Its done by writing java code that automatically invokes your unit code and test it.

JUnit = Java Code + Unit Testing

What annotations u used in JUnit?

@SpringBootTest - This annotation creates an application context and loads the full application context. which means we can @Autowire any bean that's picked up by component scanning into our test.

@Mock()

@InjectMocks

@Before: This is used when we want to execute the preconditions or any initialisation based statements before running every test case.

What annotations u used in JUnit?
@BeforeClass: This is used when we want to execute statements before all test cases. The statements may include test connections, common setup initialisation etc.

@After: This is used when we want to execute statements after each test case. The statements can be resetting the variables, deleting extra memory used etc.

@AfterClass: This is used when certain statements are required to be executed after all the test cases of the class are run. Releasing resource connections post-execution of test cases is one such example.

@Ignores: This is used when some statements are required to be ignored during the execution of test cases.

What is Mockito in JUnit?

Mockito is a Java-based mocking framework used for unit testing of Java application. Its used in conjunction with other testing frameworks such as JUnit and TestNG. It internally uses Java Reflection API and allows to create objects of a service.

Subscriber and Follow Code Decode

#singletondoublecheckedlocking #codedecode #javainterviewquestion
Рекомендации по теме
Комментарии
Автор

Junit was never so easy before. Please make the entire series on Junit. I really admire your videos & explanations presented in the most simplest way!

anujchawla
Автор

Finally got the clarity about the topic I was looking for!
Thanks!

lakshaysingla
Автор

You are Queen of Java Madam, Hats off to you your effort, Guys please do not skip adds that is the only way we can help our online tutors like Madam.

sudheerkumar-tpmg
Автор

Thank you so much for your efforts please make the next videos you are an amazing tutor.

Cricket_lovers
Автор

Thank you for this video.. Waiting for the next one.. Thanks again

Abdulgafoor-xbth
Автор

Much needed vid for me.

Thanks a million

rishiraj
Автор

I really find your videos much helpful. Thanks for your efforts.

rohitghadge
Автор

To the point explanation. Brilliant stuff. Thanks for providing.

sandeepkumararya
Автор

Too good, looking forward to this series, thank you so much, would be great if rest assured is also covered at some point

sandeepsunam
Автор

Very nice explanation, looking forward for more videos related to junit and mockito

nitinchaurasia
Автор

Excellent content with great explanations waiting for part-2.... please upload it soon....Heartly Thanks Ma'am for ur Efforts....Keep it up 👍

poojapawar-
Автор

Thanks a lot. Awesome explanation which really help me. Please go ahead with part 2.

nhv
Автор

good mam ....thank u for making smart and easy way tutorials

mdsheikh
Автор

Thank u so much for this video.. much awaited one. Pls cover more on this like throwing different exception from a test class

lakshmipriyadevaraj
Автор

Thank you so much ❤, it’s very simple and very informative

atifaftab
Автор

Please include these items in the next video. Also please test the Controller using MockMvc, many interviews ask how will you test the controller layer

AshutoshMohanty
Автор

Excellent video madam, much needed topic.. can you please elebrate bit more like kafka junit, jms junit,
.. i tried to say keep post more videos

ramprasath
Автор

Thanks for the video, please cover next topics of junit

chetankushwah
Автор

Awesome. Your explanation is really easy to understand and provides indepth understanding. Please cover other annotations well. Especially how to test void methods.

sourabhjinde
Автор

Awesome explanation.... please explain how to throw an exception in junit test cases and other topics like spring security in detail like jwt n OAuth...deserve more likes n subscribers....

yadneshdhale