Google Test and Mock Platform - Part 3: Mocking Classes and Functions with GMock

  Рет қаралды 35,898

arisaif

arisaif

Күн бұрын

Пікірлер: 32
@DifferentCoder
@DifferentCoder Жыл бұрын
I'm not an English native speaker, but I think your videos are very clearly, and very easy to understand. These series are very helpful for my job :)
@ccf19881030
@ccf19881030 Жыл бұрын
I'v never seen videos can explain gtest and gmock so clearly, Thanks!
@_jasneetsingh_
@_jasneetsingh_ Жыл бұрын
thank you for providing repo and walking through the same to explain the concepts
@thirumalak2054
@thirumalak2054 5 ай бұрын
i saw all the video and thanks for educating on gmock. i will write test cases now. thanks alot.
@anbazhagansakthivel2428
@anbazhagansakthivel2428 2 жыл бұрын
Very Well Structured and Delivered. Best tutorial for Gtest and Gmock
@arisaif
@arisaif 2 жыл бұрын
Glad you found it helpful!
@MrNyamchom
@MrNyamchom 2 жыл бұрын
I have watched all 3 of your videos. Fantastic !
@PreetiBatra-j4x
@PreetiBatra-j4x Ай бұрын
Such a amazing content
@novozelhalt9223
@novozelhalt9223 Жыл бұрын
Broooo, holy shit so much good information in such short time… with code example… kudos, sir
@arisaif
@arisaif Жыл бұрын
Thank you!
@kavyasriudayakumar3045
@kavyasriudayakumar3045 2 жыл бұрын
Excellent Video Tutorial For GTest and GMock.This will be the best series for GTest and GMock , covering all topics. The way you explain things is really Osm, easy to understand.Keep Posting many tutorials like this.All the very best !!
@kamleshkumarsahu9597
@kamleshkumarsahu9597 10 ай бұрын
That jesus sticker is damn funny😂😂
@dhanrajk6614
@dhanrajk6614 5 ай бұрын
Hi Arif, I have one doubt. Whether this gmock work for testing the c code.
@danrooke1199
@danrooke1199 2 жыл бұрын
Great tutorial! One edit if you're interested: 1:08:19 you used the pointer to the &mock_bankserver for the BankOfAriServer instantiation. It should be &actual_bankserver ;-)
@АндрейБорисов-и4о
@АндрейБорисов-и4о 2 жыл бұрын
Thank's Arisaif! Cool lessons!
@arisaif
@arisaif 2 жыл бұрын
Glad you found them useful!
@andrewborysov9211
@andrewborysov9211 2 жыл бұрын
Thanks! Great video!
@rikkipunk
@rikkipunk 2 жыл бұрын
Excellent explanation and great video! Thanks for sharing. On the other hand, I think there is an issue in the code of the file `tests/gmock_demo/expect_call_side_effects.cc` (50:48) that perhaps it is intentional to make the example more readable. Basically, that test will fail because Debit() is never called, due to the mock function GetBalance() is returning zero (the default value). So, I think it is necessary to add a EXPECT_CALL of GetBalance() setting it returns a positive number. Thanks again and I hope you continue delivering these interesting videos :)
@kirubar9459
@kirubar9459 Жыл бұрын
I am trying to mock a open() free function, my source file calls open(filepath, flag) which is defined in fctnl.h and int open(const char *__file, int __oflag, ...) is a variadic function. can u please let me know to mock this function? how to mock a free function with different arguments (say open() two argument open() three argument)?
@arisaif
@arisaif Жыл бұрын
You will get better answers if you post such questions on stack overflow. See my answer on a similar question here: stackoverflow.com/a/73613788/1383356
@vikramgondane5044
@vikramgondane5044 9 ай бұрын
any other preferable mock library for legacy code?
@rishiniranjan1746
@rishiniranjan1746 2 жыл бұрын
For the part "Mocking Non-virtual classes" what if AtmMachine class has like "T bankserver_" , not the pointer type, so for such case how can we do the testing ?
@arisaif
@arisaif 2 жыл бұрын
You can do this, but note that mocked classes are not copyable, so you won't be able to easily pass the mocked object to the class. However, you can do the opposite: return a pointer to the non-pointer member variable to the test. See an example here: github.com/ourarash/cpp-template/blob/master/tests/gmock_demo/mock_non_virtual_classes_non_pointer.cc
@87yassmin
@87yassmin 2 жыл бұрын
You're the best
@DifferentCoder
@DifferentCoder Жыл бұрын
Hi Ari, thanks for your videos, it very helpful I have used VS2019 to try gmock functions, but something make me confused... I set Expectation a = EXPECT_CALL(c, xxx()); and EXPECT_CALL(c, ooo()).After(a); But I noticed that if xxx() did not use, only calls ooo() won't get any failure. Was that my environment problem, or it just by design? In my opinion, xxx() MUST be called, then I can call ooo(), but it looks not....
@arisaif
@arisaif Жыл бұрын
Not sure if I got your question. I think you will get a very good answer if you post it on stack overflow.
@helloVorld1212
@helloVorld1212 2 жыл бұрын
ASSERT_EQ(ARI, Fantastic); // self explanatory.....!
@delwinmathewjoseph6210
@delwinmathewjoseph6210 Жыл бұрын
Hi could someone help me on doing a gtest for a program with classes n objects
@TheCapitalist_read_Das_Kapital
@TheCapitalist_read_Das_Kapital 2 жыл бұрын
I always have the question why gteat/gmock is written in MACROS, which can have so many undesirable side effects. What's the rationale hide this design?
@arisaif
@arisaif 2 жыл бұрын
I think there are two reasons for this. First is historic reasons since Google Test has been around even before C++11 and a lot of things that are possible now without macros were not possible back then. Many things in Google Test have been updated not to use macros over the years. The other reason is that some might find it more abstract and cleaner to use a macro that hides many thing behind it rather than plain C++. For example, you can register your tests programmatically only using C++, but the interface doesn't look as clean: google.github.io/googletest/reference/testing.html#RegisterTest
@tomwozne
@tomwozne 9 ай бұрын
How you use mocks with functions but no classes
@rayanebenyoucef3555
@rayanebenyoucef3555 Жыл бұрын
Thanks a lot
Google Test and Mock Platform - Part 2: GMock Matchers
55:08
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН
快乐总是短暂的!😂 #搞笑夫妻 #爱美食爱生活 #搞笑达人
00:14
朱大帅and依美姐
Рет қаралды 13 МЛН
The complete guide to unit testing structure best practices
44:12
Amichai Mantinband
Рет қаралды 30 М.
Unit Tests and Test Doubles like Mocks, Stubs & Fakes
17:32
Cognitive Programmer
Рет қаралды 136 М.
Do you even test? (your code with CMake)
12:38
Code for yourself
Рет қаралды 25 М.
Intro to Python Mocks | Python tutorial
18:42
Red Eyed Coder Club
Рет қаралды 87 М.
How to use Google Benchmark for C++ programs
35:29
arisaif
Рет қаралды 17 М.
Bazel Tutorial for C++ in 30 Minutes
29:19
arisaif
Рет қаралды 9 М.
how Google writes gorgeous C++
7:40
Low Level
Рет қаралды 954 М.
C++ Multi Threading Part 3: Atomic Variables and Memory Models
1:03:04
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24