Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Essentially, what you need to do is take the module/class you want to test and isolate it from the rest of the system, simulate (fake) all of its interactions with any external classes/API's, and verify that it did what it's supposed to do.</p> <p>Typically you do this simulation using "mock objects". You contrive behavior of the mock objects to exercise different operating conditions for your System (module/class) Under Test (SUT). You could use an existing mock object framework, or you could simply "roll your own" mock objects, by creating objects or functions that implement all of the interfaces your SUT uses.</p> <p>You'll have to figure out how you can inject your mock objects into your SUT. For example if your SUT had a member variable object instance, perhaps you could make a subclass of the SUT and add a method "SetMemberObj(aMockInstance)" to install the mock object. If your SUT uses global functions, perhaps you can create functions with identical signatures, and NOT link your test app with the .lib that contains the real functions, so that your SUT will call into the fake ones instead.</p> <p>You'll also have to decide how you can verify the SUT's behavior; in a simple case maybe you could check the return code of a method, whereas in a more complicated situation you'll want to query your mock objects to see how they were invoked by the SUT.</p> <p>You may also be challenged to figure out how to actually invoke your SUT. What I typically do is make a console .exe that instantiates and drives the SUT in various ways, indicating any errors via stdout and/or return codes. A unit testing framework can be very helpful for this, but isn't entirely necessary.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload