|
C++ Unit Testing in Visual Studio | Visual C++ Team Blog[^]
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
Unit tests, basically a smart idea.
But how does it look in praxis? I mean apart from the simple examples in all these tutorials where one tests whether a Sum function works for "1+1"?
The tutoririal's examples will of course work also for a much more complex thing like matrix inversion and what else.
But are this "more or less static" things really the problem?
In my opinion no! The dynamic/asynch/interaction things are the problem and until now not really considered to test them seriously by unit tests.
All this what I'm missing can be probably also a leak of my knowledge.
I'm happy to read contrary against my expirience/knowledge.
Bruno
modified 19-Jan-21 21:04pm.
|
|
|
|
|
The VS C++ testing framework is really only useful for very, very, very....very simple unit/integration testing. Forget about stubs and/or mocks (which is where mature test frameworks really shine) unless you are prepared to hand crank them - a slow, tedious and error prone process. The VS C++ testing framework is something you would only use when there is literally no alternative other than manually writing all of your tests.
modified 20-Apr-17 19:05pm.
|
|
|
|
|
Hmm, that's sad, if true.
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
If you're interested in a good introduction to testing then see, "The Art of Unit Testing" by Roy Osherove, 2014. Note you will not be able to perform much of what is discussed in the book using the VS C++ testing framework, that is, unless you hand crank everything (but that defeats the purpose of using a good test framework in the first place).
Cheers,
Ian
|
|
|
|
|
Thanks
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
I found it to be much better than you state. At one place we used gmock (which I don't particular like, but it worked for where it was needed.)
That aside, what native C++ test frameworks do you recommend?
|
|
|
|
|
Hello Joe,
I do not have a C++ test framework to recommend. I tried but gave up with Google's C++ test framework because I was unable to get it up and running in a reasonable time (i.e. several full days) On the other hand, my first foray into test frameworks to VS and the .NET environment, well, they just worked, without any installation or usage problems.
The C++/DLL specification does not readily lend itself to building test frameworks as does the .NET specification. The point being that C++ test frameworks simply do not (and likely never will) come even remotely close to the full featured and mature test frameworks such as one finds for the .NET environment. I have no doubt that something can eventually be cobbled together for the VS C++ test framework that provides a bit more than simple integration tests but this is a non-trivial task and rather surprising in view of just how 'old' the C++ language is.
Cheers,
Ian
|
|
|
|
|
That provides good context for you previous answer. Lately, I've been using Catch and been satisfied, but was curious if someone found something better.
(I've actually been disappointed with a lot of google's tools; many seem so half-baked. I'm curious how gRPC is.)
(I've also learned in C++ to design in dependency injection rather than depend on mock frameworks.)
|
|
|
|
|
Satya Nadella took over as CEO of Microsoft in February of 2014, and in the three years since he has succeeded in turning around what was then a stumbling, aimless company. He recently stopped by Business Insider's Poland office and spoke with us about the past, present and future of Microsoft. "We're the future, your future"
|
|
|
|
|
Bargepole.
This one.
Touching.
I'm not.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Unicode sleight of hand makes it hard for even savvy users to detect impostor sites. Ah, let's all just go back to EBCDIC
No one will mind, right?
|
|
|
|
|
Nasty.
Of the four browsers I have installed on this machine, only Vivaldi[^] displays "https://www.xn--80ak6aa92e.com/".
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Physicists have created a fluid with negative mass, which is exactly what it sounds like. Push it, and unlike every physical object in the world we know, it doesn't accelerate in the direction it was pushed. It accelerates backwards. I could do with a bit of that, thank you.
|
|
|
|
|
Now THAT is interesting.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Kent Sharkey wrote: it doesn't accelerate in the direction it was pushed. It accelerates backwards.
Sounds like my attempts at teaching certain young people to drive!
Marc
Latest Article - Merkle Trees
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
Quote: It accelerates backwards. Maybe, it was never about the mass, maybe it just loves to hug?
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
We need a beer from that negative mass liquid. Obesity epidemic solved.
|
|
|
|
|
Slow, outdated computers and intermittent internet connections demoralize workers, a survey of 6,000 European workers said. Leave this where the purchasing manager can find it (I'm *sure* it will work)
|
|
|
|
|
I know I'm demoralized and deflated everytime the network goes down/slows-down. And my 3-year-old laptop is the worst!
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
And the codeproject lounge.
|
|
|
|
|
LMAO, indeed!
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
3 year old! They give you hardware that new? Wow!
'PLAN' is NOT one of those four-letter words.
'When money talks, nobody listens to the customer anymore.'
|
|
|
|
|
yeah, it was 3 years old when I got it 6 years ago.
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
Kent Sharkey wrote: Slow, outdated computers and intermittent internet connections Bloated, CPU-numbing programs and painfully stupid UI decisions demoralize workers, a survey of 6,000 European workers said. Bloomberg is obviously a member of the ms-fanboi club.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|