What are two reasons to use mock objects in unit tests?
Suggested Answer: A, E
Get Premium PSD Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
Mock objects are simulating the behavior of dependencies such as persistance layers or APIs. By mocking these you can be sure about what you are testing, and not accidentally testing the external dependency.
22 comments · newest first
VA
Vallie
2 days ago
B sounds tempting, but it's not really true.
KI
Kimbery
7 days ago
E is crucial for isolating components.
MI
Minna
12 days ago
Agreed! A helps emulate behavior effectively.
PA
Patti
18 days ago
I think A and E are the best reasons.
AN
Anthony
23 days ago
I thought mocks were just for simulating behavior, not eliminating code!
BU
Bulah
28 days ago
D) is a bit extreme, TDD can work without mocks.
KE
Kenneth
1 month ago
Wait, B) isn't true, right? We still write some code for mocks.
LE
Leah
1 month ago
Totally agree, isolation is key for testing!
AL
Alishia
1 month ago
A) and E) are spot on!
CH
Christene
2 months ago
I thought TDD could work without mocks, isn't that a thing?
GI
Gilma
2 months ago
B) is misleading, we still write some code for mocks.
YA
Yan
2 months ago
Wait, are they really machine-generated? Sounds sketchy.
CA
Carman
2 months ago
Totally agree, isolating components is key!
CU
Curt
2 months ago
A) and E) are spot on!
NI
Nichelle
2 months ago
I think TDD can be done without mocks, but they definitely make things easier. I’m leaning towards A and E for the answer.
HU
Huey
3 months ago
I feel like we discussed how tight coupling is a bad thing, so option C doesn't make sense to me.
CI
Ciara
3 months ago
I remember something about emulating behavior from option A, but I'm not entirely sure how that works in practice.
AL
Alline
3 months ago
I think using mock objects helps isolate components, like option E mentions. It makes testing more controlled, right?
AR
Arleen
3 months ago
I definitely recall that mock objects help with isolation, so E seems solid, but I’m unsure about A.
YV
Yvette
3 months ago
I feel like B is misleading; mock objects are usually created manually, right?
PA
Paulina
4 months ago
I remember practicing a question like this, and I think isolating components is really important for effective testing.
TA
Tamesha
5 months ago
I think A and E are the right answers, but I'm not completely sure about the wording.