Test Driven Development (TDD) with Google C++ Testing Framework and Visual Studio (II)

Probably, like every developers, what you want is to start coding and see how is that of Google Testing Framework and how does it works. But not yet, my friend. Today we are going to have a look to the Unit Testing concept.

A “Unit Test” is a piece of code implemented to test a unit of work, which means that we are going to check the correct implementation of a requirement. For me the more important characteristics of a unit test are:

  • Repeatable and predictable.  It has to be designed to be executed  every time you needed and the result always must be consistent. Imagine that you’re testing an algorithm and you launch the test and it’s returns different results to the same parameters. Not good….
  • Isolated. You have to test only what is inside that function. Nothing else. That means that other modules, functionality or parts of your application shouldn’t be tested. For example, if you’re testing a function that reads a XML tag, don’t test in the same unit test a XML write routine.

Now, the process of executing unit testing is:

  1. Prepare the test performing some operation, initializing variables, etc…
  2. Launch the test.
  3. Check results
Ok, enough, it’s too much theory. We love coding and everything is much clear with examples, so in the next post we will start creating our first Unit Test with Google C++ Testing Framework!
Stay tuned!



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: