|
My short answer is "Yes and No".
I understand the theory and conventional wisdom about unit testing and integration testing. But I don't just go by what the "experts" say or where the herd goes. I apply value engineering and a long-term support consideration to implement those "conventional wisdom" principles in a way that maximizes benefit today and tomorrow on a project by project basis.
When I use mock data:
1 - early in the development process before a test database and any external services (for test mode) are available. In some cases, those test sources are not available, at least to developers.
2 - when the test database is unmaintained, or difficult to update (e.g. developers have to go through the DBA's team to do anything to a DB)
3 - when the project is so large, or so distributed among development teams that mock data is necessary for the benefit of other teams.
When I use test sources and NOT mock data:
1 - when available and easily updateable to developers (e.g. I never hire a developer who cannot at least create a T-SQL table with indices and stored procedures).
2 - when PII (Personally Identifiable Information) can be auto-generated to fill DB tables. Not hard to do, but creating such utility apps is helpful and can avoid lawsuits should the company be audited or test data leaks out.
When I use test sources AND mock data:
1 - Same reasons as above to use test sources - as available.
2 - I use mock data for those connection points where test sources are not reliably available.
In most situations, I use test sources only because I do not need mock data. As part of the initial design, the UI layout is created and approved at some point. As an offshoot, the DB design (tables, indices, PK-FK relationships) is done in parallel. I use my utility to generate the SPs for POCO CRUD, the POCO classes in C#, and the factory/manager classes in C# (I intentionally choose NOT to use the Entity Framework for a host of reasons not a part of this context). Once the UI and DB are relatively stable quantities, then I can work on the controllers and views for the WebAPI (I generally support both Blazor and Xamarin.Forms clients) using the generated code. Thus, I can write my unit tests to use actual sources.
I prefer to unit test the "stack" from WebAPI down to the source and back. Because I use an IDE that supports easy and thorough debugging (Visual Studio 2019 as of this writing), it is as easy for me to debug and fix a given unit with test sources as it is with mock data. By top-down testing throughout the "stack", I can know for certain that not only do all the parts work (in various testing case scenarios), but the integrated system works. And I only have to write one test project. What test database or service is used is configured, via transform in the project file) based on the environment chosen (typically dev, qa, uat, prod).
However, that is my approach. I find added value in this approach that I do not achieve with mock data alone. I have used this approach in simple and complex systems, with and without CI/CD. I have used this in systems with multiple databases/sources. It reduces testing complexity and coding time while finding issues not found with mock data alone.
Whatever approach works for you is probably your best choice. I appreciate the insights given by those who took the time to post.
|
|
|
|
|
I use mock data when the real data contains sensitive information that should not exist out of the production server. Also, if the project includes creating the data, the mock data just happens.
|
|
|
|
|
I agree with what you said. I ran into that at two employers with PII information. The utilities to create fake data for test and QA allowed me to include test databases instead of mock data. I guess, in a way, that is technically "mock" data, just without using a Mock functionality in testing.
|
|
|
|
|
Are barbershops hair conditioned?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
We should take a pole!
(Although the barber might get upset!)
I, for one, like Roman Numerals.
|
|
|
|
|
That's Brilliantine(TM).
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
I wonder how comb there's not more responses? It was ex-trim-ly difficult to come up with snippets of lexicon that seem a part of the theme.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
I responded for the shear fun of it!
I spent a little time looking for a Halloween character set to reply with since this post just screams the need for a BOO font look.
I, for one, like Roman Numerals.
|
|
|
|
|
Don't know if that one will razor lower status, but I'm certain we can't brush it off.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
No, but it would shave the day if they did!
|
|
|
|
|
Cut it or permit, those are your choices!
They call me different but the truth is they're all the same!
JaxCoder.com
|
|
|
|
|
I go to a "hipster" barber in Europe, and they always seem to put stuff in a few areas of the hair to make it go in a certain direction. It's pretty cool until I let it grow out by not getting the next cut for 6-8 months.
|
|
|
|
|
6-8 months?
I'm trying to work out the last time I had a hair cut, and the closest I can get is ... um ... "probably last century". The advantages of a ponytail!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Nope, I can tell you, and be reasonably accurate about it: Friday, 10 March 1989, at 21:30 (give or take ten minutes). Location: 51.097775, -0.849655[^]
My head was shaved for the second Comic Relief Day: the first raised £11 at my local pub, so I (foolishly and drunkenly) said that if they raised £500 for the second one, they could shave my head. The landlord chipped in the last £20 to get it over, the b*st*ard!
So on a busy Friday night the band was stopped, and my phair, beard and even eyebrows went.
Mind you ... I got a lot of free beer that night ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
No you would dye from the cold
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
OriginalGriff wrote: Are barbershops hair conditioned?
This is a bald question!
|
|
|
|
|
Yes orderd something from them... Asked to send ot to my postal address which is *not* my home address...
In midday - when most peple at work - one calls me that he is in town but has a PO Box and wants to know the address...
And now we start to dance to find a delivery point (the post office out of question as it would cost money and my home address terrifies one), and that means delay and me to drive to that point...
Fortunately I'm not in rush to get it... But still interesting what Amazon requires from the delivery company and why not work with local postal service (too)?
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
Although USP, FedEx and others for the final delivery, only (US) mail is allowed to be sent to a PO Box.
Now I'm not sure if this has changed in any way with USPS making the final delivery.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
People at my work have personal things delivered here to the office if they don't want it delivered at home. Either for security reasons or to maintain surprises from family members. Is that not an option for you?
|
|
|
|
|
I used it for smaller items, but this one is a bit larger to carry with me on bus (I do not like to drive into town for work because of the have traffic)..
What is my problem that Amazon accepts P.O. Box, but do not check if the delivery company does deliver there...
If it was stated in Amazon that way I would think of other addresses...
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
Hey, I've been fighting for three days with a company who refuses to send me my order because the Post Office (or at least the mechanism used to check with them) says my ZIP code is invalid.
It's not, of course. I get mail all the time, from all sorts of people.
I think the next step will be sending them photos of the mail I already get, with the ZIP code prominently displayed.
|
|
|
|
|
I almost as a matter of course involve code generation in my larger projects.
So that means I'm dealing with a lot of generated code.
Typically, I don't design my generated code for manual modification. I design the tool that generates it to be customizable. Ergo, the tool will make the code do what you want. Change the tool parameters to change the code but leave the code alone.
The reason being is it's almost always stupid to try to support generated code that a user has modified and for extremely complicated code, like parse tables, dfa tables, or business rule tables that have a lot of conditionals and branching.
So the code is a black box.
And because of *that* I throw a lot of traditional design assumptions out the window, or go meta with them.
Comments are an example: Commenting the generated code is pointless. Commenting the code that generates the code is project-critical
Constants are another example. It doesn't matter if you use hard coded values in your generated code if the values are const in the code that generates *it*. Generating private constants just adds to code size with not much upside. The exception is long constant strings.
And gotos are totally acceptable, especially in state machine code, and in the absence of cross language CodeDom loop break statements. (CodeDom only supports for() and no while() nor do while(), no break, no continue.
How many of you hate me for this, and who agrees with me here?
I'm just curious.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I agree.
I insert a comment at the top:
/* This is a generated file, any modifications may be lost. */
|
|
|
|
|
absolutely. typically the CodeDomProvider framework will even generate one for you =)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
kinda agree.
I'd rather be phishing!
|
|
|
|