开发者

Help with Unit Testing

开发者 https://www.devze.com 2023-01-10 12:15 出处:网络
I am new for the Unit Testing Can some one tell me where this testing clas开发者_如何学Cs is defined in the following code and how can i find it ?

I am new for the Unit Testing Can some one tell me where this testing clas开发者_如何学Cs is defined in the following code and how can i find it ?

#ifndef UT_USERSESSIONMANAGER_
#def UT_USERSESSIONMANAGER_
#include<gmock/gmock-genral.h>  //If define in this then how can i find it
#include<"pre_include.hpp">    //I am sure not define in this
#include<"pre_usersession.hpp">//I am sure not define in this

using namespace pre;

class Ut_UserSessionManager:public::testing::test
{
 public:
  Pre_UserSessionManager *UserSessionFailure;
  Pre_UserSessionManager *UserSessionSuccess;
 public:
  virtual void Setup();
  virtual void TearDown();
}


If this code already compiles and links and you are using Visual Studio then maybe you want to switch on the creation of browse information. Then when the build has finished place your cursor on the symbol in question and hit the F12 key.

But it's probably not that simple ...

Typically you will find the declaration of classes in header files and the definition (= implementation) in source files (*.cpp) or in libraries (note that this is just a general statements and there is more to this e.g. when using templates). So if the compiler complains then make sure you include the correct header files. If the linker complains make sure you have added the correct libraries.

To find out the hierarchy of your includes and/or locate symbols in your C++ source code you may find SourceNavigator(open source @ SourceForge) a useful tool. Sometimes it can be daunting to track this type of information down in C++. Admittedly the tool is a bit dated but it may nevertheless be helpful.


The class ::testing::Test (mind the case sensitivity) is part of the googletest framework and can be found in those files:

  • gtest.h declaration
  • gtest.cc definition

If the other answers don't help you find those files, just do a search on your disk...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号