Genetic testing involves analyzing DNA to identify mutations that may indicate a hereditary predisposition to certain cancers. For example, mutations in the BRCA1 and BRCA2 genes increase the risk of breast and ovarian cancers. Genetic testing can guide preventive measures and targeted therapies.