Search Interview Questions | ![]() ![]() Click here and help us by providing the answer. ![]() Click Correct / Improve and please let us know. |
|
| ||||
Testing - Interview Questions and Answers for 'Unit tests' - 7 question(s) found - Order By Newest | ||||
Ans. It helps in doing end to end Integration Testing | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
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. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
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 | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
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. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. mvn clean install -Dmaven.test.skip=true or mvn install -DskipTests or within parent POM file. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. @ignore | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
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. | ||||
![]() | ||||
![]() ![]() ![]() | ||||