If the file /etc/debian_version/etc/debian_version exists, itthe distribution is Debian, or a Debian derivative. This file may have a release number; on my machine it is currently 6.0.16.0.1. If it is testing or unstable, it may say testing/unstable, or it may have the number of the upcoming release. My impression is that on Ubuntu at least, this file is always testing/unstable, and that they don't put the release number in it, but someone can correct me if I am wrong.
Fedora (recent releases at least), have a similar file, namely /etc/fedora-release/etc/fedora-release.