Sunteți pe pagina 1din 151

JUnitInterviewQuestions

Advertisements

PreviousPage NextPage

Dearreaders,theseJUnitInterviewQuestionshavebeendesignedspeciallytogetyou
acquainted with the nature of questions you may encounter during your interview for the
subjectofJUnit.Aspermyexperiencegoodinterviewershardlyplantoaskanyparticular
question during your interview, normally questions start with some basic concept of the
subjectandlatertheycontinuebasedonfurtherdiscussionandwhatyouanswer:

WhatisTesting?

Testingistheprocessofcheckingthefunctionalityoftheapplicationwhetheritisworkingas
perrequirements.

WhatisUnitTesting?

Unittestingisthetestingofsingleentity(classormethod).Unittestingisveryessentialto
everysoftwarecompanytogiveaqualityproducttotheircustomers.

WhatisManualtesting?

Executingthetestcasesmanuallywithoutanytoolsupportisknownasmanualtesting.

WhatisAutomatedtesting?

Taking tool support and executing the test cases by using automation tool is known as
automationtesting.

Whatarethedisadvantagesofmanualtesting?

Followingarethedisadvantagesofmanualtesting

TimeconsumingandtediousSincetestcasesareexecutedbyhumanresourcesso
itisveryslowandtedious.

HugeinvestmentinhumanresourcesAstestcasesneedtobeexecutedmanually
somoretestersarerequiredinmanualtesting.

Less reliable Manual testing is less reliable as tests may not be performed with
precisioneachtimebecauseofhumanerrors.

Nonprogrammable No programming can be done to write sophisticated tests


whichfetchhiddeninformation.

Whataretheadvantagesofautomatedtesting?
Followingaretheadvantagesofautomatedtesting

FastAutomationrunstestcasessignificantlyfasterthanhumanresources.

Less investment in human resources Test cases are executed by using


automationtoolsolesstesterarerequiredinautomationtesting.

MorereliableAutomationtestsperformpreciselysameoperationeachtimethey
arerun.

Programmable Testers can program sophisticated tests to bring out hidden


information.

WhatisJUnit?

JUnit is a Regression Testing Framework used by developers to implement unit testing in


Javaandaccelerateprogrammingspeedandincreasethequalityofcode.

WhatareimportantfeaturesofJUnit?

FollowingaretheimportantfeaturesofJUnit

Itisanopensourceframework.

ProvidesAnnotationtoidentifythetestmethods.

ProvidesAssertionsfortestingexpectedresults.

ProvidesTestrunnersforrunningtests.

JUnit tests can be run automatically and they check their own results and provide
immediatefeedback.

JUnit tests can be organized into test suites containing test cases and even other
testsuites.

JUnitshowstestprogressinabarthatisgreeniftestisgoingfineanditturnsred
whenatestfails.

WhatisaUnitTestCase?

A Unit Test Case is a part of code which ensures that the another part of code (method)
works as expected. To achieve those desired results quickly, test framework is required
.JUnitisperfectunittestframeworkforjavaprogramminglanguage.

WhatarethebestpracticestowriteaUnitTestCase?
Aformalwrittenunittestcaseischaracterizedbyaknowninputandbyanexpectedoutput,
whichisworkedoutbeforethetestisexecuted.Theknowninputshouldtestaprecondition
andtheexpectedoutputshouldtestapostcondition.

Theremustbeatleasttwounittestcasesforeachrequirement:onepositivetestandone
negative test. If a requirement has subrequirements, each subrequirement must have at
leasttwotestcasesaspositiveandnegative.

WhenareUnitTestswritteninDevelopmentCycle?

Testsarewrittenbeforethecodeduringdevelopmentinordertohelpcoderswritethebest
code.

WhynotjustuseSystem.out.println()fortesting?

Debugging the code using system.out.println() will lead to manual scanning of the whole
outputeverytimetheprogramisruntoensurethecodeisdoingtheexpectedoperations.
Moreover,inthelongrun,ittakeslessertimetocodeJUnitmethodsandtestthemonclass
files.

HowtoinstallJUnit?

Followthestepsbelow

DownloadthelatestversionofJUnit,referredtobelowasjunit.zip.

Unzipthejunit.zipdistributionfiletoadirectoryreferredtoas%JUNIT_HOME%.

AddJUnittotheclasspath

setCLASSPATH=%CLASSPATH%;%JUNIT_HOME%\junit.jar

TesttheinstallationbyrunningthesampletestsdistributedwithJUnit(sampletests
are located in the installation directory directly, not the junit.jar file). Then simply
type

javaorg.junit.runner.JUnitCoreorg.junit.tests.AllTests

Allthetestsshouldpasswithan"OK"message.Ifthetestsdon'tpass,verifythat
junit.jarisintheCLASSPATH.

WhydoesJUnitonlyreportthefirstfailureinasingletest?

Reportingmultiplefailuresinasingletestisgenerallyasignthatthetestdoestoomuchand
it is too big a unit test. JUnit is designed to work best with a number of small tests. It
executes each test within a separate instance of the test class. It reports failure on each
test.
InJava,assertisakeyword.Won'tthisconflictwithJUnit'sassert()method?

JUnit 3.7 deprecated assert() and replaced it with assertTrue(), which works exactly the
sameway.JUnit4iscompatiblewiththeassertkeyword.IfyourunwiththeeaJVMswitch,
assertionsthatfailwillbereportedbyJUnit.

HowdoItestthingsthatmustberuninaJ2EEcontainer(e.g.servlets,EJBs)?

RefactoringJ2EEcomponentstodelegatefunctionalitytootherobjectsthatdon'thavetobe
runinaJ2EEcontainerwillimprovethedesignandtestabilityofthesoftware.Cactusisan
opensourceJUnitextensionthatcanbeusedforunittestingserversidejavacode.

NamethetoolswithwhichJUnitcanbeeasilyintegrated.

JUnitFrameworkcanbeeasilyintegratedwitheitherofthefollowings

Eclipse

Ant

Maven

WhatarethecorefeaturesofJUnit?

JUnittestframeworkprovidesfollowingimportantfeatures

Fixtures

Testsuites

Testrunners

JUnitclasses

Whatisafixture?

Fixtureisafixedstateofasetofobjectsusedasabaselineforrunningtests.Thepurposeof
atestfixtureistoensurethatthereisawellknownandfixedenvironmentinwhichtestsare
runsothatresultsarerepeatable.Itincludesfollowingmethods

setUp()methodwhichrunsbeforeeverytestinvocation.

tearDown()methodwhichrunsaftereverytestmethod.

Whatisatestsuite?

Testsuitemeansbundleafewunittestcasesandrunittogether.InJUnit,both@RunWith
and@Suiteannotationareusedtorunthesuitetest.

Whatisatestrunner?
Testrunnerisusedforexecutingthetestcases.

WhatareJUnitclasses?Listsomeofthem.

JUnitclassesareimportantclasseswhichareusedinwritingandtestingJUnits.Someofthe
importantclassesare

AssertItcontainsasetofassertmethods.

TestCaseItcontainsatestcasedefinesthefixturetorunmultipletests.

TestResultItcontainsmethodstocollecttheresultsofexecutingatestcase.

TestSuiteItisaCompositeofTests.

WhatareannotationsandhowaretheyusefulinJUnit?

Annotationsarelikemetatagsthatyoucanaddtoyoucodeandapplythemtomethodsor
inclass.TheannotationinJUnitgivesusinformationabouttestmethods,whichmethodsare
goingtorunbefore&aftertestmethods,whichmethodsrunbefore&afterallthemethods,
whichmethodsorclasswillbeignoreduringexecution.

HowwillyourunJUnitfromcommandwindow?

Followthestepsbelow

SettheCLASSPATH

Invoketherunner

javaorg.junit.runner.JUnitCore

Whatisthepurposeoforg.junit.Assertclass?

Thisclassprovidesasetofassertionmethodsusefulforwritingtests.Onlyfailedassertions
arerecorded.

Whatisthepurposeoforg.junit.TestResultclass?

ATestResultcollectstheresultsofexecutingatestcase.ItisaninstanceoftheCollecting
Parameterpattern.Thetestframeworkdistinguishesbetweenfailuresanderrors.Afailureis
anticipated and checked for with assertions. Errors are unanticipated problems like an
ArrayIndexOutOfBoundsException.

Whatisthepurposeoforg.junit.TestSuiteclass?

ATestSuiteisaCompositeofTests.Itrunsacollectionoftestcases.
Whatisthepurposeof@TestannotationinJUnit?

TheTestannotationtellsJUnitthatthepublicvoidmethodtowhichitisattachedcanberun
asatestcase.

Whatisthepurposeof@BeforeannotationinJUnit?

Several tests need similar objects created before they can run. Annotating a public void
methodwith@BeforecausesthatmethodtoberunbeforeeachTestmethod.

Whatisthepurposeof@AfterannotationinJUnit?

IfyouallocateexternalresourcesinaBeforemethodyouneedtoreleasethemafterthetest
runs. Annotating a public void method with @After causes that method to be run after the
Testmethod.

Whatisthepurposeof@BeforeClassannotationinJUnit?

Annotating a public static void method with @BeforeClass causes it to be run once before
anyofthetestmethodsintheclass.

Whatisthepurposeof@AfterClassannotationinJUnit?

Thiswillperformthemethodafteralltestshavefinished.Thiscanbeusedtoperformclean
upactivities.

Whatis@Ignoreannotationandhowisthisuseful?

Followingaresomeoftheusefulnessof@Ignoreannotation

You can easily identify all @Ignore annotations in the source code, while unannotated or
commentedouttestsarenotsosimpletofind.

Therearecaseswhenyoucan'tfixacodethatisfailing,butyoustillwanttomethodtobe
around,preciselysothatitdoesnotgetforgotten.Insuchcases@Ignoremakessense.

ExplaintheexecutionprocedureoftheJUinttestAPImethods?

FollowingishowtheJUnitexecutionprocedureworks

Firstofallmethodannotatedas@BeforeClassexecuteonlyonce.

Lastly,themethodannotatedas@AfterClassexecutesonlyonce.

Methodannotatedas@Beforeexecutesforeachtestcasebutbeforeexecutingthe
testcase.
Methodannotatedas@Afterexecutesforeachtestcasebutaftertheexecutionof
testcase.

In between method annotated as @Before and method annotated as @After each


testcaseexecutes.

Whatisthepurposeoforg.junit.JUnitCoreclass?

ThetestcasesareexecutedusingJUnitCoreclass.JUnitCoreisafacadeforrunningtests.It
supportsrunningJUnit4tests,JUnit3.8.xtests,andmixtures.

HowtosimulatetimeoutsituationinJUnit?

Junit provides a handy option of Timeout. If a test case takes more time than specified
numberofmillisecondsthenJunitwillautomaticallymarkitasfailed.Thetimeoutparameter
isusedalongwith@Testannotation.

HowcanyouuseJUnittotestthatthecodethrowsdesiredexception?

JUnit provides a option of tracing the Exception handling of code. You can test if a code
throws desired exception or not. The expected parameter is used along with @Test
annotationasfollows@Test(expected)

WhatareParameterizedtests?

Junit 4 has introduced a new feature Parameterized tests. Parameterized tests allow
developertorunthesametestoverandoveragainusingdifferentvalues.

HowtocreateParameterizedtests?

Therearefivesteps,thatyouneedtofollowtocreateParameterizedtests

Annotatetestclasswith@RunWith(Parameterized.class).

Createapublicstaticmethodannotatedwith@ParametersthatreturnsaCollection
ofObjects(asArray)astestdataset.

Createapublicconstructorthattakesinwhatisequivalenttoone"row"oftestdata.

Createaninstancevariableforeach"column"oftestdata.

Createyourtestscase(s)usingtheinstancevariablesasthesourceofthetestdata.

The test case will be invoked once per each row of data. Let's see Parameterized
testsinaction.

Howdoyouusetestfixtures?
Fixturesisafixedstateofasetofobjectsusedasabaselineforrunningtests.Thepurpose
ofatestfixtureistoensurethatthereisawellknownandfixedenvironmentinwhichtests
arerunsothatresultsarerepeatable.Itincludes

setUp()methodwhichrunsbeforeeverytestinvocation.

tearDown()methodwhichrunsaftereverytestmethod.

HowtocompileaJUnitTestClass?

CompilingaJUnittestclassislikecompilinganyotherJavaclasses.Theonlythingyouneed
watchoutisthattheJUnitJARfilemustbeincludedintheclasspath.

WhathappensifaJUnitTestMethodisDeclaredas"private"?

IfaJUnittestmethodisdeclaredas"private",itcompilessuccessfully.Buttheexecutionwill
fail.ThisisbecauseJUnitrequiresthatalltestmethodsmustbedeclaredas"public".

Howdoyoutesta"protected"method?

Whenamethodisdeclaredas"protected",itcanonlybeaccessedwithinthesamepackage
wheretheclassisdefined.Hencetotesta"protected"methodofatargetclass,defineyour
testclassinthesamepackageasthetargetclass.

Howdoyoutesta"private"method?

Whenamethodisdeclaredas"private",itcanonlybeaccessedwithinthesameclass.So
thereisnowaytotesta"private"methodofatargetclassfromanytestclass.Henceyou
needtoperformunittestingmanually.Oryouhavetochangeyourmethodfrom"private"to
"protected".

WhathappensifaJUnittestmethodisdeclaredtoreturn"String"?

If a JUnit test method is declared to return "String", the compilation will pass ok. But the
executionwillfail.ThisisbecauseJUnitrequiresthatalltestmethodsmustbedeclaredto
return"void".

Canyouuseamain()MethodforUnitTesting?

Yes you can test using main() method. One obvious advantage seems to be that you can
whitebox test the class. That is, you can test the internals of it (private methods for
example). You can't do that with unittests. But primarily the test framework tests the
interfaceandthebehaviorfromtheuser'sperspective.

Doyouneedtowriteatestclassforeveryclassthatneedstobetested?
No.Weneednotwriteanindependenttestclassforeveryclassthatneedstobetested.If
thereisasmallgroupoftestssharingacommontestfixture,youmaymovethoseteststo
anewtestclass.

Whenaretestsgarbagecollected?

The test runner holds strong references to all Test instances for the duration of the test
execution. This means that for a very long test run with many Test instances, none of the
tests may be garbage collected until the end of the entire test run. Explicitly setting an
object to null in the tearDown() method, for example, allows it to be garbage collected
beforetheendoftheentiretestrun.

WhatisaMockObject?

Inaunittest,mockobjectscansimulatethebehaviorofcomplex,real(nonmock)objects
andarethereforeusefulwhenarealobjectisimpracticalorimpossibletoincorporateintoa
unittest.

ExplainunittestingusingMockObjects.

Thecommoncodingstylefortestingwithmockobjectsisto

Createinstancesofmockobjects.

Setstateandexpectationsinthemockobjects.

Invokedomaincodewithmockobjectsasparameters.

Verifyconsistencyinthemockobjects.

NamesomeoftheJUnitExtensions.

FollowingaretheJUnitextensions

Cactus

JWebUnit

XMLUnit

MockObject

WhatisCactus?

Cactusisasimpletestframeworkforunittestingserversidejavacode(Servlets,EJBs,Tag
Libs,Filters).TheintentofCactusistolowerthecostofwritingtestsforserversidecode.It
usesJUnitandextendsit.Cactusimplementsanincontainerstrategy,meaningthattests
areexecutedinsidethecontainer.

WhatarethecorecomponentsofCactus?
CactusEcosystemismadeofseveralcomponents

Cactus Framework is the heart of Cactus. It is the engine that provides the API to
writeCactustests.

CactusIntegrationModulesarefrontendsandframeworksthatprovideeasywaysof
usingtheCactusFramework(Antscripts,Eclipseplugin,Mavenplugin).

WhatisJWebUnit?

WebUnit is a Javabased testing framework for web applications. It wraps existing testing
frameworkssuchasHtmlUnitandSeleniumwithaunified,simpletestinginterfacetoallow
youtoquicklytestthecorrectnessofyourwebapplications.

WhataretheadvantagesofusingJWebUnit?

JWebUnitprovidesahighlevelJavaAPIfornavigatingawebapplicationcombinedwithaset
ofassertionstoverifytheapplication'scorrectness.Thisincludesnavigationvialinks,form
entryandsubmission,validationoftablecontents,andothertypicalbusinesswebapplication
features.

The simple navigation methods and readytouse assertions allow for more rapid test
creationthanusingonlyJUnitorHtmlUnit.AndifyouwanttoswitchfromHtmlUnittoother
pluginssuchasSelenium(availablesoon),thereisnoneedtorewriteyourtests.

WhatisXMLUnit?

XMLUnit provides a single JUnit extension class, XMLTestCase, and a set of supporting
classes.

WhatistheuseofsupportingclassesinXMLUnit?

Supportingclassesallowassertionstobemadeabout

ThedifferencesbetweentwopiecesofXML(viaDiffandDetailedDiffclasses).

ThevalidityofapieceofXML(viaValidatorclass).

TheoutcomeoftransformingapieceofXMLusingXSLT(viaTransformclass).

TheevaluationofanXPathexpressiononapieceofXML(viaclassesimplementing
theXpathEngineinterface).

IndividualnodesinapieceofXMLthatareexposedbyDOMTraversal(viaNodeTest
class).

WhatisNext?
Furtheryoucangothroughyourpastassignmentsyouhavedonewiththesubjectandmake
sureyouareabletospeakconfidentlyonthem.Ifyouarefreshertheninterviewerdoesnot
expect you will answer very complex questions, rather you have to make your basics
conceptsverystrong.

Second it really doesn't matter much if you could not answer few questions but it matters
that whatever you answered, you must have answered with confidence. So just feel
confident during your interview. We at tutorialspoint wish you best luck to have a good
interviewerandalltheverybestforyourfutureendeavor.Cheers:)

PreviousPage NextPage
JUnitOnlineQuiz
Advertisements

QuestionsPage NextQuiz

FollowingquizprovidesMultipleChoiceQuestions(MCQs)relatedtoJUnitFramework.You
willhavetoreadallthegivenanswersandclickoverthecorrectanswer.Ifyouarenotsure
about the answer then you can check the answer using Show Answer button. You can
useNextQuizbuttontochecknewsetofquestionsinthequiz.

Q1WhichofthefollowingiscorrectaboutJUnit?

AJUnittestscanbeorganizedintotestsuitescontainingtestcasesandevenothertest
suites.

B JUnit shows test progress in a bar that is green if test is going fine and it turns red
whenatestfailsineclipse.

CBothoftheabove.

DNoneoftheabove.

Answer:C
Explanation
JUnit tests can be organized into test suites containing test cases and even other test
suites.JUnitshowstestprogressinabarthatisgreeniftestisgoingfineanditturnsred
whenatestfailsineclipse.

ShowAnswer

Q2WhichofthefollowingiscorrectaboutaUnitTestCase?

ATheremustbeatleasttwounittestcasesforeachrequirement:onepositivetestand
onenegativetest.
BIfarequirementhassubrequirements,eachsubrequirementmusthaveatleasttwo
testcasesaspositiveandnegative.

CBothoftheabove.

DNoneoftheabove.

Answer:C
Explanation
There must be at least two unit test cases for each requirement: one positive test and
one negative test. If a requirement has subrequirements, each subrequirement must
haveatleasttwotestcasesaspositiveandnegative.

HideAnswer

Q3WhichofthefollowingclassisaCompositeofTests?

AAssert

BTestCase

CTestResult

DTestSuite

Answer:D
Explanation
TestSuiteclassisaCompositeofTests.

HideAnswer

Q4WhichofthefollowingmethodofAssertclasschecksthatanobjectisnull?

Avoidassert(Objectobject,booleantoCheckAsNull)

BvoidassertCheck(Objectobject,booleantoCheckAsNull)

CvoidassertNull(Objectobject)

DvoidassertChecks(Objectobject,booleantoCheckAsNull)

Answer:C
Explanation
voidassertNull(Objectobject)checksthatanobjectisnull.
HideAnswer

Q 5 Which of the following method of TestCase class gets the name of a


TestCase?

AStringgetTestName()

BStringgetNameOfTest()

CStringgetName()

DStringgetTestCase()

Answer:C
Explanation
StringgetName()methodgetsthenameofaTestCase.

HideAnswer

Q 6 Which of the following method of TestResult class gets the number of


detectedfailures?

Ainterror()

BinterrorCount()

CintfailureCount()

Dintfailure()

Answer:C
Explanation
intfailureCount()methodgetsthenumberofdetectedfailures.

HideAnswer

Q 7 Which of the following method of TestSuite class returns the number of


testsinthissuite?

AinttestCount()

BinttestCaseCount()
CintgetTestCount()

DinttestSuiteCount()

Answer:A
Explanation
inttestCount()methodreturnsthenumberoftestsinthissuite.

HideAnswer

Q8Ifatestclassisannotatedwith@Ignorethennoneofitstestmethodswill
beexecuted.

Afalse

Btrue

Answer:B
Explanation
Ifatestclassisannotatedwith@Ignorethennoneofitstestmethodswillbeexecuted.

HideAnswer

Q9JUnitprovidesTestrunnersforrunningtests.

Atrue

Bfalse

Answer:A
Explanation
JUnitprovidesTestrunnersforrunningtests.

HideAnswer

Q10FixtureincludessetUp()methodwhichrunsoncewhentestclassloads.

Atrue

Bfalse

Answer:B

Explanation
Explanation
FixtureincludessetUp()methodwhichrunsbeforeeverytestinvocation.

HideAnswer

QuestionsPage NextQuiz
JUnitOnlineTest
Advertisements

PreviousPage NextPage

This JUnit Online Test simulates a real online certification exams. You will be presented
MultipleChoiceQuestions(MCQs)basedonJUnitFrameworkConcepts,whereyouwillbe
givenfouroptions.Youwillselectthebestsuitableanswerforthequestionandthenproceed
to the next question without wasting given time. You will get your online test score after
finishingthecompletetest.

TotalQuestions20 19:02:95 MaxTime20Min

Youscored35%
TotalQuestions:20,Attempted:20,Correct:7,TimeTaken:0.95Min

QWhichofthefollowingiscorrectaboutautomatedtesting?

AAutomationtestsperformpreciselysameoperationeachtimetheyarerun.

BTesterscanprogramsophisticatedteststobringouthiddeninformation.

CBothoftheabove.

DNoneoftheabove.

Answer:C
Explanation
Automationtestsperformpreciselysameoperationeachtimetheyarerun.Testerscan
programsophisticatedteststobringouthiddeninformation.

ShowAnswer

Q JUnit tests can be run automatically and they check their own results and
provideimmediatefeedback.

Atrue
Bfalse

Answer:A
Explanation
JUnit tests can be run automatically and they check their own results and provide
immediatefeedback.

ShowAnswer

QWhichofthefollowingiscorrectaboutTestSuiteinJUnit?

ATestsuitemeansbundleafewunittestcasesandrunittogether.

B@RunWithand@Suiteannotationareusedtorunthesuitetest.

CBothoftheabove

DNoneoftheabove.

Answer:C
Explanation
Test suite means bundle a few unit test cases and run it together. In JUnit, both
@RunWithand@Suiteannotationareusedtorunthesuitetest.

ShowAnswer

QAnnotatingapublicvoidmethodwith@BeforeClasscausesthatmethodtobe
runbeforeeachTestmethod.

Afalse

Btrue

Answer:A
Explanation
Annotatingapublicstaticvoidmethodwith@BeforeClasscausesittoberunoncebefore
anyofthetestmethodsintheclass.

ShowAnswer

Q Annotate test class with @RunWith(Parameterized.class) to create a


parameterizedtestcase.
Atrue

Bfalse

Answer:A
Explanation
Annotatetestclasswith@RunWith(Parameterized.class)tocreateaparameterizedtest
case.

ShowAnswer

QWhichofthefollowingmethodofTestResultclassaddsanerrortothelistof
errors?

AvoidaddError(Testtest,Throwablet)

BvoidaddError(Testtest,Errort)

CvoidaddError(Testtest,Exceptiont)

DvoidaddError(Testtest,TestErrort)

Answer:A
Explanation
voidaddError(Testtest,Throwablet)methodaddsanerrortothelistoferrors.

ShowAnswer

Q WhichofthefollowingmethodofTestSuiteclasscountsthenumberoftest
casesthatwillberunbythistest?

AintcountTestExecutions()

BintcountTest()

Cintcount()

DintcountTestCases()

Answer:D
Explanation
intcountTestCases()methodcountsthenumberoftestcasesthatwillberunbythistest.
ShowAnswer

Q Which of the following method of TestCase class sets the name of a


TestCase?

AvoidsetTestName()

BvoidsetNameOfTest()

CvoidsetName()

DvoidsetTestCase()

Answer:C
Explanation
voidsetName()methodsetsthenameofaTestCase.

ShowAnswer

QWhichofthefollowingiscorrectaboutFixture?

AFixtureisafixedstateofasetofobjectsusedasabaselineforrunningtests.

B The purpose of a test fixture is to ensure that there is a well known and fixed
environmentinwhichtestsarerunsothatresultsarerepeatable.

CBothoftheabove

DNoneoftheabove.

Answer:C
Explanation
Fixture is a fixed state of a set of objects used as a baseline for running tests. The
purposeofatestfixtureistoensurethatthereisawellknownandfixedenvironmentin
whichtestsarerunsothatresultsarerepeatable.

ShowAnswer

QWhichofthefollowingiscorrectaboutJUnitexecutionprocedure?

AFirstofallmethodannotatedas@BeforeClassexecuteonlyonce.

BLastly,themethodannotatedas@AfterClassexecutesonlyonce.
CMethodannotatedas@Beforeexecutesforeachtestcasebutbeforeexecutingthetest
case.

DAlloftheabove.

Answer:D
Explanation
Alloftheaboveoptionsarecorrect.

ShowAnswer

QJUnitprovidesAssertionsfortestingexpectedresults.

Atrue

Bfalse

Answer:A
Explanation
JUnitprovidesAssertionsfortestingexpectedresults.

ShowAnswer

QWhichofthefollowingiscorrectaboutorg.junit.JUnitCoreclass?

AThetestcasesareexecutedusingJUnitCoreclass.

BJUnitCoreisafacadeforrunningtests.

CItsupportsrunningJUnit4tests,JUnit3.8.xtests,andmixtures.

DAlloftheabove.

Answer:D
Explanation
ThetestcasesareexecutedusingJUnitCoreclass.JUnitCoreisafacadeforrunningtests.
ItsupportsrunningJUnit4tests,JUnit3.8.xtests,andmixtures.

ShowAnswer

Q@RunWithand@Suiteannotationareusedtorunthesuitetest.
Afalse

Btrue

Answer:B
Explanation
Both@RunWithand@Suiteannotationareusedtorunthesuitetest.

ShowAnswer

QWhichofthefollowingannotationcausesthatmethodtoberunbeforeeach
Testmethod?

A@Test

B@Before

C@After

D@BeforeClass

Answer:B
Explanation
Annotatingapublicvoidmethodwith@Beforecausesthatmethodtoberunbeforeeach
Testmethod.

ShowAnswer

QWhichofthefollowingiscorrectaboutJUnit?

AItisanopensourceframework.

BItprovidesAnnotationtoidentifythetestmethods.

CItprovidesAssertionsfortestingexpectedresults.

DAlloftheabove.

Answer:D
Explanation
Alloftheaboveoptionsarecorrect.

ShowAnswer
QWhichofthefollowingmethodofTestResultclassrunsaTestCase?

Avoidrun(TestCasetest)

Bvoidexecute(TestCasetest)

CvoidrunTest(TestCasetest)

DvoidexecuteTest(TestCasetest)

Answer:A
Explanation
voidrun(TestCasetest)methodrunsaTestCase.

ShowAnswer

QWhichofthefollowingiscorrectaboutaUnitTestCase?

ATheremustbeatleasttwounittestcasesforeachrequirement:onepositivetestand
onenegativetest.

BIfarequirementhassubrequirements,eachsubrequirementmusthaveatleasttwo
testcasesaspositiveandnegative.

CBothoftheabove.

DNoneoftheabove.

Answer:C
Explanation
There must be at least two unit test cases for each requirement: one positive test and
one negative test. If a requirement has subrequirements, each subrequirement must
haveatleasttwotestcasesaspositiveandnegative.

ShowAnswer

QWhichofthefollowingiscorrectaboutaUnitTestCase?

AAUnitTestCaseisapartofcodewhichensuresthattheanotherpartofcode(method)
worksasexpected.

BAformalwrittenunittestcaseischaracterizedbyaknowninputandbyanexpected
output,whichisworkedoutbeforethetestisexecuted.
C The known input should test a precondition and the expected output should test a
postcondition.

DAlloftheabove.

Answer:D
Explanation
Alloftheaboveoptionsarecorrect.

ShowAnswer

Q Which of the following method of TestResult class gets the number of run
tests?

AinttestCount()

BintrunCount()

CintcountExecutions()

DintcountRun()

Answer:B
Explanation
intrunCount()methodgetsthenumberofruntests.

ShowAnswer

Q Which of the following method of Assert class checks that two


primitives/Objectsareequal?

AvoidassertEquals(booleanexpected,booleanactual)

Bvoidassert(booleanexpected,booleanactual)

CvoidassertCheck(booleanexpected,booleanactual)

DvoidassertChecks(booleanexpected,booleanactual)

Answer:A
Explanation
voidassertEquals(booleanexpected,booleanactual)checksthattwoprimitives/Objects
areequal.
ShowAnswer

NewTest
JUNIT MOCK TEST
http://www.tutorialspoint.com Copyright tutorialspoint.com

This section presents you various set of Mock Tests related to JUnit Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

JUNIT MOCK TEST I

Q 1 - Which of the following describes Testing correctly?

A - Testing is the process of checking the functionality of the application whether it is working as
per requirements.

B - Testing is the testing of single entity classormethod.

C - Both of the above.

D - None of the above.

Q 2 - Which of the following describes Unit Testing correctly?

A - Unit Testing is the process of checking the functionality of the application whether it is
working as per requirements.

B - Unit testing is the testing of single entity classormethod.

C - Both of the above.

D - None of the above.

Q 3 - Which of the following is correct about manual testing?

A - Since test cases are executed by human resources so it is very slow and tedious.

B - As test cases need to be executed manually so more testers are required in manual testing.

C - Both of the above.

D - None of the above.

Q 4 - Which of the following is correct about manual testing?

A - Manual testing is less reliable as tests may not be performed with precision each time
because of human errors.

B - No programming can be done to write sophisticated tests which fetch hidden information.

C - Both of the above.

D - None of the above.

Q 5 - Which of the following is correct about automated testing?

A - Automation runs test cases significantly faster than human resources.

B - Test cases are executed by using automation tool so less tester are required in automation
testing.

C - Both of the above.

D - None of the above.

Q 6 - Which of the following is correct about automated testing?

A - Automation tests perform precisely same operation each time they are run.

B - Testers can program sophisticated tests to bring out hidden information.

C - Both of the above.

D - None of the above.

Q 7 - Which of the following is correct about JUnit?

A - It is an open source framework.

B - It provides Annotation to identify the test methods.

C - It provides Assertions for testing expected results.

D - All of the above.

Q 8 - Which of the following is correct about JUnit?

A - It provides Test runners for running tests.

B - JUnit tests can be run automatically and they check their own results and provide immediate
feedback.

C - Both of the above.

D - None of the above.

Q 9 - Which of the following is correct about JUnit?

A - JUnit tests can be organized into test suites containing test cases and even other test suites.

B - JUnit shows test progress in a bar that is green if test is going fine and it turns red when a test
fails in eclipse.

C - Both of the above.


D - None of the above.

Q 10 - Which of the following is correct about a Unit Test Case?

A - A Unit Test Case is a part of code which ensures that the another part of code method works as
expected.

B - A formal written unit test case is characterized by a known input and by an expected output,
which is worked out before the test is executed.

C - The known input should test a precondition and the expected output should test a
postcondition.

D - All of the above.

Q 11 - Which of the following is correct about a Unit Test Case?

A - There must be at least two unit test cases for each requirement: one positive test and one
negative test.

B - If a requirement has sub-requirements, each sub-requirement must have at least two test
cases as positive and negative.

C - Both of the above.

D - None of the above.

Q 12 - When should Unit Tests be written in Development Cycle?

A - Unit Tests are to be written before the code during development in order to help coders write
the best code.

B - Unit Tests are written after the code during development in order to help coders test the
code.

C - Both of the above.

D - None of the above.

Q 13 - Which of the following tools provides JUnit integration?

A - Eclipse

B - Ant

C - Maven

D - All of the above.

Q 14 - Which of the following is correct about Fixture?

A - Fixture is a fixed state of a set of objects used as a baseline for running tests.

B - The purpose of a test fixture is to ensure that there is a well known and fixed environment in
which tests are run so that results are repeatable.

C - Both of the above


D - None of the above.

Q 15 - Which of the following is correct about Fixture?

A - Fixture includes setUp method which runs before every test invocation.

B - Fixture includes tearDown method which runs after every test method.

C - Both of the above

D - None of the above.

Q 16 - Which of the following is correct about Test Suite in JUnit?

A - Test suite means bundle a few unit test cases and run it together.

B - @RunWith and @Suite annotation are used to run the suite test.

C - Both of the above

D - None of the above.

Q 17 - Which of the following is correct about Test Runner in JUnit?

A - Test runner is used for executing the test cases.

B - @RunWith and @Suite annotation are used to run the test runner.

C - Both of the above

D - None of the above.

Q 18 - Which of the following class contains a set of assert methods?

A - Assert

B - TestCase

C - TestResult

D - TestSuite

Q 19 - Which of the following class contains a test case and defines the fixture to run
multiple tests?

A - Assert

B - TestCase

C - TestResult

D - TestSuite

Q 20 - Which of the following class contains methods to collect the results of


executing a test case?

A - Assert
B - TestCase

C - TestResult

D - TestSuite

Q 21 - Which of the following class is a Composite of Tests?

A - Assert

B - TestCase

C - TestResult

D - TestSuite

Q 22 - Which of the following annotation tells JUnit that the public void method to
which it is attached can be run as a test case?

A - @Test

B - @Before

C - @After

D - @BeforeClass

Q 23 - Which of the following annotation causes that method to be run before each
Test method?

A - @Test

B - @Before

C - @After

D - @BeforeClass

Q 24 - Which of the following annotation causes that method to be run after each Test
method?

A - @Test

B - @Before

C - @After

D - @AfterClass

Q 25 - Which of the following annotation causes that method run once before any of
the test methods in the class?

A - @Test

B - @Before

C - @BeforeClass
D - @AfterClass

ANSWER SHEET

Question Number Answer Key

1 A

2 B

3 C

4 C

5 C

6 C

7 D

8 C

9 C

10 D

11 C

12 A

13 D

14 C

15 C

16 C

17 A

18 A

19 B

20 C

21 D

22 A

23 B

24 C

25 C

Loading [MathJax]/jax/output/HTML-CSS/jax.js
JUNIT MOCK TEST
http://www.tutorialspoint.com Copyright tutorialspoint.com

This section presents you various set of Mock Tests related to JUnit Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

JUNIT MOCK TEST II

Q 1 - Which of the following annotation causes that method run once after all tests
have finished?

A - @Test

B - @After

C - @BeforeClass

D - @AfterClass

Q 2 - Which of the following is correct about JUnit execution procedure?

A - First of all method annotated as @BeforeClass execute only once.

B - Lastly, the method annotated as @AfterClass executes only once.

C - Method annotated as @Before executes for each test case but before executing the test case.

D - All of the above.

Q 3 - Which of the following is correct about JUnit execution procedure?

A - Method annotated as @After executes for each test case but after the execution of test case.

B - In between method annotated as @Before and method annotated as @After each test case
executes.

C - Both of the above.

D - None of the above.

Q 4 - Which of the following is correct about org.junit.JUnitCore class?

A - The test cases are executed using JUnitCore class.


B - JUnitCore is a facade for running tests.

C - It supports running JUnit 4 tests, JUnit 3.8.x tests, and mixtures.

D - All of the above.

Q 5 - Which of the following is correct about org.junit.JUnitCore class?

A - The test cases are executed using JUnitCore class.

B - JUnitCore is a facade for running tests.

C - It supports running JUnit 4 tests, JUnit 3.8.x tests, and mixtures.

D - All of the above.

Q 6 - Which of the following method of Assert class checks that two primitives/Objects
are equal?

A - void assertEqualsbooleanexpected, booleanactual

B - void assertbooleanexpected, booleanactual

C - void assertCheckbooleanexpected, booleanactual

D - void assertChecksbooleanexpected, booleanactual

Q 7 - Which of the following method of Assert class checks that a condition is true?

A - void assertbooleancondition

B - void assertTruebooleancondition

C - void assertCheckbooleancondition

D - void assertChecksbooleancondition

Q 8 - Which of the following method of Assert class checks that a condition is false?

A - void assertbooleancondition

B - void assertFalsebooleancondition

C - void assertCheckbooleancondition

D - void assertChecksbooleancondition

Q 9 - Which of the following method of Assert class checks that an object isn't null?

A - void assertObjectobject, booleantoCheckAsNull

B - void assertCheckObjectobject, booleantoCheckAsNull

C - void assertNotNullObjectobject

D - void assertChecksObjectobject, booleantoCheckAsNull


Q 10 - Which of the following method of Assert class checks that an object is null?

A - void assertObjectobject, booleantoCheckAsNull

B - void assertCheckObjectobject, booleantoCheckAsNull

C - void assertNullObjectobject

D - void assertChecksObjectobject, booleantoCheckAsNull

Q 11 - Which of the following method of Assert class checks if two object references
point to the same object?

A - void assertObjectexpected, Objectactual

B - void assertCheckObjectexpected, Objectactual

C - void assertSameObjectexpected, Objectactual

D - void assertChecksObjectexpected, Objectactual

Q 12 - Which of the following method of Assert class checks if two object references
are not pointing to the same object?

A - void assertObjectexpected, Objectactual, booleanisSame

B - void assertCheckObjectexpected, Objectactual, booleanisSame

C - void assertNotSameObjectexpected, Objectactual

D - void assertChecksObjectexpected, Objectactual, booleanisSame

Q 13 - Which of the following method of Assert class checks whether two arrays are
equal to each other?

A - void assertObject[]expectedArray, Object[]resultArray, booleanisSame

B - void assertCheckObject[]expectedArray, Object[]resultArray, booleanisSame

C - void assertArrayEqualsObject[]expectedArray, Object[]resultArray

D - void assertChecksObject[]expectedArray, Object[]resultArray, booleanisSame

Q 14 - Which of the following method of Assert class fails a test with no message?

A - void assertChecksbooleanpass

B - void assertCheckbooleanpass

C - void assertbooleanpass

D - void fail

Q 15 - Which of the following method of TestCase class counts the number of test
cases executed by runTestResultresult?

A - int countTestCases
B - int executedTestCases

C - int getTestCaseCount

D - int testCases

Q 16 - Which of the following method of TestCase class creates a default TestResult


object?

A - TestResult getTestResult

B - TestResult createResult

C - TestResult getTestResultInstance

D - TestResult testResult

Q 17 - Which of the following method of TestCase class gets the name of a TestCase?

A - String getTestName

B - String getNameOfTest

C - String getName

D - String getTestCase

Q 18 - Which of the following method of TestCase class runs a test, collecting the
results with a default TestResult object?

A - TestResult runTestCase

B - TestResult runTest

C - TestResult runTestAndSave

D - TestResult run

Q 19 - Which of the following method of TestCase class runs the test case and collects
the results in TestResult?

A - void runTestCase TestResultresult

B - void runTest TestResultresult

C - void runTestAndSave TestResultresult

D - void run TestResultresult

Q 20 - Which of the following method of TestCase class sets the name of a TestCase?

A - void setTestName

B - void setNameOfTest

C - void setName

D - void setTestCase
Q 21 - Which of the following method of TestCase class sets up the fixture, for
example, open a network connection?

A - void setTestName

B - void setUp

C - void setUpFixture

D - void setTestCase

Q 22 - Which of the following method of TestCase class tears down the fixture, for
example, close a network connection?

A - void tearDownTestName

B - void tearDown

C - void tearDownFixture

D - void tearDownTestCase

Q 23 - Which of the following method of TestResult class adds an error to the list of
errors?

A - void addErrorTesttest, Throwablet

B - void addErrorTesttest, Errort

C - void addErrorTesttest, Exceptiont

D - void addErrorTesttest, TestErrort

Q 24 - Which of the following method of TestResult class adds a failure to the list of
failures?

A - void addFailureTesttest, Errort

B - void addFailureTesttest, AssertionFailedErrort

C - void addFailureTesttest, Exceptiont

D - void addFailureTesttest, Throwablet

Q 25 - Which of the following method of TestResult class informs the result that a test
was completed?

A - void showResultTesttest

B - void getResultTesttest

C - void endTestTesttest

D - void startTestTesttest

ANSWER SHEET
Question Number Answer Key

1 D

2 D

3 C

4 D

5 D

6 A

7 B

8 B

9 C

10 C

11 C

12 C

13 C

14 D

15 A

16 B

17 C

18 D

19 D

20 C

21 B

22 B

23 A

24 B

25 C

Processing math: 100%


JUNIT MOCK TEST
http://www.tutorialspoint.com Copyright tutorialspoint.com

This section presents you various set of Mock Tests related to JUnit Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

JUNIT MOCK TEST III

Q 1 - Which of the following method of TestResult class gets the number of detected
errors?

A - int getErrors

B - int errorCount

C - int countErrors

D - int getErrorCount

Q 2 - Which of the following method of TestResult class returns an Enumeration for


the errors?

A - Enumeration<Object> errors

B - Enumeration<TestFailure> errors

C - Enumeration<TestFailure> getErrors

D - Enumeration<Object> getErrors

Q 3 - Which of the following method of TestResult class gets the number of detected
failures?

A - int error

B - int errorCount

C - int failureCount

D - int failure

Q 4 - Which of the following method of TestResult class runs a TestCase?


A - void runTestCasetest

B - void executeTestCasetest

C - void runTestTestCasetest

D - void executeTestTestCasetest

Q 5 - Which of the following method of TestResult class gets the number of run tests?

A - int testCount

B - int runCount

C - int countExecutions

D - int countRun

Q 6 - Which of the following method of TestResult class informs the result that a test
will be started?

A - void startTestTesttest

B - void startTesttest

C - void executeTesttest

D - void executeTestTesttest

Q 7 - Which of the following method of TestResult class marks that the test run should
stop?

A - void stopTest

B - void stop

C - void stopTestTesttest

D - void breakTestTesttest

Q 8 - Which of the following method of TestSuite class adds a test to the suite?

A - void addTest

B - void add

C - void addTestTesttest

D - void addTestCaseTesttest

Q 9 - Which of the following method of TestSuite class adds the tests from the given
class to the suite?

A - void addTestClass < ?extendsTestCase > testClass

B - void addTestSuiteClass < ?extendsTestCase > testClass

C - void addTestTestCasetestClass
D - void addTestCaseTestCasetestClass

Q 10 - Which of the following method of TestSuite class counts the number of test
cases that will be run by this test?

A - int countTestExecutions

B - int countTest

C - int count

D - int countTestCases

Q 11 - Which of the following method of TestSuite class returns the name of the suite?

A - String getNameOfTestSuite

B - String getTestName

C - String getName

D - String getTestSuite

Q 12 - Which of the following method of TestSuite class runs the tests and collects
their result in a TestResult?

A - void executeTestResultresult

B - void runTestTestResultresult

C - void runTestResultresult

D - void executeTestTestResultresult

Q 13 - Which of the following method of TestSuite class sets the name of the suite?

A - void setSuiteNameStringname

B - void setNameStringname

C - void setTestSuiteNameStringname

D - void setTestNameStringname

Q 14 - Which of the following method of TestSuite class returns the test at the given
index?

A - Test testAtintindex

B - Test testAtIndexintindex

C - Test getTestAtintindex

D - Test testintindex

Q 15 - Which of the following method of TestSuite class returns the number of tests in
this suite?
A - int testCount

B - int testCaseCount

C - int getTestCount

D - int testSuiteCount

Q 16 - Which of the following method of TestSuite class returns a test which will fail
and log a warning message?

A - static Test displayWarningStringmessage

B - static Test showWarningStringmessage

C - static Test getWarningStringmessage

D - static Test warningStringmessage

Q 17 - The @Test annotation tells JUnit that the public void method to which it is
attached can be run as a test case.

A - true

B - false

Q 18 - Annotating a public void method with @Before causes that method to be run
before each Test method.

A - false

B - true

Q 19 - Annotating a public void method with @After causes that method to be run
after each Test method.

A - false

B - true

Q 20 - Annotating a public void method with @BeforeClass causes that method to be


run before each Test method.

A - false

B - true

Q 21 - Annotating a public void method with @AfterClass causes that method to be


run after each Test method.

A - false

B - true
Q 22 - The @Ignore annotation is used to ignore the test and that test will not be
executed.

A - false

B - true

Q 23 - Which of the following class is used to run test cases?

A - JUnitCore

B - TestCase

C - TestSuite

D - TestResult

Q 24 - Which of the following class is used to bundle unit test cases and run them
together?

A - JUnitCore

B - TestCase

C - TestSuite

D - TestResult

Q 25 - @RunWith and @Suite annotation are used to run the suite test.

A - false

B - true

ANSWER SHEET

Question Number Answer Key

1 B

2 C

3 C

4 A

5 B

6 A

7 B

8 C

9 B

10 D

11 C
12 C

13 B

14 A

15 A

16 D

17 A

18 B

19 B

20 A

21 A

22 B

23 A

24 C

25 B

Processing math: 100%


JUNIT MOCK TEST
http://www.tutorialspoint.com Copyright tutorialspoint.com

This section presents you various set of Mock Tests related to JUnit Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

JUNIT MOCK TEST IV

Q 1 - @RunWith and @Suite annotation are used to run the suite test.

A - false

B - true

Q 2 - A test method annotated with @Ignore will not be executed.

A - false

B - true

Q 3 - If a test class is annotated with @Ignore then none of its test methods will be
executed.

A - false

B - true

Q 4 - @Test annotation along with timeout attribute can be used to set timeout of a
test case.

A - false

B - true

Q 5 - @Test annotation along with expected attribute can be used to test the code
whether code throws desired exception or not.

A - true

B - false
Q 6 - Parameterized tests allow developer to run the same test over and over again
using same values.

A - true

B - false

Q 7 - Annotate test class with @RunWithParameterized. class to create a parameterized test


case.

A - true

B - false

Q 8 - Testing is the process of checking the functionality of the application whether it


is working as per requirements.

A - true

B - false

Q 9 - Testing is the testing of single entity classormethod.

A - true

B - false

Q 10 - Automation runs test cases significantly faster than human resources.

A - true

B - false

Q 11 - Automated Test cases are executed by using automation tool so less tester are
required in automation testing.

A - true

B - false

Q 12 - JUnit is a proprietory framework.

A - true

B - false

Q 13 - JUnit 4.0 provides Annotations to identify the test methods.

A - true

B - false
Q 14 - JUnit provides Assertions for testing expected results.

A - true

B - false

Q 15 - JUnit provides Test runners for running tests.

A - true

B - false

Q 16 - JUnit tests can be run automatically and they check their own results and
provide immediate feedback.

A - true

B - false

Q 17 - Unit Tests are to be written before the code during development in order to
help coders write the best code.

A - true

B - false

Q 18 - Unit Tests are written after the code during development in order to help
coders test the code.

A - true

B - false

Q 19 - Eclipse supports JUnit integration using its plugin.

A - true

B - false

Q 20 - Fixture includes setUp method which runs before every test invocation.

A - true

B - false

Q 21 - Fixture includes setUp method which runs once when test class loads.

A - true

B - false

Q 22 - Fixture includes tearDown method which runs after every test method.
A - true

B - false

Q 23 - Fixture includes tearDown method which runs after all test methods get
executed.

A - true

B - false

Q 24 - Assert contains a set of assert methods.

A - true

B - false

Q 25 - TestCase contains a test case and defines the fixture to run multiple tests.

A - true

B - false

ANSWER SHEET

Question Number Answer Key

1 B

2 B

3 B

4 B

5 A

6 B

7 A

8 A

9 B

10 A

11 A

12 B

13 A

14 A

15 A

16 A
17 A

18 B

19 A

20 A

21 B

22 A

23 B

24 A

25 A

Loading [MathJax]/jax/output/HTML-CSS/jax.js
http://career.guru99.com/

Top 11 JUnit Interview Questions & Answers


1) 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.

2) Explain what is Unit Test Case?

Unit Test Case is a part of the code that ensures that the another part of code (method)
behaves as expected. For each requirement, there must be at least two test cases one negative
test and one positive test.

3) Explain how you can write a simple JUnit test case?

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.

4) Mention what are parameterized tests?

Parameterized tests enable developer to perform the same test over and again using different
values.

5) Mention what is the difference between JUnit and TestNG?

JUnit TestNG
In JUnit the naming convention for In TestNG it is easier to understand
annotation is a bit complicated for, annotations like BeforMethod,
e.g., Before, After and AfterMethod and
Expected ExpectedException
In JUnit, for a method declaration In TestNG, there is no restriction
you have to follow a specific style like you have to declare methods in
like using @BeforeClass and a specific format

1/4
http://career.guru99.com/

@AfterClass. In TestNG method name constraint


In JUnit method name constraint is is not present, and you can
present determine any test method names
JUnit framework does not have TestNG use dependOnMethods
Parameterized Test or to implement the dependency
Dependency Test feature testing
In JUnit grouping of test cases are In TestNG, grouping of test cases is
not available available
JUnit does not support parallel In TestNG Parallel execution of
execution on Selenium test cases Selenium test cases are possible
It cannot re-run the failed cases It can rerun the failed tests

6) Mention different methods of exception handling in JUnit?

There are different methods of exception handling in JUnit

Try catch idiom


With JUnit rule
With @Test annotation
With catch exception library
With customs annotation

7) Explain what is ignore 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

8) List out some useful JUnit extensions?

JUnit extensions include

2/4
http://career.guru99.com/

Cactus
JWebUnit
XMLUnit
MockObject

9) 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 tests behave as a document for the unit tests when there is a transfer

10) Explain what is JUnitCore Class?

JUnitCore class is an inbuilt class in JUnit package; it is based on Faade design pattern, this
class is used to run only definite test classes only.

11) Explain how you can run JUnit from the command window?

To run JUnit from the command window, you have to follow the steps

Set the CLASSPATH


Invoke the runner:

Java org.junit.runner.JUnitCore

Guru99 Provides FREE ONLINE TUTORIAL on Various courses like

Java MIS MongoDB BigData Cassandra

Web Services SQLite JSP Informatica Accounting

SAP Training Python Excel ASP Net HBase

3/4
http://career.guru99.com/

Project Test Business Ethical Hacking PMP


Management Management Analyst

Live Project SoapUI Photoshop Manual Testing Mobile Testing

Selenium CCNA AngularJS NodeJS PLSQL

4/4
Powered by TCPDF (www.tcpdf.org)
HOME CORE JAVA OOPS JAVA COLLECTIONS JAVA I/O JSON JSP JSTL

C TUTORIAL DBMS PERL

Unit Testing) interview


nd answers
JAVA Q&A

interview questions and answers are for both freshers


FOLLOW ME ON GOOGLE+
olks. The reason behind this is that generally
basic questions (fresher level) and go for questions
experienced level)later. The whole FAQs are divided in Chaitanya Singh

Follow

4,682 followers
t here: JUnit interview questions

JOIN US ON GOOGLE PLUS


tion can be build up by integrating small-2 functional
as units. It is always better to test such individual units
plication. The process of testing the functionality and BeginnersBook
unit is known as unit testing. Unit testing can be done Follow +1
an also be automated.
+ 5,722

esting vsAutomated testing?

st cases are executed by humans, its time consuming


No human involvement, test cases are executed by
ms, Its fast and less costly compared to manual testing.

st Case?

thing but a combination of input data and expected


est the proper functionality of a individual test unit. Its
f the unit for a particular input data.
only report the rst failure in a single test?

lar answer for this question, the main reason it does it


process simple and easy. Even though the failures are
ts the rst failure, resolving which may implicitly resolve

d where its used?

mark a method as test method, result of which is then


tput to check whether the test is successful or not.

and @BeforeClass and its usage?

before each test. Such methods are generally used for


ming a actual test in test environment.

before all the tests. It executes only once. Method


ostly used for database connectivity tasks before

nd @AfterClass and its usage?


after each test and used for cleaning up the test and
mory issues.

at the end, once all the tests are nished. Method


d executes only a single time. Mostly used for closing

and when its used?

test method. Its really useful when we have all the tests
et to be tested for the particular test, in such scenarios
e marked with @Ignore annotation.

JUnit from command window?

follows:

JUNIT_HOME%junit.jar

re class?

responsible for executing tests. The


class has a runClasses() method, which allows us to run
a output we get a Result (org.junit.runner.Result)
r out the test information.

erized test in JUnit and what all annotations used for


ts are possible in JUnit and they provides us the liberty
he test classes.

class) For making a class parametrized.

zed class must have a static method for generating and


ay, this method should be marked with@Parameters

f @Rule annotation?

s used for creating objects, which later can be used in

d run JUnit test, Is there any particular time interval

e constraint. AJUnit test needs to run whenever there is


This ensures that the new change passes through all

eturn type of JUnit test method from void to some

not do this. All the JUnit test methods should have a


nge the return type then the test method would not be
d and would be ignored during execution of tests.

ass command-line arguments to a test execution?

pass command line arguments to a test execution

tation is used for testing exceptions?

Exception.class)
ting only a single exception.

can read Part 2 here!!

Try these related posts


w Questions
ew Questions and Answers
ons and answers
erview Questions and Answers
nnectivity) interview questions
interview questions

not be published. Required elds are marked *


man Being

Search this website

RECENTLY ADDED..

JSON Tutorial

Java Regular Expressions


Tutorial

Java Enum Tutorial

Java Annotations Tutorial

REFERENCE LINKS POPULAR TUTORIALS FRIENDS & LINKS

Download Java Core Java Tutorial FromDev.com

Eclipse IDE JSP Tutorial DZone - Fresh Links


Downloads JSTL Tutorial
MOST VISITED
Java Documentation Java Collections
Java EE 5 Tutorial Tutorial Java Interview

Java EE 6 Tutorial Servlet Tutorial JSP Interview

Java EE 7 Tutorial C Tutorial Java Multithreading


Interview
Java SE 6.0 API Java String Tutorial
Speci cation Java Collections
Interview
Java SE 7.0 API
Speci cation Servlet Interview

JUnit Interview
JavaServer Pages - ABOUT CHAITANYA
JSP SINGH

Founder
of
beginners
Book.com,
loves Java and open
source stuff.
BeginnersBook.com is
a tech blog where he
shares tutorials on
programming (Java, C,
CPP), WordPress, SEO
and web development.

Copyright 2012 2017 BeginnersBook - All Rights Reserved || Sitemap


JUnit (Java Unit Testing) interview questions
BYCHAITANYA SINGH|FILED UNDER:JAVA Q&A

This is Part 2 of Q&A. Read rst part here JUnit (Java Unit Testing) interview questions and
answers Part1.
Question1: What is Junit?

Answer:Java + unit testing = Junit

1. Junit is open source testing framework developed for unit testing java code and is now the
default framework for testing Java development.
2. It has been developed by Erich Gamma and Kent Beck.
3. It is an application programming interface for developing test cases in java which is part of the
XUnit Family.
4. It helps the developer to write and execute repeatable automated tests.
5. Eclipse IDEcomes with both Junit and its plug-in for working with Junit.
6. Junit also has been ported to various other languages like PHP, Python, C++ etc.

Question2: Who should use Junit, developers or testers?

Answer:Used by developers to implement unit tests in Java. Junit is designed for unit testing, which
is really a coding process, not a testing process. But many testers or QA engineers are also required
to use Junit for unit testing.

Question3: Why do you use Junit to test your code?

Answer:Junit provides a framework to achieve all the following-:

1. Test early and often automated testing.


2. Junit tests can be integrated with the build so regression testing can be done at unit level.
3. Test Code reusage.
4. Also when there is a transfer Junit tests act as a document for the unit tests.

Question4: How do you install Junit?

Answer:Lets see the installation of Junit on windows platform:

1. Download the latest version of Junit fromhttp://download.sourceforge.net/junit/

2. Uncompress the zip to a directory of your choice.

3. Add JUnit to the classpath:

setCLASSPATH=%CLASSPATH%;%JUNIT_HOME%junit.jar

4. Test the installation by running the sample tests that come along with Junit located in the
installation directory. Therefore, make sure that the JUnit installation directory is on your
CLASSPATH. Then simply type:
java org.junit.runner.JUnitCore org.junit.tests.AllTests

All the tests should pass with an OK message. If the tests dont pass, verify that junit.jar is in the
CLASSPATH.

Question5: What are unit tests?

Answer:A unit test is nothing more than the code wrapper around the application code that can be
executed to view pass fail results.

Question6: When are Unit Tests written in Development Cycle?

Answer:Tests are written before the code during development in order to help coders write the best
code. Test-driven development is the ideal way to create a bug free code. When all tests pass, you
know you are done! Whenever a test fails or a bug is reported, we must rst write the necessary unit
test(s) to expose the bug(s), and then x them. This makes it almost impossible for that particular bug
to resurface later.

Question7: How to write a simple Junit test class?

Answer:To write a test case, follow these steps:

1. Dene a subclass of TestCase.


2. Override the setUp() method to initialize object(s) under test.
3. Optionally override the tearDown() method to release object(s) under test.

Dene one or more public testXYZ() methods that exercise the object(s) under test and assert
expected results.

Question8: What Is Junit TestCase?

Answer:JUnit TestCase is the base class, junit.framework.TestCase, that allows you to create a test
case. (Although, TestCase class is no longer supported in JUnit 4.4.)

A test case denes the xture to run multiple tests. To dene a test case

-Implement a subclass of TestCase

-Dene instance variables that store the state of the xture

-Initialize the xture state by overriding setUp

-Clean-up after a test by overriding tearDown

Each test runs in its own xture so there can be no side effects among test runs.

Question9: What Is Junit TestSuite?


Answer:JUnit TestSuite is a container class under package junit.framework.TestSuite. It allows us to
group multiple test cases into a collection and run them together. (JUnit 4.4 does not support
TestSuite class now).

Question10: What is Junit Test Fixture?

Answer:A test xture is a xed state of a set of objects used as a baseline for running tests. Their
purpose is to ensure that there is a well known and xed environment in which tests are run so that
results are repeatable. Examples of xtures:

Loading a database with a specic, known set of data


Copying a specic known set of les
Preparation of input data and setup/creation of fake or mock objects

If a group of tests shares the same xtures, you should write a separate setup code to create the
common test xture. If a group of tests requires different test xtures, you can write code inside the
test method to create its own test xture.

Question11: What happens if a Junit test method is declared as private?

Answer:If a Junit test method is declared as private, the compilation will pass ok. But the execution
will fail. This is because Junit requires that all test methods must be declared as public.

Question12: What happens If a Junit test method Is declared to return String?

Answer:If a Junit test method is declared to return String, the compilation will pass ok. But the
execution will fail. This is because Junit requires that all test methods must be declared to return
void.

Question13: Why not just use system.out.println () for Unit Testing?

Answer:Debugging the code using system.out.println() will lead to manual scanning of the whole
output every time the program is run to ensure the code is doing the expected operations. Moreover,
in the long run, it takes lesser time to code Junit methods and test them on our les.

Question14: The methods Get () and Set () should be tested for which conditions?

Answer:Unit tests performed on java code should be designed to target areas that might break.
Since the set() and get() methods on simple data types are unlikely to break, there is no need to test
them explicitly. On the other hand, set() and get() methods on complex data types are vulnerable to
break. So they should be tested.

Question15: For which conditions, the methods Get () and Set () can be left out for testing?

Answer:You should do this test to check if a property has already been set (in the constructor) at the
point you wish to call getX(). In this case you must test the constructor, and not the getX() method.
This kind of test is especially useful if you have multiple constructors.

Question16: Do you need to write a test class for every class that needs to be tested?
Answer:No. We need not write an independent test class for every class that needs to be tested. If
there is a small group of tests sharing a common test xture, you may move those tests to a new test
class. If you have two groups of tests that you think youd like to execute separately from one another,
it is wise to place them in separate test classes.

Question17: How do you test a protected method?

Answer:A protected method can only be accessed within the same package where the class is
dened. So, testing a protected method of a target class means we need to dene your test class in
the same package as the target class.

Question18: How do you test a private method?

Answer:A private method only be accessed within the same class. So there is no way to test a
private method of a target class from any test class. A way out is that you can perform unit testing
manually or can change your method from private to protected.

Question19: Do you need to write a main () method compulsorily in a Junit test case class?

Answer:No. But still developers write the main() method in a JUnit test case class to call a JUnit test
runner to run all tests dened in this class like:

publicstaticvoidmain(String[]args){
junit.textui.TestRunner.run(Calculator.class);
}

Since you can call a JUnit runner to run a test case class as a system command, explicit main() for a
Junit test case is not recommended. junit.textui.TestRunner.run() method takes the test class name as
its argument. This method automatically nds all class methods whose name starts with test. Thus it
will result in below mentioned ndings:

1. testCreateLogFile()
2. testExists()
3. testGetChildList()

It will execute each of the 3 methods in unpredictable sequence (hence test case methods should be
independent of each other) and give the result in console.

Question20: What happens if a test method throws an exception?

Answer:If you write a test method that throws an exception by itself or by the method being tested,
the JUnit runner will declare that test as fail.

The example test below is designed to let the test fail by throwing the uncaught
IndexOutOfBoundsException exception:

importorg.junit.*;
importjava.util.*;
publicclassUnexpectedExceptionTest2{
//throwanyunexpectedexception
@TestpublicvoidtestGet()throwsException{
ArrayListemptyList=newArrayList();
ExceptionanyException=null;//don'tcatchanyexception
ExceptionanyException=null;//don'tcatchanyexception
Objecto=emptyList.get(1);}
}

If you run this test, it will fail:

OUTPUT:
There was 1 failure:

testGet(UnexpectedExceptionTest2)

java.lang.IndexOutOfBoundsException: Index: 1, Size: 0

at java.util.ArrayList.RangeCheck(ArrayList.java:547)

at java.util.ArrayList.get(ArrayList.java:322)

at UnexpectedExceptionTest2.testGet(UnexpectedExceptionTest2.ja

at sun.reect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reect.NativeMethodAccessorImpl.invoke(NativeMethodAcce

at sun.reect.DelegatingMethodAccessorImpl.invoke(DelegatingMe

at java.lang.reect.Method.invoke(Method.java:597)

at org.junit.internal.runners.TestMethod.invoke(TestMethod.java

at org.junit.internal.runners.MethodRoadie.runTestMethod(Method

at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.j

at org.junit.internal.runners.MethodRoadie.runBeforesThenTestTh

at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie

at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.jav

at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMetho

at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUni

at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4Cla

at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassR

at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoa
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4Class

at org.junit.internal.runners.CompositeRunner.runChildren(Compo

at org.junit.internal.runners.CompositeRunner.run(CompositeRunn

at org.junit.runner.JUnitCore.run(JUnitCore.java:130)

at org.junit.runner.JUnitCore.run(JUnitCore.java:109)

at org.junit.runner.JUnitCore.run(JUnitCore.java:100)

at org.junit.runner.JUnitCore.runMain(JUnitCore.java:81)

at org.junit.runner.JUnitCore.main(JUnitCore.java:44)

FAILURES!!!

Tests run: 1, Failures: 1

Question21: When objects are garbage collected after a test is executed?

Answer:By design, the tree of Test instances is built in one pass. Then the tests are executed in a
second pass. The test runner holds strong references to all Test instances for the duration of the test
execution. This means that for a very long test run with many Test instances, none of the tests may be
garbage collected until the end of the entire test run. Therefore, if you allocate external or limited
resources in a test, you are responsible for freeing those resources. Explicitly setting an object to null
in the tearDown() method, for example, allows it to be garbage collected before the end of the entire
test run.

Question22: What is Java assert statement?

Answer:Java assertions allow the developer to put assert statements in Java source code to help
unit testing and debugging.

An assert statement has the following format:

assertboolean_expression:string_expression;

When this statement is executed:

If boolean_expression evaluates to true, the statement will pass normally.


If boolean_expression evaluates to false, the statement will fail with an AssertionError
exception.

Helper methods which help to determine if the methods being tested are performing correctly or not
assertEquals([String message], expected, actual)any kind of object can be used for testing
equality native types and objects, also specify tolerance when checking for equality in case of
oating point numbers.
assertNull([String message], java.lang.Objectobject)asserts that a given object is null
assertNotNull([String message], java.lang.Objectobject)asserts that a given object isnotnull
assertTrue([String message], Boolean condition)Asserts that the given Boolean condition is
true
assertFalse([String message], Boolean condition)Asserts that the given Boolean condition is
false
fail([String message])Fails the test immediately with the optional message

Example-:

publicvoidtestSum(){
intnum1=15;
intnum2=50;
inttotal=35;
intsum=0;
sum=num1+num2;
assertEquals(sum,total);
}
JUnitInterviewQuestionsandAnswers

Difficulty Level: All Beginner Intermediate Expert


Ques 1.Who Should Use JUnit?
Ques 2.Why Do You Use JUnit to Test Your Code?
Ques 3.How To Compile a JUnit Test Class?

Ques 4.How To Write a Simple JUnit Test Class?


Ques 5.How To Run a JUnit Test Class?
Ques 6.What CLASSPATH Settings Are Needed to Run JUnit?
Ques 7.How Do I Run JUnit Tests from Command Window?
Ques 8.How To Write a JUnit Test Method?
Ques 9.Why Not Just Use a Debugger for Unit Testing?
Ques 10.Why Not Just Write a main() Method for Unit Testing?

Ques 11.Why Not Just Use System.out.println() for Unit Testing?


Ques 12.Under What Conditions Should You Test set() and get() Methods?

Ques 13.Do You Need to Write a Test Class for Every Class That Need to Be Tested?

Ques 14.Can You Explain the Life Cycle of a JUnit3.8 Test Case Class?
Ques 15.Please Explain the Life Cycle of a JUnit 4.4 Test Class?

Ques 16.How Do You Test a private Method?


Ques 17.How Do You Test a protected Method?

Ques 18.How to create a Test Suite using JUnit in Eclipse?

Ques 19.How To Create Test Class in Eclipse?


Ques 20.How Often Should You Run Your JUnit Tests?

Ques 21.Do You Have To Write a Test for Everything?


Ques 22.How Do You Test a Method That Does not Return Anything?

Ques 23.When Should Unit Tests Should Be Written In Development Cycle?


Ques 24.What is JUnit?
JavaInterviewQuestionsandAnswersonJunitandMocking
Frameworks
1.Whichofthefollowingareusuallyautomatedandwhichareexecutedmanually?

UnitTest
IntegrationTest

Ans.UnitTestareusuallyautomatedandIntegrationTestsareusuallyexecutedmanually.

2.WhatareJunits?

Ans.JuntistheunittestingframeworkforJava.

3.AreJunitstestedmanually?

Ans.No,theyareexecutedautomatically.

4.Howtotestwhetherthereturnsvalueofthemethodisexpected?

Ans.UsingAssert.

5.WhichpackageAssertbelongto?

Ans.java.unit

6.Whathappensiftheassertdoesn'tevaluatetobetrue?

Ans.Junitfails.

7.HowtocreateaJunittomakesurethatthetestedmethodthrowsanexception?

Ans.UsingannotationTestwiththeargumentasexpectedexception.

@Test(expected=Exception.class)

8.WhatshouldIdoifIwanttomakesurethataparticularmethodofaclassisgettingcalled
?

Ans.Ifitsastaticmethodoftheclass,wecanuseverifytomakesureit'sgettingcalled.

Ifitsaninstancemethod,Wecanmocktheobjectandthenuseverifywiththemockedobjecttomake
surethatthemethodisgettingcalled."

9.NamefewJavaMockingframeworks?

Ans.Mockito,PowerMock,EasyMock,JMock,JMockit

10.WhatistheuseofMockito.any?

Ans. In case we need to verify that a method is being called with any argument and not a specific
argumentwecanuseMockito.any(Class),Mockito.anyString,Mockito.anyLongetc.

11.Howshouldweignoreoravoidexecutingsetoftests?

Ans.Wecanremove@Testfromtherespectivetestsoastoavoiditsexecution.Alternativelywecanput
@IgnoreannotationontheJunitfileifwewanttoignorealltestsinaparticularfile.
12.Howcanwetestmethodsindividuallywhicharenotvisibleordeclaredprivate?

Ans.Wecaneitherincreasetheirvisibilityandmarkthemwithannotation@VisibleForTestingorcanuse
reflectiontoindividuallytestthosemethods.
InterviewQuestionsandAnswersfor'Junit'19question(s)foundOrderByNewest

Q1. How to create a Junit to make sure that the tested method admin
throwsanexception? info@buggybread.com

Ans.UsingannotationTestwiththeargumentasexpectedexception.

@Test(expected=Exception.class)

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss junitjunitannotations

admin
Q2.Howshouldweignoreoravoidexecutingsetoftests? info@buggybread.com

Ans.Wecanremove@Testfromtherespectivetestsoastoavoiditsexecution.Alternativelywe
canput@IgnoreannotationontheJunitfileifwewanttoignorealltestsinaparticularfile.

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss junit@test@ignoreunittestsunittestingtesting

Q3.Howcanwetestmethodsindividuallywhicharenotvisibleor admin
declaredprivate? info@buggybread.com

Ans. We can either increase their visibility and mark them with annotation @VisibleForTesting or
canusereflectiontoindividuallytestthosemethods.

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss junitreflectionapi@visiblefortestingwhiteboxtester

Q4. What are the steps to be performed while coding Junit with admin
Mockingframework? info@buggybread.com

Ans.Initializerequiredobjectsforworkingwithmocksandtestedmethod
Setthemockbehaviourondependentobjects
Executethetestedmethod
Performassertions
Verifyifamethodisinvokedornot

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss junitmockingframeworksmockunittestingjavawhiteboxtesting

Q5.Whatisassertkeywordusedfor? Anonymous

Ans.Theassertkeywordisusedtomakeanassertion astatementwhichtheprogrammer
believesisalwaystrueatthatpointintheprogram.Thiskeywordisintendedtoaidintestingand
debugging.

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss javajunit.asserttestingwhiteboxtesting

admin
Q6.DifferencebetweenAssertandVerify? info@buggybread.com

Ans.Assertworksonlyifassertions(ea)areenabledwhichisnotrequiredforVerify.

Assert throws an exception and hence doesn't continue with the test if assert evaluates to false
whereasit'snotsowithVerify.

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss assertjunitmockitoverifytestingunittestingbarclays

Admin
Q7.WhataretheannotationsusedinJunitwithJunit4? info@buggybread.com

Ans.@Test

TheTestannotationindicatesthatthepublicvoidmethodtowhichitisattachedcanberunasa
testcase.

@Before

TheBeforeannotationindicatesthatthismethodmustbeexecutedbeforeeachtestintheclass,
soastoexecutesomepreconditionsnecessaryforthetest.
@BeforeClass

TheBeforeClassannotationindicatesthatthestaticmethodtowhichisattachedmustbeexecuted
onceandbeforealltestsintheclass.

@After

TheAfterannotationindicatesthatthismethodgetsexecutedafterexecutionofeachtest.

@AfterClass

TheAfterClassannotationcanbeusedwhenamethodneedstobeexecutedafterexecutingallthe
testsinaJUnitTestCaseclasssoastocleanupthesetup.

@Ignores

TheIgnoreannotationcanbeusedwhenyouwanttemporarilydisabletheexecutionofaspecific
test.

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss javajunitjnuit4junitannotations

Q8. What should I do if I want to make sure that a particular admin


methodofaclassisgettingcalled? info@buggybread.com

Ans.Ifitsastaticmethodoftheclass,wecanuseverifytomakesureitsgettingcalled.

Ifitsaninstancemethod,Wecanmocktheobjectandthenuseverifywiththemockedobjectto
makesurethatthemethodisgettingcalled.

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss junitmockitomock

admin
Q9.WhatistheuseofMockito.any? info@buggybread.com

Ans.Incaseweneedtoverifythatamethodisbeingcalledwithanyargumentandnotaspecific
argumentwecanuseMockito.any(Class),Mockito.anyString,Mockito.anyLongetc.

Help us improve. Please let us know the company, where you were asked this question :
Like Discuss junitmockitomockmockito.any

DoyouthinkthesearetheBestJavaFrameworks?

Checkeverything
SPRING Apache thatisBestinJava
MVC Stripes
ClickHere
OpenXava

admin
Q10.NamefewJavaMockingframeworks? info@buggybread.com

Ans.Mockito,PowerMock,EasyMock,JMock,JMockit

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss junitmockingframeworksmockarchitecturewhiteboxtesting

Q11.Whichofthefollowingannotationisusedtoavoidexecuting Anonymous
Junits?

a.@explicit
b.@ignore
c.@avoid
d.@NoTest
Ans.@ignore

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss javatestingjunitunittesting

Q12. Which of the following is not the advantage of Mocking Anonymous


frameworks?

a.Ithelpstestingthemoduleindependently
b.Ithelpsinfasterunittesting
c. It helps in testing code even when external dependencies like
servicecallsarenotworking
d.IthelpsindoingendtoendIntegrationTesting
Ans.IthelpsindoingendtoendIntegrationTesting

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss mockingframeworksmockitounittestingjunits

Testing 2016110408:13:38
Q13.WriteaTestCaseusingMock?

Ans. http://javasearch.buggybread.com/CodeSnippets/searchCodeSamples.php?
keyword=mock&category=code

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss JunitMock CapitalOne

Junit 2016112211:18:43
Q14.Whatistheuseof@Beforeannotation?

Ans. When executing tests it is common that multiple tests need similar objects to be created
beforetheycanrun.@beforespecifiesamethodthatprovidethatinitializationforthesetofUnit
Tests.

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss

Testing 2016120716:13:30
Q15.Haveyouevertriedmockingstaticmethods?

Ans. Yes, that can be done using Power Mock. Mockito doesnt provide a way to mock static
methods.

Help us improve. Please let us know the company, where you were asked this question :
Like Discuss Mockitojunitpowermock

Junit 2017050913:34:52
Q16. Does a Junit without any assertions makes any
sense?

Ans. Yes, If we are testing a code segment to check if throws / doesn't throw an exception.
Moreoverwhiletestingvoidmethods,wemayjustverifyandnotuseassert.

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss junitassert

Junit 2017051716:50:18
Q17.What are the benefits of assertThat over assert in
Junits?

Ans. assertThat is introduced with Junit4 and offers many advatanges over assert. Messages are
more explanatory, offer better type safety and are more readable. Moreover hamcrest library is
portableasitcanusedbothwithjunitandTestNG.MoreoverassertThatprovidesflexibilityasthe
same method can be used for assert , assertEquals,assertTrue etc through the use of matcher
methods.

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss assertThatassertassertvsassertThat

Junit 2017051716:52:13
Q18.Canyounamefewmatchersthatcanbeusedwith
hamcrestassertThatmethod?

Ans.is
not
equals
anyOf
hasSize

Help us improve. Please let us know the company, where you were asked this question :

Like Discuss assertThat.hamcrest


Q19.Whichoffollowingannotationisusedtoinitializeobjects Junit

beforeexecutingsetoftests?
a.@Test
b.@Ignore
c.@After
d.@Before

Ans.d.@Before
JavaUnitTestingInterview
Questions
byAjiteshKumar Aug.06,14DevOpsZone

Like(0) Comment(0) Save Tweet

DownloadTheDevOpsJourneyFromWaterfalltoContinuousDeliveryto
learnlearnabouttheimportanceofintegratingautomatedtestingintotheDevOps
workflow,broughttoyouinpartnershipwithSauceLabs.

Thearticlepresentssomeofthefrequentlyaskedinterviewquestionsinrelation
withunittestingwithJavacode.Pleasesuggestotherquestionstthatyoucame
acrossandIshallincludeinthelistbelow.

1.Whatisunittesting?Whichunittestingframeworkdidyouuse?Whatare
someofthecommonJavaunittestingframeworks?
Ans:ReadthedefinitionofUnittestingonWikipediapageforunittesting.
Simplyspeaking,unittestingisabouttestingablockofcodeinisolation.
TherearetwopopularunittestingframeworkinJavanamedasJunit,TestNG.
2.InSDLC,Whenistherighttimetostartwritingunittests?
Ans:TestalongifnottestdrivenWritingunitteststowardsendisnotvery
effective.Testalongtechniquerecommendsdeveloperstowritetheunittests
astheygowiththeirdevelopment.
3.WithJunit4,dowestillneedmethodssuchassetUpandtearDown?
Ans:No.Thisistakencarewithhelpof@Beforeand@Afterannotations
respectively
4.Whatdofollowingjunittestannotationsmean?
Ans:FollowingisalistoffrequentlyusedJUnit4annotations:@Test(@Test
identifiesatestmethod)
@Before(Ans:@BeforemethodwillexecutebeforeeveryJUnit4test)@After
(Ans:@AftermethodwillexecuteaftereveryJUnit4test)@BeforeClass(Ans:
@BeforeClassmethodwillbeexecutedbeforeJUnittestforaClass
starts)@AfterClass(Ans:@AfterClassmethodwillbeexecutedafterJUnittest
foraClassiscompleted)@Ignore(@Ignoremethodwillnotbeexecuted)
5.Howdoonedoexceptionhandlingunittestsusing@Testannotation?
Ans:@Test(expected={exceptionclass}.Forexample:
@Test(expected=IllegalArgumentException.class)

6.Writeasampleunittestingmethodfortestingexceptionnamedas
IndexOutOfBoundsExceptionwhenworkingwithArrayList?

@Test(expected=IndexOutOfBoundsException.class)
publicvoidoutOfBounds(){
newArrayList<Object>().get(1);
}

7.Writeasampleunittestingmethodfortestingtimeout?

@Test(timeout=100)
publicvoidinfinity(){
while(true);
}

8.Whatisunittestingmethodnamingconventionthatyoufollow?
Ans:Unittestsnameshouldactlikethedocumentationgivingaclearideaon
whatfunctionalityistested.Therearevarioustechniquesthatcouldbeusedto
nameunittests.Someofthemarefollowing:GivenWhenThen..or
ShouldThenetc.
9.Whatarecalledastestsmellsinrelationwithunittesting?
Ans:Followingcouldbetermedastestsmells:Multipleassertionswithinone
unittest,longrunningunittestsetc
10.Whataretop23advantagesofwritingunittests?
Ans:Designtestability,Codetestability,Codemaintainabilityasgoodunit
testsenforcesOOprinciplessuchasSingleResponsitbilityetcwhichenables
peopleavoidcodesmellssuchaslongclasses,longmethods,largeconditionals
etc.
11.Whataretop23characteristicsofHardtotestcode?
Ans:Longmethods,Longconditionals,mixingconcerns,bulkyconstructors
12.Whatismocking&stubbing?Whatarekeydifferencesbetweenthem?Didyou
useanymockingframework?
Ans:ReaddetailsonWhatisdifferencebetweenstubbingandmockingon
thispage..TherearevariousdifferentJavamockingframeworksuchas
Mockito,EasyMocketc.
13.Whataretop23advantagesofmocking?
Ans:1.Verifyinteractions2.Testtheblockofcodeinisolation
14.Howiscodecyclomaticcomplexityrelatedtounittests?
Ans:Ascodecyclomaticcomplexityisdeterminedbasedonnumberof
decisionpointswithinthecodeandhenceexecutionpaths,highercyclomatic
complexitymakesitdifficulttoattainachievetest/codecoverage.
15.Whatiscodecoverage?Howisitmeasured?NamesomeJUnitcodecoverage
tools?Ans:Cobertura,EclEmma
16.Namesomecodesmellswhichmakesithardtoachievehighcodecoverage?
Ans:Longmethod,Largeconditionals
17.Whatistestdrivendevelopment(TDD)?
Ans:ReadthedetailsonWikipediapageforTDD.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question1of24
5points

WhyNotJustUseaDebuggerforUnitTesting?

Automatedunittestingrequiresextratimetosetupinitially.Butitwillsaveyourtime,ifyourcoderequires
changesmanytimesinthefuture.Adebuggerisdesignedformanualdebuggingandmanualunittesting,notfor
automatedunittesting.JUnitisdesignedforautomatedunittesting.

1. False
2. True

Correct

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter

HAVEQUESTIONS?

8887891482
Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering

interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question2of24
5points

WhatisJUnit?

JUnitisasoftwaretestingframeworkforunittesting,openSourceSoftwaremaintainedbytheJUnit.org
community.JUnitwasoriginallywrittenbyErichGammaandKentBeck.

Testrunnersforrunningtests
Testfixturesforsharingcommontestdata
Assertionsfortestingexpectedresults

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter

HAVEQUESTIONS?
8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering
interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question3of24
5points

DoYouHaveToWriteaTestforEverything?

Youhavetowriteatestforeverythingthatcouldreasonablybreak.KeepinmindNullPointerExceptionwhich
occursmaximum.
Bepracticalandmaximizeyourtestinginvestment.Rememberthatinvestmentsintestingareequalinvestments
indesign.Ifdefectsaren\tbeingreportedandyourdesignrespondswelltochange,thenyou\reprobably
testingenough.Ifyou\respendingalotoftimefixingdefectsandyourdesignisdifficulttogrow,youshould
writemoretests.
Ifsomethingisdifficulttotest,it\susuallyanopportunityforadesignimprovement.Looktoimprovethe
designsothatit\seasiertotest,andbydoingsoabetterdesignwillusuallyemerge.

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter
HAVEQUESTIONS?

8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering
interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question4of24
5points

HowToRunaJUnitTestClass?

AJUnittestclassusuallycontainsanumberoftestmethods.YoucanrunalltestmethodsinaJUnittestclass
withtheJUnitCorerunnerclass.Forexample,torunthetestclassLoginTest.javadescribedpreviously,you
shoulddothis:
javacp.
junit4.4.jarorg.junit.runner.JUnitCoreLoginTest
JUnitversion4.4
Time:0.015
OK(1test)
Thisoutputsaysthat1testsperformedandpassed.Thesameyoucanperformbyexecutingbuild.xmlalso.

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter
HAVEQUESTIONS?

8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering
interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question5of24
5points

HowToCreateTestClassinEclipse?

ToCreateTestClassinEclipseyoumust:

1.SelectFileNewJUnitTestCase.
2.Selectthearrowofthebuttonintheupperleftofthetoolbar.SelectJUnitTestCase.
3.RightclickonapackageinthePackageExplorerviewintheJavaPerspective,andselectJUnitTestCase.
4.Clickonthearrowoftheiconinthetoolbar.SelectJUnitTestCase.
5.YoucancreateanormalJavaclassasshownintheEclipsetutorial,butincludejunit.framework.TestCaseas
thesuperclassofthetestclassyouarecreating.

1. True
2. False

Correct

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter
HAVEQUESTIONS?

8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering
interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question6of24
5points

HowDoYouTestaprotectedMethod?

Asamethodisdeclaredas\protected\,itcanonlybeaccessedwithinthesamepackagewheretheclassis
defined.Totesta\protected\methodofatargetclass,youneedtodefineyourtestclassinthesamepackage
asthetargetclass.

1. True
2. False

Correct

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter

HAVEQUESTIONS?

8887891482
Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering

interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question7of24
5points

HowToWriteaJUnitTestMethod?

IfyouwanttowriteaJUnitTestMethodyouneedtomarkthemethodasaJUnittestmethodwiththeJUnit
annotation:@org.junit.Test.

*AJUnittestmethodmustbea\public\method.Thisallowstherunnerclasstoaccessthismethod.
*AJUnittestmethodmustbea\void\method.Therunnerclassdoesnotcheckanyreturnvalues.
*AJUnittestshouldperformoneJUnitassertioncallinganorg.junit.Assert.assertXXX()method.
HereisasimpleJUnittestmethod:
importorg.junit.*
@TestpublicvoidtestLogin(){
Stringusername=\withoutbook\
Assert.assertEquals(\withoutbook\,username)
}

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search
Tosearch,typeandhitenter

HAVEQUESTIONS?

8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering

interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question8of24
5points

HowDoYouTestaprivateMethod?

Whenamethodisdeclaredas\private\,itcanonlybeaccessedwithinthesameclass.Sothereisnowayto
testa\private\methodofatargetclassfromanytestclass.
Toresolvethisproblem,youhavetoperformunittestingmanually.Oryouhavetochangeyourmethodfrom
\private\to\protected\.
Orifitisnotpossibletoconvertanyoftheaboveways,youcantestprivatemethodbyusingPowerMock
partialMock.

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter

HAVEQUESTIONS?
8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering
interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question9of24
5points

DoYouNeedtoWriteaTestClassforEveryClassThatNeedtoBeTested?

Thereisnoneedtowriteonetestclassforeacheveryclassthatneedtobetested.Onetestclasscancontain
manytestsformanytesttargetclasses.Thetechnicalanswerisno.
Youshoulddesignonetestclasspertesttargetclassforlowlevelbasictests.Thismakesyourtestclassesmuch
easiertomanageandmaintain.Youshouldwriteseparatetestclassesforhighlevelteststhatrequiresmultiple
targetclassesworkingtogether.Thepracticalanswerisyes.

1. True
2. False

Correct

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter

HAVEQUESTIONS?
8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering
interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question10of24
5points

HowToWriteaSimpleJUnitTestClass?

YoushouldbeabletowritethissimpleJUnittestclasswithonetestmethod:
importorg.junit.*
publicclassLoginTest
{
@TestpublicvoidtestLogin()
{
Stringusername=\\\withoutbook\\\
Assert.assertEquals(\\\withoutbook\\\,username)
}
}
HerefirstargumentinassertEqualsistheknownparameterwhichshouldbeequaltousername.Ifbotharesame
itwillsendmetrueandifbotharenotequalsendsmefalse.

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions
Search

Tosearch,typeandhitenter

HAVEQUESTIONS?

8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA
CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering

interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question11of24
5points

WhenShouldUnitTestsShouldBeWrittenInDevelopmentCycle?

YoushouldwriteunittestbeforewritingthecodeifyouareaTDD(TestDrivenDevelopment)believer.Test
firstprogrammingispracticedbyonlywritingnewcodewhenanautomatedtestisfailing.
Goodteststellyouhowtobestdesignthesystemforitsintendeduse.Theyeffectivelycommunicateinan
executableformathowtousethesoftware.Theyalsopreventtendenciestooverbuildthesystembasedon
speculation.Whenallthetestspass,youknowyou\redone!
Wheneveracustomertestfailsorabugisreported,firstwritethenecessaryunittest(s)toexposethebug(s),
thenfixthem.Thismakesitalmostimpossibleforthatparticularbugtoresurfacelater.Testdrivendevelopment
isgainingmomentumthesedayscomparedtowritingtestsafterthecode.

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter
HAVEQUESTIONS?

8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering
interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question12of24
5points

WhyNotJustWriteamain()MethodforUnitTesting?

Youcanwriteamain()methodineachclassthatneedstobetestedforunittesting.Inthemain()method,you
couldcreatetestobjectoftheclassitself,andwritesometeststotestitsmethods.However,thisisnota
recommendedapproachbecauseofthefollowingpoints:
*Yourclasseswillbeclutteredwithtestcodeinmainmethod.Allthosetestcodeswillbepackagedintothe
finalproduct.
*Ifyouhavealotsofclassestotest,youneedtorunthemain()methodofeveryclass.Thisrequiressomeextra
codingeffort.
*IfyouwantthetestresultstobedisplayedinaGUI,youwillhavetowritecodeforthatGUI.
*IfyouwanttologtheresultsoftestsinHTMLformatortextformat,youwillhavetowriteadditionalcode.
*Ifonemethodcallfails,nextmethodcallswon\tbeexecuted.Youwillhavetoworkaroundthis.

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search
Tosearch,typeandhitenter

HAVEQUESTIONS?

8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering

interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question13of24
5points

Youshouldrunallyourunittestsasoftenaspossible,ideallyeverytimethecodeischanged.Makesureallyour
unittestsalwaysrunat100%.Frequenttestinggivesyouconfidencethatyourchangesdidn\tbreakanything
andgenerallylowersthestressofprogramminginthedark.
Forlargersystems,youmayjustrunspecifictestsuitesthatarerelevanttothecodeyou\reworkingon.Runall
youracceptance,integration,stress,andunittestsatleastonceperday.

1. True
2. False

Correct

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter

HAVEQUESTIONS?

8887891482
Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering

interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question14of24
5points

HowDoYouTestaMethodThatDoesnotReturnAnything?

ToTestaMethodThatDoesnotReturnAnythingyouneedtofollowthebelowlogics:

*Ifamethodisnotreturninganythingthroughthe\return\statement(voidmethod),itmayreturndata
throughitsarguments.Inthiscase,youcantestthedatareturnedinanyargument.
*Elseifamethodisnotreturninganydatathroughitsarguments,itmaychangevaluesofitsinstancevariables.
Inthiscase,youcantestchangesofanyinstancevariables.
*Elseifamethodisnotchanginganyinstancevariable,itmaychangevaluesofitsclassvariables.Inthiscase,
youcantestchangesofanyclassvariables.
*Elseifamethodisnotchanginganyclassvariable,itmaychangeexternalresources.Inthiscase,youcantest
changesofanyexternalresources.
*Elseifamethodisnotchanginganyexternalresources,itmayjustdoingnothingbutholdingthethreadina
waitingstatus.Inthiscase,youcantestthiswaitingcondition.
*Elseifamethodisnotholdingthethreadinwaitingstatus,thenthismethodisreallydoingnothing.Inthis
case,thereisnoneedtotestthismethod!

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions
Search

Tosearch,typeandhitenter

HAVEQUESTIONS?

8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA
CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering

interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question15of24
5points

WhyNotJustUseaDebuggerforUnitTesting?

Automatedunittestingrequiresextratimetosetupinitially.Butitwillsaveyourtime,ifyourcoderequires
changesmanytimesinthefuture.Adebuggerisdesignedformanualdebuggingandmanualunittesting,notfor
automatedunittesting.JUnitisdesignedforautomatedunittesting.

1. True
2. False

Correct

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter

HAVEQUESTIONS?

8887891482
Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering

interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question16of24
5points

WhyNotJustUseSystem.out.println()forUnitTesting?

WedontuseSystem.out.println()forUnitTestingbecauseifweadddebugstatementsintocode,itisalowtech
methodfordebuggingit.Itusuallyrequiresthatoutputbescannedmanuallyeverytimetheprogramisrunto
ensurethatthecodeisdoingwhat\sexpected.
ItgenerallytakeslesstimeinthelongruntocodifyexpectationsintheformofanautomatedJUnittestthat
retainsitsvalueovertime.Ifit\sdifficulttowriteatesttoassertexpectations,thetestsmaybetellingyouthat
shorterandmorecohesivemethodswouldimproveyourdesign.

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter

HAVEQUESTIONS?
8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering
interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question17of24
5points

HowtocreateaTestSuiteusingJUnitinEclipse?

TherearefourwaystocreateaJUnittestsuiteclassinEclipsewithJUnitplugin:org.junit_3.8.1.First,select
thedirectory(usuallyunittests)thatyouwishtocreatethetestsuiteclassin.
1.SelectFile>New>Other>Java>JUnit>JUnitTestSuite.
2.Selectthearrowofthebuttonintheupperleftofthetoolbar.SelectOther>Java>JUnit>JUnitTest
Suite,
3.RightclickonapackageinthePackageExplorerviewintheJavaPerspective,andselectOther>Java>
JUnit>JUnitTestSuite,
4.YoucancreateanormalJavaclassasshownintheEclipsetutorial,butincludejunit.framework.TestSuiteas
thesuperclassofthetestclassyouarecreating.

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter
HAVEQUESTIONS?

8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering
interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question18of24
5points

WhatCLASSPATHSettingsAreNeededtoRunJUnit?

YourunyourJUnittestsfromacommandline,fromanIDE,orfrom\ant\,youmustdefineyour
CLASSPATHsettingscorrectly.HereiswhatrecommendedbytheJUnitFAQwithsomeminorchanges:
TorunyourJUnittests,you\llneedthefollowingelemementsinyourCLASSPATH:
*TheJUnitJARfileshouldbethere.
*LocationofyourJUnittestclasses.
*Locationofclassestobetested.
*JARfilesofclasslibrariesthatarerequiredbyclassestobetested.
IffoundNoClassDefFoundErrorinyourtestresults,thensomethingismissingfromyourCLASSPATH.
IfyouarerunningyourJUnittestsfromacommandlineonaWindowssystem:
setCLASSPATH=c:\\A\\junit4.4.jarc:\\B\\test_classes
c:\\B\\target_classes
IfyouarerunningyourJUnittestsfromacommandlineonaUnix(bash)system:
exportCLASSPATH=/A/junit4.4.jar:/B/test_classes:
/C/target_classes:

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions
Search

Tosearch,typeandhitenter

HAVEQUESTIONS?

8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA
CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering

interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question19of24
5points

WhoShouldUseJUnit?

JUnitismostlyusedbydevelopersfortestingtheirwrittencode.JUnitisdesignedforunittesting,which
isreallyacodingprocess,notatestingprocess.ButmanytestersorQAengineers,arealsorequiredtouse
JUnitforunittesting.

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter

HAVEQUESTIONS?

8887891482
Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering

interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question20of24
5points

PleaseExplaintheLifeCycleofaJUnit4.4TestClass?

AJUnit4.4testclasscontainsa@Beforemethod,an@Aftermethodandmultiple@testmethods.When
callingatestrunnertorunthistestclass,therunnerwillexecutethosemethodsinaspecificordergivingthetest
classanexecutionlifecyclelikethis:
@Before
@TestXXX1
@After
@Before
@TestXXX2
@After

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter
HAVEQUESTIONS?

8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering
interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question21of24
5points

CanYouExplaintheLifeCycleofaJUnit3.8TestCaseClass?

LifeCycleofaJUnit3.8testcaseclasscontainsasetUp()method,atearDown()methodandmultipletestXXX()
methods.Whencallingatestrunnertorunthistestclass,therunnerwillexecutethosemethodsinaspecific
ordergivingthetestcaseclassanexecutionlifecyclelikethis:

setUp()
testXXX1()
tearDown()
setUp()
testXXX2()
tearDown()

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search
Tosearch,typeandhitenter

HAVEQUESTIONS?

8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering

interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question22of24
5points

HowToCompileaJUnitTestClass?

AsJUnitcodeiswritteninjava,compilingaJUnittestclassislikecompilinganyotherJavaclasses.Theonly
thingyouneedwatchoutisthattheJUnitJARfilemustbeincludedintheclasspathlikejunit.jaretc.For
example,tocompilethetestclassLoginTest.javadescribedpreviously,youshoulddothis:
javaccpjunit4.4.jarLoginTest.java
anditwillcreate.classfile.
LoginTest.class
Thecompilationisok,ifyouseetheLoginTest.classfile.

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter

HAVEQUESTIONS?
8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering
interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question23of24
5points

UnderWhatConditionsShouldYouTestset()andget()Methods?

Weshouldtestset()andget()Methodsbecausetargetareasthatmightbreak.set()andget()methodsonsimple
datatypesareunlikelytobreak.Sononeedtotestthem.
set()andget()methodsoncomplexdatatypesarelikelytobreak.Soyoushouldtestthem.

1. False
2. True

Incorrect

Next

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter

HAVEQUESTIONS?

8887891482
Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering

interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.
SQASolution

SQASolutionSQASolutionInterviewQuestionsJUnitInterviewQuizforQAEngineers
HOME QA SERVICES TRAINING DELIVERY MODELS INDUSTRIES CAREERS

JUnitInterviewQuizforQAEngineers
COMPANY

byadminonMay14,2014

JUnitInterviewQuestions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

20 21 22 23 24

Answered Review

Reviewquestion Quizsummary

Question24of24
5points

HowDoIRunJUnitTestsfromCommandWindow?

YouneedtocheckthefollowinglisttorunJUnittestsfromacommandwindow:
1.MakesurethatJDKisinstalledandthe\java\commandprogramisaccessiblethroughthePATHsetting.
Type\javaversion\atthecommandprompt,youshouldseetheJVMreportsyoubacktheversionstring.
2.MakesurethattheCLASSPATHisdefinedasshowninthepreviousquestion.
3.InvoketheJUnitrunnerbyenteringthefollowingcommand:
javaorg.junit.runner.JUnitCore

1. False
2. True

Incorrect

Quizsummary

#SQASolution

Taggedas:JUnitInterviewQuiz,JUnitInterviewQuiz[WpProQuiz4]

Previouspost:LogicalQuiz

Nextpost:TestNGInterviewQuestions

Search

Tosearch,typeandhitenter

HAVEQUESTIONS?
8887891482

Like 90peoplelikethis.SignUptosee
whatyourfriendslike.

"...oneoftheverybesttestingteams..."

QAManager,PharmaCompany

"...providingdifficulttofindQAresources..."

ProjectManager,eMarketing

"...alwaysverythorough..."

CTO,GovernmentAgency

"WhenourQAteamsareoverextended,SQASolutionprovidesuswithacosteffectivestrategythat
works.WenowrelyonSQASolutionforeverymajorrelease."

AlexM.,Fortune100FinancialInstitution

Contactusformorereferences

09/04/2015QAResumePreparationGuidelines
05/28/2015QASoftwareTestingResumeReviewsessions
03/02/2015ClassDemoandQABootcampOpenHouse
02/16/2015TESTERS:TellYourStoryatSoftwareQAandTestersMeetup
10/21/2014RoundTable:CareerDevelopmentforSoftwareTestersandQA

CaseStudy:MobileAppTestingonRealHandsets
CaseStudy:ReleaseandConfigurationManagement
CaseStudy:ReleaseEngineering
interested
SoftwareQualityAssurance(QA)EngineerSkills
Interested
QAResumeServices
AutomatedTestGenerationUsingConcolicTesting

Tags

AgileTesting applicationtestingcompany AppStoreBetaTesting BlackBoxTestingCaseStudycompanies


CompatibilityTestingContactUsCustomerQuoteDatabaseTestingEDITestingExploratoryTestingFacebookAppTesting
FunctionalTestingiPhoneAppTestingjob mobiletestingMobileTestingServices OutsourceSoftwareTesting
QAQACaseStudyqacompaniesQATestingServicesQTPqualityRentTestersReportsTestingSan
FranciscoSeleniumsoftwareQAsoftwareqaservicessoftwarequalityassuranceSoftwareTestingsoftwaretesting
companiessoftwaretestingservicesSQASQASolutionTestAutomation testingTest
Process topsoftwaretestingcompaniesUITestingUSvalidation

Home/Sitemap/PoliciesandTerms/ContactUs/Careers/Services/NDA/Brochure

Copyright2013SQASolution.Allrightsreserved.

S-ar putea să vă placă și