CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Stubs

  1. #1

    Stubs

    Could you tell me what is stub ? and what is drive ?

    Thx,
    Ron

  2. #2
    Join Date
    Oct 2002
    Location
    Singapore
    Posts
    3,128
    Do you mean test driver and stub? Basically, test driver is usually written to check if your written function is working properly. In the driver, you have to perform the necessary setup before calling the function.

    As for the stubs, they are called by your written function which you want to test. The stubs are usually dummy functions that may or may not return certain values.

  3. #3
    Join Date
    Mar 2002
    Location
    California
    Posts
    1,582
    A stub is basically an empty function that takes the place of the real function for compile reasons to achieve certain things.

    Imagine a unit test suite that you don't want with your released project. A way to handle this is to keep the unit test code in a different library. The unit test library will have a function to kick off the unit test suite. This function is called from main.

    Now for release you can have a different library, with the unit test function stubbed out. The library will only contain this empty function.

    There are other ways to achieve this example, namely by using #defines in main(), but you could probably imagine a case where you can't change the caller's code.

    I also vaguely remember using stubs to get a certain DLL to work. The functions were never called, but they had to be stubbed out in the DLL because they were somehow referenced.

    Jeff

  4. #4
    Aha Thank you guys

    Ronio

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured