There are multiple methods. The easiest is to test it on other mammals. If we want to reduce testing we have other methods. We can test it on human or animal cells in a petri dish. We can compare chemically similar substances that were tested in the past and draw conclusions from that. Building on that we may notice trends, for example generally the more aromatic rings a compound has the more carcinogenic it is. there are accepted software models that can predict the toxicity if a chemical is within a certain family of compounds. Finally if there have been any accidental releases we can get data from that.
Latest Answers