Friday, October 7, 2011

Auto-deploy feature file

Feature file for our auto-deploy:

@Install
Scenario: Install and Configure Virtual Hold on a remote machine
  Given I stop the Virtual Hold services
  And I uninstall if already installed
  And I install the media on a remote machine
  And I configure the media on a remote machine
  And I can log into EyeQueue
  And I start the Virtual Hold services
  Then Virtual Hold is running properly

When the file references Virtual Hold it is talking about the collection of windows and web services that are needed to make our software work. EyeQueue is the web application that is used to make configuration changes for the Virtual Hold software.

Monday, September 26, 2011

Automation: Auto-deploy

One of the biggest time savers that has been implemented recently at our company has been something that we call an auto-deploy. Our software consists of windows services, web services, web applications, and databases; installing and configuring a system to test against can take quite a while when doing the entire process manually. A handful of individuals here have been working to improve this process by creating an auto-deploy process that will automate the following:
  • Uninstall the software if previously installed
  • Copy the latest build of the software to the server
  • Install the software
  • Configure the databases
  • Start the software
  • Check the software status to ensure that it is running
This used to take easily 30 minutes and sometimes several hours. The problems before mostly revolved around finding the right configuration for the server and setting up the configuration in the database through a combination of wizard screens in our windows app and different pages of our web application. (Just to explain a little about the configuration, our software is capable of talking to multiple types of telephone switches and only certain servers in our lab are configured to talk to certain switches in the lab. Because not any server can talk to any switch, the difficulty was figuring out where the configuration for Server A's connection to Switch B is and then deciphering the excel document that the lab tech's use to keep track of the configured numbers on the switch.)

Now, within ten minutes I can have a system installed with the latest version and fully configured for testing. It takes about 20 minutes to setup an auto-deploy for a server for the first time, and usually within the first two or three times it is run, all of the kinks have been worked out for that environment.


The configuration for the server is now contained within a .yml file that is read in by ruby code which is called from a scenario in a cucumber feature file. A Jenkins job is setup for each server configuration, and this job runs the installation feature. Because it is in Jenkins, it is available to put on our reader board that shows each of our projects' build status.

Our team has already seen the benefit of this. There was a bug introduced in the code that caused the services not to start. Because we have this as part of our CI, we were able to know that a problem was introduced within an hour. Without CI and the auto-deploy, this could have taken days until another build was completed.

Friday, August 26, 2011

Making Daily Standups .... Interesting: Days 12-15

I got a little behind in posting these. The contest is now over, but for your viewing pleasure:

Darth Vader

Green Cowgirl (with lights)

Tiara

Pink Cowgirl (with lights)



Friday, August 19, 2011

Making Daily Standups .... Interesting: Day 11

Here's a viking quote to go along with today's hat:
Never walk away from home ahead of your axe and sword. You can't feel a battle in your bones or foresee a fight.
- The Havamal

Viking helmet





Thursday, August 18, 2011

Making Daily Standups .... Interesting: Day 10

Maiwaige. Maiwaige is what bwings us togewer today.

Some help with the veil
 
Mickey (Minnie?) Mouse wedding veil




Wednesday, August 17, 2011

Making Daily Standups .... Interesting: Day 9

Not really sure what kind of hat this is, but definitely another good entry.
Fuzzy Purple 'Lamp Shade'

Tuesday, August 16, 2011

Making Daily Standups .... Interesting: Day 8

We had retrospective yesterday so no standup. If you look at the wall, you can get a sneak peek at a couple of the hats coming up.















Friday, August 12, 2011

Making Daily Standups .... Interesting: Day 7

It looks like someone was getting desperate for a hat entry.

Potted plant
No - he didn't wear this on his head for the entire standup.




Thursday, August 11, 2011

Making Daily Standups .... Interesting: Day 6

A Viking hat with Germany's national colors is today's entry into the standup hat contest.
Viking
It is kinda hard to take him seriously with these ridiculous looking hats, but it does make it more interesting.

Standups have become better recently, but I still think that there could be more improvement that would make standup meaningful for those involved.






Wednesday, August 10, 2011

Making Daily Standups .... Interesting: Day 5

Our illustrious scrum master was out yesterday but returned today to sport this hat

Jesters Hat, with bells



Monday, August 8, 2011

Making Daily Standups .... Interesting: Day 4

Today's hat was not a bad look for him. I could see him wearing this away from work.
Propeller Hat




Friday, August 5, 2011

Making Daily Standups .... Interesting: Day 3

Another good entry in the hat contest:



This is something I could see him wearing away form work.

Thursday, August 4, 2011

Making Daily Standups .... Interesting: Day 2

Day 2 of the hat contest sees a milder, less 'anxious' headgear piece.

 Rajastan hat (Indian)
Apparently, this is some form of tribal headgear from the Indian state of Rajasthan.

Making Daily Standups .... Interesting: Day 1

UPDATE: added additional photo

Our new Scrum Master has promised to wear any headgear that we bring in for the daily standup. Here is the first hat that he had to wear:

Raggedy Ann - complete with bangs and pigtails

He has promised to do this for a couple of weeks, two sprints I believe, and the reward is a gift certificate for a local restaurant. It should be interesting as the weeks go on to see what members of the team can come up with for him to wear.



Thursday, July 14, 2011

Python Videos

YouTube links for a Python class given at Google by Nick Parlante.

Day 1 Part 1

Day 1 Part 2

Day 1 Part 3

Day 2 Part 1

Day 2 Part 2

Day 2 Part 3


Day 2 Part 4

Wednesday, June 29, 2011

Learning Python: #5 - Finish Bowling Game Kata

My finished test class TestGame.py:
import unittest
import Game

class TestGame(unittest.TestCase):

    def setUp(self):
        self.game = Game.Game()

    def testGutterGameHasZeroScore(self):
        for i in range(20):
            self.game.roll(0)
        assert self.game.score() == 0, "Score is zero"
  
    def testGameAllOnesHasScoreOfTwenty(self):
        for i in range(20):
            self.game.roll(1)
        assert self.game.score() == 20
        
    def testGameThrowsExceptionWithMoreThanTwentyOneRolls(self):
        try:
            for i in range(22):
                self.game.roll(10)
        except ValueError:
            pass
        else:
            self.fail("Expected a ValueError")
            
    def testGameWithOneSpare(self):
        self.game.roll(1)
        self.game.roll(9)
        self.game.roll(5)
        
        for i in range(17):
            self.game.roll(0)
        
        assert self.game.score() == 20
        
    def testGameWithOneStrike(self):
        self.game.roll(10)
        self.game.roll(1)
        self.game.roll(1)
        
        for i in range(17):
            self.game.roll(0)
        
        assert self.game.score() == 14
            
    def testPerfectGameScores300(self):
        for i in range(12):
            self.game.roll(10)
        assert self.game.score() == 300, "Perfect Game should score 300"
         
if __name__ == "__main__":
    unittest.main()

My finished Game.py:
MAX_ROLLS = 21
FRAMES = 10
STRIKE = 10
SPARE = 10
    
class Game:
     
    def __init__(self):
        self.scoreArr = []
        
    def roll(self, pins):
        if self.numberOfRollsTaken() > MAX_ROLLS:
            raise ValueError
        self.scoreArr.append(pins)
        
    def score(self):
        score = 0
        currentRoll = 0
        frame = 0
        while frame < FRAMES:
            if self.scoreArr[currentRoll] == STRIKE:
                score += self.scoreNextTwoBalls(currentRoll)
                currentRoll += 1
            elif self.frameScore(currentRoll) == SPARE:
                score += self.scoreNextTwoBalls(currentRoll)
                currentRoll += 2
            else:
                score += self.frameScore(currentRoll)
                currentRoll += 2
                
            frame = frame + 1
        return score

    def numberOfRollsTaken(self):
        return len(self.scoreArr) +1

    def scoreNextTwoBalls(self, index):
        return self.scoreArr[index] + self.scoreArr[index + 1] + self.scoreArr[index + 2]
        
    def frameScore(self, index):
        return self.scoreArr[index] + self.scoreArr[index + 1]
A couple of things that I learned while doing this Bowling Game kata:
  • It appears that it is a requirement for test methods to start with the word 'test' or PyUnit will not recognize them as tests that need to be run.
  • A variable and a method in the same class cannot both have the same name, or at least my syntax was wrong
  • The ':' at the end of class/method definitions and control statements gets me almost everytime; I cannot seem to remember that it needs to be there

Tuesday, June 28, 2011

Learning Python: #4 - UnitTesting - Second Test

Now that I have the first test completed, I can move on to adding some actual functionality to the Game class. My next step was to have it keep track of the number of pins rolled. Here is my second test:
def testGameHasScoreOfOneWithFirstRollOfOnePin(self):
    game = Game()
    game.roll(1)
    assert game.score == 1
At this point the tests no longer pass because the Game class does not have a roll method. My first attempt to add the roll method to my Game class failed:
def roll(pins):
        score += pins
Here is the error that was printed:

E.
======================================================================
ERROR: testGameHasScoreOfOneWithFirstRollOfOnePin (__main__.TestGame)
----------------------------------------------------------------------
Traceback (most recent call last):
File "TestGame.py", line 13, in testGameHasScoreOfOneWithFirstRollOfOnePin
game.roll(1)
TypeError: roll() takes exactly 1 positional argument (2 given)

----------------------------------------------------------------------
Ran 2 tests in 0.002s

FAILED (errors=1)

This is a very confusing error when you are unfamiliar with the language. Clearly I am passing in one argument to a method that takes one argument. What in the world?? The way that methods work in Python is that the object is passed as the first argument of the function. So essentially, the method call acts like game.roll(game, 1) though it is not actually called this way. What is needed is to change the method definition. My updated roll method:
def roll(self, pins):
    self.score += pins
Both of my tests now pass:
..
----------------------------------------------------------------------
Ran 2 tests in 0.002s

OK

Learning Python: #3 - UnitTesting - First Test

I was struggling with something to write to help me learn Python and I decided to do the classic bowling game example. I did a quick search to find out how to write TDD with Python and came across this PowerPoint slide which helped me get started writing the tests.

From that ppt slide, I figured out what my test file and first test should look like.

TestGame.py:
import unittest

class TestGame(unittest.TestCase):
    pass
    
if __name__ == "__main__":
    unittest.main()
and my First Test:
import unittest

class TestGame(unittest.TestCase):

    def testGameHasZeroScore(self):
        game = Game()
        assert game.score == 0, "Score is zero"

if __name__ == "__main__":
    unittest.main()
    
At this point I am still not certain what all of this is doing. Running the test produces this output:

E
======================================================================
ERROR: testGameHasZeroScore (__main__.TestGame)
----------------------------------------------------------------------
Traceback (most recent call last):
File "TestGame.py", line 7, in testGameHasZeroScore
game = Game()
NameError: global name 'Game' is not defined

----------------------------------------------------------------------
Ran 1 test in 0.002s

FAILED (errors=1)

This is good then because I know that I'm using the unittest import correctly. At this point I wasn't familiar with why self was being passed to the test method but I assumed it had a need. I found out later why it was needed. To get this test to pass I had to create a Game.py file that created my Game class with a score member, and I had to add from Game import Game to my TestGame.py file under the current import statement. Here is my Game class:

Game.py:
class Game: 
    score = 0

And my TestGame.py:
import unittest
from Game import Game

class TestGame(unittest.TestCase):

    def testGameHasZeroScore(self):
        game = Game()
        assert game.score == 0, "Score is zero"

if __name__ == "__main__":
    unittest.main()

Running this now produces this output:

.
----------------------------------------------------------------------
Ran 1 test in 0.001s

OK

Awesome! I have completed my first unit test with Python.

Monday, June 27, 2011

Learning Python: #2 - Five Interesting Things

So, I'm going through the tutorial and have already found some things that I find interesting.
  1. Division Operators
    • 3/2 = 1.5
    • 3//2 = 1 - division that produces an integer by discarding the remainder
  2. The _ variable will have the last thing printed in the window assigned to it
  3. A \ at the end of a line will let the string literal span multiple lines
  4. Indexing of strings
    • "someString"[2:7] prints 'meStr'
    • "someString"[:3] prints 'som'
    • "someString"[-3:] prints 'ing'
    • "someString"[:-3] prints 'someStr'
  5. The built in function len() applies to both strings and lists
Bonus:
  • By default the print() function will end with a newline. You can specify a different ending with the keyword end
    • Syntax: print(someVariable, end="|")
    • The above used in a loop will create a pipe delimited list

Learning Python: #1 - Hello World

My company provides four hours of free time per week to spend time learning a new technology, language, etc. I've decided to take some time to learn Python and sort of document what I learn as I go along.

I downloaded the latest Python for Windows (3.2 as of the time of this post) and started reading the documentation (Here is a link to a tutorial for Python 3.2.). It was easy to get Python downloaded and setup to run from the cmd window in Windows 7. All that I needed to do after downloading Python was to add the install directory to the Path Environment variable.

When I'm learning a language it typically does not take long to learn the syntax to make a Hello World application; however, it took me a little bit longer than normal with Python. What took me so long with Python and what is important to note is that the syntax has changed since 2.7.2, which is the version of the documentation I happened to be reading. I was typing >>> print "Hello World" but for 3.2 it should have been >>> print ("Hello World") with the text wrapped in parens.

The first gives an error 'File "<stdin>", line 1' while the second does what is expected and actually prints out the text of 'Hello World'.

I'm eager to put my free time to use learning something and growing as a developer.

Wednesday, May 25, 2011

PowerShell: Search files and output results to a text file

Something I do quite often is search log files in a directory for a particular string. Notepad++ does this for me quite well, but I thought I'd see how PowerShell could do this. My first attempt started with using the .NET framework's Directory class to get all of the files in the directory, get the contents of those files with a specific file extension, search those files, and then output the results to a log file. Here is that first attempt:
$files = [System.Io.Directory]::GetFiles("C:\logfiles")
Get-Content ($files -match ".log") | findstr "someString" > log.txt
The output for this is the matching lines from the files I was searching. So, somewhat helpful but not quite what I was looking for. I want to get the file that this is coming from and if possible the line number. I did a little searching and found a different way. Here was my second attempt:
Select-String C:\logfiles\*.log -pattern "someString" > log.txt
Great! This one line gets me the name of the file, the line number, and the matching line from the file, and it runs faster. This is what I was looking for and I was about to consider this done (only took a few minutes of researching so not bad) when I was trying out a different search more along the line of what I would actually use this for - searching a directory of cpp files. The path became longer and so did the results returned which is when I found out PowerShell wraps its output. Wait...what? Seriously? PowerShell appears to wrap the output at the width of the console even when running this command from a script file. I'm not sure why and I didn't really spend a whole lot of time trying to figure out why, I just wanted it not to wrap at 120 characters. I ended up researching a few more minutes to find a different method of output and this has a width parameter. Here is the final attempt:
Select-String C:\logfiles\*.log -pattern "someString" | Out-File -filepath log.txt -width 1000
This is what I was looking for, however, Notepad++ still does this better. Because it is integrated, clicking on the search results in the Find window opens the file at the line. It was a good little experiment though and may be useful in the future.

Monday, May 23, 2011

My First PowerShell Script

While reading the Pragmatic Programmer, I felt challenged to learn some sort of scripting language. Here is my first attempt at a PowerShell Script. Granted, it only loops and prints, but it does use some things that could be helpful later (variables, conditions, sleeps, etc.).

$count = 0
while (1 -ne 0)
{
 $count = $count + 1
 echo("Hello World")
 if ($count % 2)
 {
  echo("")
  Start-Sleep -m 1000
 }
 
 if ($count -gt 10)
 {
  break
 }
}

I did learn that running a powershell script file is disabled by default. Typing the command
Get-ExecutionPolicy
will return what the policy is currently set at.
Set-ExecutionPolicy remotesigned
will allow you to run PowerShell script files that you create and will not run other script files, unless the other script has been signed by a trusted publisher. There are other policy levels that this can be set to, but this is all I needed for now.

It will be interesting when I come up with something that I am currently doing that PowerShell can make easier for me.

Wednesday, May 11, 2011

C++ - char*, CString, and LPCTSTR

I have found myself looking this up several times lately because I keep forgetting. I often need to convert to or from a CString and it is often something simple.

  • For converting from a char* to a CString:

char* charStar= NULL;
// Code that sets the value of charStar
CString data;
data.Format("%s", charStar);

  • Same thing works for converting from a LPCTSTR to a CString:

void SomeMethod(LPCTSTR argument)
{
   CString data;
   data.Format("%s", argument);
}

  • And for converting from a char* to a LPCTSTR:

void SomeMethod(LPCTSTR argument)
{
}
char* charStar = NULL;
// Code that sets the value of charStar
SomeMethod(charStar);

Simple, and yet for some reason, I have had a hard time remembering this.

Friday, April 22, 2011

Google Mock Sequence

We have had a problem in our software for some time now that has caused plenty of frustration and headaches. We have a method that when it is called it builds a pipe-delimited string of values by looking up different pieces of data that had been saved off earlier. The string that is returned needed to have the values in a specific order; the reason behind this is that this string was parsed by an .asp page that had no knowledge of the order of the values. Anytime a developer would change the order of the values, it would break the web application that used these values. We all agree that this is an awful way of doing things but we currently have technology constraints that will not let us change this.

We have tried to educate the developers not to add items in the middle by sending the information out in emails, mentioning this in team meetings, and even putting comments in the code. Without fail though, someone will be in a hurry and forget about this and the next time someone goes to test the web application, it will have been broken.

Google Mock has a way to group expectations into a sequence that will cause the test to fail if not used in the proper order.

using ::testing::InSequence;
{
  InSequence pipeDelimitedStringOrder;

  EXPECT_CALL(...)...;
  EXPECT_CALL(...)...;
  ...
  EXPECT_CALL(...)...;
}

Now if a developer goes to change this method, they will see that the tests fail and will (hopefully) add any new methods to the end of the list.

Wednesday, April 13, 2011

Code Smells

Here are a few more links to code videos. Jason Gorman (www.codemanship.com) shows different code smell examples and what to do to get rid of them. All examples are screen casts in Java.

Friday, April 8, 2011

Code Video sites

Here are a couple of good sites for watching videos related to programming and testing:

http://jamesshore.com/Blog/Lets-Play/
http://confreaks.net/
http://misko.hevery.com/presentations/

I'll update this as I find other sites that I think are good resources.

Thursday, April 7, 2011

Google Mock: Leaking Mocks

There are a couple of ways to deal with Mocks that leak. An error will print like the following:
1>.\Tests.cpp(76): ERROR: this mock object (used in test Tests.SampleTest) should be deleted but never is. Its address is @00E659C8.
1>ERROR: 1 leaked mock object found at program exit.
1>Project : error PRJ0019: A tool returned an error code from "Performing Post-Build Event..."
This is an indication of either not calling delete on a pointer that was newed previously, or if the pointer is being deleted, an exception could be being thrown in the destructor of the Mocked class.


The first way is to set the command line argument to include
--gmock_catch_leaked_mocks=0
In our project, we have the test executable running after the project is built so this can just be added to the end of the Post-Build Event in the project properties.

The second way is to say in the test that the specific Mock that you are using can allow leaks.
using ::testing::Mock;
... 
Mock::AllowLeak(mockThatLeaks); 
If your problem is that an Exception is being thrown in the destructor, it should be determined why the Exception is being thrown. It could be that it's just because the class isn't initialized properly in the test or that there really is a problem that should be looked into and fixed.

Monday, April 4, 2011

Another Clean Code Talk

Here is a link to another Clean Code talk from Google. It's an interesting lecture about removing if statements and switch statements from code using Polymorphism.

Inheritance and Polymorphism

Friday, April 1, 2011

Setting up a C++ project with Google Mock/Google Test in Visual Studio 2008

Steps that I had to take to get a C++ project setup to use Google Mock and Google Test: (assumes that Google Mock and Google Test has already been downloaded and compiled)

  1. Add a New Project to the solution
    1. Right-click on Solution - Add > New Project
    2. Select Win32 Console Application
    3. Give it a name
    4. Click Ok
    5. Click Finish on the Wizard that pops up
  2. Change the Project Properties
    1. Change Configuration at the top to All Configurations
    2. Under Configuration Properties > General > Use of MFC
      • Change the selection to be Use MFC in a Shared DLL
    3. Under Configuration Properties > C/C++ > General > Additional Include Directories
      1. Add the path to the include folder for Google Mock
        • Ex. - ..\..\CoreThirdParty\gmock-1.5.0\include
        • (CoreThirdParty is a directory that houses Google Mock, Google Test, and other Third Party headers and libraries that our project depends on)
      2. Add the path to the include folder for Google Test
        • Ex. - ..\..\CoreThirdParty\gtest-1.5.0\include
    4. Under Configuration Properties > Linker > General > Additional Library Directories
      1. Add the path to the Release folder for Google Mock
        • Ex. ..\..\CoreThirdParty\gmock-1.5.0\msvc\Release
    5. Under Configuration Properties > Linker > Input > Additional Dependencies
      1. Add the libraries for Google Mock
        • gmock.lib
        • gmock_main.lib
    6. Under Configuration Properties > Build Events > Post-Build Event > Command Line
      1. Add the command to run the executable after the build is finished
        • "$(TargetDir)$(TargetFileName)" --gtest_filter=*.* --gtest_shuffle --gtest_output=xml
  3. Add a HookUpTest to the .cpp file
    1. Remove all of the code in the .cpp file that was created with the project
    2. Add the following code to create a HookUp Test
#include <gmock/gmock.h>

TEST(SimpleTest, HookUpTest)
{
    ASSERT_TRUE(true);
}

Build this project and hopefully the output will be:


1>Finished generating code
1>Embedding manifest...
1>Performing Post-Build Event...
1>Running main() from gmock_main.cc
1>[==========] Running 1 test from 1 test case.
1>[----------] Global test environment set-up.
1>[----------] 1 test from SimpleTest
1>[ RUN      ] SimpleTest.HookUpTest
1>[       OK ] SimpleTest.HookUpTest(0 ms)
1>[----------] 1 test from SimpleTest(0 ms total)
1>[----------] Global test environment tear-down
1>[==========] 1 test from 1 test case ran. (0 ms total)
1>[  PASSED  ] 1 test.

Thursday, March 31, 2011

Using git to add a submodule

The command to add a submodule to a project is:
git submodule add <URL of the submodule repo> <path to place submodule> 
Example:
git submodule add git@1.1.1.1:Submodule.git ./Submodule 
This will modify the .gitmodules file in the repository. When I ran this command, I got a fatal message stating:
fatal: LF would be replaced by CRLF in .gitmodules
Failed to register submodule 'Submodule' 
Modifying the .gitmodules file manually by replacing the LF with a CRLF fixed this problem (ie. open the file in Notepad++ or another text editor, delete the end of line character, and hit 'Enter' on the keyboard for each of the new lines added for this submodule).

Running the command
git submodule status
will show that this submodule isn't ready to be used as of yet. Run
git submodule init
to initialize this submodule. You should not need to run update for this submodule because the clone happened when the submodule was added.

Add, commit, and push this file so that other users will be able to have the changes.

Wednesday, March 30, 2011

Clean Code Talks

Here are a few links to Clean Code talks at Google dealing with unit tests. Pretty interesting and useful information.

Don't Look for Things
Law of Demeter
He teaches that in a constructor you should ask for what you need and don't look for things. Meaning, don't pass in a user object when what you really need is a username and password.


Unit Testing

Monday, March 28, 2011

Google Test/Mock: 3rd Party dll dependency

One of our projects relies heavily on third party API calls. I have already alluded to the pain involved in getting the project setup just to be able to write a HookUp test. After several linker errors and header files that were not referenced, we were finally able to get the test project to compile. When a test project is compiled and built, the tests are supposed to run as well and give an indication of whether or not the tests passed or failed. The output window in VS should show this:


13>[==========] Running 1 test from 1 test case.
13>[----------] Global test environment set-up.
13>[----------] 1 test from Tests
13>[ RUN      ] Tests.HookUp
13>[       OK ] Tests.HookUp (3286 ms)
13>[----------] 1 test from Tests (3286 ms total)
13>[----------] Global test environment tear-down
13>[==========] 1 test from 1 test case ran. (3287 ms total)
13>[  PASSED  ] 1 test.


In this particular case though, we were not seeing the test output. Every project succeeded in building and compiling, but the test output was missing. All that was in the HookUp Test was instantiating a class with a no-op ctor. The ctor however was kind of messy and created several other classes that called into third party libraries.

Because the project compiled and built just fine it seemed that it was a run-time issue and that running the .exe from the command line may show other errors or give us a reason as to why the tests were not running. So, under Tools > Visual Studio 2008 Command Prompt, we changed our directory to the Release folder of the .exe. Running the .exe produced a System Error popup:
The program can't start because <3rd party dll> is missing from your computer. Try reinstalling the program to fix this problem.
There are a couple of options at this point: 1) copy all of the required dll's (in our case > 125) into the directory that the executable was running in, or 2) change our environment PATH variable to include the directory where these dll's were located. (There may be a third option, like remove the dependency on these libraries) Both are not ideal since these are unit tests and we do not want to have to do either of these on every developer's machine plus the build machine.

The solution ended up being setting the PATH environment variable in the post-build event's command line option of the project property's. This would modify the PATH variable to include all of the required dll's for the test executable and would not permanently modify this variable.

set PATH=%PATH%;..\relative\path\to\the\required\dlls;
$(TargetDir)$(TargetFileName) --gtest_output=xml
It seems as though this still is not ideal and we would love to not have to rely on these dll's at all in our test. Perhaps when we know more about mocking we will be able to remove this step from the project.

Friday, March 25, 2011

Google Mock Presentation at work

I've just completed a presentation of Google Mock during a lunch and learn at my work. I learned a number of helpful things in the past few weeks and hopefully was able to share what I've learned with my team in a way that was easy to understand.

The first thing that I learned was how absolutely awful it was to create a C++ test project and link it with all of the dependencies in our code. A lot of trial and error, searching google to find out the problems, and asking Cheezy from LeanDog for pointers in how to solve some of the problems.

I'll post again soon about some of the things that I learned working with Google Mock.