When you upgraded the OS from whatever the computer orginally came with you lost the .diagnostics folder, which enables D key booting to the hardware test.
You can get it here.
http://download.info.apple.com/Apple_Hardware_Test/018-2845-A.dmg (Should be the right one for your Mac).
After downloading the .dmg, you will need to open it using the free demo of Pacifist. Drag the .dmg to the "Open Package" field. It will look like this after you open the disclosure triangles.
Next, you will need to be able to view normally hidden files and folders. .diagnostics is normally hidden.
Paste this command into Terminal.app (in Utilities folder) and hit Enter/Return (to reverse when finished, simply replace "true" with "false."
defaults write com.apple.finder AppleShowAllFiles -bool true ; killall Finder
Next, navigate to /System/Library/CoreServices, and drag the .diagnostics folder that you extracted with Pacifist into that location.That will be in the Macintosh HD folder.
Hide invisible folders and files again.
Post back if you need further instructions. If that's the correct .dmg for the AHT you need, this should enable D key booting again.