What is the science behind a DNA test?

A DNA test works on two important principles. One, everyone's DNA is unique, except in the case of identical twins, and that all DNA that anyone has comes half from mother and half from father. Scientists cut the DNA with restriction enzymes and run it through a machine that separates the pieces relative to size. Then the pattern generated by the separation is compared to the pattern generated by a different set of DNA and if there are enough similarities the two are related.