More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Testing - Interview Questions and Answers for 'Testing' - 42 question(s) found - Order By Newest
Q1. Which of the following is not the advantage of Mocking frameworks ?
a. It helps testing the module independently b. It helps in faster unit testing c. It helps in testing code even when external dependencies like service calls are not working d. It helps in doing end to end Integration Testing
Ans. It helps in doing end to end Integration Testing
Help us improve. Please let us know the company, where you were asked this question :
Q2. How should we ignore or avoid executing set of tests ?
Ans. We can remove @Test from the respective test so as to avoid its execution. Alternatively we can put @Ignore annotation on the Junit file if we want to ignore all tests in a particular file.
Help us improve. Please let us know the company, where you were asked this question :
LikeDiscussCorrect / Improve  junit   @test   @ignore   unit tests   unit testing   testing
Q3. How can we test methods individually which are not visible or declared private ?
Ans. We can either increase their visibility and mark them with annotation @VisibleForTesting or can use reflection to individually test those methods.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Initialize required objects for working with mocks and tested method
Set the mock behaviour on dependent objects
Execute the tested method
Perform assertions
Verify if a method is invoked or not
Help us improve. Please let us know the company, where you were asked this question :
LikeDiscussCorrect / Improve  junit   mocking frameworks   mock   unit testing   java   white box testing  Mockito
Q5. How to access a Web Element if there are many elements with the same XPath ?
Ans. By specifying the Index like
//button[@class='button'])[2]
Help us improve. Please let us know the company, where you were asked this question :
Ans. Selenium WebDriver is a tool for automating web application testing.It helps in replicating the manual tester behavior like keyboard entry, mouse events etc and then matching the output against the expected.
Help us improve. Please let us know the company, where you were asked this question :
Ans. The assert keyword is used to make an assertion—a statement which the programmer believes is always true at that point in the program. This keyword is intended to aid in testing and debugging.
Help us improve. Please let us know the company, where you were asked this question :
Ans. It is part of the analysis of a program and describes a situation that a program might encounter and what behavior the program should exhibit in that circumstance.
Help us improve. Please let us know the company, where you were asked this question :
LikeDiscussCorrect / Improve  use cases   design   high level design   testing   test driven development   software system analyst   project lead basic   frequent
Ans. Assert works only if assertions ( -ea ) are enabled which is not required for Verify.Assert throws an exception and hence doesn't continue with the test if assert evaluates to false whereas it's not so with Verify.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Unit Testing ( Junits )
Integration Testing ( Testing overall flow by calling the entry method or by calling the service end point )
Manual Testing ( End to End Manual User Testing, they way eventually it will be used by end users )
Automation Testing ( Machine replication of end to end testing )
Help us improve. Please let us know the company, where you were asked this question :
Ans. When we Mock an object and then make a reference to any method using mocked object reference , java never makes a call to that method and looks for mocked value to be returned or null if none specified. But If we want that to be overridden and want java to make actual method call upon using mocked object reference, this method can be used.
Help us improve. Please let us know the company, where you were asked this question :