Currently the best tutorial about gmock in youtube.
@Cognitive-Programmer6 жыл бұрын
Thanks for your comment...
@BarathanG25023 жыл бұрын
Watching this video in 2021 and it's still one of the best gmock tutorials
@Cognitive-Programmer3 жыл бұрын
Thank you so much 🙏🙏🙏
@sbsyr55552 жыл бұрын
@@Cognitive-Programmer nl. Nlmb. N bbig pp. Cc o
@valentinabonetti18083 жыл бұрын
Best tutorial on Google Mock I've found so far! Clear and to the point. Thanks!
@Cognitive-Programmer3 жыл бұрын
Thanks a lot for your comment 🙏🙏🙏
@bilaln68964 ай бұрын
Great intro to gmock.
@Cognitive-Programmer4 ай бұрын
Thanks for your kind comment 🙏
@truthadjustr6 жыл бұрын
Nice tutorial. At 18'30", your line 46 has type mismatch Init returns int but login2 returns bool. I was at first confused, but then it clicked on me when i realized that GMock can control the behaviour of a mocked function. GMock can make it return 69, for example. And then, the assert portion must do the necessary check.
@Cognitive-Programmer3 жыл бұрын
👉 Follow my Learnings and Journey beyond software development 🎦 @ bit.ly/insightfuldaksh
@游柏皓-q3w7 ай бұрын
Thank you! This tutorial is very useful for me as a beginer.
@Cognitive-Programmer7 ай бұрын
Thanks for your comment 🙏
@Jam181236 ай бұрын
thank you for a very nice tutorial. real case challenges - interface functions will not be virtual always, my component may not always have references.
@spicytuna086 жыл бұрын
i am a coder. i really didn't understand the complexities of testing. thanks again.
@Cognitive-Programmer6 жыл бұрын
Thanks for your comment
@huyvole97244 жыл бұрын
If you using Sleep function, you will see how Mock setup (Mock don't do anything with any parameter, it will return your value), simple show for beginer
@baqtronic77045 жыл бұрын
I really liked all the parts of this series, it is everything very concise and well explained. Thanks a lot! I had some difficulties with the pronunciation, so maybe it could be helpful for others as well to add subtitles... Thanks again!
@Cognitive-Programmer5 жыл бұрын
Thanks for your valuable comment.. I am working on a new series on the same topic and shall take care of things
@mahimohanettumanoor13963 жыл бұрын
Good video on Gmock .
@Cognitive-Programmer3 жыл бұрын
Thanks for your comment 🙏🙏🙏
@memphisraines68585 жыл бұрын
Thank you for this tutorial! Absolutely fantastic!
@Cognitive-Programmer5 жыл бұрын
Thanks for your comment
@PranaySoniKumar4 жыл бұрын
Thanks you!! It brief, to the point and very useful to get started!
@Cognitive-Programmer4 жыл бұрын
Thanks for your comment 🙏🙏🙏
@DiegodeSousa6 жыл бұрын
Hello that's me again xD Another little feedback is that in last example that we are exploring the usage of ON_CALL macro to execute randomly login() and login2() member function using the rand() function we need to initialize random seed calling srand () function, otherwise member function login2() will be called in any circumstance. Thus, code should look like this: int Init(string username, string password) { srand (time(NULL)); int rvalue = rand() % 2; ... source: www.cplusplus.com/reference/cstdlib/rand/ I hope that it helps somebody.
@Cognitive-Programmer6 жыл бұрын
Thanks again.. :)
@wizardy62676 жыл бұрын
Great video! only thing confused me was when you named a variable as 'rvalue' my first reaction was no~ it is not a rvalue and then my thoughts went to a totally different path about a whole different set of "?value" things...pretty much missed following 1 minute of your speech. Anyway, thank you for your help, this is a really good tutorial :D
@Cognitive-Programmer6 жыл бұрын
Thanks for your comment
@kevinduigou32126 жыл бұрын
Very interesting video! Thank you from France!
@Cognitive-Programmer6 жыл бұрын
Thank you very much for your comment
@studywithdas42454 жыл бұрын
very good tutorial
@Cognitive-Programmer4 жыл бұрын
Thanks for your comment 🙏🙏🙏
@dantheman88625 жыл бұрын
Super helpful video. Thanks for this!
@Cognitive-Programmer5 жыл бұрын
Thanks for your comment
@huyvole97244 жыл бұрын
Best ever! +1 like from Việt Nam
@Cognitive-Programmer4 жыл бұрын
Thanks for your comment
@eigenfield2 жыл бұрын
Thank you so much for this tutorial. Is Times(1).WillOnce(Return(true)) doing a redundant check? Since WillOnce already implies once, therefore we can remove the Times(1) constraint. Thanks for any insight on this regard.
@matthewp40463 жыл бұрын
Great video, thank you.
@Cognitive-Programmer3 жыл бұрын
Thanks for watching my video and thanks for your comment 🙏🙏🙏
@srijanshashwat19655 жыл бұрын
Does 0,1 or 2 specify the no. Of arguments?
@silviudema93156 жыл бұрын
Great tutorials !
@Cognitive-Programmer6 жыл бұрын
Thanks for your comment
@beemavishnu2 жыл бұрын
Thank you for your detailed explanation. I have a query. Do we need to keep 'virtual' always in DataBaseConnect. I tried without keeping and getting error as "Actual function call count doesn't match EXPECT_CALL".
@Cognitive-Programmer2 жыл бұрын
Yes when I created this video.. check in stackoverflow if there are any latest developments in this Thank you 🙏
@BowDrawn1152 жыл бұрын
Very nice tutorial, how would you recommend to write a test that fetches some data from a database and also writes into it?
@eigenfield2 жыл бұрын
You have to perfectly simulate such situations and never to use external subsystem that can possibly fail.
@batluongnhan04_122 жыл бұрын
dear all, i have a question, please see it help me! if in class MyDatabase, i have a function like : DataBaseConnect& returnOBject(){return dbC;} and, in the TEST function, i use db.returnOBject() instead of mdb inside EXPECT_CALL(db.returnOBject(), login()...).. it doesn't work, why? I know mbd is a referrence to dbC, but I just want to ask why it doesn't work. Thanks so much !
@sheminaboobacker84116 жыл бұрын
Can You explain how constructor of Mydatabase is created with reference of abstract class /interface
@Cognitive-Programmer6 жыл бұрын
Hello You can initialize references in constructor using constructor initialization list and that's the reason for this code MyDatabase(DataBaseConnect & _dbc): dbc(_dbc) {} Hope it helps Thanks
@Arti53hk2 жыл бұрын
Hello, if I inject a pointer of the calling class (injected class) instead of the reference, how can write the mock and the gtest for this special case ? ... Class MyDatabase{ DatabaseConnext* abc; Public: MyDatabase(DatabaseConnext* abc) : abc(abc) {} ; } ; Test (...,...) { MockDB* abc; MyDatabase db(abc) ; EXPECT_CALL(*abc, login(_, _)) // is this line correct? 😅 .Time(1) .willOnce(..); ... } When I make it, I get "segmentation fault" in the RegisterOwner() methode from class UntypedFunctionMockerBase
@rishabhagarwal34046 жыл бұрын
If anyone is having issue with installation and writing basic test. I have added a guide to installation with some sample code. github.com/rishabh-agarwal/googleTestDemo Hope this helps
@bestganesh3 жыл бұрын
can we mock the function that calls std::thread function. e.g. void myfun() { std::thread(&threadfunction, this); } I want to test this function but I am getting error with terminate called without an active exception. That means thread is created and became out of scope and testing is terminated. :( Can you please tell me if it is possible to use std::thread in gmock?
@rajeevdey_8894 Жыл бұрын
I think the test name should be InitTest. isn't itt?
@LastOfThem-d8b3 жыл бұрын
For me biggest setback you can not mock non virtual function
@aryamangupta39193 жыл бұрын
How to mock static class used by another static static class?
@theboringtechguy3 жыл бұрын
I am getting error while including gmock.h, it says no such file or directory. Please let me know what I am missing
@Cognitive-Programmer3 жыл бұрын
Hello.. you have to install gmock separately… please see gmock GitHub page for installation instructions..Thanks
@neohhueyli4 жыл бұрын
Hi Sir, how to mock non virtual function?
@Sanatani-Bharat-1084 жыл бұрын
How to unit test class with static methods?
@alyamajavier49635 жыл бұрын
Hello Sir please give time to answer to my question. I am new to googletesting. I can't compile, it keeps displaying Usr/bin/id: cannot find -lgmock collect2:error: ld returned 1 exit status
@ranjithks74 жыл бұрын
Same error to me as well although I have added -lgmock
@ranjithks74 жыл бұрын
Download googletest source and compile yourself. It worked for me
@PrashantAdlinge4 жыл бұрын
which editor you are using for code ?
@Cognitive-Programmer4 жыл бұрын
Hello I am using Atom on Ubuntu
@freddymartinez87415 жыл бұрын
I got an error using Return inside WillOnce: "Use of undeclared identifier 'Return'" :(
@freddymartinez87415 жыл бұрын
i found the issue... i missed using namespace testing :D
@Cognitive-Programmer5 жыл бұрын
Thanks
@kid-vf4lu6 жыл бұрын
How often do you write mock-ups in practice?
@Cognitive-Programmer6 жыл бұрын
Well it's bit subjective and depends upon the kind of the code. A not so perfect rule could be to use Mocks whenever you're using an API/interface which requires additional dependencies to run