Taking a sensor test picture can be done in two ways. The most common way to do this is to set the aperture on the lens to it's smallest aperture. On most lenses that would be f/22 (depending on the lens you have). Set the camera to manual focus, and point the lens towards a neutral object, like a white wall. Turn the focusing ring on the camera until the wall looks completely out of focus. The camera should be set to aperture mode. Don't worry about keeping the camera steady, all we need is a normal exposure so we can detect the dust. After the test picture is taken, open the image in a editing program like Photoshop. Go to the levels menu and use auto levels, this makes it easier to see the dust on the sensor.
Mouse over the image to see how it looks after auto levels
The other way to take a test picture is taking a picture without a lens on the camera, this is not recommended as this might bring even more dust onto the sensor.