Trial and error from plant and natural extraction would be my guess. Many of the ancient tribal people from all over the world would try certain plants, fruits and animals for human consumption. If they live the food is ok, if they die then the information gets passed onto the next generation.