Click here to Skip to main content
14,492,468 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Sander Rossel26-Nov-19 9:32
professionalSander Rossel26-Nov-19 9:32 
GeneralRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Rick York26-Nov-19 10:29
mveRick York26-Nov-19 10:29 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Marc Clifton26-Nov-19 12:11
mvaMarc Clifton26-Nov-19 12:11 
GeneralRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Dan Neely27-Nov-19 3:22
MemberDan Neely27-Nov-19 3:22 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
GuyThiebaut26-Nov-19 20:47
professionalGuyThiebaut26-Nov-19 20:47 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
RichardS26-Nov-19 21:02
MemberRichardS26-Nov-19 21:02 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Tomas Takac26-Nov-19 21:26
MemberTomas Takac26-Nov-19 21:26 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Carl_Sharman26-Nov-19 21:41
MemberCarl_Sharman26-Nov-19 21:41 
I suspect anybody who's done a significant amount of automated testing will have experienced the frustration of spending more time maintaining the tests than the code itself. Too many, or too complicated tests can become a burden, so for me it's always a tradeoff between coverage and simplicity.

I've found that testing the full stack with a test DB (what I would call end-to-end tests) gives great test coverage - without these, it's quite possible to have lots of passing unit tests but a system that doesn't actually work when put together. However, maintaining the schema and data in the test DB is an overhead, and worse, end-to-end tests can be brittle and very hard to debug when you get a failure.

On the other hand, I've found that with unit or integration tests to get a useful test often requires quite a bit of mocking, which can quickly get quite complex, and lead to tests that can be... brittle and hard to debug when you get a failure.

Supporting end-to-end tests with good unit/integration tests gives the best of both worlds, but leads to lots of tests and lots of complexity, all of which requires maintenance.

I'm curious: You mentioned that you have preferences, and as you've experienced both strategies in several places, I'd be really interested to know what these are?
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Stuart Dootson26-Nov-19 22:58
professionalStuart Dootson26-Nov-19 22:58 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
#realJSOP27-Nov-19 1:11
mva#realJSOP27-Nov-19 1:11 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Ed K27-Nov-19 2:31
MemberEd K27-Nov-19 2:31 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
davecasdf27-Nov-19 4:36
Memberdavecasdf27-Nov-19 4:36 
GeneralRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
MSBassSinger27-Nov-19 6:42
professionalMSBassSinger27-Nov-19 6:42 
AnswerRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
Bruce Patin27-Nov-19 6:58
MemberBruce Patin27-Nov-19 6:58 
GeneralRe: Unit testing discussion - Mock Data - Yes, No, or Yes & No? Pin
MSBassSinger27-Nov-19 7:08
professionalMSBassSinger27-Nov-19 7:08 
GeneralThought of the Day Pin
OriginalGriff26-Nov-19 5:07
mveOriginalGriff26-Nov-19 5:07 
GeneralRe: Thought of the Day Pin
DRHuff26-Nov-19 5:21
MemberDRHuff26-Nov-19 5:21 
GeneralRe: Thought of the Day Pin
Daniel Pfeffer26-Nov-19 5:40
professionalDaniel Pfeffer26-Nov-19 5:40 
GeneralRe: Thought of the Day Pin
W Balboos, GHB26-Nov-19 6:24
mveW Balboos, GHB26-Nov-19 6:24 
GeneralRe: Thought of the Day Pin
DRHuff26-Nov-19 9:08
MemberDRHuff26-Nov-19 9:08 
GeneralRe: Thought of the Day Pin
jeron126-Nov-19 6:59
Memberjeron126-Nov-19 6:59 
GeneralRe: Thought of the Day Pin
Kschuler26-Nov-19 8:20
MemberKschuler26-Nov-19 8:20 
GeneralRe: Thought of the Day Pin
Mike Hankey26-Nov-19 10:18
professionalMike Hankey26-Nov-19 10:18 
GeneralRe: Thought of the Day Pin
swampwiz26-Nov-19 15:54
Memberswampwiz26-Nov-19 15:54 
GeneralRe: Thought of the Day Pin
OriginalGriff26-Nov-19 20:41
mveOriginalGriff26-Nov-19 20:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.