Food safety is assured through rigorous testing for contaminants and adulterants. Chemical analysis detects residues of pesticides, herbicides, and heavy metals like lead and mercury, which can be harmful even in small quantities. Microbiological tests identify the presence of pathogens such as Salmonella, E. coli, and Listeria, which can cause foodborne illnesses. Ensuring that these contaminants are within acceptable limits is crucial for consumer safety.