Junit interview questions for SDET automation engineer
Upasana | November 20, 2022 | 2 min read | 818 views
In this article we will cover important interview questions around Junit 4 and Junit 5 for every automation SDET engineer.
-
Why do you write Unit tests in isolation?
-
Can we only write unit tests using JUnit and not the integration tests?
-
How does Junit compares with TestNG and other frameworks like BDD/Cucumber/etc?
-
How will you group Junit 5 testcases based on functionality or other parameters?
-
How to make certain testcase run on a specific environment/machine/os only, skip otherwise?
-
How to write integration testcase using Junit 5?
-
How to write API testcases using Junit 5?
-
How to specify order of execution for testcases? Should’d testcase be written in such a way that they can be run independent of execution order?
-
How to write dynamic testcase in Junit 5? Write dynamic testcases for asserting recently developed palindrome function.
-
What are parameterized tests in Junit 5? How to write a simple Parameterized test? When to use parameterized tests?
-
How will you compare parameterized tests with dynamic tests?
-
Write a simple Junit 5 testcase that checks a REST API for unauthorized access?
-
What are advantages of using JUnit 5 over JUnit 4
-
Explain Mike Cohn’s test pyramid
-
Hemcrest matchers introduction
-
AssertJ introduction
-
How will you write a junit testcase that checks if the given exception was thrown with provided message
-
What is difference between Assertions and Assumptions in Junit?
-
How will you enable certain Junit 5 testcase only on certain Operating System?
-
How to enable certain Junit Jupiter tests only on System Property Conditions
-
How to enable certain Junit Jupiter tests based on environment variable condition?
Advanced Junit Concepts
-
How to write a custom test execution listener that sends email for failures
-
What are data driven testcase, how to write them using JUnit 5
-
Write a test case that loads data from CSV input
REST API Testing
-
How to handle OAuth2 login using JUnit based tests
-
What are different libraries for API testing? HttpClient, RestTemplate, WebClient, WebTestClient, RestAssured, how do you compare them?
-
What is difference between RestAssured and Spring RestTemplate from testing perspective?
-
How will you assert the value of a specific node in JSON returned by an API
-
What are Contract Driven Tests? When will you use them?
-
How will you write a testcase to assert that unauthorized user is not allowed to access a specific API
Top articles in this category:
- 50 Java Interview Questions for SDET Automation Engineer
- Java Coding Problems for SDET Automation Engineer
- Rest Assured API Testing Interview Questions
- Essential Java Skills for SDET Automation Engineer
- Migrating Spring Boot tests from Junit 4 to Junit 5
- How to reverse a number in Java
- JUnit 5 Parameterized Tests