Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 mock virtual methods
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ffa-grahamdawes
New Member

United Kingdom
3 Posts

Posted - Jun 22 2015 :  03:55:01 AM  Show Profile  Reply with Quote
The implement virtual methods feature of Visual Assist is great time saver. I wonder if it would be possible to also have a "Mock Virtual Methods" feature.

We use Google Test/ Google Mocks as our unit testing framework. Unfortunately it can be somewhat tedious to hand write MOCK_METHODxxx for all members of the class.

There are a few other C++ mocking frameworks so perhaps the user could choose which mocking framework they are using either in the options or when they generate the methods.

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jun 23 2015 :  6:21:27 PM  Show Profile  Reply with Quote
Hmmm. Interesting idea. I haven't used this framework myself, but luckily there is a page called Google C++ Mocking Framework for Dummies so I was able to get up to speed easily.

I think something like a snippet for each line of the generated methods could be used here.

For example you could use something like the below snippet to generate MOCK_METHOD2(GoTo, void(int x, int y));

MOCK_METHOD$ArgCount$($SymbolName$, $SymbolType$($MethodArgs$));

The sample line is came from here:
https://code.google.com/p/googlemock/wiki/ForDummies#Writing_the_Mock_Class

And the snippet variable names based on this document:
http://docs.wholetomato.com/default.asp?W262

As you said you would want to select which snippets to use, and we could provide googlemock as a sample.

I have opened a feature request for this idea:

case=90460

Later, we could even create more snippets for other frameworks to have a better out-of-box experience, if we see demand for it.

Edited by - accord on Jun 23 2015 6:21:48 PM
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000