A test cross is a cross between an organism with unknown dominant genotype (either heterozygous or dominant homozygous) and an organism with known recessive genotype (recessive homozygous).
Dominant trait results from a dominant allele, therefore the test cross can determine if the unknown genotype is heterozygous and homozygous dominant.
Let A be dominant allele and a recessive allele:
AA - dominant homozygote
Aa - heterozygote
aa - recessive homozygote
Let's take a look at the Punnett square (attached image), if all of the offspring are heterozygote (Aa), then unknown genotype is dominant homozygous (AA). If half of the offspring are heterozygote (Aa), and the other half are recessive homozygote (aa), then the unknown genotype is heterozygote (Aa).